Texturing track/path onto textures

Blitz3D Forums/Blitz3D Beginners Area/Texturing track/path onto textures

Chalky(Posted 2007) [#1]
I am working on a train based game which will require tracks to be drawn on the 'ground'. I have created a plane and textured it with a grassy texture, and now need to be able to draw the railway tracks. I have a 256x256 texture ballasted track/rails and need to repeatedly render this onto the floor while following the centre-line of each track piece. Unfortunately I cannot fathom how to do this. I have searched the forums and found a couple of similar questions, but none with any indication as to how this is done.

Do I need to create an object for every required occurance of the track texture? Should I be using 3D sprites instead (er - if so, I'm not entirely sure what a '3D sprite' is...)?

If anyone could point me in the right direction I would be very grateful!


Ben(t)(Posted 2007) [#2]
why not make a 3d model?


Chalky(Posted 2007) [#3]
The track is generated from a data file when the game starts - so that the eventual game will be able to run different layouts.

At the moment, I have a system which builds the layout from lots (and lots) of textured cubes, all joined to and rotated around pivots to produce a circuit. My concern is that using cubes involves 6 surfaces, all of which need to be rendered by the 3D engine every update. Since I am only really interested in the 'top' surface, I was hoping there was a way of creating a single surface 'tile' and drawing it onto the ground - rather than using cube entities.


Barnabius(Posted 2007) [#4]
If you are recreating some sort of model layout i.e. you are not creating a train sim then you can just create some 3D models representing straight tracks, curved tracks, crossed tracks and points. That way you'll be able to put the whole track together piece by piece just as with your home train set. Take a look at some of the catalogues produced by big companies such as Hornby, Maerklin, Roco, Fleischman, etc. They all have a section describing their track system i.e. showing all the pieces with their lengths and radii. That should be a good starting point.

Barney


b32(Posted 2007) [#5]
You could use the UV coordinates for assigning the track pieces onto the plane. Each mesh can hold 2 sets of UV coords. You could for instance use the first one for the track, and the second one for the common texture.



Chalky(Posted 2007) [#6]
@Barney: Although not a true sim, I hope to have fairly realistic track formations and curves, so want to be able to load many predefined configurations to give me maximum flexibility (mind you - since they ARE predefined, your idea of a model per track-piece might be the way I end up going).

@b32: This looks good. I will see if I can understand how it works and try to apply it to what I have already.

Thanks.