I am trying to implement tracks in sand. The terrain is a sand texture. The tracks are a plane with the same sand texture, but also with a bumpmap applied, and using the transparent bumped diffuse shader. I have a script that places the tracks .02 units above the terrain(the reason I place it a little above is that it mitigates, but doesn’t eliminate, the problem I describe below) and orients the rotation of the plane to the terrain’s surface normal directly below it. .
The Problem:
In the first screenshot, everything looks good. The tracks actually look like depressions in the sand. In the second screenshot, you can see the visual artifact that occurs with the planes at certain viewing angles.
Does anyone know what is causing the artifacts, and is there a way around it? Using Indie, can anyone suggest a better way to implement footprints? They are dynamic, meaning they can’t actually be a terrain texture, and they use transparency to simulate fading over time.
I don’t think so. I’ve set it to pixel and vertex to test that, and the issue doesn’t resolve. I suspect it has something to do with transparency, but can’t confirm that b/c I don’t have enough experience with transparency (and, now that I think of it, I haven’t actually tried just a plain difuse shader to test, but I can almost guarantee it won’t have the same issue).
I guess it depends on exactly what you’re doing, how many footprints, etc, but you might be able to do something using a Projector. This simply takes an image and “projects” it onto a surface from a chosen position.
What you’re seeing is incorrect Z ordering due to the way pixel lighting is handled in Unity. You can fix this by moving the footprints a little higher off the ground, or by waiting until 2.6.
Ahh. Thanks, Daniel. And thanks for the link to the paper. I did try moving them higher off the ground, and it does resolve the issue, but then they don’t look right. Perspective kicks in and you can tell they are above the ground. I think i will opt for option 2, and enjoy the fix that 2.6 brings.
Eric, are you talking about shader programming? I don’t know anything about shader programming (I know there are tutorials, but it’s really not high on the priority list).
Yeah, but you don’t really need to know anything, just get the source for the shader you’re using, give it a new name on the Shader line, and add “Offset -1, -1” in the pass somewhere.