Replacing NoiseGen node with a small image

Node-based Shader Editor

Replacing NoiseGen node with a small image

Postby mrmongbat » Wed Dec 05, 2018 2:45 pm

I'm trying to create a wind shader, I used a noise generator to drive the movement of vertexes however that seems to be a bit too expensive so I wanted to try to use a small noise image instead.

However, the movements seem a bit different so I'm wondering how the noise generator node is being applied behind the scenes?

I'm coming from Unreal Engine and was trying to replicate a wind shader I made there, however some nodes seem to act a bit differently so I'm probably doing things inefficiently.

Here's a screenshot of the shader setup:
https://i.imgur.com/mK5tL7T.png

Basically I have 3 variables to control the direction (RedX, GreenY, BlueZ) of the wind and then I use a mask to mask out any parts that shouldn't move (or move less than the leafs). I'm using WorldNormal to get some variation in the movement in relation to how the faces are rotated.

Here's a comparison between NoiseGen node vs just Noise image, I've just plugged the NoiseGen/NoiseImage to the albedo output to clearly see the effect:

NoiseGen node: https://youtu.be/h4-JbyXH790

Noise image: https://youtu.be/toetcux-IRE

I've tried scaling the noise image up and down, I just can't get it to look similar to the noise gen results.

I'd also appreciate any pointers in how to do this more efficiently than I'm currently doing.

Thanks.
mrmongbat
 
Posts: 5
Joined: Sat Nov 10, 2018 4:14 am

Re: Replacing NoiseGen node with a small image

Postby Amplify_Borba » Tue Dec 11, 2018 12:17 pm

Hello, thank you for getting in touch and for your support!

Using a noise generator can be quite expensive, as you've mentioned, and although I'm not familiar with its specificities, you can examine its code in the NoiseGeneratorNode.cs file in order to see the math behind the scenes.
As both Simplex2D and 3D were based on Keijiro's Noise Shader library, you can find some additional information and other techniques there.

Also, have you considered using a grayscale texture to perform the offset of the vertices? It could prove as a good alternative to using the noise generator and it would be relatively simpler to set up.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Replacing NoiseGen node with a small image

Postby mrmongbat » Tue Dec 11, 2018 6:13 pm

Thanks for the reply Amplify_Borba.

Also, have you considered using a grayscale texture to perform the offset of the vertices? It could prove as a good alternative to using the noise generator and it would be relatively simpler to set up.



Yes that was what I was attempting to do. Unfortunately I didn't get as good results as with the noisegen node. I probably have to modify my greyscale image in some way, going to have to do further tests but what do you mean simpler to set up?

I'm having a bit of trouble getting results that look as smooth as the Unreal Engine equivalent.. it's probably something very simple I'm doing incorrectly.

Just to make sure, it should be best to multiply the "World Normal" node to make the leafs all move a bit differently or are there some better nodes I should use instead? All the leafs share the same UV space so I was hoping to break them a bit up with the "World Normal" node.
mrmongbat
 
Posts: 5
Joined: Sat Nov 10, 2018 4:14 am

Re: Replacing NoiseGen node with a small image

Postby Amplify_Borba » Wed Dec 12, 2018 9:44 am

I meant simpler to set up as it wouldn't involve the math or the trial and error it usually brings to the table, not to mention that it wouldn't be as expensive as noise pattern generators usually are due to their complexity.
Textures are usually the way to go, especially when performance is concerned.

The World Position node is commonly used in this scenario, in order to ensure that there is a slight variation to each object affected by the effect.

Also, another possible way of implementing this effect would be through Unity's own "_Wind" Global Variable, more details can be found in this post.

Please let me know if this helps.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Replacing NoiseGen node with a small image

Postby mrmongbat » Wed Dec 12, 2018 3:57 pm

Thanks again Amplify_Borba.

The thread you linked to helped greatly. I appreciate it. I found the low poly water exsample and managed to get a randomized vertex movement without noisegen from that. However my problem isn't completely solved, as I also want to control directionality of the movements a bit using a Color property type variable as well, so I can limit movement into a certain axes (basically like wind direction).

However since my leaf billboards have different rotations, some move up while others to the left or right if I multiply the vertex offset with a single color. I was hoping I could avoid that by using "World position" node, but it doesn't seem to be enough.

Basically, I want some control to move all vertexes into the same direction no matter how they are rotated.

I can post videos of the problem if that helps, or try to explain it more clearly.

Unfortunately the _wind unity tip is a bit too advanced for me, I'm not the best coder so I'd prefer to do this inside the Amplify node editor if at all possible.

Again, greatly appreciate your help Amplify_Borba and I'm loving the plugin although it is a bit more complex than the Unreal editor.
mrmongbat
 
Posts: 5
Joined: Sat Nov 10, 2018 4:14 am

Re: Replacing NoiseGen node with a small image

Postby Amplify_Borba » Thu Dec 13, 2018 4:58 pm

Glad to know it helped!

If you want to move your vertices according to a wind vector that is in world space, you could consider creating a float3 property to receive the direction, and then perform a World To Object on that vector, before passing it into the vertex position / offset.

We're also going to release a new sample in the next build in which we add wind driven grass into the terrain sample, which might be useful to provide some further insight in how to achieve this with our editor. I believe it will make use of the aforementioned Unity wind global variable.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am


Return to Amplify Shader Editor

Who is online

Users browsing this forum: Bing [Bot] and 28 guests