As I understand it, the Pixel Depth Offset (in the material settings) only accepts positive offsets. I was wondering if negative offsets could be enabled too. I’ll explain the use case below:
I am writing a game with the new grass system, and I need to stop the micro foliage poking through objects which are lying on the ground. For the most part it just works, because objects are big enough to occlude the foliage completely. The problem is with dead enemies! They should look as though they are squashing the foliage, but instead the tips of the grass blades protrude through them.
A work-around is to apply a small pixel depth offset (I use 20cm) to the landscape and the foliage. That means that foliage will render behind other objects if the difference in depth is less than 20cm. Because the foliage is quite small, this is enough to push it behind objects which are lying on the floor.
It would be better if the depth offset could be assigned to the enemies’ materials, at the same time as they are switched to ragdoll mode. The current system creates odd artefacts where grass blades disappear if there is a normal static mesh just behind them. It’s not too noticeable but I’d rather it didn’t happen, and I’m hoping that enabling negative pixel depth offsets is a trivial change.
(I imagine it could be difficult supporting negative offsets in a completely general way, because it would interact poorly with occlusion culling. That isn’t a problem here, though. There are no cases where the object will appear to be eligible for culling when it is not.)