Home Unreal Engine

Emissive in just unlit areas?

Testing out a planet shader and I thought I'd be cool if the side of the planet that is not lit by the star would have some lights.

And light vector no longer works with emissive, and neither does CustomLightingDiffuse. And CustomLighting only affects the faces that are facing the light.

Is there an easy way to get emissive output on the faces that are not hit by a light?

Replies

  • Vailias
    Options
    Offline / Send Message
    Vailias polycounter lvl 18
    try either of these tutorials.
    http://davenewson.com/tutorials/udk/planet-earth-material-shader-for-udk
    [ame="http://www.youtube.com/watch?v=xS8vDVCHF9c"]Earth / Planet Material Shader - UDK Tutorials by Javahawk - YouTube[/ame]
  • Santewi
    Options
    Offline / Send Message
    Thanks for the links, but the problem is that in more recent versions of UDK the light vector has been changed so that it does not work with Emissive, and CustomLighting now only affects the surface that is hit by the light, the exact opposite what I'd need.
  • Santewi
    Options
    Offline / Send Message
    I take it you can't have emissive output that relies on light vector anymore? :(
  • Xendance
    Options
    Offline / Send Message
    Xendance polycounter lvl 7
    Well you could probably hack it with a constant (or parametrized) vector, if the lighting is directional.
  • Santewi
    Options
    Offline / Send Message
    I know, but unfortunately I was using a spotlight for this... :/

    I don't really understand why they took away the ability to use light vector with emissive... Like having more options would hurt someone.
  • passerby
    Options
    Offline / Send Message
    passerby polycounter lvl 12
    performance reasons, though it could be possible to trick it, try using the light vector in the emmsive and diffuse channel, and just multiply by 0 to remove it from the diffuse.

    if that dosnt work perhaps just implemeant it vai a custom lighting shader
  • Santewi
    Options
    Offline / Send Message
    I'm using custom lighting, the problem is, the light vector is only valid in custom lighting (not customlightingdiffuse) which only covers the parts that are lit by the light.
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    Um, unless I'm mistaken that shouldn't be the case at all.

    Try this instead: Lerp(DiffuseDay, DiffuseNight, Lambert).

    Note: Remember to take into consideration the gamma correction for your Lambert, or else your DiffuseNight will show up slightly earlier in day time. So you might want to Div by itself or Power it to a lower value like 0.5, etc.

    Try putting this in both of your Custom and play around to see what happens.

    IF this doesn't work, then disable shadows, set the Shadow Bias between -1 and 1 (forgot which number you need to use).

    Note that if you do disable the shadows to get the effect you're looking for, any kind of normal map in night time that has recessive will 'take' the light information from the other direction, so stuff like mountain tops would be an example of this 'leaking'. I suggest in that case, to have Lerp also your Lambert term, one with a flat normal and the other with a full normal.
  • Santewi
    Options
    Offline / Send Message
    Oh right, it doesn't work if shadows are enabled... And that's why I thought light vector only covered the areas that are lit. Thanks Ace.

    It kinda works now, just had to darken the customlightingdiffuse a lot now when there are no shadows.

    Is there a way to disable self-shadowing while still making the object shadow other objects?
  • Vailias
    Options
    Offline / Send Message
    Vailias polycounter lvl 18
    Santewi: Not to my knowledge. Sadly. Its all shadows, self shadow and no cast, or no shadows at all.
    I've fought with that in the past.
    what you may be able to do is use a second object as a shadow caster. like a slightly smaller sphere inside that one with some basic diffuse material. Or one set to cast a shadow but not render.. I think that is possible.
  • Ace-Angel
    Options
    Offline / Send Message
    Ace-Angel polycounter lvl 12
    If you change the material type, I think you can. Not sure which one, but one of the 'opacity' enabled types will still cast shadows (if you select the proper casting options under a Light source as well type - Moveable iirc) while losing it's own self shadows.

    However, as Vail put it, it's a mess, I can't recall top of my head on what enabled, etc to get it, I will have to dig some old files.

    I tried implementing the 'proxy mesh' for casting shadow solution not too long, and it ONLY works with default material so far once you subtract all the shadows. Problem is, I don't remember effectively being able to limit the casting from one mesh to another in a simple way. Might be interesting if anyone did such things and has any results.
  • Santewi
    Options
    Offline / Send Message
    Alright, thanks guys, I'll try those out.
Sign In or Register to comment.