EmissiveColor command

View previous topic View next topic Go down

EmissiveColor command

Post by YankeesPwnMets on Tue Jan 14, 2014 4:30 am

I've been trying to learn the basics of object developing for openBVE this past weekend, so I decided to take a look at the R160 exterior objects from the openBVE Connect site. Most of the commands I had a basic understanding of, but the one command that stuck out to me was this:
Code:
EmissiveColor 100, 100, 100
I never saw that command before, so I decided to take reference back to michelle's old openBVE Developer Documentation, which I had been reading to try and learn object building. It described EmissiveColor as such:
The difference between the Color command and the EmissiveColor command is that the Color command is affected by lighting, while the EmissiveColor command is not. Thus, the EmissiveColor command should be used for faces which would emit light themselves, including signals, lamps, windows and the like. The actual color contribution to the faces will be the sum of the light-affected color data and the static emissive color data.
This command was placed where the roof was being built. Only one side of the roof had this command, the other didn't. Interesting, but, as far as I'm concerned, roofs don't emit light. I loaded up the car in ObjectViewer and sure enough, the train came out looking just fine:

However, since the EmissiveColor command was used to emit light, I was pretty sure that I would be able to see the effects of this command by setting ObjectViewer to night time. Sure enough, this was what came out:


I set ObjectViwer back to daytime and got rid of the command to see what would happen. One side of the roof came out to be much darker than the other.

At first, I just thought that different parts of the roof were using different textures. Perhaps one of the textures was darker than the other for whatever reason and the developer was using the command to compensate for that. However, when I checked the object file further, I realized that both parts of the roof were using the same texture: CurveRoof.png. This disproved my theory. I checked the roof portions of the object again to see if I could spot anything that might have affected the lighting of the roof, but I didn't notice anything. As a result, my curiosity overcame me and I came here to ask this question:

If the same textures were being used, than why would one side of the roof be noticeably darker than the other side? Why would only one side of the roof require the EmissiveColor command while the other side didn't?
avatar
YankeesPwnMets

Posts : 15
Join date : 2014-01-05
Age : 36
Location : New York, NY

Back to top Go down

Re: EmissiveColor command

Post by Dexter on Tue Jan 14, 2014 4:52 am

I think this is more about normals than about an emissive color...
avatar
Dexter

Posts : 1824
Join date : 2011-07-08
Age : 31
Location : Brno, Czech republic

http://www.brnobve.eu

Back to top Go down

Re: EmissiveColor command

Post by Ad1992 on Tue Jan 14, 2014 12:19 pm

I think you find the problem you are describing is to do with the shading. I think it is because Openbve is still heavily reliant on the way that bve works ie 2D as opposed to 3D.

There is a way around it though by putting an extra amount of code in at the end of the vertex command. This will balance the two out.
avatar
Ad1992

Posts : 232
Join date : 2012-06-04

http://bvewr.webs.com/

Back to top Go down

Re: EmissiveColor command

Post by leezer3 on Tue Jan 14, 2014 3:56 pm

Is it using Face or Face2 commands, and what is the sequence for each of the two sides?

If you use a Face2 command with the same vertex sequence on the opposite side of the roof, then the lighting will be darker. To reverse this effect, you reverse the sequence of vertexes in the Face2 command. I suspect the author of this object is unaware of this fact Smile

A simple pair of examples (Add whatever texture you want).
Differing Lighting:

Code:
[MeshBuilder]
Vertex  0 ,  2.7 ,  0
Vertex  3.6 ,  2.7 ,  0
Vertex  3.6 ,  0 ,  0
Vertex  0 ,  0 ,  0
Face2 3,2,1,0

[Texture]
Load texture.png
Coordinates   0, 0, 0
Coordinates   1, 1, 0
Coordinates   2, 1, 1
Coordinates   3, 0, 1

[MeshBuilder]
Vertex  0 ,  2.7 ,  0
Vertex  -3.6 ,  2.7 ,  0
Vertex  -3.6 ,  0 ,  0
Vertex  0 ,  0 ,  0
Face2 3,2,1,0

[Texture]
Load texture.png
Coordinates   0, 0, 0
Coordinates   1, 1, 0
Coordinates   2, 1, 1
Coordinates   3, 0, 1

Same Lighting:
Code:
[MeshBuilder]
Vertex  0 ,  2.7 ,  0
Vertex  3.6 ,  2.7 ,  0
Vertex  3.6 ,  0 ,  0
Vertex  0 ,  0 ,  0
Face2 3,2,1,0

[Texture]
Load texture.png
Coordinates   0, 0, 0
Coordinates   1, 1, 0
Coordinates   2, 1, 1
Coordinates   3, 0, 1

[MeshBuilder]
Vertex  0 ,  2.7 ,  0
Vertex  -3.6 ,  2.7 ,  0
Vertex  -3.6 ,  0 ,  0
Vertex  0 ,  0 ,  0
Face2 0,1,2,3

[Texture]
Load texture.png
Coordinates   0, 0, 0
Coordinates   1, 1, 0
Coordinates   2, 1, 1
Coordinates   3, 0, 1

Cheers

Chris Lees

http://www.bvecornwall.co.uk

leezer3

Posts : 875
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Re: EmissiveColor command

Post by YankeesPwnMets on Thu Jan 16, 2014 11:37 pm

Is it the same if it is using the Face command instead of Face2?
avatar
YankeesPwnMets

Posts : 15
Join date : 2014-01-05
Age : 36
Location : New York, NY

Back to top Go down

Re: EmissiveColor command

Post by Manuel18 on Thu Jan 16, 2014 11:59 pm

YankeesPwnMets wrote:Is it the same if it is using the Face command instead of Face2?
Never.. .
Face2 can cause Sun Lighting Position Problems.  It's Better use Face and invert the Vertex number position

Example
[meshbuilder]
vertex 0,1,-1
vertex 0,0,-1
vertex -1,1,0
vertex -1,0,0
face2 0,1,3,2

[meshbuilder]
vertex 0,1,0
vertex 0,0,0
vertex 1,1,1
vertex 1,0,1
face2 0,1,3,2

As you can see a Face2 command generating trouble with sun light position.



Front lighting is bright
Back lighting is darker.. ALL ON SAME FRONT.

I recommend you always use a Face and invert the position of the vertex on face #,#,#,# in case of the model face doesn't appear


Last edited by Manuel18 on Fri Jan 17, 2014 12:01 am; edited 1 time in total
avatar
Manuel18

Posts : 50
Join date : 2012-10-18
Age : 23
Location : Caracas,Venezuela

Back to top Go down

Re: EmissiveColor command

Post by Dexter on Fri Jan 17, 2014 12:01 am

Yes, indeed. And you can also use normals, to define the lighting vector. Very Happy
avatar
Dexter

Posts : 1824
Join date : 2011-07-08
Age : 31
Location : Brno, Czech republic

http://www.brnobve.eu

Back to top Go down

Re: EmissiveColor command

Post by Northern Line on Fri Jan 17, 2014 3:34 pm

Maybe this can be of some use http://railsimroutes.net/blog/?m=200906
avatar
Northern Line

Posts : 278
Join date : 2011-07-12
Age : 23
Location : Tooting, London, England

http://www.bve-district.co.uk/

Back to top Go down

Re: EmissiveColor command

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum