godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
86.53k stars 19.27k forks source link

Unreal Sun Temple Reference Scene #75440

Closed WickedInsignia closed 2 months ago

WickedInsignia commented 1 year ago

Godot version

4.0 Stable

System information

Windows 11, Nvidia RTX4070ti, AMD Ryzen7700x

Issue description

This is the Unreal Engine 4 Sun Temple example ported to Godot 4, utilizing files provided by Nvidia and donated by Epic Games. It's a good showcase of a scene that combines interior & exterior lighting and modular assets. Most importantly though: Godot really struggles with this environment. This scene is exceptionally clean in UE4, and it employs heavy use of repetitive modular meshes. This is a very common environment asset pipeline and something Godot should aim to accommodate.

UnrealSunTemple_BeautyShot

Changes:

Issues:

As mentioned, Godot really struggles to resolve this scene's GI adequately. Here are my observations:

UnrealSunTemple_LightmapGI UnrealSunTemple_VoxelGI UnrealSunTemple_SDFGINoOcclusion UnrealSunTemple_SDFGIOcclusion

LightmapGI was the most usable GI solution but exhibited a lot of leaking, such as in this first hallway. The walls are adequately thick and should be overlapping enough to properly obscure any exterior light:

UnrealSunTemple_LightmapLeak01

Leaks also occurred in places that were otherwise manifold and absolutely no light should have been able to pass through. This ceiling has many leaks on the inside, even though the exterior is completely sealed. The leaks persisted at 2x the texel density and with Ultra quality bakes. This behavior isn't consistent with other lightmappers I've used, which handle even the thinnest manifold walls without leaks:

UnrealSunTemple_LightmapLeak02 UnrealSunTemple_LightmapLeak03

Steps to reproduce

N/A

Minimal reproduction project

Download the Godot project file HERE Download the Blender file HERE

If all textures appear pink when the Blender file is opened, simply go to File > External Data > Find Missing Files and navigate to the Texture directory.

yosoyfreeman commented 1 year ago

Wow! this must have been a lot of porting work. Thank you!

I spend some minutes fixing some lights and set up a real time GI config I was not expecting SDFGI to works this great. Here are my results: Captura desde 2023-03-29 12-53-06

Captura desde 2023-03-29 12-50-44 Captura desde 2023-03-29 12-54-50 Captura desde 2023-03-29 12-55-58

Captura desde 2023-03-29 13-01-23

Captura desde 2023-03-29 13-02-26

Captura desde 2023-03-29 13-03-45

I'm quite impressed by how this looks and how easy was to set up. What troubled did you have with sdfgi?

WickedInsignia commented 1 year ago

@yosoyfreeman I didn't use shadows for the omni lights since they rack up performance cost on that light type (as they would in any engine tbh) and aren't practical in a game when no shadows will usually do. The Unreal version used no shadows for the omnis either, so I just followed their example.

SDFGI shows skylight leaking between many of the meshes on the closest cascade (visible in your examples on the ceiling, ground and ledges), and then leaks profusely on cascades further away. There's also quite a bit of noise, with random bright splotches appearing on the larger walls that aren't properly averaged away. Sometimes it can look nice in beauty shots, but it falls apart once you put a player and a moving camera in there. Regardless of how you tune it, moving the camera through the space will cause the GI to very visibly transition from bright to dark with leaks and splotches. This is a nice result! Although ultimately hiding the issues with fog and dynamic shadows that aren't always practical in real-world use.

yosoyfreeman commented 1 year ago

Hi @WickedInsignia , you are totally right about performance cost. I didn't change them cause i wanted to keep close to the original setup, but in the case of not using shadows for those crucial elements a really open spotlight would work better in this particular scene. Fog was used just to add volumetric detail that unreal have by default. It is not hiding nothing :)

The patches on the first image and second on the ceiling are not leaking but light coming from the back windows. The scene also used 1 light probe for the first statue and nothing more.

Anyway, i tweaked the settings and the results all close to perfect now, even the construction of the scene have paper thin walls which are usually not a great idea. fixing a bit the walls would fix the minor issues left.

It looks really cool in movement too!

https://imgur.com/a/K4nBvTV

That said, the current SDFGI implementation have two big problems:

Edit: Some pictures of the scene with this config:

imagen

imagen (The white points above there are the shadow cascades, not leaking)

imagen imagen imagen imagen

imagen imagen imagen

unfa commented 1 year ago

Maybe it'd make sense to create a camera flyby animation and render out a sequence in the movie maker mode to benchmark the visual quality in motion?

yosoyfreeman commented 1 year ago

i never touched the new movie maker and i don't have a powerful pc to do a good 4K render, but if someone is willing to i can finish tweaking some things and share it.

It is not perfect, as i said, demonstration scenes are created specifically to showcase the strong points of an engine and hide the weak ones. I would not use walls so thin, but i think is a fair use case tho show pros and cons. It may help devs to improve SDFGI.

unfa commented 1 year ago

I could try and make a camera flyby animation - I did this for Liblast already so I have figured out the quirks of doing a good one. I don't think it has to be 4K or super high quality.

WickedInsignia commented 1 year ago

@yosoyfreeman You have the reflection probes turned on in both the screenshots and video, which mask SDFGI entirely. I noticed you've increased the range on the omni lights well beyond the original spec too, the specular can be seen through the walls. The lights in the original file are tuned to avoid that. That's all fine, but the issues I brought up are regarding original spec and when SDFGI is used in a way that you can actually see it. With SDFGI tuned to the same spec and using the original settings with reflection probes turned off, I get the following results. I used default normal + probe bias though, since your settings there produced more leaks:

UnrealSunTemple_SDFGILeaks01 UnrealSunTemple_SDFGILeaks02

If I increase the omni light ranges similar to what you have, the leaks and splotches persist:

UnrealSunTemple_SDFGILeaks03 UnrealSunTemple_SDFGILeaks04

WickedInsignia commented 1 year ago

If anyone intends to test this scene with SDFGI, please turn the reflection probes off OR set their Ambient Mode to disabled. SDFGI has no effect with them on. This scene was ported to test its limits and help improve the existing solutions. If you want something pretty that works well as-is to showcase what Godot is capable of, please use the Bistro scene.

jcostello commented 1 year ago

I tested the scene as well. I can confirm that SDFGI and VoxelGI are completetly unusables in this scene. LightmapGI with ReflectionProbes works really well. I put it to x4 in each Mesh and the leaks are reduced a lot. x8 should fix them all. In the future this will be posible globally in the Lightmap itself.

Lightmap still the best GI solution and should be improved a bit more (bug fixed and feature completed)

WickedInsignia commented 1 year ago

My experiences too. Unfortunately larger texel densities bloat the file sizes. x8 would fix everything, but it's also a huge memory resource and not practical when it's just being used for GI. With the leaks improved (which shouldn't really be happening anyway, as expressed by existing bug reports) LightmapGI should be a good solution at default settings.

UE5's Lumen handles this scene just fine, but that's expected and it's also much heavier than SDFGI. It goes to show that an SDFGI-style solution can work though.

yosoyfreeman commented 1 year ago

If anyone intends to test this scene with SDFGI, please turn the reflection probes off. SDFGI has no effect with them on. This scene was ported to test its limits and help improve the existing solutions. If you want something pretty that works well as-is to showcase what Godot is capable of, please use the Bistro scene.

Just to clarify so people don't get confused: Reflection probes will not disable SDFGI effect if you set up them correctly as stated in the documentation. In this case, the ambient light parameter must be disabled so they only contribute as a static source of reflections to improve SDFGI.

Edit: First image without reflection probes, second one with them. Both using SDFGI.

imagen imagen

The default normal and probe bias prioritize slopes over leaking. As described in the documentation, lower values will produce less leaking.

Default values vs my values. The default ones produces way more leaking. Look at the center pillar, there is a gap with the defaults, not with my settings.

imagen

imagen

WickedInsignia commented 1 year ago

@yosoyfreeman I've amended my comments to reflect this ambient mode exception, but that's not the way your second set of screenshots above were set up. There doesn't seem to be any SDFGI influence in those shots or the video at all.

This is a reference scene where SDFGI objectively has issues. It's not helpful to spam screenshots where the probes are set to nullify SDFGI entirely among a multitude of changes (sun direction, skybox and light range) and then suggest you fixed it. That defeats the purpose of this body of work. It's totally fine to do your own thing with this file, but let's please try to keep it on the default config here. That's the configuration everybody has access to and can test/validate.

yosoyfreeman commented 1 year ago

Hi @WickedInsignia, you were right about the radius of the lights which were basically exploding light around everywhere. You are also correct about the fact that SDFGI have issues as I myself stated in my showcases. I also reduced the intensity and used 2 cascades if i remember well to force at least 30-35 meters on the first cascade and used physical blocker to prevent leaking. The results, tho, have low frequency in terms of detail.

I'm not spamming anything. I'm just sharing my results the same way you did. I been experimenting with this tools since the firsts pre alphas and just pointed about Reflection probes and bias correct usage.

I never claimed to have fixed nothing and already explained that didn't make any change that hides nothing. I just moved the sun to create a more balanced composition of the scene. The skybox is untouched.

But anyway, here is the project with your default sun and lights settings with the exception of the two big lights that i kept shadows on. I think we can both agree that the results are still way nicer than you described as unusable.

https://user-images.githubusercontent.com/64601424/228833812-8a8d4554-9fa0-44f7-a8ab-b174752e0611.mp4

As i understood, (Correct me if I'm wrong) the purpose of this body of work is to test the behaviour and limitations of lighting methods in 3D scenes, especially complex ones like this in a way than can be used to improve them in the future. Now, for us to being able to do that we need to push for the limits of the technology. Is with that purpose that i took the time to do my test and share the results and the tweaks needed to push the SDFGI further and find the break point.

As you may understand, i don't have an interest in hiding problems that affect us all.

Here is the project so anybody can look at it or do whatever they feel with it:

Download the scene: https://mega.nz/file/K50lxDSI#yy0R5pNMlmOITC_ykDicevnzGkmHagw5QVdvgSGENYU

Note: SSIL randomly generates artifacts. I have to investigate that deeper.

Quick approach to the scene: use the SDFGI as a low frecuency GI detail and a reduced range and doubled intensity of SSIL to simulate high frequency detail. Some reflection probes were added to the scene (adding more accurate ones would improve the results ). Used Volumetric fog to simulate a subtle light scattering.

Mayor problems: While trying to get more detailed, high frequency detail from SDFGI the lack of control make it noise and unstable. The extra detail ends up reading as noise as the camera moves. This is inherent to the design of the feature: The cascade number, the first cascade and the maximum distance are tied.

My personal recommendation: The problem here is one of usability. I can guess that those settings being tied was a design choice to keep a complex system simple and get to the "One click solution" Godot philosophy, but this causes serious problems in practice.

Just as one would do with shadows, you need to be able to tweak resolution and cascade distance independently. You don't want to gain detail when you are at literal centimeters away from a surface. You want to maintain most of the detail on the first cascades and exponentially reduce it far away. Cascades should be configurable manually and detail and distance should not be tied.

WickedInsignia commented 1 year ago

Most of that has already been explored with bug reports and proposals. If you want to help, please pursue reports that address issues that haven’t been identified. Installing blockers to prevent leaks as you’ve done doesn’t resolve the core issues with SDFGI. I’m absolutely aware that a nice result can be achieved with additional geo/edits but that’s not the point of this project, and you don’t have any authority to determine that it should be.

This is becoming patronising and I kindly ask you to please give it a rest.

yosoyfreeman commented 1 year ago

This is becoming patronising and I kindly ask you to please give it a rest.

Sure! I already explained what it needed to.

WickedInsignia commented 1 year ago

Apologies for the abrasive turn this took, everyone. Just to explain in more depth:

Thanks for your patience and please enjoy playing around with this project!

unfa commented 1 year ago

Thanks for clearing it up. I think what took place was a misunderstanding. Possibly a language barrier issue as well? We all want to improve Godot :)

If it'd be useful for evaluating the results in motion I could contribute a camera flyby feature for creating reproducible, easily comparable footage and evaluating changes that will be done to SDFGI.

Maybe a few static cameras and a script to export screenshots from them would be useful as well?

Let me know if I can be of help.

WickedInsignia commented 1 year ago

A flyby cam would be great! So many of SDFGI's issues are talked about but can't be shown adequately with stills. Any tools to better help evaluate and provide records of issues/bugs/whatever are absolutely valuable.

WickedInsignia commented 1 year ago

I do believe there was miscommunication there with YoSoy. I could've done a better job in explaining the goals of this project and accepting contributions outside of those goals, even if the reliability was a little shaky. You're completely right, everyone's here to support Godot and has good intent. Hopefully they continue experimenting with Godot and enjoying these projects.

unfa commented 1 year ago

Well, it just so happens that me and Yo Soy Freeman are working together on a game made with Godot, so I'm pretty sure that's going to be the case :)

yosoyfreeman commented 1 year ago

Hi there @WickedInsignia I'm totally sure this must been a misunderstanding. Just to clarify, i was not implying in any way that you did a bad work. In fact i praised it heavily and made sure to credit your awesome contribution in mastodon where i have my little community and any other place i published my results. I'm being totally sincere about that and I'm sorry i don't understand how i transmitted you the opposite feeling.

My intention was not to nullify your claims. I was just trying to show that even when using it following strictly the recommendations made by the dev's (Mostly Reduzio in this case) about trying to compensate leaking with bigger walls do NOT works as it should. I believe that lots of the time the dev's in charge of a specific technology don't have too much time sometimes, so i wanted to avoid the situation in which they see it quickly, say that we try thicker walls and we have to wait until the next time they see it. I'm very sincere too when i say being misleading or hiding problems was not my intention as the entirety of my Godot contributions are based on finding and reporting problems and suggesting design changes for usability. What i do is finding problems, not hide them.

Let me say again to be extremely clear: Thanks for your work, for your time and for contributing to this community.

Misunderstandings happens, I myself find human communication a complex task sometimes so i probably responsible in that part. No hard feelings at all from me and i hope we can keep working for the good of us all.

Hope this is more clear now, cause i think you did really useful work here and making you feel like i don't find value there is something that saddens me at a personal level.

WickedInsignia commented 1 year ago

No worries at all @yosoyfreeman and thanks for explaining all of that. I'll admit I was a little fizzed out yesterday, and none of that should have fallen on you. I felt something had gone awry when reading this all back, and I apologize.

I did mean it yesterday when I said the most productive course of action would be to follow up with bug reports and proposals though! I've been pursuing a lot of them myself. Remember to check if they haven't already been reported (I'm sure you'd be vigilant enough to ensure this already) and I don't think the exhaustive testing/validating you're keen to do would be wasted. If you do any more work with this project I'm sure the contributors here would love to see what else is possible, with the disclaimer that changes have been made of course 😉 . Thanks again and I'm glad we could iron that out!

yosoyfreeman commented 1 year ago

I see, i been working hard on the game with Unfa and didn't knew they were proposals already. I thought this was the test project to making them so i think that is the point in which we didn't match.

Happy to solve this in a good manner and sorry again for making you feel bad. I'll try to be less machine like cause i think i sometimes get read as sarcastic when I'm not haha

Thank you again in general.

shmolyneaux commented 1 year ago

Hi Folks,

I thought I could help out by creating a comparison video for UE4/Godot.

I rendered the same fly through in each. Github's file size limit is only 10MB, so please excuse the encoding artifacts.

The only change I made to the Godot project was to enable MSAA 8x. I'm happy to make more comparison videos if there is something specific you want to look at or if there are other Godot settings to tweak.

https://user-images.githubusercontent.com/3144113/229200289-fae4b78e-e29c-4722-8a23-f8ff733626ac.mp4

jcostello commented 1 year ago

Hi Folks,

I thought I could help out by creating a comparison video for UE4/Godot.

I rendered the same fly through in each. Github's file size limit is only 10MB, so please excuse the encoding artifacts.

The only change I made to the Godot project was to enable MSAA 8x. I'm happy to make more comparison videos if there is something specific you want to look at or if there are other Godot settings to tweak.

Really nice work. It helps a lot.

If is not much to ask can you do the inverse path so we can see the other part of each render? Also a fiew splitview images for each engine will be apreciated

yosoyfreeman commented 1 year ago

Yeah, awesome work!

shmolyneaux commented 1 year ago

Here's a video following a similar path backwards.

https://user-images.githubusercontent.com/3144113/229206420-ad46601f-5544-400d-8a6e-6e96331fe2b3.mp4

Here are a couple comparison shots:

comparison_001

comparison_195

unfa commented 1 year ago

Oh, so there's already a camera animation in that scene? :D Maybe there's no need to do another one, though maybe a slower flyby could work better for exposing SDFGI artifacts.

shmolyneaux commented 1 year ago

I added the camera animation with an AnimationPlayer in Godot and exported with the new movie mode. In Unreal I added a cinematic with Sequencer and render the animation using that. It wasn't built into the scene.

jcostello commented 1 year ago

Godot does a really decent job. How ever, under capture better the shadows and reflection. Shadows are something that could be improved in the lightmapper

shmolyneaux commented 1 year ago

The videos don't necessarily do a good job of emphasizing the issues that @WickedInsignia mentioned.

For example, there's pretty bad pop-in for the shadows in both videos at the start (the pillars and central statue in the first video, and the end of the hallway in the second). For a lot of games, pop-in like that wouldn't be acceptable. There's also the light leaking in the hallway at the start of the second video.

WickedInsignia commented 1 year ago

Really nice work, thanks so much for putting that together! I need to make some disclaimers regarding the comparison. The Unreal and Godot versions differ in major ways since the priority was to closely match the Blender and Godot versions. Here's the differences:

The more apt comparison would be a fly-through of the Blender and Godot versions, with both using Filmic tonemapping. I didn't properly configure Filmic in Godot though, so white point and exposure would need to be matched.

Calinou commented 1 year ago
  • Unreal baked lighting also seems to have directional specular. Directional baking seems to be broken in Godot at the moment.
WickedInsignia commented 1 year ago

@Calinou Using Directional in this scene (all lights dynamic) still creates issues. Many splotches appear and no directional info seems to be sent to normals. In other cases, it seems to be similar to what some other users have experienced where object's UVs are projected onto other objects around them. Directional hasn't worked properly for me in the alphas, betas or now in any projects for these reasons. Maybe something about the project setup is awry?

DirectionalBugsTemple01

jcostello commented 1 year ago

Directional baking doesn't work properly. IT creates artifacts in the lightmap. Some weird lines everywhere. I think there is an issue open for the artifacts of the directional light but I think not for the missing normal data. Can you open one?

jcostello commented 1 year ago

And BTW, Directional bakes weight a lot more than non directional. Like 4 o 5 times

WickedInsignia commented 1 year ago

For example, there's pretty bad pop-in for the shadows in both videos at the start (the pillars and central statue in the first video, and the end of the hallway in the second)

That’s very strange, I’m not actually sure why those pop-ins are happening. Looks like a reflection probe being baked suddenly during the flyaround. Maybe something to do with reflection probes not affecting lower LODs properly? Just wildly guessing tbh.

jcostello commented 1 year ago

For example, there's pretty bad pop-in for the shadows in both videos at the start (the pillars and central statue in the first video, and the end of the hallway in the second)

That’s very strange, I’m not actually sure why those pop-ins are happening. Looks like a reflection probe being baked suddenly during the flyaround. Maybe something to do with reflection probes not affecting lower LODs properly? Just wildly guessing tbh.

Could be. Reflection Probes are backed at the start of the scene and I assume that lower LODs should be affected by the same bake

jcostello commented 1 year ago

Also, another issue issue is that if you increase the number of bounces in the lightmap, the scene gets brighter and brighter. Seems that the ray energy dont decay over distance or something like that. More bounces should mean more details near objects but no a brighter scene. It kills shadows

https://github.com/godotengine/godot/issues/73295

solitaryurt commented 1 year ago

Also, another issue issue is that if you increase the number of bounces in the lightmap, the scene gets brighter and brighter. Seems that the ray energy dont decay over distance or something like that. More bounces should mean more details near objects but no a brighter scene. It kills shadows

73295

Completely agree. more bounces should be more detail, not more energy.

Jamsers commented 1 year ago

I made a tweaked version of this demo and uploaded a Github repo for it, if anyone needs it: Godot-Sun-Temple-Tweaked

I can confirm on my end that this level shows no mercy to Godot's lighting, it even helped me find a pretty oof bug with SDFGI.

https://github.com/godotengine/godot/assets/39361911/bf2b664d-90a8-4510-8dbe-0f196418c73d

jcostello commented 1 year ago

I have a tweaked version myself where I achieve really good result but only with lightmaps, having a greater texel scale and moving around reflection probes

jtnicholl commented 1 year ago

Something I noticed about this is that it's entirely indoors, with some corners keeping you from seeing very far ahead. It's the perfect scenario for occlusion culling. What's the reason nobody's used it here? Did the Unreal version not and we're trying to stay accurate for comparison?

Also, just FYI, you included the .godot/ folder in the download ZIP, and that more than doubled its size.

shmolyneaux commented 1 year ago

The focus here is the visuals, not the performance. Occlusion culling only helps for performance, so it's unnecessary for the comparison.

WickedInsignia commented 12 months ago

Also, just FYI, you included the .godot/ folder in the download ZIP, and that more than doubled its size.

Oh interesting, I didn't know it could be left out. Is this a situation like Unity where you don't need to copy the Library folder with a project since Unity just rebuilds that itself?

Calinou commented 12 months ago

Is this a situation like Unity where you don't need to copy the Library folder with a project since Unity just rebuilds that itself?

Yes, pretty much. It's generated when opening the project in the editor for the first time.

WickedInsignia commented 9 months ago

Tested this scene with 4.2 Dev 6. My findings so far:

I still advise against using modular environment assets for interiors in Godot regardless of GI technique used. I'll do some experiments with light blockers to test at what point the GI techniques become leak-free.

jcostello commented 9 months ago

To me, if modular assets are used, they have to have thickness in order to prevent light leak

WickedInsignia commented 9 months ago

To me, if modular assets are used, they have to have thickness in order to prevent light leak

In the cases where texel density was high enough for the thickness to prevent all leaks, leaks persisted. There's something else going on. Here's the archways at a very high texel density (50MB+ EXR). I can't say what exact texel density for the scene because that info still isn't exposed to the user anywhere in the interface. It was certainly high enough to prevent these leaks though, and the geo above these archways was sufficiently thick and manifold. Godot426Leaks01

There are some strange noise patterns on the ceiling meshes in the main room too. I haven't seen these in other lightmappers such as Bakery or Unity's GPU Progressive: Godot426Leaks02

jcostello commented 9 months ago

I found an issue with Physical Lights when baking, I have to report it to @DarioSamo. Try to disable physical lights and bake again. I have minimum leak but I think is a problem of the geometry because I also found z-figthing

image

No pattern you mention

image