Home Unreal Engine

Question about light functions

polycounter lvl 6
Offline / Send Message
Borgleader polycounter lvl 6
Hey,

I'm trying to use light functions to light certains parts of the scene only when the player is close to it. Through my research I've come across light functions and they seem to fit the bill but I can't get them to work properly. Is it possible to make a distanced based material for light functions? (Distance from the camera, either by using PixelDepth or distance node on WorldPosition and CameraWorldPosition)

Thank you

P.S: If anyone is interested, the problem right now is that whenever I'm in range the falloff works properly but then I get out of the range I set in the material the light comes back on again when it should stay at 0.

Replies

  • Hourences
    Options
    Offline / Send Message
    Hourences polycounter lvl 18
    Pixeldepth should be it yes.

    Multiply by 0.00001 or such, add constantclamp after, connect to LERP alpha, and have 1 and 0 as A and B.

    That did not work, or? Make sure to clamp it. And you could also use Matinee though the fading would be a bit harder than.
  • Borgleader
    Options
    Offline / Send Message
    Borgleader polycounter lvl 6
    Yes and no. I'm getting the same problem with your technique as I did with mine.

    For close enough distances it seems to work but when I get really far the light turns back on. Also, weirdly enough, the radius of the light seems to affect the range at which the light "comes back on". The bigger the radius the bigger the distance.

    See below:
    Material for light function:
    DistanceLightFunction_zpsc2d00052.png

    Within 600 units:
    Light_Close_zpse2deb868.png

    At roughly 600 units:
    Light_Far_zpscca1e44e.png

    Way farther than 600 units:
    Light_ReallyFar_zps2c29c136.png
  • Hourences
    Options
    Offline / Send Message
    Hourences polycounter lvl 18
    I tried as well and experience the same thing. The material works fine actually, but the engine removes the dynamic light after a certain range. I would guess that the light radius is multiplied with some number to determine when to fade out the dynamic lighting.

    If you assign a light function that is a solid red color on a white light, you see that it also loses its color at a certain distance. So the function as a whole is dropped at some point. Not sure how to override that. Couldn't immediately find anything in an ini file but I looked rather briefly.
  • Borgleader
    Options
    Offline / Send Message
    Borgleader polycounter lvl 6
    I looked also and I couldn't find anything that seemed pertinent. The other problem is that yes increasing the radius affect the range at which it "comes back" but as soon as I walk inside that radius it turns off, so I can't make them huge either.
Sign In or Register to comment.