-
Notifications
You must be signed in to change notification settings - Fork 265
Added shadow mapping for directional lights #315
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3be07a2
to
61200e6
Compare
…manent solution has been found
…un automatically even if no source file changed (to make sure resources are copied properly)
* enforced single shadow map * added support for PBR shadow receiving
…exposed to the material editor
adriengivry
commented
Nov 21, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting some weird logs in the console with the shadow mapping. I need to investigate!
[ERROR] 2024-11-21_12-34-55 OpenGL Debug Message:
Debug message (1282): GL_INVALID_OPERATION error generated. Texture name does not refer to a texture object generated by OpenGL.
Source: API
Type: Error
Severity: High
Edit: Fixed! Introduced singleUse
parameter in Material::Set
…ny temporary TextureHandle (such as a ShadowMap) passed to a material will be released after use (to avoid accessing deallocated memory)
This was referenced Nov 21, 2024
…d updated the shadow bias calculation to be based on the shadow map size
10 tasks
adriengivry
commented
Nov 25, 2024
Sources/Overload/OvCore/include/OvCore/Rendering/ShadowRenderPass.h
Outdated
Show resolved
Hide resolved
litelawliet
reviewed
Feb 7, 2025
litelawliet
reviewed
Feb 7, 2025
Sources/Overload/OvCore/src/OvCore/ECS/Components/CDirectionalLight.cpp
Outdated
Show resolved
Hide resolved
litelawliet
approved these changes
Feb 7, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Implementation of shadow mapping!
Default.ovmat
material by default.TextureHandle
class, which wraps an OpenGL texture ID, and can be passed as a uniform. ThisTextureHandle
class is used by the framebuffer to expose its rendered image.Texture
now inherits fromTextureHandle
.ShadowRenderPass
added: handles the rendering of shadow casters in the shadow mapShadowRenderFeature
added: ensures that the shadow map is properly bound to each entity set to receive shadows.CDirectionaLight
component. Changing this setting will change the radius of the shadow (bigger radius = less precision)CDirectionaLight
component.CDirectionaLight
component allowing the directional light to use the position of the camera as a source for its light space matrix (for shadow map rendering), making shadows "follow" the camera around, instead of being static.singleUse
parameter toMaterial::Set
, for properties that shouldn't be stored after drawing (i.e. shadow maps texture handles)Notes
This PR also updates
OvEditor
andOvGame
premake files to disablefastuptodate
, which forces both project to trigger their post-build command before any run (resulting in resources being properly updated between runs, even if no source file changed).Limitations
Shadow.ovfx
shader, which doesn't vertex transformations outside of the regularmodelMatrix * vec4(geo_Pos, 1.0);
, which could result in shaders using instancing or vertex displacement to not cast shadows properly. One way to mitigate this would be to add a way to specify a shader override for certain passes (like shadows), through the material. However this change should be made in a separate PR.To-Do
ShadowRenderFeature
only runs on materials set to receive shadowTexture
/TextureHandle
std::any
usage)Related Issues
Fixes #250
Fixes #313
Screenshots
Resources
Mostly followed:
https://learnopengl.com/Advanced-Lighting/Shadows/Shadow-Mapping