Home Unreal Engine

Emissive Help

Hey guys, if i have one object, 1 unwrap, that i need to have 2 seperate emissive colors. How do i accomplish this. Right now i simply have a emissive texture black/white and then am multiply the sample by whatever color i wanted them. But i need the text to be yellow while the light to be white. How can i accomplish this?

Replies

  • Vailias
    Options
    Offline / Send Message
    Vailias polycounter lvl 18
    Since you're using a whole other texture for emissive, you could just make them the colors you want in the texture, then multiply by the emissive intensity you desire.

    If you're going to use more channels in the texture for other things you can mask off one area from the other mathematically with a coords node, a channel mask, and an if block. Multiply the mask times the texture channel, then times the first color, then invert the mask (1 minus), multiply it by the texture channel again, then multiply it by your other color, then add the results back together and plug into the emissive slot.
  • LoTekK
    Options
    Offline / Send Message
    LoTekK polycounter lvl 17
    You can go an alternate route, and that's to use different value ranges in your emissive mask for different color constants.

    For example, if you only need two colors, you could have 0.0-0.5 be blue, and 0.5-1.0 be yellow.

    value%20masking.jpg

    It's a shitload cleaner in HLSL, lol.

    If you wanted to do more colors, I'll leave you with a short HLSL function that you can have fun translating to nodes. :p
    float InputRange(float color, float minRange, float maxRange)
    {
      float c = min(saturate(color - minRange) / (maxRange - minRange), 1);
      c = c >= 1?0:c;
      return c;
    }
    

    so for example, if you wanted to split your value range into 4 bands, and you wanted the second band of values:

    minRange = 0.25f;
    maxRange = 0.5f;
  • Vailias
    Options
    Offline / Send Message
    Vailias polycounter lvl 18
    I want a +1 button here. :)
    Thats a good option Tekk. Reminds me of the gradient mapping discussion a while back.
  • nick2730
    Options
    Offline / Send Message
    holy crap lol thnx tekk, no wonder i was having issues that a hell of a node. SO do i leave the mask as is it since i am only using 2 colors or do i need to colorize it to match the colors needed
  • Phill
    Options
    Offline / Send Message
    Not sure if this is helpful or not, but here's a slightly more compact expression set up that will give you a hard edge between the colors so you can multiply on an emissive channel without having to worry about a gradient.

    You can nest these similarly to LoTekK's method, just having an additional set you can break it into quadrants or however you like by moving the division point. The IF node is pretty awesome. :)
  • LoTekK
    Options
    Offline / Send Message
    LoTekK polycounter lvl 17
    nick2730:
    You don't need to colorise the mask, but you'll need to alter the value range of the existing mask depending on what needs to be yellow, and what needs to be blue. Quickest way would be to select what needs to be blue, and run a levels on it. Just move the bottom sliders. Blue would be (0 - 127), while yellow would be (128 - 255) in the example.

    value-masking-2.jpg

    Vailias: Haha, I know the feeling. I keep wanting to +1 stuff here :p This one came out of loving what Valve did with L4D2, but not being satisfied with being limited to only two bands, lol.

    Phill: That's one option as well. It keeps things simple, though it sacrifices versatility, since it's an either/or. The node/shader solution I provided also allows you to modulate the brightness/strength of each of the emissive colors. It can be a bit obtuse to actually work with the textures, though, without some workflow tweaks to the texture creation/editing :p
  • darthwilson
    Options
    Offline / Send Message
    If you're interested in another method you could do this..

    -In photoshop paint white areas into the red channel where you would like one colour, then on the green channel do the same again for a different emissive colour and do the same for blue

    -in the unreal editor import your new texture and multiply each individual channel with a vector to achieve individual colours.

    -multiply it again with an int to control the brightness of the glow

    Hope that helps.
  • LoTekK
    Options
    Offline / Send Message
    LoTekK polycounter lvl 17
    darthwilson: At that point, though, once you hit 2-3 colors, you might as well just paint the emissive in full color (which also gives you as much color variation as you please, instead of just 2-3 predefined ones) :p
  • darthwilson
    Options
    Offline / Send Message
    Yeah, very true! Can be very restricting

    When I was doing a 'hologram' project in unreal I used this method with material instances so i could use any colour.

    Nick I guess you just need to think what you need the most and what's most optimised
  • Phill
    Options
    Offline / Send Message
    Aye. My solution's relatively simple. It really depends on how you want to control those aspects, I'd say.
  • LoTekK
    Options
    Offline / Send Message
    LoTekK polycounter lvl 17
    I wrote up a short post expanding on the shader (though focusing on the HLSL side of things), and also updated the function a bit.

    http://teckartist.com/?p=26
    int bands = 4; //this is the number of value bands to split the range
    float range = 1.0 / bands; //range of each band
    
    float ReRamp(float val, int band)
    //val is the pixel's luminance, band is the... band [index]
    {
      float minRange = range * band;
      float maxRange = range * (band + 1);
      float c = min(saturate(val - minRange) / (maxRange - minRange), 1);
      c = c >= 1?0:c;
      return c;
    }
    
  • Computron
    Options
    Offline / Send Message
    Computron polycounter lvl 7
    If the areas that are emissive are small and simple enough in shape, consider modeling out the emissive parts and splitting them off the mesh like they do in Halo: Reach.
Sign In or Register to comment.