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

Implement pointlights #3587

Merged
merged 12 commits into from
Jan 14, 2024
Merged

Implement pointlights #3587

merged 12 commits into from
Jan 14, 2024

Conversation

vlj
Copy link
Contributor

@vlj vlj commented Jan 6, 2024

This PR adds point lights support to OpenGL and Vulkan backend for terrain high settings and instanced lit object.

Description

This adds support for per pixel (not lightmap based) point lights that behaves "correctly" with normal data in the scene.

This is a rough implementation of the "Clustered Forward Shading" technic used in forward renderer like warzone renderer.
The idea is to split the view frustrum in small bucket and build for every bucket a list of all lights intersecting this bucket. Then in the fragment shaders, the fragment will query the right bucket depending on the screenspace location.

The assumption is that point lights are often very local, and thus it doesn't make sense to run the light computations on all visible lights for every pixel in the scene.

Due to the demanding nature of the technic it is enabled only for instanced meshes rendering and high details terrain.

For now there is a limit of 128 different "frame" lights, and the accumulated size of bucket light is 512, and there are 64 buckets.

Help needed

Testing

The best map for quick test is the beginning of the beta campaign, with a lot of lights. Note that the first time when the VTOL are bombing the base in this mission, some point light disappear for a brief moment due to the amount of light.

After a toggle is introduced in the settings menu (currently I only tested by recompilation), I need tests to see if the legacy codepath still works.
I need tests to see if it works on various config, with and without the toggle enabled.

@past-due past-due added this to the 4.5.0-beta1 milestone Jan 9, 2024
Copy link
Member

@ManManson ManManson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly minor changes suggested, like forgotten const& to avoid excessive copying, std::move, mismatching iteration types and some spelling typos (like "frustrum" vs "frustum").

lib/ivis_opengl/culling.h Outdated Show resolved Hide resolved
lib/ivis_opengl/culling.cpp Outdated Show resolved Hide resolved
lib/ivis_opengl/pielighting.cpp Outdated Show resolved Hide resolved
lib/ivis_opengl/culling.h Outdated Show resolved Hide resolved
lib/ivis_opengl/pielighting.cpp Outdated Show resolved Hide resolved
lib/ivis_opengl/pielighting.cpp Outdated Show resolved Hide resolved
lib/ivis_opengl/pielighting.h Outdated Show resolved Hide resolved
src/display3d.cpp Outdated Show resolved Hide resolved
src/terrain.h Outdated Show resolved Hide resolved
lib/ivis_opengl/pielighting.h Outdated Show resolved Hide resolved
@MaNGusT-
Copy link
Contributor

looks like yellow light in blows or when vtol is destroyed still uses non-point light

@past-due past-due merged commit 2cb117d into Warzone2100:master Jan 14, 2024
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants