material

FakeDynamicLight_Sprite_MaterialFunction

  • Exposure: public
  • UE Version: 4.20

Spoondog

August 27, 2018, 1:57 am

This is for making a single sprite look like a fairly convincing dynamic light. Great for flashes during explosions so you don't have to spawn a dynamic light. Instruction count by default is 31. You can turn off directionality to reduce it to 22 instructions. Note that the instruction count you see in the material editor, in 4.20, will be wrong. See the function input descriptions for accurate counts.

Click the button above, it will automatically copy blueprint in your clipboard. Then in Unreal Engine blueprint editor, paste it with ctrl + v
Versions
August 27, 2018
  1. Fixed an issue where particle alpha at 0 would make it a black light instead of invisible (replaced a multiply with a lerp).

  2. Added instruction count for close fade

    See
  3. Improved close fade smoothness

    See
  4. Cleaned up previous version

    See
  5. Added an option to fade when up close, so there isn't a pop if the camera goes through it (generally only needed for sprites that are around for a while)

    See
  6. Initial

    See

1 comment

  • Spoondog

    Monday 27, 2018

    This is for making a single sprite look like a fairly convincing dynamic light. Great for flashes during explosions so you don't have to spawn a dynamic light. Instruction count by default is 31. You can turn off directionality to reduce it to 22 instructions. Note that the instruction count you see in the material editor, in 4.20, will be wrong. See the function input descriptions for accurate counts.

    1. Paste this into a material function.
    2. Add the material function to a new material, Blend mode = modulated. Unlit. Disable depth test = true. Render after DOF = false.
    3. Make a particle system that spawns a single sprite. Apply this material.
    4. Set the particle color - for convenience, alpha multiplies the color. COLOR VALUES NEED TO BE VERY HIGH FOR THE EFFECT TO SHOW UP. For an explosion, for example, you want the color to be 100 or higher.