Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Kolgena on June 12, 2013, 02:15:05 pm

Title: Environment maps with hues
Post by: Kolgena on June 12, 2013, 02:15:05 pm
I was wondering how easy it would be to add a feature to env mapping, namely, the ability to reference the spec map when drawing the env map. Currently, a gold (or any other colored) object will have env reflections that assume the model is silver/mirrored, which can sometimes be unconvincing in appearance. If the env map could somehow reference the spec map's color, or exist outside of greyscale values, could it look better? In this way, shiny mirror ships may look more like polished reflective metal, rather than something coated in lacquer.

This image demonstrates what I meant by how reflections take on a tint based on the material they reflect from.
(http://www.flickr.com/photos/marvinok/3333638391/)

Think this is worth the time/effort? It seems like it could be as simple as env output * spec map, which substitutes the old env output, but I could be totally off too. I also realize that this suggestion fits in better with the materials system that will be coming some point in the future, but if it actually is easy to implement, it might be a nice addition to the shaders.
Title: Re: Environment maps with hues
Post by: Valathil on June 15, 2013, 03:55:17 am
It seems like it could be as simple as env output * spec map, which substitutes the old env output, but I could be totally off too.

Actually that is already in you just have to make the Spec map without an Alpha channel. As you can see in this bit from the Shaders:

Code: [Select]
#ifdef FLAG_ENV_MAP
   vec3 envIntensity = (alpha_spec) ? vec3(specColour.a) : specColour.rgb;
   fragmentColor.a += (dot(envColour.rgb, envColour.rgb) * ENV_ALPHA_FACTOR);
   fragmentColor.rgb += envColour.rgb * envIntensity;
 #endif
Title: Re: Environment maps with hues
Post by: Kolgena on June 16, 2013, 03:10:34 pm
Cool. Is that in the shaders for deferred lighing only, or in the old ones too? I might have missed the behavior because my laptop is too crap to run the deferred lighting stuff.
Title: Re: Environment maps with hues
Post by: The E on June 16, 2013, 03:27:34 pm
This is the same for all shaders.
Title: Re: Environment maps with hues
Post by: Bobboau on June 24, 2013, 03:18:28 am
interesting historical note: the original implementation actually worked only like this.
Title: Re: Environment maps with hues
Post by: chief1983 on June 26, 2013, 02:08:10 pm
This sounds related to the 'everything is covered in stars' issue we used to have.