Vertex displacement shader not working
Asked Answered
B

5

0

So i have an equation to displace the y vertex, but the shader seems to ignore the VERTEX.y in the sin and just makes a normal sine wave. Can I not reference the same vertex more than once in an equation? Is there any workaround to this?

Boulevard answered 11/4, 2023 at 16:10 Comment(0)
P
0

Boulevard If this is applied to a flat horizontal plane then the input value of VERTEX.y is always the same. You probably meant to use VERTEX.z there.

Papyrus answered 11/4, 2023 at 16:45 Comment(0)
B
0

I'm trying to make this graph in the shader so VERTEX.z wouldn't work here. How could i make this shape in the shader ? or is it just not possible?

Boulevard answered 11/4, 2023 at 16:54 Comment(0)
B
0

and yes its applied to a flat horizontal plane

Boulevard answered 11/4, 2023 at 16:56 Comment(0)
P
0

Boulevard You can't use an implicit form of equation like this in a shader. You'll need to turn it into an explicit form where y is expressed in terms of x, in other words you need to solve for y. Unfortunately, the equation of type y=sin(x+y) belongs into category of transcendental equations and cannot be solved algebraically. You could probably solve it numerically if your math skills are up to a par. Maybe Mathematica or Wolfram Alpha can help you.

But why bother when you could patch one period of a similarly shaped curve from a couple of smoothstepped segments in the shader. Or simpler yet, take a regular sine and linearly skew it.

Papyrus answered 11/4, 2023 at 17:39 Comment(0)
B
0

This is a great help thanks!

Boulevard answered 11/4, 2023 at 17:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.