Alpha map emission shader

I've been working on the RX-7 to get it up to the recent versions, one of the things I've been fiddling with is interior lighting. The majority of this stuff (eg. the gauges) is texture mapped, and only certain elements should have emissions - if it's more general it looks like it's got a small lamp on it, rather than the icons actually glowing. With the Kilolux levels and real shadowing it's a lot darker in the cockpit so the instrument panel is really needing this kind of thing.

So, to arrange this, I copied standard_f.cg to standard_glow_f.cg, with one minor change:
Code:
baseCol*(ambient + Ke)
This is in the ambient lighting line -
Changed to
Code:
baseCol*(ambient + Ke*baseCol.a)
In combination with a shader specifying emission amounts, this means that a 1.0 on the alpha channel will emit, while a 0.0 is completely lit by normal ambient light. After that it's just a matter of fixing up the interior maps with appropriate emissions.

I guess my question is whether this functionality is duplicated in another shader, or if this would be a useful addition to the set of shaders.
 
That sounds like a good move. Most people currently use an alpha map to outline their emission materials.

I think the most important part will be how the alpha is used. The nice smooth 'blend' blendfunc is preferable to the bitty looking alpha_to_coverage variety of transparrency.


I guess then we can do some really nice dashboard illuminations with the areas around the dials picking up some of the light too (less alpha on the transparrency map_, which at dusk might not be visible but as it gets darker would become more obvious. Ah the joys of a large dynamic range :D
 
I guess then we can do some really nice dashboard illuminations with the areas around the dials picking up some of the light too (less alpha on the transparrency map_, which at dusk might not be visible but as it gets darker would become more obvious. Ah the joys of a large dynamic range :D

That's something I was thinking about as well, burning static lighting into a texture and setting it as emissive. If it's handled as emissive by Racer then it won't show up in bright light, only the appropriate low light levels.

The shader I'm using above is more for 'backlit' stuff - the colour's already there and it just needs some fixed emission level. To stick a real dashboard light in and burn its lighting into the texture might want its own color channel.

Putting it into the actual material instead of as an overlay means less messing with transparency, just mix it inside the shader and you get exactly the result you want instead of the least-bad blendfunc.
 
Yep, works well.
emissive_dials.jpg


Need to adjust the map now is all.

You made a mistake though, it should be
Code:
baseCol*(ambient + Ke*baseCol.a)
to work with the rest of the shader.
 
Haha, yeah, I've done that a few times - written something from memory only to have it fail :D

458_cluster_night.jpg

Looking really good :D
As you said, just need to be able to define shaders for needles and stuff.

###EDIT###
Can I suggest we change the line to incorporate the "night" variable? In daylight it's a little too overexposed.

Code:
float3 ambientColor=baseCol*(ambient + Ke * baseCol.a*night);
IMO that exposes better during the day, having the emission there + the sun diffuse makes it a little too bright IMHO.
My emission is currently set to 3.
 

Latest News

How long have you been simracing

  • < 1 year

    Votes: 302 15.3%
  • < 2 years

    Votes: 211 10.7%
  • < 3 years

    Votes: 203 10.3%
  • < 4 years

    Votes: 153 7.8%
  • < 5 years

    Votes: 269 13.6%
  • < 10 years

    Votes: 231 11.7%
  • < 15 years

    Votes: 148 7.5%
  • < 20 years

    Votes: 117 5.9%
  • < 25 years

    Votes: 88 4.5%
  • Ok, I am a dinosaur

    Votes: 251 12.7%
Back
Top