Coordinates problem

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

This is the first time I used 5 and 6 addvertex statements when building an object. The coordinates are wrong and my brick wall and roof didnt come out right. Can somebody help me on the coords please?



code for the wall
;side
CreateMeshBuilder,
AddVertex,-13, 0.6, -7,
AddVertex,-13, 3.5, -7,
AddVertex,-11, 4.5, -7,
AddVertex,-8.1, 4.5, -7,
AddVertex,-6.1, 3.5, -7,
AddVertex,-6.1, 0.6,-7 ,
AddFace,0,1,2,3,4,5,

LoadTexture,brick3.bmp,
SetTextureCoordinates,0,0,3,
SetTextureCoordinates,1,0,0,
SetTextureCoordinates,2,2,0,
SetTextureCoordinates,3,2,3,
SetTextureCoordinates,4,1,0,
SetTextureCoordinates,5,1,0,



code for the roof
;roof front
CreateMeshBuilder,
AddVertex,-5, 2.95,-7.05 ,
AddVertex,-8.1, 4.5,-7.05 ,
AddVertex,-9.55, 5,-6 ,
AddVertex,-9.55, 5,0 ,
AddVertex,-5, 2.95,0 ,
AddFace,0,1,2,3,4,

LoadTexture,tiles.bmp,
SetTextureCoordinates,0,0,2,
SetTextureCoordinates,1,0,0,
SetTextureCoordinates,2,2,2,
SetTextureCoordinates,3,2,0,
SetTextureCoordinates,4,0,2,
 
Sponsor Post - registered members do not see these adverts; click here to register, or click here to log in
R

RailUK Forums

eezypeazy

Member
Joined
4 Jul 2005
Messages
626
Location
UK
I'm guessing here, because I use .b3d for objects; but I believe .csv works in the same way, in that you define each face separately. So for example, a rectangular wall might be AddFace,0,1,2,3
and a rectangular wall with a triangular section above it (ie., looking like a traditional house), might be
AddFace,0,1,2,3
AddFace,1,4,2

where coordinates 1 and 2 are common to the two shapes (ie., 1 is top left of rectangle, bottom left of triangle), and coordinate 4 is the top of the triangle.

Then, you would need to specify some heights to apply the texture, and widths as well, using SetTextureCoordinates statements.

Break your wall down into, say, two rectangles, with two triangles (if you see what I mean!). You'll have to think carefully and logically as you apply the texture heights and widths....

The same applies to the roof - break it down into its constituent shapes, define each separately, carefully apply the texture.

Because BVE "stretches" textures around adjoining shapes in an object, you can get strange effects. Sometimes, I separate out adjoining faces completely, and apply textures separately, to stop this happening - ie., describe each shape with a new CreateMeshbuilder statement.

On the other hand, I could be completely wrong......

eezypeazy

PS: Very nice looking object, by the way!!
 

Simon_G

Member
Joined
19 Mar 2006
Messages
115
It's best to avoid faces with more than four coordinates as BVE doesn't always do what you expect with them. On the other hand, you don't need to go overboard chopping them up! For example, your end wall would code as two faces:

Code:
CreateMeshBuilder,
AddVertex,-13, 0.6, -7,
AddVertex,-13, 3.5, -7,
AddVertex,-11, 4.5, -7,
AddVertex,-8.1, 4.5, -7,
AddVertex,-6.1, 3.5, -7,
AddVertex,-6.1, 0.6,-7 ,
AddFace,0,1,4,5,
AddFace,1,2,3,4
Now, assuming that your brick texture covers the rectangular part of the wall with 1 across and 3 up (which is what your original code suggests to me), you can work out how it tiles per metre in horizontal and vertical directions. This gives

Horizontal tiling = 1 per 6.9m ~ 0.145 per metre
Vertical Tiling ~ 1 per metre

And with these figures you can work out the coordinates for the two upper vertices:

Code:
LoadTexture,brick3.bmp,
SetTextureCoordinates,0,0,4,
SetTextureCoordinates,1,0,1,
SetTextureCoordinates,2,0.29,0,
SetTextureCoordinates,3,0.71,0,
SetTextureCoordinates,4,1,1,
SetTextureCoordinates,5,1,4,
It's also a good idea to keep the number of faces and mesh blocks as low as you can for an object that loads and displays efficiently in BVE. In theory, you can put all the faces that use a particular coordinate in the same mesh block, though for complex objects, this can make the code a little dense! Certainly, I always put adjacent faces in the same mesh so that they can share vertices and haven't had any problems.

HTH
 

eezypeazy

Member
Joined
4 Jul 2005
Messages
626
Location
UK
Now... how's about a screenie of the finished object, to round this off?

Here's a shot of a phot realistic signalbox (Blaydon on Tyne) I've just finished.... I'm reasonably happy with it....
 

Dennis

Established Member
Joined
8 Aug 2005
Messages
2,676
Location
Trowbridge
Out of curioisity I just checked how this looked compared with the real thing - I must say that's a great job. :thumbup:

Only things missing that I can see would be some ridge tiles on the corners of the roof and a bit of lichen growing on it - now that is being picky!

Looking forward to seeing the finished Blaydon station as the real one looks very smart - http://railwayman9419.fotopic.net/c945780_1.html.
 

eezypeazy

Member
Joined
4 Jul 2005
Messages
626
Location
UK
I'm not intending to completely rebuild my Blaydon Station yet - just replacing the existing signalbox in my route with the real thing...

Anyway, to get back on topic - come on, EmergencyBrake, let's see more of your super looking object!

eezypeazy
 
Joined
9 Apr 2006
Messages
405
Location
London, UK
Nice signalbox there Eezypeazy!

Yes, the screenshots- here they are- feel free to compare it the the real thing...


North Weald station building


An overview of North Weald
 
Status
Not open for further replies.

Top