Hey
So I have this ground sand gradient shader, not a real intersection shader but a cheap solution that is good enough from a top down view
Now this works well for objects that have a pivot at the bottom, like a Building or a Lamppost or something that stands on the ground
For rocks however, that dosnt work at all, as they are rotated and moved a ton.
Using object position AKA the Pivot, you can see the downfalls here:
(The cube shows the problem, with a pivot on center, the sand effect is not working, or the stone on the right is rotated and floating but still shows it)
Now I could use world position instead of object position, the issue there is that the terrain is not flat, and at different heights that would not work.
Here is my simple setup:
Some ideas:
- Object intersection shader based on camera depth? No experience in that but might work? but then the stones also intersect each other?
- World position with a terrain height map for an offset? - Not the greatest workflow but could likely work
- ??
How do you go about this?
Replies
I usually use mesh distance fields in unreal for this sort of thing - not sure if that's available in unity
Or you can use the object's world space bounding volume to generate UVs
That dosnt sound super amazing all in all, but ill give the first a try
Otherwise I will just vertex paint it by hand I guess.