This version is more correct and smoother
Old V1
New V2
much less black artefacts
Maybe you will be interested. I am trying to change the waveform. I found this method in YouTube
Now itās just a WPO wave
I left this value as a parameter for more fine tuning in the future.
What is the difference between Amplitude and WPO Scale? isnāt that a duplication? Visually, there is a slight difference, but the WPO Scale has no effect on the normal. I left WPO Scale as fixed value
Yes, less math means less precision errors. For example the arctan fast is an approximation and we have eliminated it.
Looks nice, I particularly like the front wave.
Not exactly a duplication. It allows for the WPO to be changed in strength without reducing the amplitude which would in turn weaken the normal. This was mostly just for testing when I wanted to temporarily turn off/down the WPO.
Itās mostly redundant because we can already independently scale the normal from the amplitude but if the amplitude is 0 then the normal is flat and canāt be scaled.
If you have no use for it I would replace it with a switch that simply disables WPO altogether while keeping the wave, since thatās all it was good for. I didnāt do it that way because Iād have to recompile the shader every time I toggled the switch which slows down testing.
An example use would be to slowly decrease WPO beyond a certain distance until it reaches zero, then switch to a version with it turned off entirely. Being able to do this without adjusting the amplitude allows the wave to continue to look the same in light and reflection even as we prepare to switch to the cheaper version of the shader.
You can still use the DFG to generate normals for this wave, as it will still have the same fundamental property that the sine wave did, where the wave front normals are pointing in the direction of the DFG and the wave back pointing in the opposite direction.
You should also be able to achieve something similar with a the old sine wave too, you would just have to shape its inputs.
Good idea
Itās cool that I can generate waves even for a rectangle without a dense mesh. But their distance is not so big
For example, here I am shaping the sine wave using a curve asset. You could do this with math, but a curve allows for us to very easily control the x in our sine(x) to make it non-linear and create any shape of wave. And since it is still technically a sine wave, the previous normal calculation should work without modification.
I tried to reproduce this method, but my wave does not repeat. And accordingly, it is not possible to animate
You would need to set the sampler type to wrap in order for it to repeat. As you can see in my screenshot, it is repeating.
It can still animate, you would just need to animate the position of the texture too.
It also doesnāt need to be a texture. A similar gradient could be created using nodes. The point is just that any non-linear input will lead to an altered waveform.
This approach also allows you to encode multiple waveforms into the texture in the RGB channel, or as extra indices in the atlas, and sample them in different times and locations.
Hereās a single sine function that is sampling two different curves at the same time in different directions (one along the U direction and the other along the V direction):
I literally tabbed out, 1min later tabbed back and it was different.
I love this place.
EDIT: In your pic above, I see the curve on the right-side, but in the material graph, ???. Color-coded right, purple? I see a constant and a texure sampleā¦ Did I miss something?
Curves assets are sampled as textures via a Curve Atlas asset. The curve on the right propagates into the texture sample on the left instantly as changes are made. The appended value is the index in the atlas to sample, as it can hold numerous curves per index and per color channel.
TY. I knew of them, what they could do but never explored them.
Much appreciated.
Very power and underutilized. Not UE, but Horizon Zero Dawn used curve atlases to colorize their foliage and some props by biome using gradient mapping if Iām not mistaken. This allowed for assets to use only a grayscale texture channel for their base color as a lookup table and could automatically colorize themselves based on the biome index.
Thanks! I always think of things like this, how to pack data, do more w/less; good to know Iām on a right trackā¦
Is there a paper/video where they talk about this?
Hereās the GDC slides. There should also be a YouTube Talk or two.
The Vegetation of Horizon Zero Dawn - Amazon AWS https://ubm-twvideo01.s3.amazonaws.com/o1/vault/gdc2018/presentations/gilbert_sanders_between_tech_and.pdf
Everything worked in WPO, it looks great. Shore waves are generated and easily modified.
Thanks for showing me a new tool!
In theory, I can make masks for foam using curves.
When I add curves to normals, errors appear. Tried to fix it with MakeFloat2 but it didnāt work.
Maybe the problem is that the cosine has a different waveform and I need to edit it. But now the problem seems to be something else
Iām tired of the lack of knowledge))
This is what I got when I started changing the parameters of the curve. But all this parameters does not work correctly
The curve isnāt the shape of the wave. The curve is the shape of the input of the wave. Think of the value of the curve as (x) in the function y = sin(x).
To get the desired shape, you need to understand the relationship of the input and the output.
And yes, youād need to use this curve to modify the waveform of both the sin and the cos.
If you want to directly shape the curve itself instead, we donāt need sine at all - but weād have to find the normal another way because we canāt rely on the relationship between sine and cosine to find the normal. The reason the last method works is because cos is equal to the tangent of sin, and the normal is perpendicular to the tangent.
In order to find the normal mathematically the curve needs to be a defined function, so that you can solve for itās derivative (tangent) mathematically as well. If our surface is an image (like the curve or a heightmap) you can also approximate the derivative by sampling it at two of the closest points possible along that curve. This would give us the rate of change between these two points, aka the slope. The slope is essentially the tangent, and with that tangent we can solve for the normal.
Hereās an example of a wave driven by a curve texture only with no parametric function whatsoever. Instead, the normal is found by sampling the curve with a tiny offset and measuring the difference. Small mistake in the screenshot here is that the Curve index should be appended after the offset, not before - as this would cause the index to be offset too in error. I didnāt notice because this curve atlas only had one index.
If youāre tired of a lack of knowledge in this area, Iād suggest getting comfy with linear algebra, trigonometry and at least some basic calculus.
And to demonstrate my earlier point about being able to dynamically morph between custom waveforms using curves, hereās a gif of a slightly modified version of the last example that has two curves in the atlas and alternates between them over time, but this could also be done over space. Using the offset technique above it has accurate normals during the transition although it may be hard to tell due to the color.
Hereās an example of that, which is more visually interesting. In this case there are two identical waveforms, staggered from each-other and then it alternates between them by a radial UV map. The idea here was to create something that resembles ferrofluid. But the point is the waveform doesnāt need to be identical across space as this demonstrates.
Thank you for spending your time and giving so many options to solve this problem. I tried all the options and the last one is more flexible for me.