"Long" lights not supported by lightmass

Hey, not sure if this is in progress, or was just overlooked, but lightmass doesn’t take into account a light’s “Source Length” when baking the scene. It works correctly in realtime, and the preview, but the bake ignores the setting.

Here’s a picture to illustrate:

Would be awesomely useful if this could get implemented!

Yes, they know. The hope is that they’ll fix that along with adding other light shapes as well.

Ah so I’m not just going mad then… glad I’m not the only one having that problem :stuck_out_tongue:

It would be even better if not only shape, but light influence would be fixed, too. AFAIK, at the moment light shape affects only on reflection & specularity of the light.
If only we could use not only some light length and radius values, but make certain areas (of any given form) emit the light - THAT would be perfect. *And I’m not talking about bounced-light-lit areas here, it’s a lot more complex, I suppose.

Well, me not being one for waiting, I thought I’d jump into the lightmass code and see what’s what. Looks like what I had thought, and it’s either overlooked or just not done yet, as the source length just isn’t passed in.

A bit more digging, and some mind bending vector math later, I think I’ve almost got it baking capsule lights properly.


It’s far from optimized, but definitely getting there. I’ll post my code when I get it cleaned up.

What’s the best way for me to post this? I saw in the last update that there were some community contributors, how would I get this into the next patch?

Also, if a mod sees this, can this topic be moved from the Feedback forum to the Rendering forum?

Edit: Had an issue, but fixed it just after posting. Updated with a new screen of it working properly.

Hi M.Palko,

I moved the thread to the rendering section for you. Have a great day!

Cool stuff! Yes, I haven’t gotten to better lightmass support for tube lights. As you note, the static version doesn’t work right now. In addition I’d like better support for precomputed shadows from area lights. Dynamic area light shadows are super hard but precomputed ones are easy so there’s no reason why not. Also I’d like to do a similar trick for per object shadows to area lights as I’ve done at a previous company. The trick is basically cast shadow from closest point on light shape. Not accurate but looks good.

To submit code make a pull request on GitHub. https://github.com/EpicGames/UnrealEngine/pulls

Ok, a little bit of an update on this; It works really well, doesn’t seem to be any obvious issues. Mission accomplished!


I submitted a pull request to the 4.1 branch, I hope I’ve done it properly. I’m a bit of a git n00b, I’ve only ever used SVN before.

If anyone’s interested, I can post the code here.

Wait a minute…Does Unreal now have Tube Lights!!?

Dude! Please, please post the code here. I needed this feature for a while now, and unfortunately it does not seem as a high priority in official roadmap. It would be greatly appreciated and I’m sure not only by me.


Hi M.Palko,

Great work! If you post the code, please consider posting it in the Engine Source and GitHub section. This will give users who like to add plugins and make modifications to the source the opportunity to see it more easily. Here in the rendering section it seems a little buried.

Really great work though!


Thanks for the PR, I made sure the right person was made aware today :slight_smile:

Okay, I’ve posted my code in the Engine Source & GitHub section, you can find the topic here:

This is Awesome! Will definitely be utilizing this for Caffeine! :slight_smile:

Sooo, how exactly do I utilize this feature?

4.4 update has this integrated, so you don’t need to run a build on the engine yourself. In the light properties, change the radius and the length and it will render correctly.

The only problem is the light falloff does not adjust as well, so it’s not quite perfect.

Sorry if I shouldn’t revive this.

Is it possible to change the attenuation shape of a point light from the default sphere to a capsule ? This would fix the unrealistic radial falloff.

If you change the length then it should adjust that