vehicle tracks
any ideas on how to render vehicle tracks with D3D9.
links to implementations, explanations, howtos, or source code will be gratly appreciated.
thanks for ur time,
cesaro
Assuming you know the basics of directX rendering etc.....
Find your wheel position and drop it down by the radius of the wheel, this will place your tire marks on the ground without the need for any collision checks.
add and subtract half the skid width from this point (I align this to the vehicles velocity but you could use the wheel orientation too), this will give you two points on either edge of the tire mark.
Setup a timer and at each step drop two of these points into a vertex buffer. The faster you drop the points the smoother your tire tracks will be.
Render the vertex buffer as a triangle strip and there you go - your wheel will trail tire marks.
there are a few refinments that can be added. If you store the data and fill your vertex buffer each frame you can keep track of the points ages and fade them out nicely as they die out.
If you can keep track of the wheels contact with the groun you can stop the tracks and draw a totally transparant poly to fill in the gap when you start dropping points again.
While the wheel is dropping tracks you can draw an extra poly that joins the last two points to the wheel position, if you dont do this each time you drop a section of track it will appear to pop into existance meaning the tracks trail behind your wheel slightly.
Hope that helps a bit.
Find your wheel position and drop it down by the radius of the wheel, this will place your tire marks on the ground without the need for any collision checks.
add and subtract half the skid width from this point (I align this to the vehicles velocity but you could use the wheel orientation too), this will give you two points on either edge of the tire mark.
Setup a timer and at each step drop two of these points into a vertex buffer. The faster you drop the points the smoother your tire tracks will be.
Render the vertex buffer as a triangle strip and there you go - your wheel will trail tire marks.
there are a few refinments that can be added. If you store the data and fill your vertex buffer each frame you can keep track of the points ages and fade them out nicely as they die out.
If you can keep track of the wheels contact with the groun you can stop the tracks and draw a totally transparant poly to fill in the gap when you start dropping points again.
While the wheel is dropping tracks you can draw an extra poly that joins the last two points to the wheel position, if you dont do this each time you drop a section of track it will appear to pop into existance meaning the tracks trail behind your wheel slightly.
Hope that helps a bit.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement