Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an AreaLight3D node to render real-time light coming out from a rectangle in 3D space #11450

Open
radiantgurl opened this issue Dec 30, 2024 · 4 comments

Comments

@radiantgurl
Copy link

Describe the project you are working on

I'm currently working on a project with the sole purpose of exporting Roblox games to run inside Godot through a translation layer (as a consequence most of those games will be single-player)

Describe the problem or limitation you are having in your project

Having to implement Roblox's SurfaceLight however having no way of making this inside Godot.

Doing this requires real-time lighting, which VoxelGI and LightmapGI are unable to do, and SDFGI incurs too much of an overhead to be used here + it's not fully dynamic for meshes which is a problem.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Implementation of an AreaLight3D node. This node will have the following properties:

Vector2 size;
float range;

They are very similar to blender's AreaLight nodes.
Image

Implementation of these would be enough for me to be able to implement the SurfaceLight instance.

Note

Implementation of this would allow developers to finally not rely on emission textures with GI to fulfill this, which would prove a benefit to multiple projects with their own use cases.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Implementation of https://eheitzresearch.wordpress.com/415-2/

If this enhancement will not be used often, can it be worked around with a few lines of script?

No.

Is there a reason why this should be core and not an add-on in the asset library?

Requires modification to RenderingServer which cannot be done at this point in time.

@Calinou
Copy link
Member

Calinou commented Jan 2, 2025

Note that rendering real-time area light shadows with good performance is notoriously difficult, so I expect capsule shadows to be a good alternative here. In fact, capsule shadows alone can suffice for dynamic objects if you're using LightmapGI for static object shadows (using an emissive mesh that you hide after baking).

I wonder if there is any performant way to make rectangular area lights affect volumetric fog too.

Doing this requires real-time lighting, which VoxelGI and LightmapGI are unable to do,

VoxelGI can do this in real-time if the emissive mesh has its GI mode set to Dynamic. This is quite slow due to the oversampling that can't be turned off though.

@Calinou Calinou changed the title Implementation of AreaLight3D Add an AreaLight3D node to render real-time light coming out from a rectangle in 3D space Jan 2, 2025
@CookieBadger
Copy link

Just to mention this somewhere, I am working on an (actually several) area light implementations & integration into Godot for a thesis. So far I have implemented stochastic lighting, but I was also looking into spherical cosines and the implementation of Heitz et. al. that you have mentioned above. Currently, I am working on realistic adaptive soft shadows, using a technique suggested by Schwärzler et. al. in 2012, where recent research showed optimization potential through the use of cascades. You shouldn't expect a PR any time soon, as there is a lot of working going into integrating with all the different systems (GI, materials, different renderers, etc.), and also except for chats with @clayjohn I have not really proposed and discussed this anywhere yet, but there might be a chance that I can get something in the engine given enough time.

Here's some images of the rectangular area light, as far as I got it working in Godot:

Image

Image

@radiantgurl
Copy link
Author

I'd beg you to please open a draft PR for this feature 🙏 🙏

@CookieBadger
Copy link

Draft won't happen at the moment, because I don't want to waste people's time on my buggy / chaotic implementation of an experimental technique, that has barely been tested on my machines yet. You can however find the code on my fork at https://github.com/CookieBadger/godot/tree/area-light-shadows if you want to follow my work in progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants