Help... Coordinates for power rail texture

Status
Not open for further replies.
Joined
9 Apr 2006
Messages
405
Location
London, UK
Hi,

I need help with the SetTextureCoordinates codes for textured LUL power rails.

My route started with coloured rails but now I felt that the aesthetics will be better with photoreal textured rails (thanks for voting in my other post guys!).

I managed to apply a texture to the straight sections, but I have hit a problem with Im trying to do the same for the curved sections. Up to now, I still do not know everything about the coordinates section- especially for a complex object like track objects, so I copied and pasted the coords from a normal running rail.

Heres the code for the power rail for a 500 radius left curve-

CreateMeshBuilder,
AddVertex,.059,.05,25.294,
AddVertex,.115,.05,22.765,
AddVertex,.159,.05,20.235,
AddVertex,.19,.05,17.706,
AddVertex,.208,.05,15.176,
AddVertex,.214,.05,12.646,
AddVertex,.207,.05,10.116,
AddVertex,.187,.05,7.587,
AddVertex,.151,.05,5.057,
AddVertex,.107,.05,2.528,
AddVertex,.05,.05,-.001,
AddVertex,-.041,.05,25.291,
AddVertex,.015,.05,22.763,
AddVertex,.059,.05,20.234,
AddVertex,.09,.05,17.705,
AddVertex,.108,.05,15.175,
AddVertex,.114,.05,12.646,
AddVertex,.107,.05,10.117,
AddVertex,.087,.05,7.588,
AddVertex,.054,.05,5.059,
AddVertex,.008,.05,2.53,
AddVertex,-.05,.05,.001,
AddFace,0, 1, 12, 11,
AddFace,1, 2, 13, 12,
AddFace,2, 3, 14, 13,
AddFace,3, 4, 15, 14,
AddFace,4, 5, 16, 15,
AddFace,5, 6, 17, 16,
AddFace,6, 7, 18, 17,
AddFace,7, 8, 19, 18,
AddFace,8, 9, 20, 19,
AddFace,9, 10, 21, 20,

GenerateNormals,

LoadTexture,top.bmp,
SetTextureCoordinates,0, 1.02, 10,
SetTextureCoordinates,1, -0.02, 10,
SetTextureCoordinates,2, 1.02, 8,
SetTextureCoordinates,3, -0.02, 8,
SetTextureCoordinates,4, 1.02, 6,
SetTextureCoordinates,5, -0.02, 6,
SetTextureCoordinates,6, 1.02, 4,
SetTextureCoordinates,7, -0.02, 4,
SetTextureCoordinates,8, 1.02, 2,
SetTextureCoordinates,9, -0.02, 2,
SetTextureCoordinates,10, 1.02, 0,
SetTextureCoordinates,11, -0.02, 0,


and heres the results (I know that the problem is because there are 21 vertices and the coords only defined 11 of them)-



Can somebody with better knowledge about the coords statement help me by posting the correct set of coords for the whole chunck of addvertex statements please. Credits will be given.

Thanks
 
Sponsor Post - registered members do not see these adverts; click here to register, or click here to log in
R

RailUK Forums

Dennis

Established Member
Joined
8 Aug 2005
Messages
2,676
Location
Trowbridge
This should do the job;


CreateMeshBuilder,
AddVertex,.059,.05,25.294,
AddVertex,.115,.05,22.765,
AddVertex,.159,.05,20.235,
AddVertex,.19,.05,17.706,
AddVertex,.208,.05,15.176,
AddVertex,.214,.05,12.646,
AddVertex,.207,.05,10.116,
AddVertex,.187,.05,7.587,
AddVertex,.151,.05,5.057,
AddVertex,.107,.05,2.528,
AddVertex,.05,.05,-.001,
AddVertex,-.041,.05,25.291,
AddVertex,.015,.05,22.763,
AddVertex,.059,.05,20.234,
AddVertex,.09,.05,17.705,
AddVertex,.108,.05,15.175,
AddVertex,.114,.05,12.646,
AddVertex,.107,.05,10.117,
AddVertex,.087,.05,7.588,
AddVertex,.054,.05,5.059,
AddVertex,.008,.05,2.53,
AddVertex,-.05,.05,.001,
AddFace,11,0,1,12,
AddFace,12,1,2,13,
AddFace,13,2,3,14,
AddFace,14,3,4,15,
AddFace,15,4,5,16,
AddFace,16,5,6,17,
AddFace,17,6,7,18,
AddFace,18,7,8,19,
AddFace,19,8,9,20,
AddFace,20,9,10,21,

GenerateNormals,
LoadTexture,top.bmp,
SetTextureCoordinates,11, 0, 0,
SetTextureCoordinates,0, 1, 0,
SetTextureCoordinates,1, 1, 2,
SetTextureCoordinates,12, 0, 2,

SetTextureCoordinates,12, 0, 2,
SetTextureCoordinates,1, 1, 2,
SetTextureCoordinates,2, 1, 4,
SetTextureCoordinates,13, 0, 4,

SetTextureCoordinates,13, 0, 4,
SetTextureCoordinates,2, 1, 4,
SetTextureCoordinates,3, 1, 6,
SetTextureCoordinates,14, 0, 6,

SetTextureCoordinates,14, 0, 6,
SetTextureCoordinates,3, 1, 6,
SetTextureCoordinates,4, 1, 8,
SetTextureCoordinates,15, 0, 8,

SetTextureCoordinates,15, 0, 8,
SetTextureCoordinates,4, 1, 8,
SetTextureCoordinates,5, 1, 10,
SetTextureCoordinates,16, 0, 10,

SetTextureCoordinates,16, 0, 10,
SetTextureCoordinates,5, 1, 10,
SetTextureCoordinates,6, 1, 12,
SetTextureCoordinates,17, 0, 12,

SetTextureCoordinates,17, 0, 12,
SetTextureCoordinates,6, 1, 12,
SetTextureCoordinates,7, 1, 14,
SetTextureCoordinates,18, 0, 14,

SetTextureCoordinates,18, 0, 14,
SetTextureCoordinates,7, 1, 14,
SetTextureCoordinates,8, 1, 16,
SetTextureCoordinates,19, 0, 16,

SetTextureCoordinates,19, 0, 16,
SetTextureCoordinates,8, 1, 16,
SetTextureCoordinates,9, 1, 18,
SetTextureCoordinates,20, 0, 18,

SetTextureCoordinates,20, 0, 18,
SetTextureCoordinates,9, 1, 18,
SetTextureCoordinates,10, 1, 20,
SetTextureCoordinates,21, 0, 20,

When using addface commands, I try and work clockwise starting from the top left. 4 settexturecoordinates commands are then needed for each rectangular face, the first parameter in each of these are in the same order as the vertices in the addface command. The secon and third parameters in the settexturecoordinates commands governs the orientation and number of times the texture is applied.

The bitmap image I used to help with construction is shown below;

View attachment 104

When making complex objects, I always build them up one face at a time, using a texture which I can easily recognise and checking the results regularly (normally using BVE rather than structure viewer as this is guaranteed to give a true representation of the object at the correct orientation).
 
Status
Not open for further replies.

Top