Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Lightmass GI Calculation without baking direct lighting

Hey everyone.

I'm looking for a solution to use static precalculated Lightmass GI together with realtime dynamic shadows of a skylight. Basically i'm trying to recreate the interior of a moving train. I plan to have it moving around slight bends but not make full turns so diffuse interreflection should likely still look convincing enough as the sun will always shine from a similar direction.

I need a dynamic skylight for casting shadows of the windowframing, seats, tables etc into the wagon.

Yet i would also like to use the fidelity of lightmass GI. The lightmass documentation shows images of each bounce step (click here). Basically i would like to just use bounce 1 to X without the direct light baked into the lightmap

Can anyone give me a hint on how to achieve this? I'm also open for workarounds.

Product Version: UE 4.10
more ▼

asked Feb 18 '16 at 05:17 PM in Rendering

avatar image

1 1 1 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Hi a_prototype,

You're essentially asking for Dynamic GI since static lighting cannot handle something like this. When static lighting is built the mesh cannot be moved otherwise the lighting for that object would break and no longer be accurate.

As of right now the only options for Dynamic GI that I'm aware of are:

  • Distance Field GI (Experimental and not currently being worked on)

  • Light Propagation Volumes (Experimental)

  • NVidia's VXGI (requires a source build and to be compiled, and higher end GPUs)

  • Enlighten (Requires licensing)

As far as workarounds, if you're moving the train through your level, getting static lighting to stay on a movable object is going to be very troublesome. The dynamic skylight should provide some lighter shadowing, but it won't provide the bounce that baked GI would. At the moment, if you need GI, I would recommend testing with LPVs, but I wouldn't be surprised if you ran into some performance hiccups since it's still experimental, and dynamic GI can be very expensive to use.

I hope this helps.


more ▼

answered Feb 18 '16 at 10:52 PM

avatar image

Tim Hobson ♦♦ STAFF
48.8k 888 103 878

avatar image a_prototype Feb 19 '16 at 11:24 AM

hey i just replied to this but i think i missed to mark this as an answer to your reply. Would love to get your input on this matter.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hey Tim,

thanks for your quick answer and sharing your insight. I'm not a 100% convinced though - there's always a way to make things work inside a game engine - it's a matter of finding the best way to achieve the desired results.

Maybe it makes sense to broaden this discussion by explaining more of my concept.

What i'm after, as explained earlier, is to create game with a moving train interior seen from a first person view. The goal is to have it lit as good as the engine can offer. I know there will be compromises but i won't call it a day just yet :) Basically it's a moving platform game, with the train passing through an environment along an freeform, manually created path. A possibility to step outside isn't planned.

I've already gotten the train, which consists of multiple imported static meshes, moving along a straight path. I set the static mesh actors to movable and ticked light as if static. The environment meshes (some trees and placeholder blocks) outside, actually only the ones that are positioned on the side where the sun light is coming from, are set to dynamic shadowing, to cast dynamic shadows into the interior, as the train moves along its straight path. So far this is working nicely! There are two compromises for me to accept with this approach:

  • One is that the dynamic shadows don't have any effect on the indirect GI inside the cabin - that's expected, knowing that lightmass is a precalc, static way to illuminate an environment - and is also a compromise that's easy for me to accept in motion. The dynamic shadows add more to the immersion than the missing GI effect is taking away from it.

  • The second compromise is that with this approach the train is driving in a simple straight line, which honestly is a rather underwhelming experience, and much harder to accept.

Okay, so i've got a nicely lit train interior with dynamic shadows moving along a straight path. So far, so good. Now how do i get the train moving around bends? As mentioned before, my ideal goal is to have it moving along an arbitrary (but manually created) path. I've found three approaches for the movement side of this.

  • A very much obvious approach is a skeletal mesh, animated along a path in maya. I've managed to import everything nicely, and using a skeletal mesh i can achieve the most convincing animation for the moving train, allowing me to even add subtle things like shakes etc. This approach can be ruled out right away, because currently UE4 doesn't allow skeletal meshes to go through the lightmass pipeline and i wasn't able to find a way to hack this.

  • The second one is using the same skeletal animation imported WITHOUT any rigged geometry. So i've got an empty skeleton animated to move through the world, pretty much like a ghost train ;). UE4 allows me to stick static meshes into sockets of a skeletal mesh - And this actually works nicely! Even with light as if static ticked. As to be expected there are some major drawbacks though. One is that the socket attachment system likely isn't layed out for collision geometry. When i step into the moving interior (onto a simple hidden collision block stuck into a socket) i'm experiencing player lag / stuttering. As soon as i step out again i can notice that it's not the attached meshes (they're moving smoothly) but likely the player physics having a hard time to keep up with a platform moving this way. That might somehow be solvable through changing player physics or so (any suggestions here?). Another drawback is that the the dynamic shadow of the static meshes seems to be stuttering in motion. This only happens with the shadow of one static mesh falling onto another static meshes surface. the selfshadowing is absolutely smooth. Maybe this is resulting from the same source as the player stuttering (amount of ticks/updates per second for attached meshes maybe?). The third drawback is the one i initially created this question for. it's the combination of realtime shadow casting / dynamic lighting with lightmass precalculated shadows (static GI vs dynamic lighting). I'll get back to that towards the end and continue with the movement side of things.

  • The last movement approach is having my imported static mesh train interior models set to movable and light as if static checked and then make them move along a spline created in UE4 via blueprint. This works but it will need quite complex blueprint work to give authentic results for the train movement. I'm not a programmer and i always prefer a manual/artistic approach over a solution implemented through algorithm when it comes to subtle motion etc. There's one big plus for using blueprint though. This way there's no player or light stuttering. I do have the same problem with static GI vs dynamic lighting as in the previous approach though.

To sum up my findings for the train movement i am somewhat confident to get either the second or the third approach to work. I guess it's a matter of implementation here. Either i get the skeletal, socketed approach to work stutter free, or i manage to create a convincing movement through blueprint.

That brings me to the drawback both those approaches share: the GI lighting :)

Again, i'd love to make use of the super nice indirect lighting / GI i get from using lightmass. The realtime GI solutions are sadly not practicable for me yet so i need to focus on some sort of hack or workaround to use the precalculated lightmaps lightmass provides.

to visualize the prominent issue i currently experience i created this image. sadly, right now, i can't share any of the scene work - so this will have to do for now.

alt text

Just as it is supposed to do, lightmass is calculating the direct light, first bounce, second bounce etc, and combines them all together into a final lightmap after completion. Because with both practicable movement approaches the static mesh is set to movable and "light as if static" ticked, it also casts a dynamic shadow as well. And once the train starts to move around a bend (rotation) the dynamic lights shadow will stray away from the starting position, revealing TWO shadows (see image). This is obviously to be avoided!

I find the realtime cascaded shadow of the DIRECT DYNAMIC LIGHT to be visually convincing enough to replace the BAKED IN STATIC LIGHT. To be able to achieve this i need to prevent lightmass from writing the DIRECT LIGHTING into the final lightmap. I understand that Lightmass needs to calculate this direct light to calculate the important Diffuse Interreflection afterwards. Let me illustrate this with the following image.

alt text

As visible in the Lightmass documentation there is an example of the first and second bounce light pass SEPARATED from the direct lighting pass though. So atleast for debug/technical presentation purposes there seems to be a way to extract each separate lighting pass during/after lightmass calculation. What i would like to do is exclude the direct light result from the final lightmass bake result.

What i hope to get in return is a cheap but high quality GI solution that works with limited dynamic light movement. The indirect light reflections (GI) will hold up as long as the dynamic light is only moved in a limited space/directionality (like just a few degrees). The visual result would only break if the dynamic light source would point from or move to completely different positions (like from the opposite side).

Is this somewhat understandable? I would absolutely LOVE to learn that this is actually possible. I know that the chances are massive that this not achievable right now. But still, maybe there's a way to hack around, find compromises etc to get closer to what i want to achieve.

Help of ANY KIND is greatly appreciated here. Thanks in advance!

more ▼

answered Feb 19 '16 at 11:22 AM

avatar image

1 1 1 3

avatar image Tim Hobson ♦♦ STAFF Feb 22 '16 at 01:23 PM

That's a lot of information to take in, I'm not going to comment on all of it, but I'll point out some areas.

The player lag/stutter:

In this type of setup, instead of moving the train, the world would move around the train. This can get rid of some/all of the physics issues you may run into. Anywhere where the player is going to have to move on another moving object for significant amounts of time the world is typically moved around the player rather than the moving the player through the world.

Movable Object with Light as if Static:

I would not recommend this approach unless the object is moving only slightly. When an object that is lit with this checked and rotated ~180 degrees the object will fade to completely black on one side. A ticket was entered for this but quickly kicked back as by design and it will not be fixed.

GI Docs:

Those images and setup were actually taken with UE3. That documentation was converted and adjusted where needed. If there is a way to get the Second bounce by itself I'm not aware of any way to do so. That could also have been an image setup for representation purposes, but doesn't actually exist in the sense as it's part of the engine. Sometimes this has to be done for demonstration purposes.

The problem with combining dynamic and baked lighting is that these are that the baked lighting cannot be handled dynamically. I suppose if you had programming experience you could adjust and fix this to your desired, but as standard tools provided out-of-the-box they are not available.

You may want to check out the live stream about Making of Bullet Train from Epic Games as it's got a lot of tricks for lighting, but nothing specifically necessarily to what you're trying to do, but something that could be helpful. It was developed for VR so it heavily used Static Lighting for performance reasons, and fakes some dynamic lighting effects.

avatar image unrealengine123 Jun 13 '16 at 09:58 PM

"Movable Object with Light as if Static:

I would not recommend this approach unless the object is moving only slightly. When an object that is lit with this checked and rotated ~180 degrees the object will fade to completely black on one side. A ticket was entered for this but quickly kicked back as by design and it will not be fixed"

Hi Tim, ive been trying to fix this issue for days now and saw your reply. Is it there still no fix for this issue? and is there any other way i could rotate an environment in unreal? (i already raised the question and provided video) Basically id like my lighting to stay just the same when rotated. weather if its static or movable doesnt matter.

Any comment appreciated. thank you.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question