Rendering: Shadows pt 2 #155
Merged
MuniuDev merged 99 commits intoPolyEngineTeam:devfrom Dec 16, 2018
Merged
Conversation
added 3 commits
September 9, 2018 01:14
…nd far planes based on scene intersection and moving light in texel-sized increments
2 tasks
| #include "Common/PrimitiveCube.hpp" | ||
| #include "Common/PrimitiveQuad.hpp" | ||
|
|
||
| #include "Debugging//DebugDrawSystem.hpp" |
Contributor
There was a problem hiding this comment.
unnessecary double forwardslash
# Conflicts: # PolyEngine/Engine/Src/Engine.cpp
…lyEngine into rendering/shadows-pt-2
MuniuDev
requested changes
Dec 1, 2018
| /// <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)) |
Contributor
There was a problem hiding this comment.
There is Vector::abs method (or at least should be), use it.
Contributor
Author
There was a problem hiding this comment.
BasicMath.hpp has Poly::abs for float, double and long double overloads but no Vector.
Contributor
There was a problem hiding this comment.
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); |
Contributor
There was a problem hiding this comment.
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; |
| #include <Proxy/GLShaderProgram.hpp> | ||
| #include <Common/PrimitiveCube.hpp> | ||
| #include <Common/PrimitiveQuad.hpp> | ||
| #include "GLRenderingDevice.hpp" |
Contributor
There was a problem hiding this comment.
Please conform to the new convention of using <> instead of quotes for the includes. This applies to the whole PR.
Contributor
Author
There was a problem hiding this comment.
Updated all includes is GLRenderingDevice
| // | ||
| // glBindFramebuffer(GL_FRAMEBUFFER, 0); | ||
| // | ||
| // CHECK_FBO_STATUS(); |
| glViewport(0, 0, screenSize.Width, screenSize.Height); | ||
|
|
||
| for (int i = 9; i > 0; --i) | ||
| for (int i = 10; i > 0; --i) |
| glBindVertexArray(0); | ||
|
|
||
| for (int i = 9; i > 0; --i) | ||
| for (int i = 10; i > 0; --i) |
| // GLuint FBOShadowMapResolve1; | ||
| // GLShaderProgram ShadowMapShader; | ||
| // GLShaderProgram EVSMResolveShader; | ||
| // GLShaderProgram EVSMBlurShader; |
MuniuDev
approved these changes
Dec 16, 2018
MuniuDev
pushed a commit
to MuniuDev/PolyEngine
that referenced
this pull request
Dec 28, 2018
* 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
MuniuDev
pushed a commit
to MuniuDev/PolyEngine
that referenced
this pull request
Jan 2, 2019
* 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
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
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.
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