-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
James Brundage
committed
Feb 15, 2024
1 parent
9adff40
commit c008830
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Zoom XY Shader | ||
|
||
// A simple twist on the Zoom Shader in https://github.com/exeldro/obs-shaderfilter/ | ||
|
||
// The allow for an independent Horizontal and Vertical Zoom. | ||
|
||
uniform int center_x_percent< | ||
string label = "center x percent"; | ||
string widget_type = "slider"; | ||
int minimum = 0; | ||
int maximum = 100; | ||
int step = 1; | ||
> = 50; | ||
uniform int center_y_percent< | ||
string label = "center y percent"; | ||
string widget_type = "slider"; | ||
int minimum = 0; | ||
int maximum = 100; | ||
int step = 1; | ||
> = 50; | ||
uniform float x_power< | ||
string label = "x power"; | ||
string widget_type = "slider"; | ||
float minimum = 0; | ||
float maximum = 20.0; | ||
float step = 0.001; | ||
> = 1; | ||
|
||
uniform float y_power< | ||
string label = "y power"; | ||
string widget_type = "slider"; | ||
float minimum = 0; | ||
float maximum = 20.0; | ||
float step = 0.001; | ||
> = 1; | ||
|
||
float4 mainImage(VertData v_in) : TARGET | ||
{ | ||
float2 center_pos = float2(center_x_percent * .01, center_y_percent * .01); | ||
float2 uv = v_in.uv; | ||
uv.x = (v_in.uv.x - center_pos.x) * x_power + center_pos.x; | ||
uv.y = (v_in.uv.y - center_pos.y) * y_power + center_pos.y; | ||
return image.Sample(textureSampler, uv); | ||
} |