0
\$\begingroup\$

I've made simple world curving shader following some online tutorials and cleaning few things up. It's doing its job, however I have small issue where it curves objects that are very close to a camera. So, I am trying to figure out how to start curving only if objects are certain distance form the camera, lets say 20 units or more?

Below is a sub-graph I use to output a value for a vertex position i.e. curve world shader, this is the one I need to figure out how to modify

enter image description here

\$\endgroup\$
1
\$\begingroup\$

Before you feed the z position into the Power node, subtract your minimum curving distance from the z to get a signed difference, and then run that through a Max node to take the greater of 0, or that z difference. Then pipe that clamped z value into the Power node.

If your camera is looking in the -z direction, then you'd do something similar, but add the minimum curving distance and then run it through a Min node instead. Either way, what you're doing is moving the vertex of the parabola forward or back along the z axis, then clamping everything closer to the camera to zero so you only see the further branch of the parabola.

\$\endgroup\$
1
  • \$\begingroup\$ This did the trick! Thank you \$\endgroup\$
    – Ilja
    Sep 15 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.