Lightmass volumetric lightmaps do not work with Landscape UVs

Hi,

I was just doing some experiments with lightmass when I noticed something very surprising. I was testing how well volumetric lightmaps work to capture light bounced off of landscape for moving objects, and I noticed that lightmass completely ignores UV mapping of the landscape, be it modified or default, and instead samples the textures on landscape in some arbitrary random UV space, which doesn’t match the actual UV mapping you see. :open_mouth: Here are some examples:


I tried some modifications to both TextureCoordinate and LandscapeCoords, like rotations, different sizes, and they did affect the result of volumetric lightmap every time, but also, they never actually matched the surroundings.

What this pretty much means is that everyone who ever used volumetric lightmap on landscapes ever since this broken has likely got a very wrong results :open_mouth:

Thats very interesting! Can someone verify that? :smiley:

I have made a small, simple test project so that you can try to reproduce it yourself, and make sure I did nothing wrong. It’s here:
https://drive.google.com/open?id=1XbqBiT9G_nynXUw9CoQt5re7D6eyISIi

This is a picture of a flat landscape:

And this one is after replacing the landscape with mesh plane of the exact same size:
So the volumetric lightmap itself works, but when it comes to landscapes, it samples something completely weird. It definitely doesn’t sample the result you see.

Heh,

I am surprised people have so little interest in something so breaking. I guess game people don’t really give a ■■■■ about if indirect lighting is right or not :slight_smile:

You should make a Bug Submission!

That’s my plan. But I want to first verify I did not make any mistake on my side, because I just struggle to believe no one noticed something so crucial to game visuals yet so broken. :expressionless: Once someone independently verifies it’s really not an user/setup mistake, I’ll make the bug report.

So, I have taken a time to create quite elaborate bug report with example project and many screenshots. I have taken quite some time to get it right.

This is what I got back:

The person on the other end did not even bother to read it carefully enough to realize it’s not a volumetric light probe placement issue, but issue with the colors that the light probes gather. So obviously bCullBricksBelowLandscape does nothing.

So, in the end, there is currently no way to use volumetric lightmass with landscape in UE4. Which means there is currently no way to get proper indirect illumination from the landscape on any movable objects. And this issue probably won’t be solved anytime soon, if ever. :frowning: Ultimately, if you have any project which includes landscape and movable objects, you can forget about indirect illumination. Even baked lightmass one.

uhh this is unsettling

maybe if we ping @JackP or @RyanB they might have a different opinion than this Trey

So apparently the issue goes even deeper than that. I’ve made one of the objects on the landscape static, and the baked lighting on it has wrong bounce color as well.


So this doesn’t only affect volumetric lightmass bounces from landscape, but all bounced light from landscape, including baked one on static objects. But I would still very much appreciate if someone grabbed the project and verified it independently https://drive.google.com/open?id=1Xb…Qt5re7D6eyISIi because I am not that experienced with lightmass.

Ouch. This is pretty serious - have you tested this on an older version of the engine?

Since GPULightmass also relies on the original Lightmass’s material export, I modified GPULightmass to let it output diffuse channel to the lightmap, and this is how the material is exported:

Honestly, not yet… :slight_smile: I don’t have older ones installed, but I’ll have to bite the bullet.

Ouch…

Ok I think I got a quick workaround for this problem:

Engine\Source\Editor\UnrealEd\Private\Lightmass\LightmassLandscapeRender.cpp: 73


const FVector2D BaseLayerCoords = FVector2D(UVSubsection) * LayerScale;

change to:


const FVector2D BaseLayerCoords = FVector2D(LandscapeComponent->SectionBaseX, LandscapeComponent->SectionBaseY) + FVector2D(UVSubsection) * LayerScale;

Tested works with LandscapeCoords and TexCoords, unsure about whether it has some side effects

Hmm… if I remember correctly, landscape is being broken into separate components before sent to lightmass. So I guess the issue is that the separate components are then starting their own UV coordinates from their local corners instead of the global UV coordinates of the entire landscape component array.

Yep I believe thats indeed the problem - so the workaround I posted adds the base offset of each component.

Thank you! Unfortunately I am not technically skilled to trust myself to touch the engine source code, but hopefully someone else will find it useful before (if) it gets the official fix :slight_smile:

@Luoshuang
By the way there were some rumors that you are an Epic employee. Do you think you could pull some strings to make sure this doesn’t get into final 4.22, since my bug report got rejected? :slight_smile:

Yes I became an employee not long ago :o
I’ll try to see whether I can get it into 4.22 release as long as it doesn’t have side effects

Thank you! :slight_smile:

I owe Trey an apology. It just took him a while to get back to it: Unreal Engine Issues and Bug Tracker (UE-70009)