Home Coding, Scripting, Shaders

Shader in Unity: using alpha as specular intensity and diffuse as specular color, could it work?

polycounter lvl 12
Offline / Send Message
Kyalie polycounter lvl 12
Hi guys!
I've been in the industry for a while but never had much love for poking around shaders settings and such. So when it comes to properly explain to our shader programmer the kind of result i would like, i end up not being sure if it makes sense at all.
What i'm trying to achieve for our stylized game is to use the alpha channel of a diffuse map as the specular intensity, with the specular color being linked to the alpha channel of the diffuse map, while still having it react somehow to the scene lighting (because we also use normal map).
Is this technically achievable? Thanks!

Replies

  • suspectlogic
    Offline / Send Message
    suspectlogic polycounter lvl 13
    An alpha channel will work well for intensity. I'm not sure I understand the second part, you can't get color from the alpha channel if that's what you mean?

    I suppose you could make a color property in your shader that gets multiplied with either the specular intensity or a mask created by a remapped specular intensity. But the result will be a monochromatic/uniform specular color.
  • Kyalie
    Offline / Send Message
    Kyalie polycounter lvl 12
    Using the RGB channels from the diffuse as specular color for the highlighted parts (like how in 3ds max you have specular level (black and white intensity) and specular color (RGB, color))
    Example, here the lighter version is specular only, with the highlits being rather desaturated, the more contrasted one has its hightlights more saturated, because it uses the info from the RGB channels from the diffuse.

  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    Just tell them what you want control over in the shader and they'll sort the rest out

    You can use any channel of any texture to do anything you want in a modern shader and how they're packed can have a huge effect on quality and cost so it's best to let the programmer worry about that. 
Sign In or Register to comment.