-
Couldn't load subscription status.
- Fork 37
Rendering: Shadows pt 2 #155
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
Conversation
…nd far planes based on scene intersection and moving light in texel-sized increments
| #include "Common/PrimitiveCube.hpp" | ||
| #include "Common/PrimitiveQuad.hpp" | ||
|
|
||
| #include "Debugging//DebugDrawSystem.hpp" |
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.
unnessecary double forwardslash
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.
Done
# Conflicts: # PolyEngine/Engine/Src/Engine.cpp
…lyEngine into rendering/shadows-pt-2
| /// <see cref="AABox.Contains()"/> | ||
| inline bool Intersects(const AABox& rhs) const | ||
| { | ||
| return (abs(Min.X - rhs.Min.X) * 2.0f < (Size.X + rhs.Size.X)) |
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.
There is Vector::abs method (or at least should be), use it.
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.
BasicMath.hpp has Poly::abs for float, double and long double overloads but no Vector.
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.
Ok, I added this to trello.
| vec2 depthScale = uEVSMBias * 0.01 * exponents * warpedDepth; | ||
| vec2 minVariance = depthScale * depthScale; | ||
|
|
||
| return ChebyshevUpperBound(moments.xy, warpedDepth.x, minVariance.x, uLightBleedingReduction); |
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.
please check your indentation setting in the IDE. These files are all over the place.
| outputEVSM[3] = vec4(warpedDepth[3], warpedDepth[3] * warpedDepth[3]); | ||
|
|
||
| vec4 finalOutput = outputEVSM[0] + outputEVSM[1] + outputEVSM[2] + outputEVSM[3]; | ||
| finalOutput *= 0.25f; |
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.
indentation inconsistency
| #include <Proxy/GLShaderProgram.hpp> | ||
| #include <Common/PrimitiveCube.hpp> | ||
| #include <Common/PrimitiveQuad.hpp> | ||
| #include "GLRenderingDevice.hpp" |
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.
Please conform to the new convention of using <> instead of quotes for the includes. This applies to the whole PR.
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.
Updated all includes is GLRenderingDevice
| // | ||
| // glBindFramebuffer(GL_FRAMEBUFFER, 0); | ||
| // | ||
| // CHECK_FBO_STATUS(); |
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.
Remove commented code.
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.
Done
| glViewport(0, 0, screenSize.Width, screenSize.Height); | ||
|
|
||
| for (int i = 9; i > 0; --i) | ||
| for (int i = 10; i > 0; --i) |
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.
Magic number alert.
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.
Moved to constant
| glBindVertexArray(0); | ||
|
|
||
| for (int i = 9; i > 0; --i) | ||
| for (int i = 10; i > 0; --i) |
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.
Magic number.
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.
Moved to constant
| // GLuint FBOShadowMapResolve1; | ||
| // GLShaderProgram ShadowMapShader; | ||
| // GLShaderProgram EVSMResolveShader; | ||
| // GLShaderProgram EVSMBlurShader; |
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.
Remove commented code.
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.
Done
* test case * calculating light bounds in AABox around frustum in game example for debug * added tight projection around camera frustum, light projection near and far planes based on scene intersection and moving light in texel-sized increments * shadow bug dependent on camera direction * imgui reacting to input and drawing on screen from render device * proper init, render deinit and windows created by game * comments * comments * commented #pragma failing travis ci * removed #pragma * removed pragma from resource * commented unused components * commented out wrong variable doh... * prototype of shadow casters culling * moved code to rendering device, tested on example scene and on sponza, seems ok * added AABox around every drawn mesh and still fails on sponza * removed shadow casters AABox * stable shadows working on sponza and test scene * stable shadowmap * interpolated Percentage Closer Filtering * shadows prototype cleanup * shadow ramblings * merged with dev * cmake attempt * moved imgui to third parties, cmake updated for Engine, RenderingDevice and Game Project. Spams a lot * removed sanity spam * resource cleanup * imguisystem cleanup * imgui world component cleanup * added non windows API attributes to imconfig.h * moved imgui to pch * silencing third party gcc -Wimplicit-fallthrough= * enabled -fPIC (Position Independent Code) for imgui static lib to be included in shared libs * fixing gcc includes * fixing cgg includes * made includes same as in GLTextureDeviceProxy * removed commented out code * ImguiUpdate is now in System, Imgui context creation moved to ImguiSystem constructor, removed Resource and WorldComponent * moved Imgui to Engine subdirectory * Added clipboard support, tweaked mouse handling and input that can be consumed by any system * added UTF8 char input from keyboard keys * fixing input consumption (works on all widowns: engine and game) * added output queue and events handled by SDL * CI fix * CI fix and cleanup * CI fix * CI fix * fix * Moved getting axis vector from MovementSystem to EntityTransform * shadowmap ortho projection has correct direction based on dir light forward vector * shadowmap projection in [0, 1] range * stable shadows on frustum transform and properties change * shadows prototype with tight bound around frustum and ortho projection in [0, 1] on Z * more changes * tweaks to AABB intersection tests * added tweakable shadow bias and glPolygonOffset * working evsm2 and evsm4 * shadow projection working with shadow bounds extended by vertical shadow casters * some EVSM4 shadows that work * created pass with shadowmap * switched renderer to use Shadommap pass * parametrizing shadow types * EVSM2 seems to work as well * removed debug light parameters, shadowmap pass has pcf and evsm versions * removed debug variables from light and camera components * CI fix * CI fix * CI fix * CI fix * CI Fix * debug rendering cleanup * cleanup and comments * cleanup * compilation fix * cleanup * cleanup * ignore shader dump extension * fix * Added comment for .dump file extention * cleanup * AABB unit tests * CI fix, tabbed documents * CI fix, tabbed documents * review fix, tabbed code * assert and nullptr fix * None RenderingSettingsComponent fix * review fix * review fix, updated includes * review fix, removed commented code * magic variable moved to constant * CI fix * CI fix
* test case * calculating light bounds in AABox around frustum in game example for debug * added tight projection around camera frustum, light projection near and far planes based on scene intersection and moving light in texel-sized increments * shadow bug dependent on camera direction * imgui reacting to input and drawing on screen from render device * proper init, render deinit and windows created by game * comments * comments * commented #pragma failing travis ci * removed #pragma * removed pragma from resource * commented unused components * commented out wrong variable doh... * prototype of shadow casters culling * moved code to rendering device, tested on example scene and on sponza, seems ok * added AABox around every drawn mesh and still fails on sponza * removed shadow casters AABox * stable shadows working on sponza and test scene * stable shadowmap * interpolated Percentage Closer Filtering * shadows prototype cleanup * shadow ramblings * merged with dev * cmake attempt * moved imgui to third parties, cmake updated for Engine, RenderingDevice and Game Project. Spams a lot * removed sanity spam * resource cleanup * imguisystem cleanup * imgui world component cleanup * added non windows API attributes to imconfig.h * moved imgui to pch * silencing third party gcc -Wimplicit-fallthrough= * enabled -fPIC (Position Independent Code) for imgui static lib to be included in shared libs * fixing gcc includes * fixing cgg includes * made includes same as in GLTextureDeviceProxy * removed commented out code * ImguiUpdate is now in System, Imgui context creation moved to ImguiSystem constructor, removed Resource and WorldComponent * moved Imgui to Engine subdirectory * Added clipboard support, tweaked mouse handling and input that can be consumed by any system * added UTF8 char input from keyboard keys * fixing input consumption (works on all widowns: engine and game) * added output queue and events handled by SDL * CI fix * CI fix and cleanup * CI fix * CI fix * fix * Moved getting axis vector from MovementSystem to EntityTransform * shadowmap ortho projection has correct direction based on dir light forward vector * shadowmap projection in [0, 1] range * stable shadows on frustum transform and properties change * shadows prototype with tight bound around frustum and ortho projection in [0, 1] on Z * more changes * tweaks to AABB intersection tests * added tweakable shadow bias and glPolygonOffset * working evsm2 and evsm4 * shadow projection working with shadow bounds extended by vertical shadow casters * some EVSM4 shadows that work * created pass with shadowmap * switched renderer to use Shadommap pass * parametrizing shadow types * EVSM2 seems to work as well * removed debug light parameters, shadowmap pass has pcf and evsm versions * removed debug variables from light and camera components * CI fix * CI fix * CI fix * CI fix * CI Fix * debug rendering cleanup * cleanup and comments * cleanup * compilation fix * cleanup * cleanup * ignore shader dump extension * fix * Added comment for .dump file extention * cleanup * AABB unit tests * CI fix, tabbed documents * CI fix, tabbed documents * review fix, tabbed code * assert and nullptr fix * None RenderingSettingsComponent fix * review fix * review fix, updated includes * review fix, removed commented code * magic variable moved to constant * CI fix * CI fix
Depends on: #158
References:
https://github.com/TheRealMJP/Shadows
https://github.com/bartwronski/CSharpRenderer
https://docs.microsoft.com/pl-pl/windows/desktop/DxTechArts/common-techniques-to-improve-shadow-depth-maps
https://gamedev.stackexchange.com/questions/73851/how-do-i-fit-the-camera-frustum-inside-directional-light-space