Help needed re Shader coordinates?

Share your Construct 2 effect files

Post » Tue Dec 29, 2015 7:41 pm

My shader currently uses 'offSetX and offSetY to alter the vec2(tex) coordinates.
(see below)
Image

This works fine for one direction, but when I add all the other directions into
it, I end up with another 30 or so lines.

So my question is..how do add an 'Angle' parameter into the equation?

Changing the calculations to something like -

vec2(tex.x-(pixelWidth*(offsetX*1.0)*cos(angle)),tex.y-(pixelHeight*(offSetY*1.0))*sin(angle)))*0.20000;

would simplify things, but after 2 weeks of trawling the Internet for a solution,
I have come no closer to solving the problem.

Cheers.
B
21
S
6
G
8
Posts: 1,215
Reputation: 7,881

Post » Tue Dec 29, 2015 8:39 pm

I'm not super clear about what you're doing but here's the formula to
https://www.siggraph.org/education/mate ... 2drota.htm

then you could do this to rotate the offsets by the angle:
vec2(tex.x+ cos(radians(angle))*offsetX - sin(radians(angle))*offsetY, tex.y + sin(radians(angle))*offsetX + cos(radians(angle))*offsetY)
B
89
S
30
G
96
Posts: 5,160
Reputation: 63,956

Post » Tue Dec 29, 2015 11:53 pm

Thanks ROJOhound (worked on first test!)

@R0J0hound

'I'm not super clear about what you're doing but here's the formula'

(motion blur effect)
B
21
S
6
G
8
Posts: 1,215
Reputation: 7,881


Return to Effects

Who is online

Users browsing this forum: No registered users and 1 guest