I’m trying to create my own water surface material. And I made a bunch of wave generators that use time input and various sine functions for World Position Offset. It’s starting to look good actually. Not amazing, but good. It got me thinking it would be cool if I could add some foam or noise when the waves peak at the top. I just for the lif of me can’t figure out how to process the output from my wave generators.
Basically I would like to have some sort of function that collects the output from the wave generating formulas, before I attach them to the World Position Output. A function that returns a value between 0 and 1. Where 0 is the maximum negative Z value, and 1 being the maximum positive Z value that can be produced by the generators. Is there a function that will return how much a pixel position is being altered from it’s original position?
Height = WPO mask z. Subtract world position z of actor.
For what its worth, instead of dredging about with world position z I would suggest you work off your amplitude.
Anything above 3/4 amplitude is probably a good start as a zone that should have some amount of foam.
The period and amplitude can give you the slope value if you want to be more sophisticated about it, but keeping things simple is better for performance.
The material happens everywhere simultaneously, so there is no need to catch,store,or collect anything.
What you are shifting is usually vertices, not pixels.
Mostly because if you were shifting pixels the cost would be really high, where shifting verticis is faster by nature (and in turn shifts pixels I suppose).
If you happen to know or figure out a way to offset things with WPO while they still conform to the underlying mesh… i still haven’t figured that out.
World position offset is global, so not localized to the mesh itself.
Ok, now I feel stupid. Because that’s actually quite obvious when I think about it. I have no excuse to why I didn’t think of that myself. Haha.
Sounds good. Keep in mind that I’m apparently a little stupid now, but how do I “mask” out the top 1/4? Would you clamp the amplitude between 3/4 and 4/4 (actual numbers instead of course) and use that output? Or is there some other node that can be triggered by a given limit?
I would take the output and split it off into a lerp 0 to 1 with anything above 3/4 driving the alpha.
You can probably just use > since lerp takes in a float as alpha. An IF stamens can also help (0 if <, 1 if > or =).
Alternatively world position z - object location z - plus 1/4 amplitude ? Something similar to that.