Skip to content

Commit

Permalink
- Add screenspace method option
Browse files Browse the repository at this point in the history
- Support bend screenspace directional
- Frustrum check screenspace shadow lights
- Fix normal screenspace shadow constant buffer
- Cleanup
  • Loading branch information
Nickelium committed Sep 27, 2023
1 parent 7a25484 commit a587f64
Show file tree
Hide file tree
Showing 20 changed files with 67,660 additions and 114 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,6 @@ ModelManifest.xml
.vscode/

# Rider IDE config dir
.idea/
.idea/

*.obj
33,620 changes: 33,620 additions & 0 deletions 1.txt

Large diffs are not rendered by default.

33,620 changes: 33,620 additions & 0 deletions 2.txt

Large diffs are not rendered by default.

Binary file added assimp.res
Binary file not shown.
19 changes: 12 additions & 7 deletions build_scripts/generate_project_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,14 @@ def copy(source, destination):
def extract_third_party_dependencies():
print("1. Extracting third-party dependencies...")
cmd = (
"build_scripts\\7z.exe e third_party\\libraries\\libraries.7z -othird_party\\libraries\\ -aoa"
if sys.argv[1] == "vs2022"
else "7za e third_party/libraries/libraries.7z -othird_party/libraries/ -aoa"
"Spartan\\build_scripts\\7z.exe e Spartan\\third_party\\libraries\\libraries.7z -othird_party\\libraries\\ -aoa"
# "build_scripts\\7z.exe e third_party\\libraries\\libraries.7z -othird_party\\libraries\\ -aoa"
# "build_scripts\\7z.exe"
# if sys.argv[1] == "vs2022"
# else "7za e third_party/libraries/libraries.7z -othird_party/libraries/ -aoa"
# "build_scripts\\7z.exe"
# "dir"
# "Spartan\\build_scripts\\7z.exe"
)
os.system(cmd)

Expand All @@ -78,18 +83,18 @@ def copy_assets():
def generate_project_files():
print("\n5. Generating project files...")
cmd = (
f"build_scripts\\premake5.exe --file=build_scripts\\premake.lua {sys.argv[1]} {sys.argv[2]}"
f"Spartan\\build_scripts\\premake5.exe --file=Spartan\\build_scripts\\premake.lua {sys.argv[1]} {sys.argv[2]}"
if sys.argv[1] == "vs2022"
else f"premake5 --file=build_scripts/premake.lua {sys.argv[1]} {sys.argv[2]}"
else f"Spartan\\build_scripts\\premake5.exe --file=build_scripts/premake.lua {sys.argv[1]} {sys.argv[2]}"
)
subprocess.Popen(cmd, shell=True).communicate()


def main():
extract_third_party_dependencies()
create_binaries_folder()
# create_binaries_folder()
copy_dlls()
copy_assets()
# copy_assets()
generate_project_files()
sys.exit(0)

Expand Down
31 changes: 31 additions & 0 deletions data/shaders/sss.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
Copyright(c) 2016-2023 Panos Karabelas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

//= INCLUDES =========
#include "common.hlsl"
#include "screen_space_shadows.hlsl"
//====================

[numthreads(THREAD_GROUP_COUNT_X, THREAD_GROUP_COUNT_Y, 1)]
void mainCS(uint3 thread_id : SV_DispatchThreadID)
{
tex_av[thread_id.xy] = float4(float3(1,0,0), 0);
}
Binary file added data/textures/no_texture.texture
Binary file not shown.
56 changes: 56 additions & 0 deletions editor.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[Window][World]
Pos=1536,40
Size=384,379
Collapsed=0
DockId=0x00000003,0

[Window][Properties]
Pos=1536,421
Size=384,570
Collapsed=0
DockId=0x00000004,0

[Window][Console]
Pos=0,753
Size=612,238
Collapsed=0
DockId=0x00000007,0

[Window][Assets]
Pos=614,753
Size=920,238
Collapsed=0
DockId=0x00000008,0

[Window][Viewport]
Pos=0,40
Size=1534,711
Collapsed=0
DockId=0x00000005,0

[Window][##main_window]
Pos=0,8
Size=1920,983
Collapsed=0

[Window][Debug##Default]
Pos=60,60
Size=400,400
Collapsed=0

[Window][World selection]
Pos=476,237
Size=582,316
Collapsed=0

[Docking][Data]
DockSpace ID=0xA9D11E79 Window=0x11109896 Pos=0,69 Size=1920,951 Split=X
DockNode ID=0x00000001 Parent=0xA9D11E79 SizeRef=1534,991 Split=Y
DockNode ID=0x00000005 Parent=0x00000001 SizeRef=1534,741 Selected=0x13926F0B
DockNode ID=0x00000006 Parent=0x00000001 SizeRef=1534,248 Split=X
DockNode ID=0x00000007 Parent=0x00000006 SizeRef=612,248 Selected=0x49278EEE
DockNode ID=0x00000008 Parent=0x00000006 SizeRef=920,248 Selected=0x26CE0345
DockNode ID=0x00000002 Parent=0xA9D11E79 SizeRef=384,991 Split=Y
DockNode ID=0x00000003 Parent=0x00000002 SizeRef=384,395 Selected=0x39008DEC
DockNode ID=0x00000004 Parent=0x00000002 SizeRef=384,594 Selected=0x199AB496

16 changes: 12 additions & 4 deletions editor/Widgets/RenderOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ void RenderOptions::OnTickVisible()
bool do_dof = Renderer::GetOption<bool>(Renderer_Option::DepthOfField);
bool do_volumetric_fog = Renderer::GetOption<bool>(Renderer_Option::VolumetricFog);
bool do_ssgi = Renderer::GetOption<bool>(Renderer_Option::Ssgi);
bool do_sss = Renderer::GetOption<bool>(Renderer_Option::ScreenSpaceShadows);
bool do_ssr = Renderer::GetOption<bool>(Renderer_Option::ScreenSpaceReflections);
bool do_motion_blur = Renderer::GetOption<bool>(Renderer_Option::MotionBlur);
bool do_film_grain = Renderer::GetOption<bool>(Renderer_Option::FilmGrain);
Expand Down Expand Up @@ -354,8 +353,18 @@ void RenderOptions::OnTickVisible()
ImGui::EndDisabled();
}

// Screen space shadows
option_check_box("Screen space shadows", do_sss);
static vector<string> screenspaceshadow_modes =
{
"Disabled",
"Normal",
"Bend"
};

uint32_t screenspaceshadow_mode = Renderer::GetOption<uint32_t>(Renderer_Option::ScreenSpaceShadows);
if (option_combo_box("Screenspace shadow", screenspaceshadow_modes, screenspaceshadow_mode))
{
Renderer::SetOption(Renderer_Option::ScreenSpaceShadows, static_cast<float>(screenspaceshadow_mode));
}

// Shadow resolution
option_int("Shadow resolution", resolution_shadow);
Expand Down Expand Up @@ -440,7 +449,6 @@ void RenderOptions::OnTickVisible()
Renderer::SetOption(Renderer_Option::DepthOfField, do_dof);
Renderer::SetOption(Renderer_Option::VolumetricFog, do_volumetric_fog);
Renderer::SetOption(Renderer_Option::Ssgi, do_ssgi);
Renderer::SetOption(Renderer_Option::ScreenSpaceShadows, do_sss);
Renderer::SetOption(Renderer_Option::ScreenSpaceReflections, do_ssr);
Renderer::SetOption(Renderer_Option::MotionBlur, do_motion_blur);
Renderer::SetOption(Renderer_Option::FilmGrain, do_film_grain);
Expand Down
2 changes: 1 addition & 1 deletion editor/Widgets/ShaderEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void ShaderEditor::ShowControls()

void ShaderEditor::GetShaderInstances()
{
array<shared_ptr<RHI_Shader>, 45> shaders = Renderer::GetShaders();
array<shared_ptr<RHI_Shader>, Renderer::numberOfShaders> shaders = Renderer::GetShaders();
m_shaders.clear();

for (const shared_ptr<RHI_Shader>& shader : shaders)
Expand Down
2 changes: 1 addition & 1 deletion generate_vs2022_vulkan.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

def main():
script_dir = Path(__file__).parent
os.chdir(script_dir)
os.system("dir")

script = script_dir / "build_scripts" / "generate_project_files.py"
subprocess.Popen([sys.executable, str(script), "vs2022", "vulkan"]).communicate()
Expand Down
Loading

0 comments on commit a587f64

Please sign in to comment.