Skid texture

Blitz3D Forums/Blitz3D Programming/Skid texture

Jeremy Alessi(Posted 2004) [#1]
Now I've got 3 methods going for skidmarks in Leadfoot GT ... thing is I want to write my skidmarks in a multitextured method. I can set the

TextureCoords, skidTex, 0

and it writes but it follows the titled UV's of the road ... so I see skidmarks being drawn on a small tile. If I set the

TextureCoords, skidTex, 1 ...

then I don't see anything. I have the texture on the index[1] for multitexturing so you can still see the road texture on index[0].

How can I set the texturing to cover the whole road like a lightmap so that the texture draws properly to the road?


MSW(Posted 2004) [#2]
You would need to set up the second set of texture cords to use something like a light map...

From the way you are describeing it the second set of texture cords are currently 0 or the default value...to set them up look into the code archive for light mappers, which should give you a basic idea on how to do this....

also it would be best for the sake of detail to only include polygons that you want the skid marks on...just don't bother setting the second set of texture cords for the other polygons...that will allow you to maximize the texture space without createing another surface (or requireing some uber huge 2048 X 2048 texture map for the effect)...

another thing to consider is storeing a duplicate of this texture in system memory (not as an image, rather as an array or in a bank)...assumeing you are only going to be dealing with grey or black skid marks you can save a lot of system memory by useing a byte per pixel (as if it were a greyscale image)...this might help with game frame rate in that you can check the system memory texture instead of readpixelfast with the real one (this is in the case that both reading and writeing pixel fast causes some slow up on older PCs...by removeing the need to read pixels before writeing them...well you only have to write them, and thus spend less time on system to video memory transfers <-which will eat much more time then mucking around with system memory duplicateing the texture)...this of course assumes you want the skid marks to fade realisticly with vehical speed and all that (tires spinning at 80MPH will leave "darker" marks if the car is going 10MPH verses 30MPH, etc..)


Vorderman(Posted 2004) [#3]
When I did skidmarks for my MiniTurismo program I had it dynamically building the skid meshes as the car slid, from whichever of the wheels were sliding at the time - the skid meshes were just thick black strips along the road, like a pencil line, but make them semi-transparent and add UV coords (very easy when you're building the mesh yourself at runtime) and it would look much better.

The trick is to orient each pair of verts to match the rotation of the car as you add them, so the skidmarks maintain a set width.

In fact I might give that a go for my Burnout-on-Bikes game at some point, just to make the crashes look better.


Jeremy Alessi(Posted 2004) [#4]
Yeah I was thinking of using dynamic mesh instead ... but the texture painting is also an option. I could have several skid mark options.


Rob(Posted 2004) [#5]
I'd just use the single surface mesh. Using another texture will be slower IMHO.