BVE WorldWide
Would you like to react to this message? Create an account in a few clicks or log in to continue.

SetEmissiveColor or LoadTexture?

2 posters

Go down

SetEmissiveColor or LoadTexture? Empty SetEmissiveColor or LoadTexture?

Post by joeyfjj 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 : 266
Join date : 2011-07-30
Location : Singapore

http://joeyfoo.com

Back to top Go down

SetEmissiveColor or LoadTexture? Empty Re: SetEmissiveColor or LoadTexture?

Post by graymac 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.
graymac
graymac

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

http://www.celtictrainsim.com

Back to top Go down

SetEmissiveColor or LoadTexture? Empty Re: SetEmissiveColor or LoadTexture?

Post by Guest Sun Oct 09, 2011 6:29 pm

.


Last edited by lonelyinardwick on Wed May 13, 2020 3:48 am; edited 1 time in total

Guest
Guest


Back to top Go down

SetEmissiveColor or LoadTexture? Empty Re: SetEmissiveColor or LoadTexture?

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

...and the results are in!

SetEmissiveColor or LoadTexture? Openbvetexturefps

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 : 266
Join date : 2011-07-30
Location : Singapore

http://joeyfoo.com

Back to top Go down

SetEmissiveColor or LoadTexture? Empty Re: SetEmissiveColor or LoadTexture?

Post by graymac 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".
graymac
graymac

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

http://www.celtictrainsim.com

Back to top Go down

SetEmissiveColor or LoadTexture? Empty Re: SetEmissiveColor or LoadTexture?

Post by joeyfjj 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.

SetEmissiveColor or LoadTexture? 207135_143787619023538_129631873772446_276600_1302629_n

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 : 266
Join date : 2011-07-30
Location : Singapore

http://joeyfoo.com

Back to top Go down

SetEmissiveColor or LoadTexture? Empty Re: SetEmissiveColor or LoadTexture?

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

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

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

http://www.celtictrainsim.com

Back to top Go down

SetEmissiveColor or LoadTexture? Empty Re: SetEmissiveColor or LoadTexture?

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


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