Download

How to add lightmass importance volume to blueprint actor ?

Hi

i 'm making game something like Endless Runner ue4 official tutorial , i wonder how to add lightmass importance volume to my blueprint ? i can’t add it to my level as the level will be generated infinite and the location of the new added stuff is not static in my level ? i searched around but couldn’t find an answer . hopefully someone tell me how .

And one more question , if i add objects to my BP actor does it get calculated when i press build light ?

Thanks

Which rules out static lighting for this case in the first place.

i 'm new to UE4 , thanks for the answer so static lighting doesn’t need any light mass ? as i remember i removed all the lights from my scene and i still got light mass error when i build my level .

Nononono :slight_smile:

Static lighting needs lightmass. But since your actors are moving, they cannot be lit statically…

:frowning: so how can i add light mass to my scene which is not in my level but in BP actor ?

If you have a BP in your scene that contains static mesh items, they willbe lit statically, if the BP and its static mesh components are set to static.
No need to make further adjustments.
But as far I understood you, the meshes, although contained in a BP, will move around in the world space.
This is why they cannot be statically lit.

If you want static lightig, things need to remain stationary in the world space.
… And of course a light that is set to non-movable… :slight_smile:

Everything in my game is in the BP actor nothing in my level , i still couldn’t understand you mate :slight_smile: , my problem is with light mass volume which is required to get ride of the error message i get when i build the light . my BP actor is very big about 3000 unit , its a big road that contain all the static mesh and every time i spawn new one it spawn at the end of the last one . so hopefully now you understand me how can i add light mass now in such BP ?

That is the problem. Meshes like you describe them cannot be lit statically.
In order to be staticlly lit, the object must exist before BeginPlay and may not be detroyed or moved throughout the entire gameplay session.

You will have to use dymanic lighting only. If you use only “movable” lightsources, you shouldnt get any lighting build warnings… :slight_smile:

Now i understand , thanks a lot mate for all the clarification and your time that you put here :slight_smile:

You can set a static mesh to moveable and use “Light as if Static” to bake in lighting. I believe his can work for modular and procedural projects as long as you don’t have strong lighting or shadows, so I would go for an overcast look with no/little directional lighting.

BUT, I’m not sure exactly how you would set that up to work with that blueprint though. You could not spawn in new objects, but maybe you could move objects in and out, swapping them around. Or duplicate/instance objects that have baked lighting in and out. I haven’t done much with blueprints as an artist.

Or you could just make a custom material with baked lighting from another application.

For future reference there is a lot of good technical information here in our documentation: https://docs.unrealengine.com/latest/INT/Engine/Rendering/LightingAndShadows/index.html

It’s a lot to read through, but it can definitely help give you and anyone else a better understanding of how things should work with lighting in Unreal Engine 4. :slight_smile:

Light as if Static option would not work when you are spawning in objects. This option is only meant for movable objects that move slightly, that already have a lightmap setup, and are already in placed in the level and precomputed. So runtime is a no-go for this option.

That’s kinda disappointing, I could really see a mobile endless runner wanting to put in some subtle baked lighting onto assets. There are some Unity games that have used baked lighting like this for procedurally generated levels. I know the workflow for something like that would be a bit weird, you would have to place and bake the lighting before hand for every asset that could be “spawned in” and it could look awful if done wrong, but it’s a perfectly valid option.

I thought i didn’t know but seems UE4 Doesn’t support that which is disappointing as it will save a lot of time for you especially when the actor you are spawning is the same .

If its a shadow that you want, you could fake it of course.
This fakery assumes that a directional light is used and the lighting vector never changes.
Also, no objects can move throigh the shadow (else the effect breaks down)
-Add a polygon to the mesh on the ground, covering the area where the shadow would be.
-Drag it in the level and light statically.
-Where the shadow is cast on your ground polygons, paint the corresponding parts (in photoshop)
-Use the mask texture to create a translucent materials, sporting the shadow on the floor.

This should work.
Im actually curious myself. :slight_smile:
Ill try to make a proof of concept and post the results…

Aaaaaand here we go :slight_smile:

First, I made a static mesh for testing purposes.

This is the version just like any other mesh:

TestMesh.JPG

And this is the “fake ready” version:
The plane that has been added to the ground is offset 1mm above the ground to prevent z-fighting when the mesh is placed on the ground

FakeMesh.JPG

Now I put the first mesh into the level on a flat plane and build the lighting. (Dont forget the importance volume)

I place the camera view as directly from above and take a screenshot of the viewport. (Cheesy, but it works :slight_smile: )

FakeCapture.JPG

In photoshop, with some editing swag, the shadow is copied into the mask.

MaskLayers.JPG

I also had a small rim masked out by the opacity patch, to help me position the shadow inside photoshop.
Afterwards, I disabled shadow casting on the mesh.

Closeup.JPG

Here you can see both, side by side. The right mesh is lit statically, while the left uses the fake shadow.

Sidebyside.JPG

Another upshot of this is that the shadow details are now independent from the lightmap resolution of the underlying floor mesh.
Just use a higher texture resolution on the fake mesh and improve on the shadow quality :smiley:

Another afterthought:
If you assign a second material ID for the ground polygon, then you could also use translucency instead of masked opacity, faking some indirect lighting this way…
Also, nothing stops you from painting more shadow in to fake self shadowing (omitted in this example).

Hope that gets you a little closer to what you are looking for :slight_smile:
[MENTION=4894]Tim Hobson[/MENTION] Are there any drawbacks to that method that Im missing?

Cheers,
Klaus

Sorry for asking too many question , as i don’t think i will find an easy answer on google for such cases .

1st - is there are a way to let the mesh or BP keep the light map or lock it that have been baked in our level even if we move the object or we spawned a new one ? in another way i ask can we copy and past the light map from existence one ?

below we have 3 object two of them is box set in the floor all of them is in one BP , i baked the light in the level and i get nice shadow , can i save this shadow and use it in the spawned same BP ?

1.jpg

once i move it i lose the shadow , is there are a way to keep it ?

e9bd112ef9457e1efab5d913dd3cf612e6371e9f.jpeg

or when i spawn new BP i don’t get shadow , so can we use the one already backed shadow on this one ?

3.jpg

And mu 2nd question is all meshes you see are static and same with light source so why when i delete the light source and skylight the scene shadow get bad and not as cool as if i keep them even both of them was stationary which should bake the light .
4.jpg

5.jpg

Too many question :slight_smile:

Thats what the forum is for :slight_smile:

Nope. They are actually visible in the world settings merely for entertainment purposes. You shoudnt modify that data.

Nope, only by the method described above.

FWIW, if you use 3ds Max, press “0” to open the “render to texture” panel.
From there, you can render the shadow map directly, without having to go through Unreal Engine and Photoshop.

Im using Modo :slight_smile: Wouldnt it be a bit fidely to align the lightsource in max…