SetEmissiveColor or LoadTexture?

View previous topic View next topic Go down

SetEmissiveColor or LoadTexture?

Post by joeyfjj on Sun Oct 09, 2011 5:49 pm

When I code a train's interior, I used to use this code to make the the texture the same despite brightness levels
Code:
LoadTexture, texture.png, texture.png

It was only later that I started using the following:
Code:
LoadTexture, texture.png
SetEmissiveColor,255,255,255

Both had the same effect visually, by my question is, is there any performance differences (in terms of framerates) between both?

joeyfjj

Posts : 265
Join date : 2011-07-30
Location : Singapore

http://joeyfoo.com

Back to top Go down

Re: SetEmissiveColor or LoadTexture?

Post by graymac on Sun Oct 09, 2011 6:05 pm

SetEmissiveColor is appropriate for solid faces. You find if you use it on a texture the whole texture takes on the emissive color as defined.
It is always more costly in terms of framerates to use a texture.
Have you tried both options above to see if there's a noticeable difference in fps? If none is detected you need not worry.
avatar
graymac

Posts : 1744
Join date : 2011-08-28
Location : Co Mayo, Eire

http://www.celtictrainsim.com

Back to top Go down

Re: SetEmissiveColor or LoadTexture?

Post by lonelyinardwick on Sun Oct 09, 2011 6:29 pm

If for nighttime textures, I suggest using SetEmissiveColor
If you want to use the same texture for nightime, then add nighttime.
If you use a nightime texture with nightime mesh, you'll have white edges.

lonelyinardwick

Posts : 375
Join date : 2011-07-24

https://about.me/lonelyinardwick

Back to top Go down

Re: SetEmissiveColor or LoadTexture?

Post by joeyfjj on Tue Oct 11, 2011 12:58 pm

...and the results are in!



In each of the tests, I have used a full-coloured non-alpha PNG applied onto 2000 faces.

Apparently there are performance differences, but it's not large enough to justify spending time to pore through codes changing NighttimeImage to use SetEmissiveColor.

joeyfjj

Posts : 265
Join date : 2011-07-30
Location : Singapore

http://joeyfoo.com

Back to top Go down

Re: SetEmissiveColor or LoadTexture?

Post by graymac on Tue Oct 11, 2011 3:55 pm

What is most relevant in those results is the evidence that the use of textures not scaled to >2 has on your frame rates. Although the 1000x1000 textures will actually be a smaller file size than the 1024x1024 ones, their effect on the renderer is clearly to slow it down.
Nighttime image will obviously impact on fps because there are two files loaded instead of normally one.
EmissiveColor is generally only suitable for solid faces, not for textures (with the exception of "glows") . Any use of textures brings a responsibility to optimise size and consider using index color even, to give the best performance. Many add-ons are deficient in this respect and waste resources to the point where the performance of the route is degraded. The best thing to do with such add-ons is to convert them to "take-offs".
avatar
graymac

Posts : 1744
Join date : 2011-08-28
Location : Co Mayo, Eire

http://www.celtictrainsim.com

Back to top Go down

Re: SetEmissiveColor or LoadTexture?

Post by joeyfjj on Tue Oct 11, 2011 4:08 pm

To illustrate the uses of such a command on a texture, this is how it is used in my C751A add-on. As you can see, all faces in the train's interior has to remain lighted while the train undergoes different environmental brightness changes, hence the need for SetEmissiveColor.



Edit: and a blog post about it: http://joeyfoo.wordpress.com/2011/10/11/openbve-development-nighttimeimage-v-setemissivecolor-why-to-avoid-non-standard-texture-sizes/

joeyfjj

Posts : 265
Join date : 2011-07-30
Location : Singapore

http://joeyfoo.com

Back to top Go down

Re: SetEmissiveColor or LoadTexture?

Post by graymac on Tue Oct 11, 2011 6:03 pm

Looks like we've gone from a driver simulator to a passenger simulator Very Happy
avatar
graymac

Posts : 1744
Join date : 2011-08-28
Location : Co Mayo, Eire

http://www.celtictrainsim.com

Back to top Go down

Re: SetEmissiveColor or LoadTexture?

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