programming wheel track on terrain surface

Started by
5 comments, last by juhaszt 22 years, 1 month ago
Please help! How to programm wheel tracks on the terrain surface like on this picture: http://www.ejfelkapitany.hu/swine4.jpg Tom
programmer
Advertisement
Calculate the intersections of the wheels with the ground... then for that point use the surface''s (ground''s) plane to make a square... then use that square for texturing tracks... and voila

that is all

ICQ: 130925152
Email: e.j.folkertsma@student.utwente.nl
ICQ: 130925152Email: e.j.folkertsma@student.utwente.nl
so if I understand you well:
the wheel track contains lot of small textured squares?
Then you need some tricks I think...
You have to switch off Z buffering in order to be sure that the small textured squares will not be covered by the terrain surface. But if you switch off the Z buffering you have to render this small squares before rendering any other objects on the terrain surface.
Am I right?
programmer
In OpenGL, you''d have to render them after everything else. Well, not actually everything, just the terrain as the tracks would show through the objects on the terrain. I''ve never done something like that but maybe you can do something tricky with detail textures on the terrain.
The DX docs use this exact example as an opportunity to advertise stencil buffering. If your development system supports this, I''d look into it.
I thought stencil buffering is something completely different thing! Thanks for the idea, I will check it...

programmer
In stencil buffering you have basically a flag for each pixel onscreen. If you have tyre-tracks at a pixel, set the flag. Then make a second render-pass and wherever the flag is set, draw on your tracks. The stencil buffer uses bits from the z buffer, i think 1,2,4 or 8. Obviously using 8bits makes the depth buffer a lot less accurate, but here I think you can use a 1 bit stencil buffer - the tracks are either there or not.

This topic is closed to new replies.

Advertisement