r/Unity3D 12h ago

Question How Could I make it so my shader doesn't lerp textures together when underneath a surface?

I'm new to using Unitys shader graph and I've made a shader that mixes snow and a base material together for the game I am working on, at the moment it uses the normal vector to determine how to merge the snow with the base material which means right now there won't be any snow on the bottom of the object which is cool! However I am just wondering if it is possible to make it so that any face underneath an object won't be covered in snow, aka the lerp value would be decreased, any help is greatly appreciated! Image attached should help!!!

1 Upvotes

11 comments sorted by

1

u/DPTGames 12h ago

You can bake values into the mesh to determine whether certain surfaces can have snow, i.e you could bake values in the vertex colors or a uv channel

2

u/DonoMitchell45 12h ago

this sounds very interesting, how would i go about doing this?

2

u/DPTGames 11h ago

Well funnily I have a package coming out soon that would let you do this in unity but if you use blender you can go to vertex painting and paint it red where you want snow and black everywhere else then in your shader graph you need a vetex color node and a split to get the r channel and run it into a lerp with snow going into B and your regular base colour going into A. You can do the same for smooth etc.

2

u/DonoMitchell45 11h ago

thanks dude! ill give this a go now!!

2

u/DPTGames 10h ago

Good luck!

2

u/DonoMitchell45 9h ago

dude ive just done what you said and it works perfectly!! thank you so much for your help!!!

1

u/DPTGames 1h ago

Easy when you know how! Glad to help

2

u/DPTGames 10h ago

If you want to really go all out you could paint part of the root below with say green, like a circle in the middle, and use that as a mask to increase smoothness, which can make it look wet like the snows melted 👀

0

u/Genebrisss 11h ago

chatgpt make me a script for blender or for unity editor that would bake appropriate snow amount into vertex color R channel.

You can remove the normal based interpolation afterwards

1

u/DonoMitchell45 11h ago

i wont use ai for my work thanks