[Bug?] Static light in BP with visibility turned off is still backed during build

I created a BP for something like bonfire for level design to just put in place and set with bool parameter if flame is active or not. If it is, then particles, light and different material for the ash show up. Meshes are static, so is the light. Everything is a part of the Construction Script and works just fine in the editor, but after baking the light I always find out that lights where flame wasn’t active are baked as well. Am I doing something wrong, or is it a bug?

Also sometimes after building the light particles of the bonfire don’t show up. I need to uncheck and check again the Flame parameter for them to do so. I’m a bit confused (and yes, my viewport is rendered in a real-time).

Hi Nox_A15,

I believe you could set the Active and Visibity nodes in the Event Graph instead of the Construction Script. That way, if you change the Boolean during play it will effect the fire and the light. The way you have it set now will only check and set them at run-time.

Another thing to look into is the Particle system has a Light module that you can add to your particle systems. That way the light will be automatically set when the fire is activated. Take a look at the P_Fire sample that is part of the Starter Content.

I hope that gives you some ideas.

TJ

Thank you for answer TJ. :slight_smile: I haven’t started learning Particle System yet, so thanks for the tip. But returning to overall problem I’m not sure your solution is what I’m looking for. According to this tutorial - - YouTube - Construction Script should be used when we want to make changes only in the editor, and Event Script when during gameplay. In the example there is a lamp, which has dynamic light turned on or off during play. But I don’t want to make my light dynamic, that’s the point. I’m looking for a method to make a tool for level designers, not gameplay feature. So I want to turn on or off a static light in the editor, bake the lighting and then watch the result during gameplay, but without changing it there. Right now lighting bakes even when light is turned off unfortunately and that’s my problem. :frowning:

Using this opportunity we are talking about optimisation, I have another question. Let’s say I have a mesh and a blueprint which is the same mesh and simple nodes changing it’s material in the editor (not dynamically during gameplay). Is both solutions going to differ in performance during gameplay? Let’s say with hundreds or thousands of such objects.

How are your ‘turning off’ the lighting. If you use the bool that is part of the construction script then it should work fine. Set the bool to false, build the lighting, then play. If I am misunderstanding anything, please let me know.

As for your second question. I said ‘runtime’ above but you’re correct, most of the calculations happen in the editor. It is still calculated at runtime but the process is so slight that you should never notice a difference when using this method. The only time it could be an issue is if you are moving the blueprint during gameplay, in that case it would be calculated over and over again as the bp moved.

Thank you for clarifying this. Returning to lighting problem - yes, I’m turning it off using this bool. I prepared some more images this time to show the BP and the results. I’m working on UE4.4.

I will explain what I’m doing in the image below:

  1. I turned of the directional lighting on the map to make the results more visible. You can see my bools on the right side of the screen.

  2. If Flame bool is turned on the particles and light appear (I know I should attach the light to the particles, but that’s not the point now).

  3. I created a copy of the object and turned the Flame bool off for it. There’s no particles or lighting around it.

  4. Lighting is baked. I haven’t touched anything after the build. There are two strange things going on here - lighting is baked around the right object as well and there are no particles around the left one (I will write more about it below).

  5. Deleted the objects to show only the baked lighting.

  6. Particles on the left side are not visible but Flame bool is active. I need to move the object or uncheck and check the bool again for particles to reappear. I discovered it’s a matter of turning on/off “Auto Activate” in their parameters. They will disappear after build if Auto Activate is turned off. I think it also should be considered a bug in this circumstances.

I hope it will help. Lighting is visible by default, but changing it doesn’t solve the problem.

Hi Nox_A15,

The issue where the particles aren’t displayed in the editor when they should be active is definitely odd. I submitted this as TTP# 344881 into our tracking software and the developers will be looking into it further.

As for the lighting issue, I believe I’ve found a solution. The issue with Static and Stationary lighting is, if it is active at all (even briefly) something will be baked. So to prevent this, make sure that the light is visible but the intensity is set to 0. Then in the EventGraph, make a Branch at the very beginning so the light doesn’t have a chance to bake if it should be off and change the SetVisibility for a SetBrightness.

I hope that helps. If you have anymore questions please feel free to post back.

Thanks, TJ

You probably meant Construction Script, not Event Graph. :wink: But yes, changing SetVisibility to SetBrightness works like a charm. Thank you! :slight_smile:

Ah yes, you’re right. :slight_smile: I’m glad it worked for you, good luck on your project.