Train-Sim.Com
BVE

B3d Coding

Notice to all visitors and members of the Train-Sim.Com message forums:
If you plan on using a signature banner in your posts, we would like to remind you that there is a maximum size for banners. That maximum is 450 pixels wide by 120 pixels high, and not to exceed 25k. Your compliance is appreciated. FORUM RULES Problems? There are two common reasons for problems with logging in and posting messages. The first is that you are running a firewall that prevents your messages from being sent to the server. The other is that you have cookies disabled; the DCForum software requires cookies to work properly.

Previous Topic | Next Topic

Printer-friendly copy Email this topic to a friend

Reading Topic #618

Member since Apr-20-03 · 69 posts

ive tried for ages now and cant get the hang of coding objects!
i think i can get the co ordinates and stuff but cant get the texture to show. Your help will be most appreciated as i currently have track but no scenary. i just want to code my own objects instead of using others all the time thanks shaneVisit my Site

Just been updated
http://www.bve-midlands.tk

Alert | IP

Printer-friendly page | Edit | Reply | Reply With Quote | Top

RE: B3d Coding, Tim Frost, Jul-27-03, 05:13 PM, (1) RE: B3d Coding, Central trains, Jul-27-03, 05:38 PM, (2) RE: B3d Coding, mailer_diablo, Jul-28-03, 05:09 AM, (3) RE: B3d Coding, Tim Frost, Jul-28-03, 07:20 AM, (4) RE: B3d Coding, cjh401, Jul-28-03, 10:53 AM, (5) RE: B3d Coding, TomBoyRacer, Jul-28-03, 03:26 PM, (6) RE: B3d Coding, TomBoyRacer, Jul-28-03, 04:47 PM, (7) RE: B3d Coding, Owls91, Jul-28-03, 04:55 PM, (8) RE: B3d Coding, Stooopid_person, Jul-29-03, 09:18 AM, (9) RE: B3d Coding, cjh401, Jul-29-03, 02:31 PM, (10) RE: B3d Coding, TomBoyRacer, Jul-29-03, 02:49 PM, (11) RE: B3d Coding, Joao_CG, Jul-29-03, 06:37 PM, (12) RE: B3d Coding, Stooopid_person, Jul-30-03, 07:08 AM, (13) RE: B3d Coding, tof63, Jul-30-03, 01:25 PM, (14) RE: B3d Coding, Stooopid_person, Jul-31-03, 07:04 AM, (15) RE: B3d Coding, Technical Numpty, Aug-01-03, 08:17 AM, (16) RE: B3d Coding, Stooopid_person, Aug-01-03, 09:17 AM, (17) RE: B3d Coding, Technical Numpty, Aug-01-03, 09:44 AM, (18) RE: B3d Coding, TomBeevers2000, Aug-01-03, 10:07 AM, (19) RE: B3d Coding, Stooopid_person, Aug-01-03, 10:27 AM, (20) RE: B3d Coding, smikes, Aug-01-03, 11:45 AM, (21) RE: B3d Coding, Technical Numpty, Aug-01-03, 04:46 PM, (22) RE: B3d Coding, TomBoyRacer, Aug-01-03, 05:33 PM, (23) RE: B3d Coding, Stooopid_person, Aug-02-03, 02:01 AM, (24) RE: B3d Coding, Technical Numpty, Aug-02-03, 06:41 PM, (25) RE: B3d Coding, Stooopid_person, Aug-03-03, 02:56 AM, (26) RE: B3d Coding, NathanWhitington, Aug-03-03, 07:25 AM, (27)

Conferences | Topics | Previous Topic | Next Topic

Member since Apr-9-03 · 292 posts

RE: B3d Coding

Click to send message via ICQ

B3d Coding – image 1

I just stole the coordinates part from another object when I started out. Now I just continue to copy and paste. This works wonders for simple objects... IE 4 vertices... more complex ones you'll have to get the answer from someone who understands BVE texturing better than I do. And no, borrowing those 4 lines of someone's object is not copyright infringement. You can take them from mine if you want. Tim Frost
NVTA Subway routes for BVE:
http://nvta.co.uk
B3d Coding – image 2

Alert | IP

Printer-friendly page | Edit | Reply | Reply With Quote | Top

Member since Apr-9-03 · 292 posts

RE: B3d Coding

Click to send message via ICQ

B3d Coding – image 5

LAST EDITED ON Jul-28-03 AT 07:21 AM (EDT)

Err... for what?Oh and I meant a very specific four lines of someone's object, the texture coordinates. These are pretty standard depending on the arrangement of the face.Tim Frost
NVTA Subway routes for BVE:
http://nvta.co.uk
B3d Coding – image 6

Alert | IP

Printer-friendly page | Edit | Reply | Reply With Quote | Top

Member since Jul-3-03 · 18 posts

RE: B3d Coding

As far as I could see, there is always an element of trial and error in objects. If the face is the problem try using face2 instead of face. I do this so the texture is on both sides. Also, the three columns of numbers:
1: the vertex number (obvious)
2: the nummber of texture repeats you want along the length of the objects
3: as 2 for the heightSometimes it is neccessary to swap 2 and 3 around, someone else needs to tell you why, I have no idea.HTHCheers

Chris H

Alert | IP

Printer-friendly page | Edit | Reply | Reply With Quote | Top

Member since Apr-19-03 · 129 posts

RE: B3d Coding

B3d Coding – image 7

LAST EDITED ON Jul-28-03 AT 03:29 PM (EDT)

I keep meaning to build an in-depth tutorial for making .b3d objects, but i've never got round to it.
i'm going to assume you know how to create a .b3d file and place it in a route.
you must try, as far as possible to order the vertices clockwise, as this makes things easier, although not impossible.
ok, lets make a flat square 2 meters wide.
let's order the faces like this:1-------------2
| |
| |
| |
0-------------3the reason i have done so is so that we can extend the object to the right with a minimum of fuss. if you want to extend it in another direction, simply order the vertices accordingly.
the vertex statement goes as such
vertex x,y,z
x,y and z being dimensions that you should be familiar with. as we are only creating a flat square, we clearly don't need the 'z' vertice,
so we leave it at '0', which will make it at zero meters from where you have placed the object.
the face statement tells BVE in which order to create the faces. it seems rather pointless for just 4 vertices, but it is useful when you create an object with more than 4 vertices.
'face 2' refers to if you want an object to be seen from the other side too, you reverse the order of the face command, or indeed if you have only the reversed order, it will ONLY become visible from the other side (useful for objects with could be placed either side of the tracks)
the color (use of american syntax is paramount!) part refers to the standard RGB code ranging from 0,0,0 *00,00,00 in hex* (black) to 255,255,255 *FF,FF,FF* (white)
if you add an extra number from 0 to 255, the image will become translucent, the last set of numbers defining the amount of transparency.
here is our test object
*******************************************************************
{meshbuilder} (square brackets)
vertex 0,2,0
vertex 2,2,0
vertex 2,0,0
vertex 0,0,0
face 0,1,2,3
color 100,100,100
************************************
if you use this object in a route, you should see a dark grey
square appear slightly to the right of the track centreline.
to extend the object to the right, we will do it like this:
*******************************************************************
1-------2-------4------->
| | |
| | |
| | |
0-------3-------5------->
*************************************************
if you want to use this as the start of a cube object, alter the z-axis. +x would put the vertex after z=0 a value of -x would put it before.
the texture part is altogether more tricky. as a rule of thumb, make sure all your basic statements are working OK before you progress onto the texture section.
firstly, make sure the texture you specify to put on is in the same folder as the object file. you must also remember that if you want to put different textures on the same object, it's best to make a separate meshbuilder section for each one. what you are doing is defining the tiling factor for the texture. i.e, the length and the height.
also, the textures you use must come in sizes of 1,2,4,8,16,32,64,128,256,512... etc although they don't have to be square, as long as the sides fit those dimensions, and they MUST be jpegs. also try to make the textures as small as possible, while maintaining quality of image.
here is an example
{meshbuilder}
vertex 0,2,0
vertex 2,2,0
vertex 2,0,0
vertex 0,0,0
face 0,1,2,3
(note we don't use the color if were putting a texture on. you can, but it will alter the appearance of the object!)
{texture}
load yourtexture.bmp
coordinates 0,0,0
coordinates 1,1,0
coordinates 2,1,1
coordinates 3,0,1
transparent x,x,x
note the first digit after the 'coordinates' is telling bve the face to which the statement applies. the other 2 digits are the horizontal and vertical tiling factors of your chosen bitmap.
to use transparency, you must fill parts of your texture that you wish to be transparent with a chosen color (preferably one that blends in quite well, instead of a marked contrast). you then set this colour to be transparent. if you don't want transparency, then omit the command.
this should at least start you off building objects.
hope this helps

phew that must be my longest ever post!

Routes for BVE

Alert | IP

Printer-friendly page | Edit | Reply | Reply With Quote | Top

Charter Member · 2708 posts

RE: B3d Coding

>the textures you use must come in sizes of
>1,2,4,8,16,32,64,128,256,512... etc although they don't have That is not neccessary. If the object only has 4 vertices, there doesn't need to be a specified size.

--You are reading my signature now, don't waste your time reading it!--
Eh, where did my signature go?
Where has my favourite LUL train gone? Maybe it was sent for bolt checking again...

Alert | IP

Printer-friendly page | Edit | Reply | Reply With Quote | Top

Member since Jul-3-03 · 18 posts

RE: B3d Coding

>>the textures you use must come in sizes of
>>1,2,4,8,16,32,64,128,256,512... etc although they don't have
>
>That is not neccessary. If the object only has 4 vertices,
>there doesn't need to be a specified size. Well, unless you need to use a tranparent background! It took me a while to work that one out myslef!!Cheers

Chris H

Alert | IP

Printer-friendly page | Edit | Reply | Reply With Quote | Top

Member since Apr-19-03 · 129 posts

RE: B3d Coding

B3d Coding – image 9

well, I have alot on my plate right now, but soon i hope to complete my site and then i'll send a draft of the .b3d command document out to established coders to check for ommissions or errors and then i'll upload it. i see no point in creating a .csv tutorial other than to cover one or two points, and the fact i use the structre converter tool when i want things in .csv format anyway
i hope to include some case studies on building large objects or stations etc.
it will be a while though!

Routes for BVE

Alert | IP

Printer-friendly page | Edit | Reply | Reply With Quote | Top

Member since May-4-03 · 16 posts

RE: B3d Coding

B3d Coding – image 10

>>the textures you use must come in sizes of
>>1,2,4,8,16,32,64,128,256,512... etc although they don't have>>PaintShop can be widely used here to resize the bitmaps. This is
one of the BVE rules and must be followed. Some months ago,
some of my textures had a size of 320x240, as a result, the background color of these bitmaps were shown in my route as a blue shadow. (I've chosen blue color, with transparency 0,0,255...)And remember, the large you choose, the lower will be in the route.
>>That is not neccessary. If the object only has 4 vertices,
>>there doesn't need to be a specified size.>>It doesn't matter the number of vertices, the upper procedure must
be done, otherwise your textures will appear in the route with
the background color. This occurs due to some video card incompatibilities with BVE so, if
you resize the bitmaps according the BVE rules, your problems
will certainly minimize. Ah, don't forget to upgrade your Video card
drivers.Cheers,

John Goncalves, Brazil
http://joaocg.topcities.com

Alert | IP

Printer-friendly page | Edit | Reply | Reply With Quote | Top

Charter Member · 2708 posts

RE: B3d Coding

>Well, unless you need to use a tranparent background! It
>took me a while to work that one out myslef!! Well, it is not fully neccessary. 192x48 can have a transparent backgound.
And if the bitmap size is not mutilples of two, it has to be saved in 256 colours. If it is saved as 24 bit colours, it will not display at all. But it won't give an error either.

--You are reading my signature now, don't waste your time reading it!--
Eh, where did my signature go?
Where has my favourite LUL train gone? Maybe it was sent for bolt checking again...

Alert | IP

Printer-friendly page | Edit | Reply | Reply With Quote | Top

Charter Member · 2708 posts

RE: B3d Coding

>You are very much lucky if your gfx card allows this. But if
>you will release a route with such an object, be sure that
>you'll receive a lot of complains... Both computers of mine worked, one with a ATI Radeon 9000 and one with a Diamond S3.

--You are reading my signature now, don't waste your time reading it!--
Eh, where did my signature go?
Where has my favourite LUL train gone? Maybe it was sent for bolt checking again...

Alert | IP

Printer-friendly page | Edit | Reply | Reply With Quote | Top

Member since Apr-16-03 · 42 posts

RE: B3d Coding

>If it is saved as 24 bit colours, it will not display at all. But it won't give an error either. Hi Gang!!Really? I'm currently using 24 bit colours for my textures to get extra realism and it's working fine so far. Are you saying that I should avoid using 24 bit textures as they generally don't work, or just that they don't work if the bitmap is not correctly sized (e.g. 256x256)?Confused.Technical Numpty

Alert | IP

Printer-friendly page | Edit | Reply | Reply With Quote | Top

Charter Member · 2708 posts

RE: B3d Coding

LAST EDITED ON Aug-01-03 AT 09:24 AM (EDT)

>Really? I'm currently using 24 bit colours for my textures
>to get extra realism and it's working fine so far. Are you
>saying that I should avoid using 24 bit textures as they
>generally don't work, or just that they don't work if the
>bitmap is not correctly sized (e.g. 256x256)? 24-bit will not work properly if the bitmap's size is not in multiples of twos. 256 colour will work properly in all cases. 16 colour will become fuzzy(e.g. most textures in Piccadilly Line).
Why don't you save in 256 colour? It can half the size of the bitmap! But it some exceptional cases, 24-bit is smaller than 256 colour. I think that will happen if the size of the bitmap is less than 32x32. But 16 colour will always be the smallest.
What do you mean for added realism, if your picture doesn't have more than 256 colour, use a picture editor(I use Photoshop), to reduce the size, and sometimes, it reduces all the way to 16 colour, without any colour lost that I have to make in 256 colour in Paint again(Anyone can help me here? http://www.train-sim.com/dcforum/DCForumID1/5881.html)

--You are reading my signature now, don't waste your time reading it!--
Eh, where did my signature go?
Where has my favourite LUL train gone? Maybe it was sent for bolt checking again...

Alert | IP

Printer-friendly page | Edit | Reply | Reply With Quote | Top

Member since Apr-16-03 · 42 posts

RE: B3d Coding

LAST EDITED ON Aug-01-03 AT 09:48 AM (EDT)

>24-bit will not work properly if the bitmap's size is not in
>multiples of twos.OK, so I'm guessing that I'm fine given the bitmap sizes that I'm using.>What do you mean for added realism, if your picture doesn't
>have more than 256 colour, use a picture editor(I use
>Photoshop), to reduce the size, and sometimes, it reduces
>all the way to 16 colour, without any colour lost that I
>have to make in 256 colour in Paint againEr, um, I've not really explored picture editors so I've just been using Adobe Photodeluxe (presumably the skinflint's version of Photoshop) and (hangs head in shame) MS Paint because it's easy to use. Saving as a 256 bitmap results in disasterous colour loss that turn all my greens to grey. Only by using a 24 bit bitmap am I able to get acceptable colour reproduction.The other reason is that I try and base my textures on photos wherever possible, which obviously include vastly more colours than just creating bitmaps in Paint (or similar). The effort required is sometimes much greater, but the end result (especially on train fronts) is so worth it.Perhaps someone can advise me on this...?Technical Numpty

Alert | IP

Printer-friendly page | Edit | Reply | Reply With Quote | Top

Charter Member · 129 posts

RE: B3d Coding

B3d Coding – image 12

I reduce the filesize by making it 16 color - complaints about fuzzienessI increase them all to 24 bit bitmaps - complaints about filesize.Can't win can yer? Picc v3 will be lots more 24 bit bitmaps and lots more 512x512.--
Tom Beevers
http://brj.rr.nu

Alert | IP

Printer-friendly page | Edit | Reply | Reply With Quote | Top

Charter Member · 2708 posts

RE: B3d Coding

>I reduce the filesize by making it 16 color - complaints
>about fuzzieness
>
>I increase them all to 24 bit bitmaps - complaints about
>filesize.
>
>Can't win can yer? Picc v3 will be lots more 24 bit bitmaps
>and lots more 512x512. Erm, what about 256 colours? Filesize? I think you should delte all the unwanted bitmaps first.

--You are reading my signature now, don't waste your time reading it!--
Eh, where did my signature go?
Where has my favourite LUL train gone? Maybe it was sent for bolt checking again...

Alert | IP

Printer-friendly page | Edit | Reply | Reply With Quote | Top

Member since Apr-7-03 · 79 posts

RE: B3d Coding

Try the free program Irfanview.It does an excellent job of reducing to 256 colors because it creates the palette using only colors in the photo or drawing.Ive put the image back in Paint to outline with a transparent color and used pure blue;but the color that showed was not pure blue but the nearest one in that palette.It still seems wierd looking,even if I know why.The transparency works fine. http://irfanview.com/

Alert | IP

Printer-friendly page | Edit | Reply | Reply With Quote | Top

Member since Apr-16-03 · 42 posts

RE: B3d Coding

> Try the free program Irfanview.It does an
>excellent job of reducing to 256 colors because it creates
>the palette using only colors in the photo or drawing.Ive
>put the image back in Paint to outline with a transparent
>color and used pure blue;but the color that showed was not
>pure blue but the nearest one in that palette.It still seems
>wierd looking,even if I know why.The transparency works
>fine. http://irfanview.com/
>
Genius!!Thanks for the excellent tip Smikes. I've just tried it on one of my bitmaps and it's gone from 48K to 17K with no discernable difference. Only at 400% magnification can you see that it is just ever so slighty grainier than before.All my bitmaps will be getting Irfan-ised from now on. However, I think I'll stick with MS Paint for all the editing and transparency. If you use pure blue before it gets reduced, it'll sample that colour too and leaves it totally unchanged.I'm converted. Thanks again!!Technical Numpty

Alert | IP

Printer-friendly page | Edit | Reply | Reply With Quote | Top

Member since Apr-19-03 · 129 posts

RE: B3d Coding

B3d Coding – image 13

i used to use blue for my transparent colour until i dicovered it was better to use a colour similar to the actual colour of the bitmap content. it blends in alot better in my experience when dealing with small bitmaps.

Routes for BVE

Alert | IP

Printer-friendly page | Edit | Reply | Reply With Quote | Top

Charter Member · 2708 posts

RE: B3d Coding

>Er, um, I've not really explored picture editors so I've
>just been using Adobe Photodeluxe (presumably the
>skinflint's version of Photoshop) and (hangs head in shame)
>MS Paint because it's easy to use. Saving as a 256 bitmap
>results in disasterous colour loss that turn all my greens
>to grey. Only by using a 24 bit bitmap am I able to get
>acceptable colour reproduction. Photoshop will not give you any colour loss unless the picture you have has more than 256 colours. I noticed you said in the post below that Ifranview is grainy, but Photoshop does not give you grainy stuff, even in 1600%.

--You are reading my signature now, don't waste your time reading it!--
Eh, where did my signature go?
Where has my favourite LUL train gone? Maybe it was sent for bolt checking again...

Alert | IP

Printer-friendly page | Edit | Reply | Reply With Quote | Top

Member since Apr-16-03 · 42 posts

RE: B3d Coding

>Photoshop will not give you any colour loss unless the
>picture you have has more than 256 colours. I noticed you
>said in the post below that Ifranview is grainy, but
>Photoshop does not give you grainy stuff, even in 1600%.
Hi Fella!!I'm afraid that I would have no other use for Photoshop, so I can't really justify the expense just for BVE. Besides, the results that I'm getting are perfectly acceptable, as you're not really going to get close enough to any textures to be able to see that it's a bit grainier than the source material.I will bear it in mind, though. You never know. Someone might want to treat me to some software for Christmas...!!Technical Numpty

Alert | IP

Printer-friendly page | Edit | Reply | Reply With Quote | Top

Charter Member · 2708 posts

RE: B3d Coding

>I would have no other use for Photoshop, so
>I can't really justify the expense just for BVE. Hint: Just before you release your route, download the Photoshop 30-day trial and convert all to 256 colour.

--You are reading my signature now, don't waste your time reading it!--
Eh, where did my signature go?
Where has my favourite LUL train gone? Maybe it was sent for bolt checking again...

Alert | IP

Printer-friendly page | Edit | Reply | Reply With Quote | Top

Member since Apr-8-03 · 136 posts

RE: B3d Coding

B3d Coding – image 14

>>I would have no other use for Photoshop, so
>>I can't really justify the expense just for BVE.
>
>Hint: Just before you release your route, download the
>Photoshop 30-day trial and convert all to 256 colour. I used to use Adobe Home Deluxe 4.0 (as part of some package with a digital camera) I've noticed exactly what you had mentioned previously in your post up there. I recently converted to using Ulead Photosuite which is much better and it tends to do exactly as others have specified and mentioned.--
Nathan Whitington

http://members.aol.com/nwhitington

Alert | IP


[ Home | MSTS Forum | MSTS FAQ | File Library ] Copyright © 2002 by Nels Anderson. All Rights Reserved.

Restored from the Train-Sim.Com archive, captured August 3, 2003. About this archive.