NokiMo
pucklovesgames
pucklovesgames

patreon


Environment Interaction Updated - FILES

This is pretty much the same as the previous Environment Interaction asset, now cleaned up, a bit easier to use, and updated with a few extra things that I've added in since I made the original.

The main visible addition is the grass swaying on the ground trail. The trail now wobbles between and outward push and an inward pull over time, which gives recently disturbed grass a swaying motion as you move through it.

The main 'cleaned up' part is the render texture is handled automatically via script, and now there are separate handy shader functions available to sample the Water, Ground, and Grass interaction channels.

Ground is stored in R, Grass in G, and Water ripples in B. The alpha channel of the render texture is so far unused, so it's available if there's anything else you might want add in. 

Previously I had the R and G channels used for the grass pushing vector (up/down and left/right), but then I realised I could just use a single channel and derive a normal vector from this heightmap, the same way I do for the water ripples and mud splats.

I've also combined the particle spawner for the grass and ground trails, and merged them both into one particle for performance and simplicity - since you'll usually want to be interacting with potential grass and ground at the same time. You'll notice that the ground/grass particle shader writes to both R and G (but not B). Of course these can be split off into separate interactor particles if need be.

IMPORTANT: Just like in the previous Mario Galaxy fog asset, you'll need to make sure that the particle systems (under the envIntRTCam) are on the same layer as the Culling Mask on the envIntRTCam Camera, and that this layer is not in the culling mask of the Main Camera. I don't think Unity Packages bring across Layer setup correctly, so this is something you might have to correct yourself.


One other thing to keep in mind if you want to extend this, is that any grayscale textures you use for the particles will need to have sRGB toggled OFF in the texture import settings to preserve the 0.5 middle grey. The render texture has a full signed range, to allow for both positive and negative vertex displacement, so the particle textures use a 0.5 middle grey as the zero value - darker shades go into the negative, brighter shades into the positive.

Depending on your Unity version/pipeline and camera setup, you might also need to adjust the vectors in the shader functions - good old fashioned trial and error is my favourite method. It should work out of the box for most use cases though.

If anything doesn't make sense please let me know and I can talk you through it. It's obviously one of the more complicated assets, but I think it has a lot of potential, and once set up it should be easy to tweak.

EDIT: Added a circular gradient quad material (previously missing) to the interactors, to push the grass out even when a particle isn't spawning on movement.

Environment Interaction Updated - FILES

Related Creators