├── Source ├── RenderPasses │ ├── NRCVoxelPT │ │ ├── NRCShared.slang │ │ ├── Debug │ │ │ ├── NRCPixelStatsShared.slang │ │ │ └── NRCPixelStats.slang │ │ ├── FalcorCUDA.h │ │ ├── Data │ │ │ ├── default_nrc.json │ │ │ ├── NRCPathTracer.py │ │ │ ├── NRCVoxelPT.py │ │ │ └── DenoisedNRC.py │ │ ├── DataStructure.slang │ │ ├── Composite.cs.slang │ │ └── Network.h │ ├── NRCPathTracer │ │ ├── Debug │ │ │ ├── NRCPixelStatsShared.slang │ │ │ └── NRCPixelStats.slang │ │ ├── Data │ │ │ ├── default_nrc.json │ │ │ ├── default_nrc_ema.json │ │ │ ├── default_nrc_new.json │ │ │ ├── NRCPathTracer.py │ │ │ └── DenoisedNRC.py │ │ ├── FalcorCUDA.h │ │ ├── DataStructure.slang │ │ ├── Composite.cs.slang │ │ ├── Network.h │ │ ├── NRC.cpp │ │ └── Parameters.h │ ├── make_new_pass_project.bat │ ├── BlitPass │ │ └── BlitPass.vcxproj.filters │ ├── ImageLoader │ │ └── ImageLoader.vcxproj.filters │ ├── TemporalDelayPass │ │ └── TemporalDelayPass.vcxproj.filters │ ├── PassLibraryTemplate │ │ ├── PassLibraryTemplate.vcxproj.filters │ │ ├── PassLibraryTemplate.h │ │ └── PassLibraryTemplate.cpp │ ├── RTAO │ │ ├── RTAO.vcxproj.filters │ │ └── RTAO.h │ ├── SkyBox │ │ ├── SkyBox.vcxproj.filters │ │ └── Data │ │ │ └── cube.obj │ ├── DepthPass │ │ ├── DepthPass.vcxproj.filters │ │ └── DepthPass.ps.slang │ ├── SimplePostFX │ │ └── SimplePostFX.vcxproj.filters │ ├── AccumulatePass │ │ └── AccumulatePass.vcxproj.filters │ ├── RTLightingPass │ │ ├── RTLightingPass.vcxproj.filters │ │ └── RTLightingPass.h │ ├── MinimalPathTracer │ │ ├── MinimalPathTracer.vcxproj.filters │ │ └── Data │ │ │ └── MinimalPathTracer.py │ ├── FLIPPass │ │ └── FLIPPass.vcxproj.filters │ ├── ForwardLightingPass │ │ └── ForwardLightingPass.vcxproj.filters │ ├── BSDFViewer │ │ └── BSDFViewer.vcxproj.filters │ ├── TestPasses │ │ ├── TestPasses.vcxproj.filters │ │ └── TestPasses.cpp │ ├── SceneDebugger │ │ └── SceneDebugger.vcxproj.filters │ ├── SSAO │ │ ├── SSAO.vcxproj.filters │ │ ├── SSAOData.slang │ │ └── ApplyAO.ps.slang │ ├── MegakernelPathTracer │ │ ├── MegakernelPathTracer.vcxproj.filters │ │ └── Data │ │ │ └── MegakernelPathTracer.py │ ├── WhittedRayTracer │ │ ├── WhittedRayTracer.vcxproj.filters │ │ └── Data │ │ │ └── WhittedRayTracer.py │ ├── PixelInspectorPass │ │ ├── PixelInspectorPass.vcxproj.filters │ │ └── Data │ │ │ └── GBufferRasterInspector.py │ ├── ToneMapper │ │ ├── ToneMapper.vcxproj.filters │ │ └── Luminance.ps.slang │ ├── CSM │ │ └── CSM.vcxproj.filters │ ├── SVGFPass │ │ ├── SVGFPass.vcxproj.filters │ │ └── SVGFFinalModulate.ps.slang │ ├── OptixDenoiser │ │ ├── OptixDenoiser.vcxproj.filters │ │ ├── ConvertTexToBuf.cs.slang │ │ └── ConvertBufToTex.ps.slang │ ├── Antialiasing │ │ └── Antialiasing.vcxproj.filters │ ├── Utils │ │ ├── Utils.vcxproj.filters │ │ └── Composite │ │ │ └── CompositeMode.slangh │ ├── make_new_pass_project.py │ ├── GBuffer │ │ └── GBuffer │ │ │ └── GBuffer.h │ └── DebugPasses │ │ ├── ColorMapPass │ │ └── ColorMapParams.slang │ │ └── InvalidPixelDetectionPass │ │ └── InvalidPixelDetection.ps.slang ├── Falcor │ ├── Data │ │ └── Framework │ │ │ ├── Nvidia.ico │ │ │ ├── Fonts │ │ │ ├── consolab.ttf │ │ │ ├── trebucbd.ttf │ │ │ ├── DejaVu Sans Mono14.000000.bin │ │ │ └── DejaVu Sans Mono14.000000.dds │ │ │ └── Textures │ │ │ ├── Pause.jpg │ │ │ ├── Play.jpg │ │ │ ├── Rewind.jpg │ │ │ ├── Stop.jpg │ │ │ ├── NextFrame.jpg │ │ │ └── PrevFrame.jpg │ ├── ShaderSource.targets │ ├── stdafx.cpp │ ├── stdafx.h │ ├── ShaderSource.xml │ ├── Utils │ │ ├── NVAPI.slangh │ │ ├── NVAPI.slang │ │ ├── Debug │ │ │ └── ReflectPixelDebugTypes.cs.slang │ │ ├── Attributes.slang │ │ ├── Sampling │ │ │ └── SampleGeneratorType.slangh │ │ └── Algorithm │ │ │ └── ParallelReductionType.slangh │ ├── Scene │ │ ├── SceneBlock.slang │ │ ├── Volume │ │ │ └── BrickedGrid.h │ │ ├── ParticleSystem │ │ │ └── ParticleConstColor.ps.slang │ │ └── Animation │ │ │ └── Animatable.cpp │ ├── Core │ │ ├── Program │ │ │ └── ShaderLibrary.cpp │ │ └── API │ │ │ ├── Vulkan │ │ │ ├── VKVao.cpp │ │ │ ├── VkResource.cpp │ │ │ └── VKRasterizerState.cpp │ │ │ ├── D3D12 │ │ │ ├── D3D12ApiData.h │ │ │ ├── D3D12Vao.cpp │ │ │ ├── D3D12RasterizerState.cpp │ │ │ └── D3D12Resource.h │ │ │ └── VertexLayout.cpp │ ├── FalcorExperimental.h │ ├── Testing │ │ └── UnitTest.cs.slang │ ├── RenderPasses │ │ └── Shared │ │ │ └── PathTracer │ │ │ ├── PixelStatsShared.slang │ │ │ └── RayFootprintModes.slangh │ ├── dependencies.xml │ ├── RenderGraph │ │ └── BasePasses │ │ │ └── FullScreenPass.vs.slang │ └── Experimental │ │ └── Scene │ │ ├── Material │ │ ├── BCSDFConfig.slangh │ │ └── TexLODTypes.cpp │ │ └── Lights │ │ └── LightBVHSamplerSharedDefinitions.slang ├── Tools │ └── RenderGraphEditor │ │ └── Data │ │ └── DefaultPassIcon.png ├── Apps │ ├── make_new_project.bat │ ├── ProjectTemplate │ │ ├── ProjectTemplate.vcxproj.filters │ │ ├── ProjectTemplate.h │ │ └── ProjectTemplate.cpp │ ├── CudaInterop │ │ ├── FalcorCUDA.props │ │ ├── CopySurface.cu │ │ ├── README.md │ │ ├── FalcorCUDA.h │ │ └── CopySurface.h │ └── make_new_project.py ├── Externals │ ├── xoshiro │ │ ├── README.txt │ │ ├── splitmix64.c │ │ └── xoshiro128starstar.c │ ├── hypothesis │ │ ├── README.md │ │ └── LICENSE │ └── lz4_stream │ │ ├── README.md │ │ └── LICENSE.txt └── Mogwai │ ├── Data │ ├── SceneDebugger.py │ ├── BSDFViewer.py │ ├── VBufferPathTracer.py │ ├── CustomScripts │ │ ├── NRCPathTracer.py │ │ └── PathTracerPostFX.py │ ├── PathTracer.py │ └── ForwardRenderer.py │ ├── stdafx.cpp │ └── stdafx.h ├── demo.png ├── Falcor.sln.nvsettings ├── Outputs └── requirements.txt ├── CMakeLists.txt ├── .gitmodules ├── Build ├── packman │ ├── config.packman.xml │ ├── bootstrap │ │ ├── generate_temp_file_name.ps1 │ │ ├── generate_temp_folder.ps1 │ │ ├── fetch_file_from_s3.cmd │ │ ├── fetch_file_from_url.ps1 │ │ └── install_package.py │ ├── python.bat │ ├── python.sh │ └── packman.cmd ├── deployproject.bat ├── update_dependencies.bat ├── update_dependencies.sh ├── patchpropssheet.py └── prebuild.bat ├── Tools ├── update_dependencies.bat ├── dependencies.xml ├── update_legal_headers.bat └── notes │ └── PathTracer.md ├── .gitignore ├── README.md └── .editorconfig /Source/RenderPasses/NRCVoxelPT/NRCShared.slang: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cuteday/nrc/HEAD/demo.png -------------------------------------------------------------------------------- /Falcor.sln.nvsettings: -------------------------------------------------------------------------------- 1 | [WarpWatch] 2 | Expressions=@Invalid() 3 | -------------------------------------------------------------------------------- /Outputs/requirements.txt: -------------------------------------------------------------------------------- 1 | numpy 2 | scikit-image 3 | opencv-python -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.0.0) 2 | project(NeuralRadianceCache) 3 | 4 | -------------------------------------------------------------------------------- /Source/Falcor/Data/Framework/Nvidia.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cuteday/nrc/HEAD/Source/Falcor/Data/Framework/Nvidia.ico -------------------------------------------------------------------------------- /Source/Falcor/Data/Framework/Fonts/consolab.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cuteday/nrc/HEAD/Source/Falcor/Data/Framework/Fonts/consolab.ttf -------------------------------------------------------------------------------- /Source/Falcor/Data/Framework/Fonts/trebucbd.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cuteday/nrc/HEAD/Source/Falcor/Data/Framework/Fonts/trebucbd.ttf -------------------------------------------------------------------------------- /Source/Falcor/Data/Framework/Textures/Pause.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cuteday/nrc/HEAD/Source/Falcor/Data/Framework/Textures/Pause.jpg -------------------------------------------------------------------------------- /Source/Falcor/Data/Framework/Textures/Play.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cuteday/nrc/HEAD/Source/Falcor/Data/Framework/Textures/Play.jpg -------------------------------------------------------------------------------- /Source/Falcor/Data/Framework/Textures/Rewind.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cuteday/nrc/HEAD/Source/Falcor/Data/Framework/Textures/Rewind.jpg -------------------------------------------------------------------------------- /Source/Falcor/Data/Framework/Textures/Stop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cuteday/nrc/HEAD/Source/Falcor/Data/Framework/Textures/Stop.jpg -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule ".\\Source\\tiny-cuda-nn"] 2 | path = .\\Source\\tiny-cuda-nn 3 | url = https://github.com/cuteday/tiny-cuda-nn.git 4 | -------------------------------------------------------------------------------- /Source/Falcor/Data/Framework/Textures/NextFrame.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cuteday/nrc/HEAD/Source/Falcor/Data/Framework/Textures/NextFrame.jpg -------------------------------------------------------------------------------- /Source/Falcor/Data/Framework/Textures/PrevFrame.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cuteday/nrc/HEAD/Source/Falcor/Data/Framework/Textures/PrevFrame.jpg -------------------------------------------------------------------------------- /Source/Tools/RenderGraphEditor/Data/DefaultPassIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cuteday/nrc/HEAD/Source/Tools/RenderGraphEditor/Data/DefaultPassIcon.png -------------------------------------------------------------------------------- /Source/Falcor/Data/Framework/Fonts/DejaVu Sans Mono14.000000.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cuteday/nrc/HEAD/Source/Falcor/Data/Framework/Fonts/DejaVu Sans Mono14.000000.bin -------------------------------------------------------------------------------- /Source/Falcor/Data/Framework/Fonts/DejaVu Sans Mono14.000000.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cuteday/nrc/HEAD/Source/Falcor/Data/Framework/Fonts/DejaVu Sans Mono14.000000.dds -------------------------------------------------------------------------------- /Build/packman/config.packman.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCVoxelPT/Debug/NRCPixelStatsShared.slang: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Utils/HostDeviceShared.slangh" 3 | 4 | BEGIN_NAMESPACE_FALCOR 5 | 6 | 7 | END_NAMESPACE_FALCOR 8 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCPathTracer/Debug/NRCPixelStatsShared.slang: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Utils/HostDeviceShared.slangh" 3 | 4 | BEGIN_NAMESPACE_FALCOR 5 | 6 | 7 | END_NAMESPACE_FALCOR 8 | -------------------------------------------------------------------------------- /Build/deployproject.bat: -------------------------------------------------------------------------------- 1 | 2 | rem %1==projectDir %2==outputdir 3 | setlocal 4 | 5 | IF not exist %2\Data\ ( mkdir %2\Data >nul ) 6 | IF exist %1\data\ ( xcopy %1\Data\*.* %2\Data /s /y /d /q >nul) 7 | 8 | -------------------------------------------------------------------------------- /Tools/update_dependencies.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set PM_DISABLE_VS_WARNING=true 3 | call "%~dp0..\Build\packman\packman.cmd " pull "%~dp0dependencies.xml" --platform windows-x86_64 4 | if errorlevel 1 exit /b 1 5 | exit /b 0 6 | -------------------------------------------------------------------------------- /Tools/dependencies.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Source/Apps/make_new_project.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set pwd=%~dp0 4 | set project_dir=%pwd%..\..\ 5 | set python=%project_dir%Tools\.packman\Python\python.exe 6 | 7 | if not exist %python% call %project_dir%Tools\update_dependencies.bat 8 | 9 | call %python% %pwd%/make_new_project.py %* 10 | -------------------------------------------------------------------------------- /Tools/update_legal_headers.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set pwd=%~dp0 4 | set project_dir=%pwd%..\ 5 | set python=%project_dir%Tools\.packman\Python\python.exe 6 | 7 | if not exist %python% call %project_dir%Tools\update_dependencies.bat 8 | 9 | call %python% %pwd%update_legal_headers.py %* 10 | -------------------------------------------------------------------------------- /Build/update_dependencies.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | if [%1] == [] goto helpMsg 3 | set PM_DISABLE_VS_WARNING=true 4 | call "%~dp0packman\packman.cmd " pull "%1" --platform windows-x86_64 5 | if errorlevel 1 exit /b 1 6 | exit /b 0 7 | 8 | :helpMsg 9 | echo Please specify a dependency file 10 | exit /b 1 11 | -------------------------------------------------------------------------------- /Build/update_dependencies.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash +x 2 | export FALCOR_ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 3 | $FALCOR_ROOT_DIR/packman/packman pull "$FALCOR_ROOT_DIR/dependencies.xml" --platform linux-x86_64 4 | status=$? 5 | if [ "$status" -ne "0" ]; then 6 | echo "Error $status" 7 | exit 1 8 | fi 9 | -------------------------------------------------------------------------------- /Source/RenderPasses/make_new_pass_project.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set pwd=%~dp0 4 | set project_dir=%pwd%..\..\ 5 | set python=%project_dir%Tools\.packman\Python\python.exe 6 | 7 | if not exist %python% call %project_dir%Tools\update_dependencies.bat 8 | 9 | call %python% %pwd%/make_new_pass_project.py %* 10 | -------------------------------------------------------------------------------- /Source/RenderPasses/BlitPass/BlitPass.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Bin/* 2 | *.user 3 | *.sdf 4 | *.opensdf 5 | *.suo 6 | *.ptx 7 | *.pyc 8 | *.VC.db 9 | *.VC.opendb 10 | .vs/* 11 | .vscode/ 12 | *.pyc 13 | *.o 14 | *slang-dump-* 15 | *.mp4 16 | Source/Externals/.packman/* 17 | Media 18 | Tools/.packman 19 | Tests/data 20 | *.tlog 21 | *.log 22 | Build/ 23 | Outputs/Metrics 24 | Outputs/Image 25 | Outputs/Video -------------------------------------------------------------------------------- /Source/RenderPasses/ImageLoader/ImageLoader.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Source/Apps/ProjectTemplate/ProjectTemplate.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Source/RenderPasses/TemporalDelayPass/TemporalDelayPass.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Source/RenderPasses/PassLibraryTemplate/PassLibraryTemplate.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Source/Externals/xoshiro/README.txt: -------------------------------------------------------------------------------- 1 | xoshiro128starstar.c 2 | 3 | Reference implementation of the xoshiro128** pseudorandom number generator. 4 | Downloaded from http://xoshiro.di.unimi.it/xoshiro128starstar.c on 2018-11-20. 5 | 6 | splitmix64.c 7 | 8 | Reference implementation of the SplitMix64 pseudorandom number generator. 9 | Downloaded from http://xoshiro.di.unimi.it/splitmix64.c on 2018-11-20. 10 | -------------------------------------------------------------------------------- /Source/RenderPasses/RTAO/RTAO.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Source/RenderPasses/SkyBox/SkyBox.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Source/RenderPasses/DepthPass/DepthPass.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Source/RenderPasses/SimplePostFX/SimplePostFX.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Source/Mogwai/Data/SceneDebugger.py: -------------------------------------------------------------------------------- 1 | from falcor import * 2 | 3 | def render_graph_SceneDebugger(): 4 | g = RenderGraph('SceneDebugger') 5 | loadRenderPassLibrary('SceneDebugger.dll') 6 | SceneDebugger = createPass('SceneDebugger') 7 | g.addPass(SceneDebugger, 'SceneDebugger') 8 | g.markOutput('SceneDebugger.output') 9 | return g 10 | 11 | SceneDebugger = render_graph_SceneDebugger() 12 | try: m.addGraph(SceneDebugger) 13 | except NameError: None 14 | -------------------------------------------------------------------------------- /Source/RenderPasses/AccumulatePass/AccumulatePass.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Source/RenderPasses/RTLightingPass/RTLightingPass.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Source/Externals/hypothesis/README.md: -------------------------------------------------------------------------------- 1 | # hypothesis.h 2 | ## A collection of quantiles and utility functions for running Z, Chi^2, and Student's T hypothesis tests 3 | 4 | A variety of quantile functions are needed to perform statistical hypothesis 5 | tests, but these are missing from the C++ standard library. This compact header 6 | file-only library contains the most important quantiles; it is mostly a wrapper 7 | around a C++ port of the relevant functions from the Cephes math library. 8 | -------------------------------------------------------------------------------- /Source/RenderPasses/MinimalPathTracer/MinimalPathTracer.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Source/RenderPasses/FLIPPass/FLIPPass.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Source/RenderPasses/ForwardLightingPass/ForwardLightingPass.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Source/RenderPasses/SkyBox/Data/cube.obj: -------------------------------------------------------------------------------- 1 | o Cube 2 | v 1.000000 -1.000000 -1.000000 3 | v 1.000000 -1.000000 1.000000 4 | v -1.000000 -1.000000 1.000000 5 | v -1.000000 -1.000000 -1.000000 6 | v 1.000000 1.000000 -1.000000 7 | v 1.000000 1.000000 1.000000 8 | v -1.000000 1.000000 1.000000 9 | v -1.000000 1.000000 -1.000000 10 | s off 11 | f 1//1 2//1 3//1 4//1 12 | f 5//2 8//2 7//2 6//2 13 | f 1//3 5//3 6//3 2//3 14 | f 2//4 6//4 7//4 3//4 15 | f 3//5 7//5 8//5 4//5 16 | f 5//6 1//6 4//6 8//6 17 | -------------------------------------------------------------------------------- /Source/RenderPasses/BSDFViewer/BSDFViewer.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Source/RenderPasses/TestPasses/TestPasses.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Source/RenderPasses/SceneDebugger/SceneDebugger.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Source/RenderPasses/SSAO/SSAO.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Source/RenderPasses/MegakernelPathTracer/MegakernelPathTracer.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Source/RenderPasses/WhittedRayTracer/WhittedRayTracer.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Source/RenderPasses/PixelInspectorPass/PixelInspectorPass.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Source/RenderPasses/ToneMapper/ToneMapper.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCPathTracer/Data/default_nrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "loss": { 3 | "otype": "RelativeL2" 4 | }, 5 | "optimizer": { 6 | "otype": "Adam", 7 | "learning_rate": 5e-4, 8 | "beta1": 0.9, 9 | "beta2": 0.99, 10 | "epsilon": 1e-8, 11 | "l2_reg": 1e-8 12 | }, 13 | "encoding": { 14 | "otype": "NRC", 15 | "n_bins": 4, 16 | "n_frequencies": 12 17 | }, 18 | "network": { 19 | "otype": "FullyFusedMLP", 20 | "activation": "ReLU", 21 | "output_activation": "None", 22 | "n_neurons": 64, 23 | "n_hidden_layers": 5, 24 | "n_input_dims": 5, 25 | "n_output_dims": 3 26 | } 27 | } -------------------------------------------------------------------------------- /Source/RenderPasses/CSM/CSM.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCPathTracer/Data/default_nrc_ema.json: -------------------------------------------------------------------------------- 1 | { 2 | "loss": { 3 | "otype": "RelativeL2" 4 | }, 5 | "optimizer": { 6 | "otype": "Ema", 7 | "decay": 0.99, 8 | "nested": { 9 | "otype": "Adam", 10 | "learning_rate": 4.5e-3, 11 | "beta1": 0.9, 12 | "beta2": 0.99, 13 | "epsilon": 1e-8, 14 | "l2_reg": 1e-8 15 | } 16 | }, 17 | "encoding": { 18 | "otype": "NRC", 19 | "n_bins": 4, 20 | "n_frequencies": 12 21 | }, 22 | "network": { 23 | "otype": "FullyFusedMLP", 24 | "activation": "ReLU", 25 | "output_activation": "None", 26 | "n_neurons": 64, 27 | "n_hidden_layers": 5, 28 | "n_input_dims": 5, 29 | "n_output_dims": 3 30 | } 31 | } -------------------------------------------------------------------------------- /Source/Apps/ProjectTemplate/ProjectTemplate.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Falcor.h" 3 | 4 | using namespace Falcor; 5 | 6 | class ProjectTemplate : public IRenderer 7 | { 8 | public: 9 | void onLoad(RenderContext* pRenderContext) override; 10 | void onFrameRender(RenderContext* pRenderContext, const Fbo::SharedPtr& pTargetFbo) override; 11 | void onShutdown() override; 12 | void onResizeSwapChain(uint32_t width, uint32_t height) override; 13 | bool onKeyEvent(const KeyboardEvent& keyEvent) override; 14 | bool onMouseEvent(const MouseEvent& mouseEvent) override; 15 | void onHotReload(HotReloadFlags reloaded) override; 16 | void onGuiRender(Gui* pGui) override; 17 | 18 | private: 19 | }; 20 | -------------------------------------------------------------------------------- /Source/Mogwai/Data/BSDFViewer.py: -------------------------------------------------------------------------------- 1 | def render_graph_BSDFViewerGraph(): 2 | g = RenderGraph("BSDFViewerGraph") 3 | loadRenderPassLibrary("AccumulatePass.dll") 4 | loadRenderPassLibrary("BSDFViewer.dll") 5 | BSDFViewer = createPass("BSDFViewer") 6 | g.addPass(BSDFViewer, "BSDFViewer") 7 | AccumulatePass = createPass("AccumulatePass", {'enabled': True, 'precisionMode': AccumulatePrecision.Double}) 8 | g.addPass(AccumulatePass, "AccumulatePass") 9 | g.addEdge("BSDFViewer.output", "AccumulatePass.input") 10 | g.markOutput("AccumulatePass.output") 11 | return g 12 | 13 | BSDFViewerGraph = render_graph_BSDFViewerGraph() 14 | try: m.addGraph(BSDFViewerGraph) 15 | except NameError: None 16 | -------------------------------------------------------------------------------- /Build/packman/bootstrap/generate_temp_file_name.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Copyright 2019 NVIDIA CORPORATION 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | #> 16 | 17 | $out = [System.IO.Path]::GetTempFileName() 18 | Write-Host $out -------------------------------------------------------------------------------- /Source/RenderPasses/SVGFPass/SVGFPass.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCPathTracer/FalcorCUDA.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #include 5 | 6 | 7 | namespace FalcorCUDA 8 | { 9 | // Initializes the CUDA driver API. Returns true if successful, false otherwise. 10 | bool initCUDA(); 11 | 12 | cudaExternalMemory_t importExternalMemory(Falcor::Resource::SharedPtr pResource); 13 | void* mapExternalMemory(const cudaExternalMemory_t& externalMemory, unsigned long long size); 14 | 15 | void* importResourceToDevicePointer(Falcor::Resource::SharedPtr pResource); 16 | cudaMipmappedArray_t importTextureToMipmappedArray(Falcor::Texture::SharedPtr pTexture, uint32_t cudaUsageFlags); 17 | cudaSurfaceObject_t mapTextureToSurfaceObject(Falcor::Texture::SharedPtr pTexture, uint32_t cudaUsageFlags); 18 | }; 19 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCVoxelPT/FalcorCUDA.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | #include 5 | 6 | 7 | namespace FalcorCUDA 8 | { 9 | // Initializes the CUDA driver API. Returns true if successful, false otherwise. 10 | bool initCUDA(); 11 | 12 | cudaExternalMemory_t importExternalMemory(Falcor::Resource::SharedPtr pResource); 13 | void* mapExternalMemory(const cudaExternalMemory_t& externalMemory, unsigned long long size); 14 | 15 | void* importResourceToDevicePointer(Falcor::Resource::SharedPtr pResource); 16 | cudaMipmappedArray_t importTextureToMipmappedArray(Falcor::Texture::SharedPtr pTexture, uint32_t cudaUsageFlags); 17 | cudaSurfaceObject_t mapTextureToSurfaceObject(Falcor::Texture::SharedPtr pTexture, uint32_t cudaUsageFlags); 18 | }; 19 | -------------------------------------------------------------------------------- /Build/packman/python.bat: -------------------------------------------------------------------------------- 1 | :: Copyright 2019-2020 NVIDIA CORPORATION 2 | :: 3 | :: Licensed under the Apache License, Version 2.0 (the "License"); 4 | :: you may not use this file except in compliance with the License. 5 | :: You may obtain a copy of the License at 6 | :: 7 | :: http://www.apache.org/licenses/LICENSE-2.0 8 | :: 9 | :: Unless required by applicable law or agreed to in writing, software 10 | :: distributed under the License is distributed on an "AS IS" BASIS, 11 | :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | :: See the License for the specific language governing permissions and 13 | :: limitations under the License. 14 | 15 | @echo off 16 | setlocal 17 | 18 | call "%~dp0\packman" init 19 | set "PYTHONPATH=%PM_MODULE_DIR%;%PYTHONPATH%" 20 | set PYTHONNOUSERSITE=1 21 | "%PM_PYTHON%" -u %* 22 | -------------------------------------------------------------------------------- /Source/RenderPasses/OptixDenoiser/OptixDenoiser.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## NRC 2 | 3 | This is a naive and dirty implementation of the paper Real-time Neural Radiance Caching for Path Tracing. The main implementation is located at [here](Source/RenderPasses/NRCPathTracer). The ReSTIR part described in the paper is not implemented. 4 | 5 | These are some really old code implemented on an old versiton of Falcor, just for fun. The performance is slow due to my poor implementation. The noise of the 1-spp PT has reduced, but I have no confidence on the correctness of my implementation \_(:з」∠)\_. 6 | 7 |

Rendered at 1spp. Left: Default PT; Right: NRC.
8 | 9 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Topmost EditorConfig file; do not look at files higher up in the directory tree 2 | root = true 3 | 4 | # Set default editor config for all files: 5 | # - 4 spaces, no trailing whitespaces 6 | # - final newline for slightly cleaner diffs when changing the last line 7 | # - native end-of-line in case we want to open a file elsewhere, git converts to LF for non-Windows 8 | # - use utf-8 as default 9 | [*] 10 | indent_size = 4 11 | indent_style = space 12 | trim_trailing_whitespace = true 13 | insert_final_newline = true 14 | end_of_line = crlf 15 | charset = utf-8 16 | 17 | # Override trailing whitespace setting for Markdown since there it's actually useful 18 | [*.{md}] 19 | trim_trailing_whitespace = false 20 | 21 | # Override settings for project files to use the same settings as Visual Studio 22 | [*.{vcxproj,vcxproj.filters}] 23 | indent_size = 2 24 | insert_final_newline = false 25 | -------------------------------------------------------------------------------- /Build/packman/bootstrap/generate_temp_folder.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Copyright 2019 NVIDIA CORPORATION 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | #> 16 | 17 | param( 18 | [Parameter(Mandatory=$true)][string]$parentPath=$null 19 | ) 20 | [string] $name = [System.Guid]::NewGuid() 21 | $out = Join-Path $parentPath $name 22 | New-Item -ItemType Directory -Path ($out) | Out-Null 23 | Write-Host $out 24 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCPathTracer/Data/default_nrc_new.json: -------------------------------------------------------------------------------- 1 | { 2 | "loss": { 3 | "otype": "RelativeL2" 4 | }, 5 | "optimizer": { 6 | "otype": "Ema", 7 | "decay": 0.99, 8 | "nested": { 9 | "otype": "Adam", 10 | "learning_rate": 4.5e-3, 11 | "beta1": 0.9, 12 | "beta2": 0.99, 13 | "epsilon": 1e-8, 14 | "l2_reg": 1e-8 15 | } 16 | }, 17 | "encoding": { 18 | "otype": "Composite", 19 | "nested":[ 20 | { 21 | "n_dims_to_encode": 3, 22 | "otype": "TriangleWave", 23 | "n_frequencies": 12 24 | }, 25 | { 26 | "n_dims_to_encode": 5, 27 | "otype": "OneBlob", 28 | "n_bins": 4 29 | }, 30 | { 31 | "n_dims_to_encode": 6, 32 | "otype": "Identity" 33 | } 34 | ] 35 | }, 36 | "network": { 37 | "otype": "FullyFusedMLP", 38 | "activation": "ReLU", 39 | "output_activation": "None", 40 | "n_neurons": 64, 41 | "n_hidden_layers": 5, 42 | "n_input_dims": 5, 43 | "n_output_dims": 3 44 | } 45 | } -------------------------------------------------------------------------------- /Build/packman/python.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2019-2020 NVIDIA CORPORATION 4 | 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | 19 | PACKMAN_CMD="$(dirname "${BASH_SOURCE}")/packman" 20 | if [ ! -f "$PACKMAN_CMD" ]; then 21 | PACKMAN_CMD="${PACKMAN_CMD}.sh" 22 | fi 23 | source "$PACKMAN_CMD" init 24 | export PYTHONPATH="${PM_MODULE_DIR}:${PYTHONPATH}" 25 | export PYTHONNOUSERSITE=1 26 | "${PM_PYTHON}" -u "$@" 27 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCVoxelPT/Debug/NRCPixelStats.slang: -------------------------------------------------------------------------------- 1 | /** Functionality for collecting runtime stats in the path tracer. 2 | 3 | The host sets the following defines: 4 | 5 | _NRC_PIXEL_STATS_ENABLED Nonzero if stats should be collected. 6 | 7 | */ 8 | __exported import NRCPixelStatsShared; 9 | 10 | RWTexture2D gStatsInferencePathLength; 11 | RWTexture2D gStatsSuffixPathLength; 12 | 13 | #ifdef _NRC_PIXEL_STATS_ENABLED 14 | static uint2 gPixelStatsPixelNRC; 15 | #endif 16 | 17 | void logSetPixelNRC(uint2 pixel) 18 | { 19 | #ifdef _NRC_PIXEL_STATS_ENABLED 20 | gPixelStatsPixelNRC = pixel; 21 | #endif 22 | } 23 | 24 | void logInferencePathLength(uint length) 25 | { 26 | #ifdef _NRC_PIXEL_STATS_ENABLED 27 | gStatsInferencePathLength[gPixelStatsPixelNRC] = length; 28 | #endif 29 | } 30 | 31 | void logSuffixPathLength(uint length) 32 | { 33 | #ifdef _NRC_PIXEL_STATS_ENABLED 34 | gStatsSuffixPathLength[gPixelStatsPixelNRC] = length; 35 | #endif 36 | } 37 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCPathTracer/Debug/NRCPixelStats.slang: -------------------------------------------------------------------------------- 1 | /** Functionality for collecting runtime stats in the path tracer. 2 | 3 | The host sets the following defines: 4 | 5 | _NRC_PIXEL_STATS_ENABLED Nonzero if stats should be collected. 6 | 7 | */ 8 | __exported import NRCPixelStatsShared; 9 | 10 | RWTexture2D gStatsInferencePathLength; 11 | RWTexture2D gStatsSuffixPathLength; 12 | 13 | #ifdef _NRC_PIXEL_STATS_ENABLED 14 | static uint2 gPixelStatsPixelNRC; 15 | #endif 16 | 17 | void logSetPixelNRC(uint2 pixel) 18 | { 19 | #ifdef _NRC_PIXEL_STATS_ENABLED 20 | gPixelStatsPixelNRC = pixel; 21 | #endif 22 | } 23 | 24 | void logInferencePathLength(uint length) 25 | { 26 | #ifdef _NRC_PIXEL_STATS_ENABLED 27 | gStatsInferencePathLength[gPixelStatsPixelNRC] = length; 28 | #endif 29 | } 30 | 31 | void logSuffixPathLength(uint length) 32 | { 33 | #ifdef _NRC_PIXEL_STATS_ENABLED 34 | gStatsSuffixPathLength[gPixelStatsPixelNRC] = length; 35 | #endif 36 | } 37 | -------------------------------------------------------------------------------- /Source/Apps/CudaInterop/FalcorCUDA.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | $(FALCOR_CORE_DIRECTORY)\Externals\.packman\cuda\include;%(AdditionalIncludeDirectories) 9 | 10 | 11 | $(CudaToolkitLibDir);%(AdditionalLibraryDirectories) 12 | cudart_static.lib;%(AdditionalDependencies) 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCVoxelPT/Data/default_nrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "net": { 3 | "loss": { 4 | "otype": "RelativeL2" 5 | }, 6 | "optimizer": { 7 | "otype": "Ema", 8 | "decay": 0.99, 9 | "nested": { 10 | "otype": "Adam", 11 | "learning_rate": 1e-3, 12 | "beta1": 0.9, 13 | "beta2": 0.99, 14 | "epsilon": 1e-8, 15 | "l2_reg": 1e-8 16 | } 17 | }, 18 | "encoding": { 19 | "otype": "Composite", 20 | "nested": [ 21 | { 22 | "n_dims_to_encode": 3, 23 | "otype": "TriangleWave", 24 | "n_frequencies": 12 25 | }, 26 | { 27 | "n_dims_to_encode": 5, 28 | "otype": "OneBlob", 29 | "n_bins": 4 30 | }, 31 | { 32 | "n_dims_to_encode": 6, 33 | "otype": "Identity" 34 | } 35 | ] 36 | }, 37 | "network": { 38 | "otype": "CuteMLP", 39 | "activation": "ReLU", 40 | "output_activation": "None", 41 | "n_neurons": 64, 42 | "n_hidden_layers": 5, 43 | "n_input_dims": 5, 44 | "n_output_dims": 3 45 | } 46 | }, 47 | "voxel":{ 48 | "size": [3,3,3] 49 | } 50 | } -------------------------------------------------------------------------------- /Source/Apps/CudaInterop/CopySurface.cu: -------------------------------------------------------------------------------- 1 | #include "CopySurface.h" 2 | #include 3 | 4 | // The CUDA kernel. This sample simply copies the input surface. 5 | template 6 | __global__ void copySurface(cudaSurfaceObject_t input, cudaSurfaceObject_t output, unsigned int width, unsigned int height) 7 | { 8 | unsigned int x = blockIdx.x * blockDim.x + threadIdx.x; 9 | unsigned int y = blockIdx.y * blockDim.y + threadIdx.y; 10 | if (x < width && y < height) 11 | { 12 | T data; 13 | surf2Dread(&data, input, sizeof(T) * x, y); 14 | surf2Dwrite(data, output, sizeof(T) * x, y); 15 | } 16 | } 17 | 18 | // A wrapper function that launches the kernel. 19 | void launchCopySurface(cudaSurfaceObject_t input, cudaSurfaceObject_t output, unsigned int width, unsigned int height, unsigned int format) 20 | { 21 | dim3 dimBlock(16, 16); 22 | dim3 dimGrid((width + dimBlock.x - 1) / dimBlock.x, (height + dimBlock.y - 1) / dimBlock.y); 23 | if (format == cudaChannelFormatKindFloat) copySurface<<>>(input, output, width, height); 24 | else copySurface<<>>(input, output, width, height); 25 | } 26 | -------------------------------------------------------------------------------- /Source/Externals/xoshiro/splitmix64.c: -------------------------------------------------------------------------------- 1 | /* Written in 2015 by Sebastiano Vigna (vigna@acm.org) 2 | 3 | To the extent possible under law, the author has dedicated all copyright 4 | and related and neighboring rights to this software to the public domain 5 | worldwide. This software is distributed without any warranty. 6 | 7 | See . */ 8 | 9 | #include 10 | 11 | /* This is a fixed-increment version of Java 8's SplittableRandom generator 12 | See http://dx.doi.org/10.1145/2714064.2660195 and 13 | http://docs.oracle.com/javase/8/docs/api/java/util/SplittableRandom.html 14 | 15 | It is a very fast generator passing BigCrush, and it can be useful if 16 | for some reason you absolutely want 64 bits of state; otherwise, we 17 | rather suggest to use a xoroshiro128+ (for moderately parallel 18 | computations) or xorshift1024* (for massively parallel computations) 19 | generator. */ 20 | 21 | static uint64_t x; /* The state can be seeded with any value. */ 22 | 23 | uint64_t next() { 24 | uint64_t z = (x += 0x9e3779b97f4a7c15); 25 | z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9; 26 | z = (z ^ (z >> 27)) * 0x94d049bb133111eb; 27 | return z ^ (z >> 31); 28 | } 29 | -------------------------------------------------------------------------------- /Source/RenderPasses/Antialiasing/Antialiasing.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | FXAA 7 | 8 | 9 | TAA 10 | 11 | 12 | 13 | 14 | {d69c4530-d37a-41a3-aa88-251d480d1ee2} 15 | 16 | 17 | {7232c72b-f923-4ca7-973d-7d3cc9f05957} 18 | 19 | 20 | 21 | 22 | FXAA 23 | 24 | 25 | TAA 26 | 27 | 28 | 29 | 30 | FXAA 31 | 32 | 33 | TAA 34 | 35 | 36 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCPathTracer/DataStructure.slang: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Utils/HostDeviceShared.slangh" 3 | 4 | BEGIN_NAMESPACE_NRC 5 | 6 | struct RadianceQuery 7 | { 8 | float3 pos; // the frequency encoding needs inputs to be mapped into [-1, 1] 9 | float roughness;// 10 | float2 dir; // the oneblob encoding needs inputs to be mapped in [0, 1] 11 | float2 normal; // 12 | float3 diffuse; // these parameters are passed through, since they preserve linearity 13 | float _pad0; 14 | float3 specular; 15 | float _pad1; 16 | }; 17 | 18 | struct RadianceInfer 19 | { 20 | RadianceQuery query; 21 | uint2 pixel; 22 | float2 _pad0; 23 | }; 24 | 25 | struct RadianceSample 26 | { 27 | RadianceQuery query; 28 | // L_o (scattered radiance) = a * L_i + b 29 | int idx; // which query it belongs to? 30 | float3 a; // factor of scatter ray (bsdf sample) 31 | float3 b; // the direct sample part 32 | float _pad0; 33 | }; 34 | 35 | enum class NRCVisualizeMode { 36 | Result = 1, 37 | Radiance = 2, 38 | Factor = 3, 39 | Bias = 4, 40 | Reflectance = 5 41 | }; 42 | 43 | END_NAMESPACE_NRC 44 | -------------------------------------------------------------------------------- /Source/Mogwai/Data/VBufferPathTracer.py: -------------------------------------------------------------------------------- 1 | def render_graph_VBufferPathTracerGraph(): 2 | g = RenderGraph("VBufferPathTracerGraph") 3 | loadRenderPassLibrary("AccumulatePass.dll") 4 | loadRenderPassLibrary("GBuffer.dll") 5 | loadRenderPassLibrary("ToneMapper.dll") 6 | loadRenderPassLibrary("MegakernelPathTracer.dll") 7 | AccumulatePass = createPass("AccumulatePass", {'enabled': True}) 8 | g.addPass(AccumulatePass, "AccumulatePass") 9 | ToneMappingPass = createPass("ToneMapper", {'autoExposure': False, 'exposureCompensation': 0.0}) 10 | g.addPass(ToneMappingPass, "ToneMappingPass") 11 | VBufferRT = createPass("VBufferRT", {'samplePattern': SamplePattern.Stratified, 'sampleCount': 16}) 12 | g.addPass(VBufferRT, "VBufferRT") 13 | MegakernelPathTracer = createPass("MegakernelPathTracer", {'params': PathTracerParams(useVBuffer=1)}) 14 | g.addPass(MegakernelPathTracer, "MegakernelPathTracer") 15 | g.addEdge("VBufferRT.vbuffer", "MegakernelPathTracer.vbuffer") 16 | g.addEdge("MegakernelPathTracer.color", "AccumulatePass.input") 17 | g.addEdge("AccumulatePass.output", "ToneMappingPass.src") 18 | g.markOutput("ToneMappingPass.dst") 19 | return g 20 | 21 | VBufferPathTracerGraph = render_graph_VBufferPathTracerGraph() 22 | try: m.addGraph(VBufferPathTracerGraph) 23 | except NameError: None 24 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCVoxelPT/DataStructure.slang: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Utils/HostDeviceShared.slangh" 3 | 4 | BEGIN_NAMESPACE_NRC 5 | 6 | struct RadianceQuery 7 | { 8 | float3 pos; // the frequency encoding needs inputs to be mapped into [-1, 1] 9 | float roughness;// 10 | float2 dir; // the oneblob encoding needs inputs to be mapped in [0, 1] 11 | float2 normal; // 12 | float3 diffuse; // these parameters are passed through, since they preserve linearity 13 | float _pad0; 14 | float3 specular; 15 | int voxel_idx; // which voxel it belongs to? (in flatten index) 16 | uint2 pixel; // if this query belongs to a screen query... 17 | float2 _pad1; 18 | }; 19 | 20 | struct RadianceSample 21 | { 22 | RadianceQuery query; 23 | // L_o (scattered radiance) = a * L_i + b 24 | int idx; // which self-query it contains? 25 | float3 a; // factor of scatter ray (bsdf sample) 26 | float3 b; // the direct sample part 27 | float _pad0; 28 | //int voxel_idx; 29 | }; 30 | 31 | enum class NRCVisualizeMode { 32 | Result = 1, 33 | Radiance = 2, 34 | Factor = 3, 35 | Bias = 4, 36 | Reflectance = 5 37 | }; 38 | 39 | END_NAMESPACE_NRC 40 | -------------------------------------------------------------------------------- /Source/Apps/CudaInterop/README.md: -------------------------------------------------------------------------------- 1 | # Using CUDA with Falcor 2 | 3 | Download and run the CUDA Toolkit installer from [here](https://developer.nvidia.com/cuda-10.1-download-archive-update1). Navigate to the location the CUDA Toolkit was installed to (`C:\Program Files\NVIDIA GPU Computing Tools\CUDA` by default). Copy the `v.10.1` folder into `Source/Externals/.packman` and rename it `cuda`. 4 | 5 | The following will show how to create a CUDA project for use with Falcor: 6 | 1. Create a new CUDA Runtime project and add it to the Falcor solution. 7 | 2. In the Solution Explorer, right-click on `References` under the project and select `Add Reference`, then add `Falcor`. 8 | 3. Right-click on the project and go to `Build Dependencies -> Build Customizations`. Select `Find Existing`, and select `Source/Externals/.packman/cuda/extras/visual_studio_integration/MSBuildExtensions/CUDA 10.1.targets`. 9 | 4. Open the Property Manager and add the `Falcor` and `FalcorCUDA` property sheets to both Debug and Release. These are located in `Source/Falcor` and `Source/Samples/CudaInterop`, respectively. 10 | 5. Open the project's properties and go to `CUDA/C++` and set `CUDA Toolkit Custom Dir` to `$(SolutionDir)Source\Externals\.packman\cuda`, then go to `Linker -> System` and change the `SubSystem` to Windows. 11 | 12 | The CudaInterop sample is tested on CUDA Toolkit v.10.1.168. 13 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCPathTracer/Composite.cs.slang: -------------------------------------------------------------------------------- 1 | cbuffer CompositeCB { 2 | uint gVisualizeMode; 3 | bool gReflectanceFact; 4 | }; 5 | 6 | Texture2D bias; 7 | Texture2D factor; 8 | Texture2D radiance; 9 | Texture2D reflectance; 10 | RWTexture2D output; 11 | 12 | [numthreads(16, 16, 1)] 13 | void main(uint3 dispatchThreadId : SV_DispatchThreadID){ 14 | const uint2 pixel = dispatchThreadId.xy; 15 | float4 result = bias[pixel]; 16 | // float4 reflectance = float4(diffuse[pixel].xyz + specular[pixel].xyz, 1); 17 | // factor == 0 means we don't need to query the network, these situations include: 18 | // e.g. last hit on emissive primitives (envmaps, lights, etc.) 19 | if (any(factor[pixel])) { 20 | float4 defact = gReflectanceFact ? reflectance[pixel] : float4(1); 21 | result += factor[pixel] * radiance[pixel] * defact; 22 | } 23 | output[pixel] = result; 24 | if (gVisualizeMode > 1 && any(factor[pixel])) 25 | { 26 | if (gVisualizeMode == 2) 27 | output[pixel] = radiance[pixel]; 28 | else if (gVisualizeMode == 3) 29 | output[pixel] = factor[pixel]; 30 | else if (gVisualizeMode == 4) 31 | output[pixel] = bias[pixel]; 32 | else if (gVisualizeMode == 5) 33 | output[pixel] = reflectance[pixel]; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCVoxelPT/Composite.cs.slang: -------------------------------------------------------------------------------- 1 | cbuffer CompositeCB { 2 | uint gVisualizeMode; 3 | bool gReflectanceFact; 4 | }; 5 | 6 | Texture2D bias; 7 | Texture2D factor; 8 | Texture2D radiance; 9 | Texture2D reflectance; 10 | RWTexture2D output; 11 | 12 | [numthreads(16, 16, 1)] 13 | void main(uint3 dispatchThreadId : SV_DispatchThreadID){ 14 | const uint2 pixel = dispatchThreadId.xy; 15 | float4 result = bias[pixel]; 16 | // float4 reflectance = float4(diffuse[pixel].xyz + specular[pixel].xyz, 1); 17 | // factor == 0 means we don't need to query the network, these situations include: 18 | // e.g. last hit on emissive primitives (envmaps, lights, etc.) 19 | if (any(factor[pixel])) { 20 | float4 defact = gReflectanceFact ? reflectance[pixel] : float4(1); 21 | result += factor[pixel] * radiance[pixel] * defact; 22 | } 23 | output[pixel] = result; 24 | if (gVisualizeMode > 1 && any(factor[pixel])) 25 | { 26 | if (gVisualizeMode == 2) 27 | output[pixel] = radiance[pixel]; 28 | else if (gVisualizeMode == 3) 29 | output[pixel] = factor[pixel]; 30 | else if (gVisualizeMode == 4) 31 | output[pixel] = bias[pixel]; 32 | else if (gVisualizeMode == 5) 33 | output[pixel] = reflectance[pixel]; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCVoxelPT/Network.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #ifdef __NVCC__ 10 | #define NRC_CALLABLE __host__ __device__ 11 | #else 12 | #define NRC_CALLABLE 13 | #endif 14 | 15 | #include "DataStructure.slang" 16 | 17 | namespace NRC { 18 | 19 | 20 | class NRCNetwork { 21 | 22 | public: 23 | using SharedPtr = std::shared_ptr; 24 | using WeakPtr = std::weak_ptr; 25 | using SharedConstPtr = std::shared_ptr; 26 | 27 | NRCNetwork(); 28 | ~NRCNetwork(); 29 | 30 | void initializeNetwork(); 31 | void reset(); 32 | float& learningRate() { return learning_rate; }; 33 | 34 | __host__ void beginFrame(uint32_t* counterBufferDevice); 35 | __host__ void inference(RadianceQuery* queries, Falcor::uint2* pixels, cudaSurfaceObject_t output); 36 | __host__ void inference(RadianceQuery* queries, cudaSurfaceObject_t output, uint32_t width, uint32_t height); 37 | __host__ void train(RadianceQuery* self_queries, uint32_t* self_query_counter, 38 | RadianceSample* training_samples, uint32_t* training_sample_counter, float& loss); 39 | 40 | private: 41 | uint32_t seed = 7272u; 42 | float learning_rate = 1e-4f; 43 | }; 44 | } 45 | 46 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCPathTracer/Network.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #ifdef __NVCC__ 10 | #define NRC_CALLABLE __host__ __device__ 11 | #else 12 | #define NRC_CALLABLE 13 | #endif 14 | 15 | #include "DataStructure.slang" 16 | 17 | namespace NRC { 18 | 19 | 20 | class NRCNetwork { 21 | 22 | public: 23 | using SharedPtr = std::shared_ptr; 24 | using WeakPtr = std::weak_ptr; 25 | using SharedConstPtr = std::shared_ptr; 26 | 27 | NRCNetwork(); 28 | ~NRCNetwork(); 29 | 30 | void initializeNetwork(); 31 | void reset(); 32 | float& learningRate() { return learning_rate; }; 33 | 34 | __host__ void beginFrame(uint32_t* counterBufferDevice); 35 | __host__ void inference(RadianceQuery* queries, Falcor::uint2* pixels, cudaSurfaceObject_t output); 36 | __host__ void inference(RadianceQuery* queries, cudaSurfaceObject_t output, uint32_t width, uint32_t height); 37 | __host__ void train(RadianceQuery* self_queries, uint32_t* self_query_counter, 38 | RadianceSample* training_samples, uint32_t* training_sample_counter, float& loss); 39 | 40 | private: 41 | uint32_t seed = 7272u; 42 | float learning_rate = 1e-4f; 43 | }; 44 | } 45 | 46 | -------------------------------------------------------------------------------- /Source/RenderPasses/PassLibraryTemplate/PassLibraryTemplate.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Falcor.h" 3 | #include "FalcorExperimental.h" 4 | 5 | using namespace Falcor; 6 | 7 | class RenderPassTemplate : public RenderPass 8 | { 9 | public: 10 | using SharedPtr = std::shared_ptr; 11 | 12 | /** Create a new render pass object. 13 | \param[in] pRenderContext The render context. 14 | \param[in] dict Dictionary of serialized parameters. 15 | \return A new object, or an exception is thrown if creation failed. 16 | */ 17 | static SharedPtr create(RenderContext* pRenderContext = nullptr, const Dictionary& dict = {}); 18 | 19 | virtual std::string getDesc() override; 20 | virtual Dictionary getScriptingDictionary() override; 21 | virtual RenderPassReflection reflect(const CompileData& compileData) override; 22 | virtual void compile(RenderContext* pContext, const CompileData& compileData) override {} 23 | virtual void execute(RenderContext* pRenderContext, const RenderData& renderData) override; 24 | virtual void renderUI(Gui::Widgets& widget) override; 25 | virtual void setScene(RenderContext* pRenderContext, const Scene::SharedPtr& pScene) override {} 26 | virtual bool onMouseEvent(const MouseEvent& mouseEvent) override { return false; } 27 | virtual bool onKeyEvent(const KeyboardEvent& keyEvent) override { return false; } 28 | 29 | private: 30 | RenderPassTemplate() = default; 31 | }; 32 | -------------------------------------------------------------------------------- /Source/Externals/lz4_stream/README.md: -------------------------------------------------------------------------------- 1 | lz4_stream - A C++ stream using LZ4 (de)compression 2 | =================================================== 3 | 4 | lz4_stream is a simple wrapper that uses C++ streams for compressing and decompressing data using the [LZ4 compression library] 5 | 6 | Usage 7 | ----- 8 | 9 | Look at lz4\_compress.cpp and lz4\_decompress.cpp for example command line programs that can compress and decompress using this stream library. 10 | 11 | Building 12 | -------- 13 | 14 | ``` 15 | mkdir build 16 | cd build 17 | cmake .. 18 | make 19 | ``` 20 | 21 | Requirements 22 | ------------ 23 | 24 | The [LZ4 compression library] is required to use this library. 25 | 26 | Build status 27 | ------------ 28 | 29 | Ubuntu and OSX (GCC/Clang): 30 | 31 | [![Build Status](https://travis-ci.org/laudrup/lz4_stream.png)](https://travis-ci.org/laudrup/lz4_stream) 32 | 33 | Windows (MS C++): 34 | 35 | [![Build status](https://ci.appveyor.com/api/projects/status/xrp8bjf9217broom?svg=true)](https://ci.appveyor.com/project/laudrup/lz4-stream) 36 | 37 | Code coverage (codecov.io): 38 | 39 | [![codecov](https://codecov.io/gh/laudrup/lz4_stream/branch/master/graph/badge.svg)](https://codecov.io/gh/laudrup/lz4_stream) 40 | 41 | License 42 | ------- 43 | 44 | Standard BSD 3-Clause License as used by the LZ4 library. 45 | 46 | [LZ4 compression library]: https://github.com/lz4/lz4 47 | [cmake]: http://cmake.org 48 | [Google Test Framework]: https://github.com/google/googletest 49 | -------------------------------------------------------------------------------- /Source/RenderPasses/Utils/Utils.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | GaussianBlur 7 | 8 | 9 | Composite 10 | 11 | 12 | 13 | 14 | {f5ad0f5c-6bfe-400d-829d-339405ec579b} 15 | 16 | 17 | {4ce3ad03-f33f-4ee3-9083-e5a9c3a6aee1} 18 | 19 | 20 | 21 | 22 | GaussianBlur 23 | 24 | 25 | Composite 26 | 27 | 28 | 29 | 30 | GaussianBlur 31 | 32 | 33 | Composite 34 | 35 | 36 | Composite 37 | 38 | 39 | -------------------------------------------------------------------------------- /Build/patchpropssheet.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | 4 | def patchGroup(propSheet, group, val): 5 | groupStart = "<" + group + ">" 6 | groupEnd = "" 7 | s = propSheet.find(groupStart) 8 | e = propSheet.find(groupEnd) 9 | if(s == -1 or e == -1): 10 | sys.exit("Can't find a `" + groupStart + "` section in the file. This is probably because someone deleted it for the property sheet. Revert the changes and try again.\n") 11 | 12 | if(s >= e): 13 | sys.exit("The property sheet is corrupted. `" + groupEnd + "` can't appear before `" + groupStart + "` \n") 14 | 15 | s += len(groupStart) 16 | propSheet = propSheet[:s] + val + propSheet[e:] 17 | return propSheet 18 | 19 | if(len(sys.argv) != 4): 20 | sys.exit("Usage:\npatchpropssheet.py ") 21 | 22 | coreDir = sys.argv[1] 23 | solutionDir = sys.argv[2] 24 | backend = sys.argv[3] 25 | propsFileName = coreDir + "\\Falcor\\falcor.props" 26 | # Open and read the file 27 | f = open(propsFileName) 28 | propSheet = f.read() 29 | f.close() 30 | 31 | # Get a relative path from the Current Solution Directory to the Falcor Core Directory. 32 | relcorepath = os.path.relpath(coreDir, solutionDir) 33 | coreDir = "$(SolutionDir)\\" + relcorepath 34 | 35 | propSheet = patchGroup(propSheet, "FALCOR_CORE_DIRECTORY", coreDir) 36 | propSheet = patchGroup(propSheet, "FALCOR_BACKEND", backend) 37 | 38 | # Save the file 39 | f = open(propsFileName, "w") 40 | f.write(propSheet) 41 | f.close() -------------------------------------------------------------------------------- /Build/prebuild.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem %1 -> Falcor Core Directory Path 4 | rem %2 -> Solution Directory Path 5 | rem %3 -> Project Directory Path 6 | rem %4 -> Platform Name. 7 | rem %5 -> Platform Short Name. 8 | rem %6 -> Configuration. 9 | rem %7 -> Output Directory 10 | 11 | 12 | rem echo "Falcor Core Directory Path:" 13 | rem echo %1 14 | 15 | rem echo "Solution Directory Path:" 16 | rem echo %2 17 | 18 | rem echo "Project Directory Path:" 19 | rem echo %3 20 | 21 | rem echo "Platform Name:" 22 | rem echo %4 23 | 24 | rem echo "Platform Short Name:" 25 | rem echo %5 26 | 27 | rem echo "Configuration:" 28 | rem echo %6 29 | 30 | rem echo "Output Directory:" 31 | rem echo %7 32 | 33 | 34 | rem Set the Falcor Backend to D3D12 by default. 35 | set falcor_backend=FALCOR_D3D12 36 | 37 | rem Set the Falcor Backend according to the Build Configuration. 38 | if /I "%6"=="DebugD3D12" set falcor_backend=FALCOR_D3D12 39 | if /I "%6"=="ReleaseD3D12" set falcor_backend=FALCOR_D3D12 40 | 41 | if /I "%6"=="DebugVK" set falcor_backend=FALCOR_VK 42 | if /I "%6"=="ReleaseVK" set falcor_backend=FALCOR_VK 43 | 44 | rem Call Update Dependencies - Runs packman. 45 | call %~dp0\update_dependencies.bat %1\Falcor\dependencies.xml 46 | if errorlevel 1 exit /b 1 47 | 48 | %1\Externals\.packman\python\python.exe %~dp0\patchpropssheet.py %1 %2 %falcor_backend% 49 | if errorlevel 1 exit /b 1 50 | if exist %1\Internal\internal_dependencies.xml (call %~dp0\update_dependencies.bat %1\Internal\internal_dependencies.xml) 51 | if errorlevel 1 exit /b 1 52 | -------------------------------------------------------------------------------- /Source/Apps/make_new_project.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import argparse 3 | from pathlib import Path 4 | 5 | SAMPLES_DIR = Path(sys.argv[0]).parent 6 | EXCLUDE_EXT = ['.user'] 7 | TEMPLATE_NAME = 'ProjectTemplate' 8 | 9 | def create_project(name): 10 | # Source and destination directories. 11 | src_dir = SAMPLES_DIR / TEMPLATE_NAME 12 | dst_dir = SAMPLES_DIR / name 13 | 14 | print(f'Creating project "{name}":') 15 | 16 | # Check that destination does not exist. 17 | if dst_dir.exists(): 18 | print(f'Project "{name}" already exists!') 19 | return False 20 | 21 | # Create destination folder. 22 | dst_dir.mkdir() 23 | 24 | # Copy project template. 25 | for src_file in filter(lambda f: not f.suffix in EXCLUDE_EXT, src_dir.iterdir()): 26 | dst_file = dst_dir / (src_file.name.replace(TEMPLATE_NAME, name)) 27 | 28 | print(f'Writing {dst_file}.') 29 | 30 | # Replace all occurrences 'ProjectTemplate' with new project name. 31 | content = src_file.read_text(encoding='utf-8-sig') 32 | content = content.replace(TEMPLATE_NAME, name) 33 | dst_file.write_text(content) 34 | 35 | return True 36 | 37 | 38 | def main(): 39 | parser = argparse.ArgumentParser(description='Script to create a new Falcor sample project.') 40 | parser.add_argument('name', help='Project name') 41 | args = parser.parse_args() 42 | 43 | success = create_project(args.name) 44 | 45 | return 0 if success else 1 46 | 47 | if __name__ == '__main__': 48 | main() 49 | -------------------------------------------------------------------------------- /Source/Externals/hypothesis/LICENSE: -------------------------------------------------------------------------------- 1 | Redistribution and use in source and binary forms, with or without 2 | modification, are permitted provided that the following conditions are met: 3 | * Redistributions of source code must retain the above copyright 4 | notice, this list of conditions and the following disclaimer. 5 | * Redistributions in binary form must reproduce the above copyright 6 | notice, this list of conditions and the following disclaimer in the 7 | documentation and/or other materials provided with the distribution. 8 | * Neither the name of the nor the 9 | names of its contributors may be used to endorse or promote products 10 | derived from this software without specific prior written permission. 11 | 12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 13 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 14 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 15 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 16 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 17 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 18 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 19 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 20 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 21 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 | -------------------------------------------------------------------------------- /Source/RenderPasses/PixelInspectorPass/Data/GBufferRasterInspector.py: -------------------------------------------------------------------------------- 1 | from falcor import * 2 | 3 | def render_graph_DefaultRenderGraph(): 4 | g = RenderGraph('DefaultRenderGraph') 5 | loadRenderPassLibrary('GBuffer.dll') 6 | loadRenderPassLibrary('PixelInspectorPass.dll') 7 | GBufferRaster = createPass('GBufferRaster', {'samplePattern': SamplePattern.Center}) 8 | g.addPass(GBufferRaster, 'GBufferRaster') 9 | PixelInspectorPass = createPass('PixelInspectorPass') 10 | g.addPass(PixelInspectorPass, 'PixelInspectorPass') 11 | g.addEdge('GBufferRaster.posW', 'PixelInspectorPass.posW') 12 | g.addEdge('GBufferRaster.normW', 'PixelInspectorPass.normW') 13 | g.addEdge('GBufferRaster.tangentW', 'PixelInspectorPass.tangentW') 14 | g.addEdge('GBufferRaster.texC', 'PixelInspectorPass.texC') 15 | g.addEdge('GBufferRaster.diffuseOpacity', 'PixelInspectorPass.diffuseOpacity') 16 | g.addEdge('GBufferRaster.specRough', 'PixelInspectorPass.specRough') 17 | g.addEdge('GBufferRaster.emissive', 'PixelInspectorPass.emissive') 18 | g.addEdge('GBufferRaster.matlExtra', 'PixelInspectorPass.matlExtra') 19 | g.addEdge('GBufferRaster.faceNormalW', 'PixelInspectorPass.faceNormalW') 20 | g.addEdge('GBufferRaster.vbuffer', 'PixelInspectorPass.vbuffer') 21 | g.addEdge('GBufferRaster', 'PixelInspectorPass') 22 | g.markOutput('GBufferRaster.faceNormalW') 23 | return g 24 | 25 | DefaultRenderGraph = render_graph_DefaultRenderGraph() 26 | try: m.addGraph(DefaultRenderGraph) 27 | except NameError: None 28 | -------------------------------------------------------------------------------- /Source/RenderPasses/PassLibraryTemplate/PassLibraryTemplate.cpp: -------------------------------------------------------------------------------- 1 | #include "PassLibraryTemplate.h" 2 | 3 | 4 | namespace 5 | { 6 | const char kDesc[] = "Insert pass description here"; 7 | } 8 | 9 | // Don't remove this. it's required for hot-reload to function properly 10 | extern "C" __declspec(dllexport) const char* getProjDir() 11 | { 12 | return PROJECT_DIR; 13 | } 14 | 15 | extern "C" __declspec(dllexport) void getPasses(Falcor::RenderPassLibrary& lib) 16 | { 17 | lib.registerClass("RenderPassTemplate", kDesc, RenderPassTemplate::create); 18 | } 19 | 20 | RenderPassTemplate::SharedPtr RenderPassTemplate::create(RenderContext* pRenderContext, const Dictionary& dict) 21 | { 22 | SharedPtr pPass = SharedPtr(new RenderPassTemplate); 23 | return pPass; 24 | } 25 | 26 | std::string RenderPassTemplate::getDesc() { return kDesc; } 27 | 28 | Dictionary RenderPassTemplate::getScriptingDictionary() 29 | { 30 | return Dictionary(); 31 | } 32 | 33 | RenderPassReflection RenderPassTemplate::reflect(const CompileData& compileData) 34 | { 35 | // Define the required resources here 36 | RenderPassReflection reflector; 37 | //reflector.addOutput("dst"); 38 | //reflector.addInput("src"); 39 | return reflector; 40 | } 41 | 42 | void RenderPassTemplate::execute(RenderContext* pRenderContext, const RenderData& renderData) 43 | { 44 | // renderData holds the requested resources 45 | // auto& pTexture = renderData["src"]->asTexture(); 46 | } 47 | 48 | void RenderPassTemplate::renderUI(Gui::Widgets& widget) 49 | { 50 | } 51 | -------------------------------------------------------------------------------- /Source/Apps/CudaInterop/FalcorCUDA.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Core/Framework.h" 3 | #include "Core/API/Texture.h" 4 | #include "Core/API/RenderContext.h" 5 | 6 | #include 7 | 8 | namespace FalcorCUDA 9 | { 10 | /** Initializes the CUDA driver API. Returns true if successful, false otherwise. 11 | */ 12 | bool initCUDA(); 13 | 14 | /** Imports the texture into a CUDA mipmapped array and returns the array in mipmappedArray. This method should only be called once per 15 | texture resource. 16 | \param pTex Pointer to the texture being imported 17 | \param mipmappedArray Reference to the array to import to 18 | \param usageFlags The requested flags to be bound to the mipmapped array 19 | \return True if successful, false otherwise 20 | */ 21 | bool importTextureToMipmappedArray(Falcor::Texture::SharedPtr pTex, cudaMipmappedArray_t& mipmappedArray, uint32_t cudaUsageFlags); 22 | 23 | /** Maps a texture to a surface object which can be read and written within a CUDA kernel. 24 | This method should only be called once per texture on initial load. Store the returned surface object for repeated use. 25 | \param pTex Pointer to the texture being mapped 26 | \param usageFlags The requested flags to be bound to the underlying mipmapped array that will be used to create the surface object 27 | \return The surface object that the input texture is bound to 28 | */ 29 | cudaSurfaceObject_t mapTextureToSurface(Falcor::Texture::SharedPtr pTex, uint32_t usageFlags); 30 | }; 31 | -------------------------------------------------------------------------------- /Build/packman/bootstrap/fetch_file_from_s3.cmd: -------------------------------------------------------------------------------- 1 | :: Copyright 2019 NVIDIA CORPORATION 2 | :: 3 | :: Licensed under the Apache License, Version 2.0 (the "License"); 4 | :: you may not use this file except in compliance with the License. 5 | :: You may obtain a copy of the License at 6 | :: 7 | :: http://www.apache.org/licenses/LICENSE-2.0 8 | :: 9 | :: Unless required by applicable law or agreed to in writing, software 10 | :: distributed under the License is distributed on an "AS IS" BASIS, 11 | :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | :: See the License for the specific language governing permissions and 13 | :: limitations under the License. 14 | 15 | :: You need to specify as input to this command 16 | @setlocal 17 | @set PACKAGE_NAME=%1 18 | @set TARGET_PATH=%2 19 | 20 | @echo Fetching %PACKAGE_NAME% ... 21 | 22 | @powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0fetch_file_from_s3.ps1" -sourceName %PACKAGE_NAME% ^ 23 | -output %TARGET_PATH% 24 | :: A bug in powershell prevents the errorlevel code from being set when using the -File execution option 25 | :: We must therefore do our own failure analysis, basically make sure the file exists and is larger than 0 bytes: 26 | @if not exist %TARGET_PATH% goto ERROR_DOWNLOAD_FAILED 27 | @if %~z2==0 goto ERROR_DOWNLOAD_FAILED 28 | 29 | @endlocal 30 | @exit /b 0 31 | 32 | :ERROR_DOWNLOAD_FAILED 33 | @echo Failed to download file from S3 34 | @echo Most likely because endpoint cannot be reached or file %PACKAGE_NAME% doesn't exist 35 | @endlocal 36 | @exit /b 1 -------------------------------------------------------------------------------- /Source/Externals/lz4_stream/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Kasper Laudrup 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | 3. Neither the name of the copyright holder nor the names of its 16 | contributors may be used to endorse or promote products derived from 17 | this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /Source/RenderPasses/make_new_pass_project.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import argparse 3 | from pathlib import Path 4 | 5 | RENDER_PASSES_DIR = Path(sys.argv[0]).parent 6 | EXCLUDE_EXT = ['.user'] 7 | TEMPLATE_NAME = 'PassLibraryTemplate' 8 | 9 | def create_project(name): 10 | # Source and destination directories. 11 | src_dir = RENDER_PASSES_DIR / TEMPLATE_NAME 12 | dst_dir = RENDER_PASSES_DIR / name 13 | 14 | print(f'Creating project "{name}":') 15 | 16 | # Check that destination does not exist. 17 | if dst_dir.exists(): 18 | print(f'Project "{name}" already exists!') 19 | return False 20 | 21 | # Create destination folder. 22 | dst_dir.mkdir() 23 | 24 | # Copy project template. 25 | for src_file in filter(lambda f: not f.suffix in EXCLUDE_EXT, src_dir.iterdir()): 26 | dst_file = dst_dir / (src_file.name.replace(TEMPLATE_NAME, name)) 27 | 28 | print(f'Writing {dst_file}.') 29 | 30 | # Replace all occurrences 'PassLibraryTemplate' and 'RenderPassTemplate' with new project name. 31 | content = src_file.read_text(encoding='utf-8-sig') 32 | content = content.replace(TEMPLATE_NAME, name) 33 | content = content.replace('RenderPassTemplate', name) 34 | dst_file.write_text(content) 35 | 36 | return True 37 | 38 | 39 | def main(): 40 | parser = argparse.ArgumentParser(description='Script to create a new Falcor render pass project.') 41 | parser.add_argument('name', help='Project name') 42 | args = parser.parse_args() 43 | 44 | success = create_project(args.name) 45 | 46 | return 0 if success else 1 47 | 48 | if __name__ == '__main__': 49 | main() 50 | -------------------------------------------------------------------------------- /Source/Falcor/ShaderSource.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 12 | 13 | 14 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | $(BuildDependsOn);ShaderSourceCopy;ShaderSourceCopyFlat 34 | $(CleanDependsOn);ShaderSourceClean;ShaderSourceCleanFlat 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Source/Apps/ProjectTemplate/ProjectTemplate.cpp: -------------------------------------------------------------------------------- 1 | #include "ProjectTemplate.h" 2 | uint32_t mSampleGuiWidth = 250; 3 | uint32_t mSampleGuiHeight = 200; 4 | uint32_t mSampleGuiPositionX = 20; 5 | uint32_t mSampleGuiPositionY = 40; 6 | 7 | void ProjectTemplate::onGuiRender(Gui* pGui) 8 | { 9 | Gui::Window w(pGui, "Falcor", { 250, 200 }); 10 | gpFramework->renderGlobalUI(pGui); 11 | w.text("Hello from ProjectTemplate"); 12 | if (w.button("Click Here")) 13 | { 14 | msgBox("Now why would you do that?"); 15 | } 16 | } 17 | 18 | void ProjectTemplate::onLoad(RenderContext* pRenderContext) 19 | { 20 | } 21 | 22 | void ProjectTemplate::onFrameRender(RenderContext* pRenderContext, const Fbo::SharedPtr& pTargetFbo) 23 | { 24 | const float4 clearColor(0.38f, 0.52f, 0.10f, 1); 25 | pRenderContext->clearFbo(pTargetFbo.get(), clearColor, 1.0f, 0, FboAttachmentType::All); 26 | } 27 | 28 | void ProjectTemplate::onShutdown() 29 | { 30 | } 31 | 32 | bool ProjectTemplate::onKeyEvent(const KeyboardEvent& keyEvent) 33 | { 34 | return false; 35 | } 36 | 37 | bool ProjectTemplate::onMouseEvent(const MouseEvent& mouseEvent) 38 | { 39 | return false; 40 | } 41 | 42 | void ProjectTemplate::onHotReload(HotReloadFlags reloaded) 43 | { 44 | } 45 | 46 | void ProjectTemplate::onResizeSwapChain(uint32_t width, uint32_t height) 47 | { 48 | } 49 | 50 | int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nShowCmd) 51 | { 52 | ProjectTemplate::UniquePtr pRenderer = std::make_unique(); 53 | SampleConfig config; 54 | config.windowDesc.title = "Falcor Project Template"; 55 | config.windowDesc.resizableWindow = true; 56 | Sample::run(config, pRenderer); 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCPathTracer/NRC.cpp: -------------------------------------------------------------------------------- 1 | #include "NRC.h" 2 | #include "Parameters.h" 3 | 4 | using namespace Falcor; 5 | 6 | namespace NRC { 7 | 8 | NRCInterface::NRCInterface(){ 9 | if (!FalcorCUDA::initCUDA()) { 10 | Falcor::logFatal("Cuda init failed"); 11 | return; 12 | } 13 | logInfo("NRCInterface::working directory: " + std::filesystem::current_path().string()); 14 | logInfo("NRCInferface::creating and initializing network"); 15 | mNetwork = NRCNetwork::SharedPtr(new NRCNetwork()); 16 | } 17 | 18 | void NRCInterface::beginFrame() 19 | { 20 | mNetwork->beginFrame(mFalcorResources.counterBufferPtr); 21 | } 22 | 23 | void NRCInterface::trainFrame() 24 | { 25 | float loss; 26 | mNetwork->train(mFalcorResources.trainingQuery, mFalcorResources.trainingQueryCounter, 27 | mFalcorResources.trainingSample, mFalcorResources.trainingSampleCounter, loss); 28 | mStats.n_frames++; 29 | mStats.training_loss_avg = mStats.ema_factor * mStats.training_loss_avg + (1 - mStats.ema_factor) * loss; 30 | 31 | if (mStats.n_frames % mStats.print_every == 0) { 32 | printStats(); 33 | } 34 | } 35 | 36 | void NRCInterface::inferenceFrame() 37 | { 38 | mNetwork->inference(mFalcorResources.screenQuery, mFalcorResources.inferenceQueryPixel, mFalcorResources.screenResult); 39 | } 40 | 41 | void NRCInterface::printStats() 42 | { 43 | std::stringstream ss; 44 | ss << "Current frame: " << mStats.n_frames << "loss: " << mStats.training_loss_avg; 45 | Falcor::logInfo(ss.str()); 46 | } 47 | 48 | void NRCInterface::resetParameters() 49 | { 50 | mNetwork->reset(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Source/Falcor/stdafx.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #include "stdafx.h" 29 | -------------------------------------------------------------------------------- /Source/Mogwai/stdafx.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #include "stdafx.h" 29 | -------------------------------------------------------------------------------- /Source/Falcor/stdafx.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #pragma once 29 | #include "Falcor.h" 30 | -------------------------------------------------------------------------------- /Build/packman/bootstrap/fetch_file_from_url.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | Copyright 2019 NVIDIA CORPORATION 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | #> 16 | 17 | param( 18 | [Parameter(Mandatory=$true)][string]$sourceUrl=$null, 19 | [Parameter(Mandatory=$true)][string]$output=$null 20 | ) 21 | $source = $sourceUrl 22 | $filename = $output 23 | 24 | $req = [System.Net.httpwebrequest]::Create($source) 25 | $req.cookiecontainer = New-Object System.net.CookieContainer 26 | 27 | Write-Host "Connecting to $source ..." 28 | $res = $req.GetResponse() 29 | 30 | if($res.StatusCode -eq "OK") { 31 | Write-Host "Downloading ..." 32 | [int]$goal = $res.ContentLength 33 | $reader = $res.GetResponseStream() 34 | $writer = new-object System.IO.FileStream $fileName, "Create" 35 | [byte[]]$buffer = new-object byte[] 4096 36 | [int]$total = [int]$count = 0 37 | do 38 | { 39 | $count = $reader.Read($buffer, 0, $buffer.Length); 40 | $writer.Write($buffer, 0, $count); 41 | $total += $count 42 | if($goal -gt 0) { 43 | Write-Progress "Downloading $url" "Saving $total of $goal" -id 0 -percentComplete (($total/$goal)*100) 44 | } else { 45 | Write-Progress "Downloading $url" "Saving $total bytes..." -id 0 46 | } 47 | } while ($count -gt 0) 48 | 49 | $reader.Close() 50 | $writer.Flush() 51 | $writer.Close() 52 | } 53 | 54 | -------------------------------------------------------------------------------- /Source/Mogwai/stdafx.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #pragma once 29 | #include "Falcor.h" 30 | #include "Mogwai.h" 31 | -------------------------------------------------------------------------------- /Source/RenderPasses/RTAO/RTAO.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Falcor.h" 3 | #include "FalcorExperimental.h" 4 | #include "Utils/Sampling/SampleGenerator.h" 5 | 6 | using namespace Falcor; 7 | 8 | class RTAO : public RenderPass 9 | { 10 | public: 11 | using SharedPtr = std::shared_ptr; 12 | 13 | /** Create a new render pass object. 14 | \param[in] pRenderContext The render context. 15 | \param[in] dict Dictionary of serialized parameters. 16 | \return A new object, or an exception is thrown if creation failed. 17 | */ 18 | static SharedPtr create(RenderContext* pRenderContext = nullptr, const Dictionary& dict = {}); 19 | 20 | virtual std::string getDesc() override; 21 | virtual Dictionary getScriptingDictionary() override; 22 | virtual RenderPassReflection reflect(const CompileData& compileData) override; 23 | virtual void compile(RenderContext* pContext, const CompileData& compileData) override {} 24 | virtual void execute(RenderContext* pRenderContext, const RenderData& renderData) override; 25 | virtual void renderUI(Gui::Widgets& widget) override; 26 | virtual void setScene(RenderContext* pRenderContext, const Scene::SharedPtr& pScene) override; 27 | virtual bool onMouseEvent(const MouseEvent& mouseEvent) override { return false; } 28 | virtual bool onKeyEvent(const KeyboardEvent& keyEvent) override { return false; } 29 | 30 | private: 31 | RTAO() = default; 32 | RTAO(const Dictionary& dict); 33 | 34 | // rtao parameters 35 | float mAoRadius = 0.30f; 36 | float mMinT = 0.0001f; 37 | uint mSampleCount = 8; 38 | 39 | uint mFrameCount = 0; 40 | 41 | Scene::SharedPtr mpScene = nullptr; 42 | 43 | SampleGenerator::SharedPtr mpSampleGenerator = nullptr; 44 | 45 | RtProgram::SharedPtr mpProgram = nullptr; 46 | RtProgramVars::SharedPtr mpProgramVars = nullptr; 47 | }; 48 | -------------------------------------------------------------------------------- /Source/RenderPasses/WhittedRayTracer/Data/WhittedRayTracer.py: -------------------------------------------------------------------------------- 1 | from falcor import * 2 | 3 | def render_graph_WhittedRayTracer(): 4 | g = RenderGraph("DefaultRenderGraph") 5 | loadRenderPassLibrary("GBuffer.dll") 6 | loadRenderPassLibrary("WhittedRayTracer.dll") 7 | loadRenderPassLibrary("ToneMapper.dll") 8 | WhittedRayTracer = createPass("WhittedRayTracer", {'maxBounces': 7, 'texLODMode': TexLODMode.RayCones, 'rayConeMode': RayConeMode.Unified, 'rayConeFilterMode': RayFootprintFilterMode.AnisotropicWhenRefraction, 'rayDiffFilterMode':RayFootprintFilterMode.AnisotropicWhenRefraction, 'useRoughnessToVariance': False}) 9 | g.addPass(WhittedRayTracer, "WhittedRayTracer") 10 | GBufferRT = createPass("GBufferRT", {'samplePattern': SamplePattern.Center, 'sampleCount': 1}) 11 | g.addPass(GBufferRT, "GBufferRT") 12 | ToneMapper = createPass("ToneMapper", {'autoExposure': False, 'exposureValue': 1.0, 'exposureCompensation': 2.2, 'operator': ToneMapOp.Linear}) 13 | g.addPass(ToneMapper, "ToneMapper") 14 | g.addEdge("WhittedRayTracer.color", "ToneMapper.src") 15 | g.addEdge("GBufferRT.posW", "WhittedRayTracer.posW") 16 | g.addEdge("GBufferRT.normW", "WhittedRayTracer.normalW") 17 | g.addEdge("GBufferRT.tangentW", "WhittedRayTracer.tangentW") 18 | g.addEdge("GBufferRT.diffuseOpacity", "WhittedRayTracer.mtlDiffOpacity") 19 | g.addEdge("GBufferRT.specRough", "WhittedRayTracer.mtlSpecRough") 20 | g.addEdge("GBufferRT.matlExtra", "WhittedRayTracer.mtlParams") 21 | g.addEdge("GBufferRT.emissive", "WhittedRayTracer.mtlEmissive") 22 | g.addEdge("GBufferRT.faceNormalW", "WhittedRayTracer.faceNormalW") 23 | g.addEdge("GBufferRT.vbuffer", "WhittedRayTracer.vbuffer") 24 | g.markOutput("ToneMapper.dst") 25 | return g 26 | 27 | WhittedRayTracerGraph = render_graph_WhittedRayTracer() 28 | try: m.addGraph(WhittedRayTracerGraph) 29 | except NameError: None 30 | -------------------------------------------------------------------------------- /Source/Falcor/ShaderSource.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 31 | 32 | 33 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Build/packman/packman.cmd: -------------------------------------------------------------------------------- 1 | :: Reset errorlevel status (don't inherit from caller) [xxxxxxxxxxx] 2 | @call :ECHO_AND_RESET_ERROR 3 | :: You can remove the call below if you do your own manual configuration of the dev machines 4 | call "%~dp0\bootstrap\configure.bat" 5 | 6 | if %errorlevel% neq 0 ( exit /b %errorlevel% ) 7 | :: Everything below is mandatory 8 | if not defined PM_PYTHON goto :PYTHON_ENV_ERROR 9 | if not defined PM_MODULE goto :MODULE_ENV_ERROR 10 | 11 | :: Generate temporary path for variable file 12 | for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile ^ 13 | -File "%~dp0bootstrap\generate_temp_file_name.ps1"') do set PM_VAR_PATH=%%a 14 | 15 | if %1.==. ( 16 | set PM_VAR_PATH_ARG= 17 | ) else ( 18 | set PM_VAR_PATH_ARG=--var-path="%PM_VAR_PATH%" 19 | ) 20 | 21 | "%PM_PYTHON%" -S -s -u -E "%PM_MODULE%" %* %PM_VAR_PATH_ARG% 22 | if %errorlevel% neq 0 ( exit /b %errorlevel% ) 23 | 24 | :: Marshall environment variables into the current environment if they have been generated and remove temporary file 25 | if exist "%PM_VAR_PATH%" ( 26 | for /F "usebackq tokens=*" %%A in ("%PM_VAR_PATH%") do set "%%A" 27 | ) 28 | if %errorlevel% neq 0 ( goto :VAR_ERROR ) 29 | 30 | if exist "%PM_VAR_PATH%" ( 31 | del /F "%PM_VAR_PATH%" 32 | ) 33 | if %errorlevel% neq 0 ( goto :VAR_ERROR ) 34 | 35 | set PM_VAR_PATH= 36 | goto :eof 37 | 38 | :: Subroutines below 39 | :PYTHON_ENV_ERROR 40 | @echo User environment variable PM_PYTHON is not set! Please configure machine for packman or call configure.bat. 41 | exit /b 1 42 | 43 | :MODULE_ENV_ERROR 44 | @echo User environment variable PM_MODULE is not set! Please configure machine for packman or call configure.bat. 45 | exit /b 1 46 | 47 | :VAR_ERROR 48 | @echo Error while processing and setting environment variables! 49 | exit /b 1 50 | 51 | :ECHO_AND_RESET_ERROR 52 | @echo off 53 | if /I "%PM_VERBOSITY%"=="debug" ( 54 | @echo on 55 | ) 56 | exit /b 0 57 | -------------------------------------------------------------------------------- /Source/Falcor/Utils/NVAPI.slangh: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #if _ENABLE_NVAPI 29 | #include "NVAPI/nvShaderExtnEnums.h" 30 | #endif 31 | import NVAPI; 32 | -------------------------------------------------------------------------------- /Source/Falcor/Scene/SceneBlock.slang: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | import Scene.Scene; 29 | 30 | float4 main() : SV_TARGET 31 | { 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCPathTracer/Parameters.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Utils/Math/Vector.h" 3 | #include 4 | 5 | /* 6 | Parameters that don't need to change / can't be changed during runtime. 7 | */ 8 | 9 | #ifndef NRC_PARAMETERS 10 | #define NRC_PARAMETERS 11 | 12 | #define AUX_INPUTS 1 13 | #define REFLECTANCE_FACT 1 14 | #define LITE_SCREEN 0 15 | 16 | namespace NRC { 17 | using Falcor::uint2; 18 | 19 | namespace Parameters { 20 | 21 | 22 | // 4 steps each frame, with 16384 samples per batch 23 | #if LITE_SCREEN 24 | const uint2 screen_size = uint2(1280, 720); 25 | #else 26 | const uint2 screen_size = uint2(1920, 1080); 27 | #endif 28 | const uint2 trainingPathStride = uint2(6, 6); 29 | const uint32_t batch_size = 1 << 14; 30 | const uint32_t n_train_batch = 4; 31 | 32 | const uint32_t resolution = screen_size.x * screen_size.y; // is a multiple of 256 33 | const unsigned int max_inference_query_size = resolution; 34 | const unsigned int max_training_query_size = 1 << 16; // ~57,600 35 | 36 | const uint2 trainingPathStrideRR = trainingPathStride * 4u; 37 | 38 | const unsigned int max_training_sample_size = resolution / trainingPathStride.x / trainingPathStride.y * 15; 39 | const uint32_t self_query_batch_size = resolution / trainingPathStride.x / trainingPathStride.y; // ~ 57600 40 | 41 | #if AUX_INPUTS 42 | const uint32_t input_dim = 14; // pos dir normal roughness diffuse specular 43 | #else 44 | const uint32_t input_dim = 5; // pos, dir 45 | #endif 46 | const uint32_t output_dim = 3; // RGB 47 | //const uint32_t alignment = 16; // input dim alignment 48 | const std::string config_path = "../RenderPasses/NRCPathTracer/Data/default_nrc_new.json"; 49 | 50 | } 51 | } 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /Source/Falcor/Core/Program/ShaderLibrary.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #include "stdafx.h" 29 | #include "ShaderLibrary.h" 30 | 31 | namespace Falcor 32 | { 33 | 34 | } 35 | -------------------------------------------------------------------------------- /Source/RenderPasses/MinimalPathTracer/Data/MinimalPathTracer.py: -------------------------------------------------------------------------------- 1 | from falcor import * 2 | 3 | def render_graph_MinimalPathTracer(): 4 | g = RenderGraph("MinimalPathTracer") 5 | loadRenderPassLibrary("AccumulatePass.dll") 6 | loadRenderPassLibrary("GBuffer.dll") 7 | loadRenderPassLibrary("MinimalPathTracer.dll") 8 | loadRenderPassLibrary("ToneMapper.dll") 9 | AccumulatePass = createPass("AccumulatePass", {'enabled': True, 'precisionMode': AccumulatePrecision.Single}) 10 | g.addPass(AccumulatePass, "AccumulatePass") 11 | ToneMapper = createPass("ToneMapper", {'autoExposure': False, 'exposureCompensation': 0.0}) 12 | g.addPass(ToneMapper, "ToneMapper") 13 | MinimalPathTracer = createPass("MinimalPathTracer", {'mMaxBounces': 3, 'mComputeDirect': True}) 14 | g.addPass(MinimalPathTracer, "MinimalPathTracer") 15 | GBufferRT = createPass("GBufferRT", {'samplePattern': SamplePattern.Stratified, 'sampleCount': 16}) 16 | g.addPass(GBufferRT, "GBufferRT") 17 | g.addEdge("AccumulatePass.output", "ToneMapper.src") 18 | g.addEdge("GBufferRT.posW", "MinimalPathTracer.posW") 19 | g.addEdge("GBufferRT.normW", "MinimalPathTracer.normalW") 20 | g.addEdge("GBufferRT.tangentW", "MinimalPathTracer.tangentW") 21 | g.addEdge("GBufferRT.faceNormalW", "MinimalPathTracer.faceNormalW") 22 | g.addEdge("GBufferRT.viewW", "MinimalPathTracer.viewW") 23 | g.addEdge("GBufferRT.diffuseOpacity", "MinimalPathTracer.mtlDiffOpacity") 24 | g.addEdge("GBufferRT.specRough", "MinimalPathTracer.mtlSpecRough") 25 | g.addEdge("GBufferRT.emissive", "MinimalPathTracer.mtlEmissive") 26 | g.addEdge("GBufferRT.matlExtra", "MinimalPathTracer.mtlParams") 27 | g.addEdge("MinimalPathTracer.color", "AccumulatePass.input") 28 | g.markOutput("ToneMapper.dst") 29 | return g 30 | 31 | MinimalPathTracer = render_graph_MinimalPathTracer() 32 | try: m.addGraph(MinimalPathTracer) 33 | except NameError: None 34 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCVoxelPT/Data/NRCPathTracer.py: -------------------------------------------------------------------------------- 1 | def render_graph_PathTracerGraph(): 2 | g = RenderGraph("PathTracerGraph") 3 | loadRenderPassLibrary("AccumulatePass.dll") 4 | loadRenderPassLibrary("GBuffer.dll") 5 | loadRenderPassLibrary("ToneMapper.dll") 6 | loadRenderPassLibrary("NRCVoxelPT.dll") 7 | AccumulatePass = createPass("AccumulatePass", {'enabled': False}) 8 | g.addPass(AccumulatePass, "AccumulatePass") 9 | ToneMappingPass = createPass("ToneMapper", {'autoExposure': False, 'exposureCompensation': 0.0}) 10 | g.addPass(ToneMappingPass, "NRCToneMapped") 11 | GBufferRT = createPass("GBufferRT", {'forceCullMode': False, 'cull': CullMode.CullBack, 'samplePattern': SamplePattern.Stratified, 'sampleCount': 16}) 12 | g.addPass(GBufferRT, "GBufferRT") 13 | NRCVoxelPT = createPass("NRCVoxelPT", {'params': PathTracerParams(useVBuffer=0, maxBounces=15, maxNonSpecularBounces=15)}) 14 | g.addPass(NRCVoxelPT, "NRCVoxelPT") 15 | g.addEdge("GBufferRT.vbuffer", "NRCVoxelPT.vbuffer") # Required by ray footprint. 16 | g.addEdge("GBufferRT.posW", "NRCVoxelPT.posW") 17 | g.addEdge("GBufferRT.normW", "NRCVoxelPT.normalW") 18 | g.addEdge("GBufferRT.tangentW", "NRCVoxelPT.tangentW") 19 | g.addEdge("GBufferRT.faceNormalW", "NRCVoxelPT.faceNormalW") 20 | g.addEdge("GBufferRT.viewW", "NRCVoxelPT.viewW") 21 | g.addEdge("GBufferRT.diffuseOpacity", "NRCVoxelPT.mtlDiffOpacity") 22 | g.addEdge("GBufferRT.specRough", "NRCVoxelPT.mtlSpecRough") 23 | g.addEdge("GBufferRT.emissive", "NRCVoxelPT.mtlEmissive") 24 | g.addEdge("GBufferRT.matlExtra", "NRCVoxelPT.mtlParams") 25 | g.addEdge("NRCVoxelPT.result", "AccumulatePass.input") 26 | g.addEdge("AccumulatePass.output", "NRCToneMapped.src") 27 | g.markOutput("NRCToneMapped.dst") 28 | return g 29 | 30 | PathTracerGraph = render_graph_PathTracerGraph() 31 | try: m.addGraph(PathTracerGraph) 32 | except NameError: None 33 | -------------------------------------------------------------------------------- /Source/Mogwai/Data/CustomScripts/NRCPathTracer.py: -------------------------------------------------------------------------------- 1 | def render_graph_PathTracerGraph(): 2 | g = RenderGraph("PathTracerGraph") 3 | loadRenderPassLibrary("AccumulatePass.dll") 4 | loadRenderPassLibrary("GBuffer.dll") 5 | loadRenderPassLibrary("ToneMapper.dll") 6 | loadRenderPassLibrary("NRCPathTracer.dll") 7 | AccumulatePass = createPass("AccumulatePass", {'enabled': True}) 8 | g.addPass(AccumulatePass, "AccumulatePass") 9 | ToneMappingPass = createPass("ToneMapper", {'autoExposure': False, 'exposureCompensation': 0.0}) 10 | g.addPass(ToneMappingPass, "ToneMappingPass") 11 | GBufferRT = createPass("GBufferRT", {'forceCullMode': False, 'cull': CullMode.CullBack, 'samplePattern': SamplePattern.Stratified, 'sampleCount': 16}) 12 | g.addPass(GBufferRT, "GBufferRT") 13 | NRCPathTracer = createPass("NRCPathTracer", {'params': PathTracerParams(useVBuffer=0)}) 14 | g.addPass(NRCPathTracer, "NRCPathTracer") 15 | g.addEdge("GBufferRT.vbuffer", "NRCPathTracer.vbuffer") # Required by ray footprint. 16 | g.addEdge("GBufferRT.posW", "NRCPathTracer.posW") 17 | g.addEdge("GBufferRT.normW", "NRCPathTracer.normalW") 18 | g.addEdge("GBufferRT.tangentW", "NRCPathTracer.tangentW") 19 | g.addEdge("GBufferRT.faceNormalW", "NRCPathTracer.faceNormalW") 20 | g.addEdge("GBufferRT.viewW", "NRCPathTracer.viewW") 21 | g.addEdge("GBufferRT.diffuseOpacity", "NRCPathTracer.mtlDiffOpacity") 22 | g.addEdge("GBufferRT.specRough", "NRCPathTracer.mtlSpecRough") 23 | g.addEdge("GBufferRT.emissive", "NRCPathTracer.mtlEmissive") 24 | g.addEdge("GBufferRT.matlExtra", "NRCPathTracer.mtlParams") 25 | g.addEdge("NRCPathTracer.color", "AccumulatePass.input") 26 | g.addEdge("AccumulatePass.output", "ToneMappingPass.src") 27 | g.markOutput("ToneMappingPass.dst") 28 | return g 29 | 30 | PathTracerGraph = render_graph_PathTracerGraph() 31 | try: m.addGraph(PathTracerGraph) 32 | except NameError: None 33 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCVoxelPT/Data/NRCVoxelPT.py: -------------------------------------------------------------------------------- 1 | def render_graph_PathTracerGraph(): 2 | g = RenderGraph("NRCVoxelPathTracerGraph") 3 | loadRenderPassLibrary("AccumulatePass.dll") 4 | loadRenderPassLibrary("GBuffer.dll") 5 | loadRenderPassLibrary("ToneMapper.dll") 6 | loadRenderPassLibrary("NRCVoxelPT.dll") 7 | AccumulatePass = createPass("AccumulatePass", {'enabled': False}) 8 | g.addPass(AccumulatePass, "AccumulatePass") 9 | ToneMappingPass = createPass("ToneMapper", {'autoExposure': False, 'exposureCompensation': 0.0}) 10 | g.addPass(ToneMappingPass, "NRCToneMapped") 11 | GBufferRT = createPass("GBufferRT", {'forceCullMode': False, 'cull': CullMode.CullBack, 'samplePattern': SamplePattern.Stratified, 'sampleCount': 16}) 12 | g.addPass(GBufferRT, "GBufferRT") 13 | NRCVoxelPT = createPass("NRCVoxelPT", {'params': PathTracerParams(useVBuffer=0, maxBounces=15, maxNonSpecularBounces=15)}) 14 | g.addPass(NRCVoxelPT, "NRCVoxelPT") 15 | g.addEdge("GBufferRT.vbuffer", "NRCVoxelPT.vbuffer") # Required by ray footprint. 16 | g.addEdge("GBufferRT.posW", "NRCVoxelPT.posW") 17 | g.addEdge("GBufferRT.normW", "NRCVoxelPT.normalW") 18 | g.addEdge("GBufferRT.tangentW", "NRCVoxelPT.tangentW") 19 | g.addEdge("GBufferRT.faceNormalW", "NRCVoxelPT.faceNormalW") 20 | g.addEdge("GBufferRT.viewW", "NRCVoxelPT.viewW") 21 | g.addEdge("GBufferRT.diffuseOpacity", "NRCVoxelPT.mtlDiffOpacity") 22 | g.addEdge("GBufferRT.specRough", "NRCVoxelPT.mtlSpecRough") 23 | g.addEdge("GBufferRT.emissive", "NRCVoxelPT.mtlEmissive") 24 | g.addEdge("GBufferRT.matlExtra", "NRCVoxelPT.mtlParams") 25 | g.addEdge("NRCVoxelPT.result", "AccumulatePass.input") 26 | g.addEdge("AccumulatePass.output", "NRCToneMapped.src") 27 | g.markOutput("NRCToneMapped.dst") 28 | return g 29 | 30 | PathTracerGraph = render_graph_PathTracerGraph() 31 | try: m.addGraph(PathTracerGraph) 32 | except NameError: None 33 | -------------------------------------------------------------------------------- /Source/RenderPasses/RTLightingPass/RTLightingPass.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Falcor.h" 3 | #include "FalcorExperimental.h" 4 | #include "Utils/Sampling/SampleGenerator.h" 5 | 6 | using namespace Falcor; 7 | 8 | class RTLightingPass : public RenderPass 9 | { 10 | public: 11 | using SharedPtr = std::shared_ptr; 12 | 13 | /** Create a new render pass object. 14 | \param[in] pRenderContext The render context. 15 | \param[in] dict Dictionary of serialized parameters. 16 | \return A new object, or an exception is thrown if creation failed. 17 | */ 18 | static SharedPtr create(RenderContext* pRenderContext = nullptr, const Dictionary& dict = {}); 19 | 20 | virtual std::string getDesc() override; 21 | virtual Dictionary getScriptingDictionary() override; 22 | virtual RenderPassReflection reflect(const CompileData& compileData) override; 23 | virtual void compile(RenderContext* pContext, const CompileData& compileData) override {} 24 | virtual void execute(RenderContext* pRenderContext, const RenderData& renderData) override; 25 | virtual void renderUI(Gui::Widgets& widget) override; 26 | virtual void setScene(RenderContext* pRenderContext, const Scene::SharedPtr& pScene) override; 27 | virtual bool onMouseEvent(const MouseEvent& mouseEvent) override { return false; } 28 | virtual bool onKeyEvent(const KeyboardEvent& keyEvent) override { return false; } 29 | 30 | private: 31 | RTLightingPass() = default; 32 | RTLightingPass(const Dictionary& dict); 33 | 34 | float mMinT = 0.0001f; 35 | uint mDirectSampleCount = 4; 36 | uint mFrameCount = 0; 37 | bool mUseMonteCarloShading = true; 38 | 39 | Scene::SharedPtr mpScene = nullptr; 40 | EnvMapLighting::SharedPtr mpEnvMapLighting; 41 | SampleGenerator::SharedPtr mpSampleGenerator; 42 | 43 | RtProgram::SharedPtr mpProgram = nullptr; 44 | RtProgramVars::SharedPtr mpProgramVars = nullptr; 45 | }; 46 | -------------------------------------------------------------------------------- /Source/Falcor/Utils/NVAPI.slang: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #if _ENABLE_NVAPI 29 | #define NV_SHADER_EXTN_SLOT u63 30 | #define NV_SHADER_EXTN_REGISTER_SPACE space0 31 | #include "NVAPI/nvHLSLExtns.h" 32 | #endif 33 | -------------------------------------------------------------------------------- /Source/Falcor/Utils/Debug/ReflectPixelDebugTypes.cs.slang: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | 29 | /** Dummy compute program for reflection of the PixelDebug types. 30 | */ 31 | import Utils.Debug.PixelDebug; 32 | 33 | void main() {} 34 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCPathTracer/Data/NRCPathTracer.py: -------------------------------------------------------------------------------- 1 | def render_graph_PathTracerGraph(): 2 | g = RenderGraph("PathTracerGraph") 3 | loadRenderPassLibrary("AccumulatePass.dll") 4 | loadRenderPassLibrary("GBuffer.dll") 5 | loadRenderPassLibrary("ToneMapper.dll") 6 | loadRenderPassLibrary("NRCPathTracer.dll") 7 | AccumulatePass = createPass("AccumulatePass", {'enabled': False}) 8 | g.addPass(AccumulatePass, "AccumulatePass") 9 | ToneMappingPass = createPass("ToneMapper", {'autoExposure': False, 'exposureCompensation': 0.0}) 10 | g.addPass(ToneMappingPass, "NRCToneMapped") 11 | GBufferRT = createPass("GBufferRT", {'forceCullMode': False, 'cull': CullMode.CullBack, 'samplePattern': SamplePattern.Stratified, 'sampleCount': 16}) 12 | g.addPass(GBufferRT, "GBufferRT") 13 | NRCPathTracer = createPass("NRCPathTracer", {'params': PathTracerParams(useVBuffer=0, maxBounces=15, maxNonSpecularBounces=15)}) 14 | g.addPass(NRCPathTracer, "NRCPathTracer") 15 | g.addEdge("GBufferRT.vbuffer", "NRCPathTracer.vbuffer") # Required by ray footprint. 16 | g.addEdge("GBufferRT.posW", "NRCPathTracer.posW") 17 | g.addEdge("GBufferRT.normW", "NRCPathTracer.normalW") 18 | g.addEdge("GBufferRT.tangentW", "NRCPathTracer.tangentW") 19 | g.addEdge("GBufferRT.faceNormalW", "NRCPathTracer.faceNormalW") 20 | g.addEdge("GBufferRT.viewW", "NRCPathTracer.viewW") 21 | g.addEdge("GBufferRT.diffuseOpacity", "NRCPathTracer.mtlDiffOpacity") 22 | g.addEdge("GBufferRT.specRough", "NRCPathTracer.mtlSpecRough") 23 | g.addEdge("GBufferRT.emissive", "NRCPathTracer.mtlEmissive") 24 | g.addEdge("GBufferRT.matlExtra", "NRCPathTracer.mtlParams") 25 | g.addEdge("NRCPathTracer.result", "AccumulatePass.input") 26 | g.addEdge("AccumulatePass.output", "NRCToneMapped.src") 27 | g.markOutput("NRCToneMapped.dst") 28 | return g 29 | 30 | PathTracerGraph = render_graph_PathTracerGraph() 31 | try: m.addGraph(PathTracerGraph) 32 | except NameError: None 33 | -------------------------------------------------------------------------------- /Source/Falcor/Utils/Attributes.slang: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | 29 | /** Attribute for tagging resources that should be bound to a root descriptor. 30 | */ 31 | [__AttributeUsage(_AttributeTargets.Var)] 32 | struct rootAttribute {}; 33 | -------------------------------------------------------------------------------- /Source/Apps/CudaInterop/CopySurface.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #include 29 | 30 | extern void launchCopySurface(cudaSurfaceObject_t input, cudaSurfaceObject_t output, unsigned int width, unsigned int height, unsigned int format); 31 | -------------------------------------------------------------------------------- /Source/RenderPasses/DepthPass/DepthPass.ps.slang: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | import Scene.Raster; 29 | 30 | void main(VSOut vsOut, uint triangleIndex : SV_PrimitiveID) : SV_TARGET 31 | { 32 | if (alphaTest(vsOut, triangleIndex)) discard; 33 | } 34 | -------------------------------------------------------------------------------- /Source/Falcor/Core/API/Vulkan/VKVao.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #include "stdafx.h" 29 | #include "API/VAO.h" 30 | 31 | namespace Falcor 32 | { 33 | const VaoHandle& Vao::getApiHandle() const 34 | { 35 | return mApiHandle; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Source/Mogwai/Data/PathTracer.py: -------------------------------------------------------------------------------- 1 | def render_graph_PathTracerGraph(): 2 | g = RenderGraph("PathTracerGraph") 3 | loadRenderPassLibrary("AccumulatePass.dll") 4 | loadRenderPassLibrary("GBuffer.dll") 5 | loadRenderPassLibrary("ToneMapper.dll") 6 | loadRenderPassLibrary("MegakernelPathTracer.dll") 7 | AccumulatePass = createPass("AccumulatePass", {'enabled': True}) 8 | g.addPass(AccumulatePass, "AccumulatePass") 9 | ToneMappingPass = createPass("ToneMapper", {'autoExposure': False, 'exposureCompensation': 0.0}) 10 | g.addPass(ToneMappingPass, "ToneMappingPass") 11 | GBufferRT = createPass("GBufferRT", {'forceCullMode': False, 'cull': CullMode.CullBack, 'samplePattern': SamplePattern.Stratified, 'sampleCount': 16}) 12 | g.addPass(GBufferRT, "GBufferRT") 13 | MegakernelPathTracer = createPass("MegakernelPathTracer", {'params': PathTracerParams(useVBuffer=0)}) 14 | g.addPass(MegakernelPathTracer, "MegakernelPathTracer") 15 | g.addEdge("GBufferRT.vbuffer", "MegakernelPathTracer.vbuffer") # Required by ray footprint. 16 | g.addEdge("GBufferRT.posW", "MegakernelPathTracer.posW") 17 | g.addEdge("GBufferRT.normW", "MegakernelPathTracer.normalW") 18 | g.addEdge("GBufferRT.tangentW", "MegakernelPathTracer.tangentW") 19 | g.addEdge("GBufferRT.faceNormalW", "MegakernelPathTracer.faceNormalW") 20 | g.addEdge("GBufferRT.viewW", "MegakernelPathTracer.viewW") 21 | g.addEdge("GBufferRT.diffuseOpacity", "MegakernelPathTracer.mtlDiffOpacity") 22 | g.addEdge("GBufferRT.specRough", "MegakernelPathTracer.mtlSpecRough") 23 | g.addEdge("GBufferRT.emissive", "MegakernelPathTracer.mtlEmissive") 24 | g.addEdge("GBufferRT.matlExtra", "MegakernelPathTracer.mtlParams") 25 | g.addEdge("MegakernelPathTracer.color", "AccumulatePass.input") 26 | g.addEdge("AccumulatePass.output", "ToneMappingPass.src") 27 | g.markOutput("ToneMappingPass.dst") 28 | return g 29 | 30 | PathTracerGraph = render_graph_PathTracerGraph() 31 | try: m.addGraph(PathTracerGraph) 32 | except NameError: None 33 | -------------------------------------------------------------------------------- /Source/Falcor/Core/API/Vulkan/VkResource.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #include "stdafx.h" 29 | #include "API/Resource.h" 30 | 31 | namespace Falcor 32 | { 33 | void Resource::apiSetName() 34 | { 35 | // Vulkan doesn't support resource naming 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Source/Falcor/Scene/Volume/BrickedGrid.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #pragma once 29 | 30 | namespace Falcor 31 | { 32 | struct BrickedGrid 33 | { 34 | Texture::SharedPtr range; 35 | Texture::SharedPtr indirection; 36 | Texture::SharedPtr atlas; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /Source/Falcor/Core/API/D3D12/D3D12ApiData.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #pragma once 29 | #include "Core/API/FencedPool.h" 30 | 31 | namespace Falcor 32 | { 33 | struct LowLevelContextApiData 34 | { 35 | FencedPool::SharedPtr pAllocatorPool; 36 | }; 37 | } 38 | -------------------------------------------------------------------------------- /Source/Falcor/Core/API/VertexLayout.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #include "stdafx.h" 29 | #include "VertexLayout.h" 30 | 31 | namespace Falcor 32 | { 33 | SCRIPT_BINDING(VertexLayout) 34 | { 35 | pybind11::class_(m, "VertexLayout"); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Source/Mogwai/Data/ForwardRenderer.py: -------------------------------------------------------------------------------- 1 | def render_graph_forward_renderer(): 2 | loadRenderPassLibrary("Antialiasing.dll") 3 | loadRenderPassLibrary("BlitPass.dll") 4 | loadRenderPassLibrary("CSM.dll") 5 | loadRenderPassLibrary("DepthPass.dll") 6 | loadRenderPassLibrary("ForwardLightingPass.dll") 7 | loadRenderPassLibrary("SSAO.dll") 8 | loadRenderPassLibrary("ToneMapper.dll") 9 | 10 | skyBox = createPass("SkyBox") 11 | 12 | forward_renderer = RenderGraph("ForwardRenderer") 13 | forward_renderer.addPass(createPass("DepthPass"), "DepthPrePass") 14 | forward_renderer.addPass(createPass("ForwardLightingPass"), "LightingPass") 15 | forward_renderer.addPass(createPass("CSM"), "ShadowPass") 16 | forward_renderer.addPass(createPass("BlitPass"), "BlitPass") 17 | forward_renderer.addPass(createPass("ToneMapper", {'autoExposure': True}), "ToneMapping") 18 | forward_renderer.addPass(createPass("SSAO"), "SSAO") 19 | forward_renderer.addPass(createPass("FXAA"), "FXAA") 20 | 21 | forward_renderer.addPass(skyBox, "SkyBox") 22 | 23 | forward_renderer.addEdge("DepthPrePass.depth", "SkyBox.depth") 24 | forward_renderer.addEdge("SkyBox.target", "LightingPass.color") 25 | forward_renderer.addEdge("DepthPrePass.depth", "ShadowPass.depth") 26 | forward_renderer.addEdge("DepthPrePass.depth", "LightingPass.depth") 27 | forward_renderer.addEdge("ShadowPass.visibility", "LightingPass.visibilityBuffer") 28 | forward_renderer.addEdge("LightingPass.color", "ToneMapping.src") 29 | forward_renderer.addEdge("ToneMapping.dst", "SSAO.colorIn") 30 | forward_renderer.addEdge("LightingPass.normals", "SSAO.normals") 31 | forward_renderer.addEdge("LightingPass.depth", "SSAO.depth") 32 | forward_renderer.addEdge("SSAO.colorOut", "FXAA.src") 33 | forward_renderer.addEdge("FXAA.dst", "BlitPass.src") 34 | 35 | forward_renderer.markOutput("BlitPass.dst") 36 | 37 | return forward_renderer 38 | 39 | forward_renderer = render_graph_forward_renderer() 40 | try: m.addGraph(forward_renderer) 41 | except NameError: None 42 | -------------------------------------------------------------------------------- /Source/RenderPasses/MegakernelPathTracer/Data/MegakernelPathTracer.py: -------------------------------------------------------------------------------- 1 | def render_graph_PathTracerGraph(): 2 | g = RenderGraph("PathTracerGraph") 3 | loadRenderPassLibrary("AccumulatePass.dll") 4 | loadRenderPassLibrary("GBuffer.dll") 5 | loadRenderPassLibrary("ToneMapper.dll") 6 | loadRenderPassLibrary("MegakernelPathTracer.dll") 7 | AccumulatePass = createPass("AccumulatePass", {'enabled': True}) 8 | g.addPass(AccumulatePass, "AccumulatePass") 9 | ToneMappingPass = createPass("ToneMapper", {'autoExposure': False, 'exposureCompensation': 0.0}) 10 | g.addPass(ToneMappingPass, "ToneMappingPass") 11 | GBufferRT = createPass("GBufferRT", {'forceCullMode': False, 'cull': CullMode.CullBack, 'samplePattern': SamplePattern.Stratified, 'sampleCount': 16}) 12 | g.addPass(GBufferRT, "GBufferRT") 13 | MegakernelPathTracer = createPass("MegakernelPathTracer", {'params': PathTracerParams(useVBuffer=0)}) 14 | g.addPass(MegakernelPathTracer, "MegakernelPathTracer") 15 | g.addEdge("GBufferRT.vbuffer", "MegakernelPathTracer.vbuffer") # Required by ray footprint. 16 | g.addEdge("GBufferRT.posW", "MegakernelPathTracer.posW") 17 | g.addEdge("GBufferRT.normW", "MegakernelPathTracer.normalW") 18 | g.addEdge("GBufferRT.tangentW", "MegakernelPathTracer.tangentW") 19 | g.addEdge("GBufferRT.faceNormalW", "MegakernelPathTracer.faceNormalW") 20 | g.addEdge("GBufferRT.viewW", "MegakernelPathTracer.viewW") 21 | g.addEdge("GBufferRT.diffuseOpacity", "MegakernelPathTracer.mtlDiffOpacity") 22 | g.addEdge("GBufferRT.specRough", "MegakernelPathTracer.mtlSpecRough") 23 | g.addEdge("GBufferRT.emissive", "MegakernelPathTracer.mtlEmissive") 24 | g.addEdge("GBufferRT.matlExtra", "MegakernelPathTracer.mtlParams") 25 | g.addEdge("MegakernelPathTracer.color", "AccumulatePass.input") 26 | g.addEdge("AccumulatePass.output", "ToneMappingPass.src") 27 | g.markOutput("ToneMappingPass.dst") 28 | return g 29 | 30 | PathTracerGraph = render_graph_PathTracerGraph() 31 | try: m.addGraph(PathTracerGraph) 32 | except NameError: None 33 | -------------------------------------------------------------------------------- /Source/Falcor/FalcorExperimental.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #pragma once 29 | #include "Experimental/Scene/Lights/EnvMapSampler.h" 30 | #include "Experimental/Scene/Lights/EnvMapLighting.h" 31 | #include "Experimental/Scene/Lights/EmissiveLightSampler.h" 32 | #include "Experimental/Scene/Lights/EmissiveUniformSampler.h" 33 | -------------------------------------------------------------------------------- /Source/Falcor/Testing/UnitTest.cs.slang: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | RWStructuredBuffer result; 29 | 30 | cbuffer TestCB 31 | { 32 | int nValues; 33 | float scale; 34 | }; 35 | 36 | void main() 37 | { 38 | for (int i = 0; i < nValues; ++i) 39 | { 40 | result[i] = scale * i; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Source/Externals/xoshiro/xoshiro128starstar.c: -------------------------------------------------------------------------------- 1 | /* Written in 2018 by David Blackman and Sebastiano Vigna (vigna@acm.org) 2 | 3 | To the extent possible under law, the author has dedicated all copyright 4 | and related and neighboring rights to this software to the public domain 5 | worldwide. This software is distributed without any warranty. 6 | 7 | See . */ 8 | 9 | #include 10 | 11 | /* This is xoshiro128** 1.0, our 32-bit all-purpose, rock-solid generator. It 12 | has excellent (sub-ns) speed, a state size (128 bits) that is large 13 | enough for mild parallelism, and it passes all tests we are aware of. 14 | 15 | For generating just single-precision (i.e., 32-bit) floating-point 16 | numbers, xoshiro128+ is even faster. 17 | 18 | The state must be seeded so that it is not everywhere zero. */ 19 | 20 | 21 | static inline uint32_t rotl(const uint32_t x, int k) { 22 | return (x << k) | (x >> (32 - k)); 23 | } 24 | 25 | 26 | static uint32_t s[4]; 27 | 28 | uint32_t next(void) { 29 | const uint32_t result_starstar = rotl(s[0] * 5, 7) * 9; 30 | 31 | const uint32_t t = s[1] << 9; 32 | 33 | s[2] ^= s[0]; 34 | s[3] ^= s[1]; 35 | s[1] ^= s[2]; 36 | s[0] ^= s[3]; 37 | 38 | s[2] ^= t; 39 | 40 | s[3] = rotl(s[3], 11); 41 | 42 | return result_starstar; 43 | } 44 | 45 | 46 | /* This is the jump function for the generator. It is equivalent 47 | to 2^64 calls to next(); it can be used to generate 2^64 48 | non-overlapping subsequences for parallel computations. */ 49 | 50 | void jump(void) { 51 | static const uint32_t JUMP[] = { 0x8764000b, 0xf542d2d3, 0x6fa035c3, 0x77f2db5b }; 52 | 53 | uint32_t s0 = 0; 54 | uint32_t s1 = 0; 55 | uint32_t s2 = 0; 56 | uint32_t s3 = 0; 57 | for(int i = 0; i < sizeof JUMP / sizeof *JUMP; i++) 58 | for(int b = 0; b < 32; b++) { 59 | if (JUMP[i] & UINT32_C(1) << b) { 60 | s0 ^= s[0]; 61 | s1 ^= s[1]; 62 | s2 ^= s[2]; 63 | s3 ^= s[3]; 64 | } 65 | next(); 66 | } 67 | 68 | s[0] = s0; 69 | s[1] = s1; 70 | s[2] = s2; 71 | s[3] = s3; 72 | } 73 | -------------------------------------------------------------------------------- /Source/Falcor/Utils/Sampling/SampleGeneratorType.slangh: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #pragma once 29 | 30 | #include "Utils/HostDeviceShared.slangh" 31 | 32 | #define SAMPLE_GENERATOR_TINY_UNIFORM 0 33 | #define SAMPLE_GENERATOR_UNIFORM 1 34 | 35 | #define SAMPLE_GENERATOR_DEFAULT SAMPLE_GENERATOR_UNIFORM 36 | 37 | -------------------------------------------------------------------------------- /Source/Falcor/Core/API/D3D12/D3D12Vao.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #include "stdafx.h" 29 | #include "Core/API/VAO.h" 30 | 31 | namespace Falcor 32 | { 33 | const VaoHandle& Vao::getApiHandle() const 34 | { 35 | UNSUPPORTED_IN_D3D12("VAO doesn't have an API handle"); 36 | return mApiHandle; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Source/Falcor/RenderPasses/Shared/PathTracer/PixelStatsShared.slang: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #pragma once 29 | #include "Utils/HostDeviceShared.slangh" 30 | 31 | BEGIN_NAMESPACE_FALCOR 32 | 33 | enum class PixelStatsRayType 34 | { 35 | Shadow = 0, 36 | ClosestHit = 1, 37 | 38 | Count 39 | }; 40 | 41 | END_NAMESPACE_FALCOR 42 | -------------------------------------------------------------------------------- /Source/RenderPasses/Utils/Composite/CompositeMode.slangh: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #pragma once 29 | 30 | // Type defines shared between host and device. 31 | #define COMPOSITE_MODE_ADD 0 32 | #define COMPOSITE_MODE_MULTIPLY 1 33 | 34 | #define OUTPUT_FORMAT_FLOAT 0 35 | #define OUTPUT_FORMAT_UINT 1 36 | #define OUTPUT_FORMAT_SINT 2 37 | -------------------------------------------------------------------------------- /Build/packman/bootstrap/install_package.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019 NVIDIA CORPORATION 2 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import logging 16 | import zipfile 17 | import tempfile 18 | import sys 19 | import shutil 20 | 21 | __author__ = "hfannar" 22 | logging.basicConfig(level=logging.WARNING, format="%(message)s") 23 | logger = logging.getLogger("install_package") 24 | 25 | 26 | class TemporaryDirectory: 27 | def __init__(self): 28 | self.path = None 29 | 30 | def __enter__(self): 31 | self.path = tempfile.mkdtemp() 32 | return self.path 33 | 34 | def __exit__(self, type, value, traceback): 35 | # Remove temporary data created 36 | shutil.rmtree(self.path) 37 | 38 | 39 | def install_package(package_src_path, package_dst_path): 40 | with zipfile.ZipFile( 41 | package_src_path, allowZip64=True 42 | ) as zip_file, TemporaryDirectory() as temp_dir: 43 | zip_file.extractall(temp_dir) 44 | # Recursively copy (temp_dir will be automatically cleaned up on exit) 45 | try: 46 | # Recursive copy is needed because both package name and version folder could be missing in 47 | # target directory: 48 | shutil.copytree(temp_dir, package_dst_path) 49 | except OSError as exc: 50 | logger.warning( 51 | "Directory %s already present, packaged installation aborted" % package_dst_path 52 | ) 53 | else: 54 | logger.info("Package successfully installed to %s" % package_dst_path) 55 | 56 | 57 | install_package(sys.argv[1], sys.argv[2]) 58 | -------------------------------------------------------------------------------- /Source/Falcor/Scene/ParticleSystem/ParticleConstColor.ps.slang: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | struct VSOut 29 | { 30 | float4 pos : SV_POSITION; 31 | float2 texCoords : TEXCOORD; 32 | uint particleIndex : ID; 33 | }; 34 | 35 | cbuffer PsPerFrame : register(b2) 36 | { 37 | float4 color; 38 | }; 39 | 40 | float4 main(VSOut vOut) : SV_Target0 41 | { 42 | return color; 43 | } 44 | -------------------------------------------------------------------------------- /Source/RenderPasses/OptixDenoiser/ConvertTexToBuf.cs.slang: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | cbuffer GlobalCB 29 | { 30 | uint gStride; 31 | } 32 | 33 | Texture2D gInTex; 34 | RWBuffer gOutBuf; 35 | 36 | [numthreads(8, 8, 1)] 37 | void main(uint3 thrdId : SV_DispatchThreadID) 38 | { 39 | uint bufIdx = thrdId.x + thrdId.y * gStride; 40 | gOutBuf[bufIdx] = gInTex[thrdId.xy]; 41 | } 42 | -------------------------------------------------------------------------------- /Source/RenderPasses/OptixDenoiser/ConvertBufToTex.ps.slang: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | cbuffer GlobalCB 29 | { 30 | uint gStride; 31 | } 32 | 33 | Buffer gInBuf; 34 | 35 | float4 main( 36 | float2 texC : TEXCOORD, 37 | float4 posH : SV_POSITION) : SV_Target0 38 | { 39 | uint2 pixel = uint2(posH.xy); 40 | uint bufIdx = pixel.x + pixel.y * gStride; 41 | return gInBuf[bufIdx]; 42 | } 43 | -------------------------------------------------------------------------------- /Source/Falcor/Utils/Algorithm/ParallelReductionType.slangh: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #pragma once 29 | 30 | // Type defines shared between host and device. 31 | 32 | #define FORMAT_TYPE_UNKNOWN 0 33 | #define FORMAT_TYPE_FLOAT 1 34 | #define FORMAT_TYPE_SINT 2 35 | #define FORMAT_TYPE_UINT 3 36 | 37 | #define REDUCTION_TYPE_UNKNOWN 0 38 | #define REDUCTION_TYPE_SUM 1 39 | #define REDUCTION_TYPE_MINMAX 2 40 | -------------------------------------------------------------------------------- /Source/Falcor/dependencies.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Source/Falcor/Core/API/Vulkan/VKRasterizerState.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #include "stdafx.h" 29 | #include "API/RasterizerState.h" 30 | 31 | namespace Falcor 32 | { 33 | RasterizerState::~RasterizerState() = default; 34 | 35 | const RasterizerStateHandle& RasterizerState::getApiHandle() const 36 | { 37 | UNSUPPORTED_IN_VULKAN("RasterizerState::getApiHandle()"); 38 | return mApiHandle; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Source/RenderPasses/SSAO/SSAOData.slang: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #pragma once 29 | #include "Utils/HostDeviceShared.slangh" 30 | 31 | BEGIN_NAMESPACE_FALCOR 32 | 33 | struct SSAOData 34 | { 35 | static const uint32_t kMaxSamples = 32; 36 | 37 | float4 sampleKernel[kMaxSamples]; 38 | float2 noiseScale = float2(1, 1); 39 | uint32_t kernelSize = 16; 40 | float radius = 0.1f; 41 | }; 42 | 43 | END_NAMESPACE_FALCOR 44 | -------------------------------------------------------------------------------- /Source/Falcor/RenderPasses/Shared/PathTracer/RayFootprintModes.slangh: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #pragma once 29 | #include "Utils/HostDeviceShared.slangh" 30 | 31 | // Define all available ray footprint modes here. 32 | #define RAY_FOOTPRINT_MODE_DISABLED 0 33 | #define RAY_FOOTPRINT_MODE_RAYCONE 1 34 | #define RAY_FOOTPRINT_MODE_RAYDIFFS_ISO 2 35 | #define RAY_FOOTPRINT_MODE_RAYDIFFS_ANISO 3 36 | 37 | -------------------------------------------------------------------------------- /Source/Falcor/Core/API/D3D12/D3D12RasterizerState.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #include "stdafx.h" 29 | #include "Core/API/RasterizerState.h" 30 | 31 | namespace Falcor 32 | { 33 | RasterizerState::~RasterizerState() = default; 34 | 35 | const RasterizerStateHandle& RasterizerState::getApiHandle() const 36 | { 37 | UNSUPPORTED_IN_D3D12("RasterizerState::getApiHandle()"); 38 | return mApiHandle; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCVoxelPT/Data/DenoisedNRC.py: -------------------------------------------------------------------------------- 1 | def render_graph_PathTracerGraph(): 2 | g = RenderGraph("PathTracerGraph") 3 | loadRenderPassLibrary("AccumulatePass.dll") 4 | loadRenderPassLibrary("GBuffer.dll") 5 | loadRenderPassLibrary("ToneMapper.dll") 6 | loadRenderPassLibrary("NRCVoxelPT.dll") 7 | loadRenderPassLibrary("OptixDenoiser.dll") 8 | AccumulatePass = createPass("AccumulatePass", {'enabled': True}) 9 | g.addPass(AccumulatePass, "AccumulatePass") 10 | ToneMappingPass = createPass("ToneMapper", {'autoExposure': False, 'exposureCompensation': 6.0}) 11 | g.addPass(ToneMappingPass, "NRCToneMapped") 12 | GBufferRT = createPass("GBufferRT", {'forceCullMode': False, 'cull': CullMode.CullBack, 'samplePattern': SamplePattern.Stratified, 'sampleCount': 16}) 13 | g.addPass(GBufferRT, "GBufferRT") 14 | NRCVoxelPT = createPass("NRCVoxelPT", {'params': PathTracerParams(useVBuffer=0, maxBounces=15, maxNonSpecularBounces=15)}) 15 | g.addPass(NRCVoxelPT, "NRCVoxelPT") 16 | OptixDenoiser = createPass("OptixDenoiser") 17 | g.addPass(OptixDenoiser, "OptixDenoiser") 18 | 19 | g.addEdge("GBufferRT.vbuffer", "NRCVoxelPT.vbuffer") # Required by ray footprint. 20 | g.addEdge("GBufferRT.posW", "NRCVoxelPT.posW") 21 | g.addEdge("GBufferRT.normW", "NRCVoxelPT.normalW") 22 | g.addEdge("GBufferRT.tangentW", "NRCVoxelPT.tangentW") 23 | g.addEdge("GBufferRT.faceNormalW", "NRCVoxelPT.faceNormalW") 24 | g.addEdge("GBufferRT.viewW", "NRCVoxelPT.viewW") 25 | g.addEdge("GBufferRT.diffuseOpacity", "NRCVoxelPT.mtlDiffOpacity") 26 | g.addEdge("GBufferRT.specRough", "NRCVoxelPT.mtlSpecRough") 27 | g.addEdge("GBufferRT.emissive", "NRCVoxelPT.mtlEmissive") 28 | g.addEdge("GBufferRT.matlExtra", "NRCVoxelPT.mtlParams") 29 | g.addEdge("NRCVoxelPT.result", "NRCToneMapped.src") 30 | g.addEdge("NRCToneMapped.dst", "OptixDenoiser.color") 31 | g.addEdge("NRCVoxelPT.albedo", "OptixDenoiser.albedo") 32 | g.addEdge("GBufferRT.normW", "OptixDenoiser.normal") 33 | g.markOutput("OptixDenoiser.output") 34 | return g 35 | 36 | PathTracerGraph = render_graph_PathTracerGraph() 37 | try: m.addGraph(PathTracerGraph) 38 | except NameError: None 39 | -------------------------------------------------------------------------------- /Tools/notes/PathTracer.md: -------------------------------------------------------------------------------- 1 | # PathTracer 2 | 3 | ### Methods 4 | 5 | ### Auxillary Classes 6 | 7 | 基本位于`RenderPasses/Shared/PathTracer/`,以及`Scene/`中 8 | 9 | ##### ShadingsData 10 | 11 | 包含Geometry信息,像是face normal、shading normal、tangent;以及材质信息,roughness、opacity、emissive等。 12 | 13 | ##### PathData 14 | 15 | 当前的光线信息,throughput,pdf,hitinfo等等,累计的path contribution,用于当前路径的sanple generator,记录当前路径的ray footprint,以及一个维护了路径上材质信息的interior list,其实是一个固定长度的数组。 16 | 17 | ##### Packed Hit Info 18 | 19 | 当前intersection的信息,精确定位到具体是哪一个三角形(triangle id)被击中了。 20 | 21 | #### Ray Footprint 22 | 23 | 主要两个属性,`width`和`spread angle`. 24 | 25 | ### Debugging 26 | 27 | #### Embedded Shader Program 28 | 29 | `PixelDebug`和`PixelStats`就是两个典型的shader program。使用它们的shader需要`__exported import`这两个slang shader,在host code端create它们,并在`beginFrame`和`endFrame`中也调用它们的相应方法,以使它们可以向shader绑定资源。 30 | 31 | #### Pixel Stats 32 | 33 | `PixelStats.slang`使用Texture记录路径长度、采样次数等信息,在host code端使用`ParallelReduction`将Texture2D求和。在获取信息时使用了`CpuFence`进行同步(保证ParallelReduction已经完成)。在shader中使用`log-`对相应统计信息进行写入。 34 | 35 | #### Pixel Debug 36 | 37 | ​ `PixelDebug.slang`绑定了一个固定长度的StructuredBuffer,在shader中可以使用`print(msg, val)`指令写入debug message,具体可见shader文件。使用pixel stats和pixel debug功能时都需要在pixel shader中通过`logSetPixel`和`printSetPixel`指定当前像素的坐标,这存储在`static int`中。 38 | 39 | ### Shader-CPU Communications 40 | 41 | #### Mapping to structured buffer 42 | 43 | `Buffer`类可以创建可被CPU读写的buffer,通过`Buffer::map`可以将buffer映射至内存中。除了原子类型,还可以使用自定义的数据结构`Buffer::createStructured`,在创建之时就要绑定到shader中的RWStructuredBuffer上,它就像是一个固定长度的数组一样被索引。 44 | 45 | 目前来看,structuredBuffer可以绑定到shader上,buffer虽然同样位于GPU中,但不能被绑定到shader上;而一般通过host code使用其他算子读写buffer,比如`ParallelReduction`。[开销尚待考察] 46 | 47 | StructuredBuffer还会自带一个UAV Counter buffer,在shader中可以使用`IncrementCounter`等方法对其值进行修改,在host code中可以获取该buffer并`map`映射到内存中从而读取counter的值。 48 | 49 | #### Ansynchronous routines 50 | 51 | 一些操作可以异步执行,比如说`copyBufferRegion`或者`executeParallelReduction`等。这些操作会被提交到command list中,我们使用`RenderContext::Flush`提交这些commend,并可以指定是否阻塞直到任务完成。一般我们与`GpuFence`联合使用,可在这些命令执行完成时进行同步。 52 | 53 | #### CUDA Interop 54 | 55 | 我们目前还在考察,使用CUDA interop能否将shader buffer中的内容在避免经过CPU的情况下直接送入CUDA,现在看来好像是可行的。在官方的`Cudainterop` sample中描述了将Texture映射到`CudaExternalMemory`中的流程。 56 | 57 | -------------------------------------------------------------------------------- /Source/Falcor/RenderGraph/BasePasses/FullScreenPass.vs.slang: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | struct VsOut 29 | { 30 | float2 texC : TEXCOORD; 31 | #ifndef _VIEWPORT_MASK 32 | float4 posH : SV_POSITION; 33 | #else 34 | float4 posH : POSITION; 35 | #endif 36 | }; 37 | 38 | VsOut main(float4 posS : POSITION, float2 texC : TEXCOORD) 39 | { 40 | VsOut vOut; 41 | vOut.texC = texC; 42 | vOut.posH = posS; 43 | return vOut; 44 | } 45 | -------------------------------------------------------------------------------- /Source/RenderPasses/GBuffer/GBuffer/GBuffer.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #pragma once 29 | #include "../GBufferBase.h" 30 | #include "RenderGraph/RenderPassHelpers.h" 31 | 32 | using namespace Falcor; 33 | 34 | /** Base class for the different G-buffer passes. 35 | */ 36 | class GBuffer : public GBufferBase 37 | { 38 | protected: 39 | GBuffer(); 40 | 41 | // Constants used in derived classes 42 | static const ChannelList kGBufferChannels; 43 | }; 44 | -------------------------------------------------------------------------------- /Source/RenderPasses/SVGFPass/SVGFFinalModulate.ps.slang: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | import Scene.ShadingData; 29 | import SVGFCommon; 30 | 31 | cbuffer PerImageCB 32 | { 33 | Texture2D gAlbedo; 34 | Texture2D gEmission; 35 | Texture2D gIllumination; 36 | }; 37 | 38 | float4 main(FullScreenPassVsOut vsOut) : SV_TARGET0 39 | { 40 | const int2 ipos = int2(vsOut.posH.xy); 41 | 42 | return gAlbedo[ipos] * gIllumination[ipos] + gEmission[ipos]; 43 | } 44 | -------------------------------------------------------------------------------- /Source/Falcor/Experimental/Scene/Material/BCSDFConfig.slangh: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #pragma once 29 | 30 | /** Static configuration of the BCSDF models. 31 | 32 | The defaults can be overridden by passing in defines from the host. 33 | 34 | TODO: This file will be removed when we've settled on a new standard material definition. 35 | */ 36 | 37 | #define DiffuseLambert 0 38 | #define HairChiang 1 39 | 40 | #ifndef BCSDF 41 | #define BCSDF HairChiang 42 | #endif 43 | -------------------------------------------------------------------------------- /Source/RenderPasses/TestPasses/TestPasses.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #include "TestRtProgram.h" 29 | 30 | extern "C" __declspec(dllexport) const char* getProjDir() 31 | { 32 | return PROJECT_DIR; 33 | } 34 | 35 | extern "C" __declspec(dllexport) void getPasses(Falcor::RenderPassLibrary& lib) 36 | { 37 | lib.registerClass("TestRtProgram", TestRtProgram::kDesc, TestRtProgram::create); 38 | ScriptBindings::registerBinding(TestRtProgram::registerScriptBindings); 39 | } 40 | -------------------------------------------------------------------------------- /Source/Falcor/Experimental/Scene/Lights/LightBVHSamplerSharedDefinitions.slang: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #pragma once 29 | #include "Utils/HostDeviceShared.slangh" 30 | 31 | BEGIN_NAMESPACE_FALCOR 32 | 33 | enum class SolidAngleBoundMethod 34 | // TODO: Remove the ifdefs and the include when Slang supports enum type specifiers. 35 | #ifdef HOST_CODE 36 | : uint32_t 37 | #endif 38 | { 39 | BoxToCenter = 1, 40 | BoxToAverage, 41 | Sphere, 42 | }; 43 | 44 | END_NAMESPACE_FALCOR 45 | -------------------------------------------------------------------------------- /Source/Falcor/Core/API/D3D12/D3D12Resource.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #pragma once 29 | #include "Core/API/Resource.h" 30 | 31 | namespace Falcor 32 | { 33 | D3D12_RESOURCE_FLAGS getD3D12ResourceFlags(Resource::BindFlags flags); 34 | D3D12_RESOURCE_STATES getD3D12ResourceState(Resource::State s); 35 | 36 | extern const D3D12_HEAP_PROPERTIES kDefaultHeapProps; 37 | extern const D3D12_HEAP_PROPERTIES kUploadHeapProps; 38 | extern const D3D12_HEAP_PROPERTIES kReadbackHeapProps; 39 | } 40 | -------------------------------------------------------------------------------- /Source/Falcor/Scene/Animation/Animatable.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #include "stdafx.h" 29 | #include "Animatable.h" 30 | 31 | namespace Falcor 32 | { 33 | SCRIPT_BINDING(Animatable) 34 | { 35 | pybind11::class_ animatable(m, "Animatable"); 36 | animatable.def_property_readonly("hasAnimation", &Animatable::hasAnimation); 37 | animatable.def_property("animated", &Animatable::isAnimated, &Animatable::setIsAnimated); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Source/Mogwai/Data/CustomScripts/PathTracerPostFX.py: -------------------------------------------------------------------------------- 1 | def render_graph_PathTracerGraph(): 2 | g = RenderGraph("PathTracerGraph") 3 | loadRenderPassLibrary("AccumulatePass.dll") 4 | loadRenderPassLibrary("GBuffer.dll") 5 | loadRenderPassLibrary("ToneMapper.dll") 6 | loadRenderPassLibrary("MegakernelPathTracer.dll") 7 | loadRenderPassLibrary("SimplePostFX.dll") 8 | AccumulatePass = createPass("AccumulatePass", {'enabled': True}) 9 | g.addPass(AccumulatePass, "AccumulatePass") 10 | ToneMappingPass = createPass("ToneMapper", {'autoExposure': False, 'exposureCompensation': 0.0}) 11 | g.addPass(ToneMappingPass, "ToneMappingPass") 12 | GBufferRT = createPass("GBufferRT", {'forceCullMode': False, 'cull': CullMode.CullBack, 'samplePattern': SamplePattern.Stratified, 'sampleCount': 16}) 13 | g.addPass(GBufferRT, "GBufferRT") 14 | MegakernelPathTracer = createPass("MegakernelPathTracer", {'params': PathTracerParams(useVBuffer=0)}) 15 | g.addPass(MegakernelPathTracer, "MegakernelPathTracer") 16 | SimplePostFX = createPass("SimplePostFX", {}) 17 | g.addPass(SimplePostFX, "SimplePostFX") 18 | g.addEdge("GBufferRT.vbuffer", "MegakernelPathTracer.vbuffer") # Required by ray footprint. 19 | g.addEdge("GBufferRT.posW", "MegakernelPathTracer.posW") 20 | g.addEdge("GBufferRT.normW", "MegakernelPathTracer.normalW") 21 | g.addEdge("GBufferRT.tangentW", "MegakernelPathTracer.tangentW") 22 | g.addEdge("GBufferRT.faceNormalW", "MegakernelPathTracer.faceNormalW") 23 | g.addEdge("GBufferRT.viewW", "MegakernelPathTracer.viewW") 24 | g.addEdge("GBufferRT.diffuseOpacity", "MegakernelPathTracer.mtlDiffOpacity") 25 | g.addEdge("GBufferRT.specRough", "MegakernelPathTracer.mtlSpecRough") 26 | g.addEdge("GBufferRT.emissive", "MegakernelPathTracer.mtlEmissive") 27 | g.addEdge("GBufferRT.matlExtra", "MegakernelPathTracer.mtlParams") 28 | g.addEdge("MegakernelPathTracer.color", "AccumulatePass.input") 29 | g.addEdge("AccumulatePass.output", "ToneMappingPass.src") 30 | g.addEdge("ToneMappingPass.dst", "SimplePostFX.src") 31 | g.markOutput("SimplePostFX.dst") 32 | return g 33 | 34 | PathTracerGraph = render_graph_PathTracerGraph() 35 | try: m.addGraph(PathTracerGraph) 36 | except NameError: None 37 | -------------------------------------------------------------------------------- /Source/RenderPasses/NRCPathTracer/Data/DenoisedNRC.py: -------------------------------------------------------------------------------- 1 | def render_graph_PathTracerGraph(): 2 | g = RenderGraph("PathTracerGraph") 3 | loadRenderPassLibrary("AccumulatePass.dll") 4 | loadRenderPassLibrary("GBuffer.dll") 5 | loadRenderPassLibrary("ToneMapper.dll") 6 | loadRenderPassLibrary("NRCPathTracer.dll") 7 | loadRenderPassLibrary("OptixDenoiser.dll") 8 | AccumulatePass = createPass("AccumulatePass", {'enabled': True}) 9 | g.addPass(AccumulatePass, "AccumulatePass") 10 | ToneMappingPass = createPass("ToneMapper", {'autoExposure': False, 'exposureCompensation': 6.0}) 11 | g.addPass(ToneMappingPass, "NRCToneMapped") 12 | GBufferRT = createPass("GBufferRT", {'forceCullMode': False, 'cull': CullMode.CullBack, 'samplePattern': SamplePattern.Stratified, 'sampleCount': 16}) 13 | g.addPass(GBufferRT, "GBufferRT") 14 | NRCPathTracer = createPass("NRCPathTracer", {'params': PathTracerParams(useVBuffer=0, maxBounces=15, maxNonSpecularBounces=15)}) 15 | g.addPass(NRCPathTracer, "NRCPathTracer") 16 | OptixDenoiser = createPass("OptixDenoiser") 17 | g.addPass(OptixDenoiser, "OptixDenoiser") 18 | 19 | g.addEdge("GBufferRT.vbuffer", "NRCPathTracer.vbuffer") # Required by ray footprint. 20 | g.addEdge("GBufferRT.posW", "NRCPathTracer.posW") 21 | g.addEdge("GBufferRT.normW", "NRCPathTracer.normalW") 22 | g.addEdge("GBufferRT.tangentW", "NRCPathTracer.tangentW") 23 | g.addEdge("GBufferRT.faceNormalW", "NRCPathTracer.faceNormalW") 24 | g.addEdge("GBufferRT.viewW", "NRCPathTracer.viewW") 25 | g.addEdge("GBufferRT.diffuseOpacity", "NRCPathTracer.mtlDiffOpacity") 26 | g.addEdge("GBufferRT.specRough", "NRCPathTracer.mtlSpecRough") 27 | g.addEdge("GBufferRT.emissive", "NRCPathTracer.mtlEmissive") 28 | g.addEdge("GBufferRT.matlExtra", "NRCPathTracer.mtlParams") 29 | g.addEdge("NRCPathTracer.result", "NRCToneMapped.src") 30 | g.addEdge("NRCToneMapped.dst", "OptixDenoiser.color") 31 | g.addEdge("NRCPathTracer.albedo", "OptixDenoiser.albedo") 32 | g.addEdge("GBufferRT.normW", "OptixDenoiser.normal") 33 | g.markOutput("OptixDenoiser.output") 34 | return g 35 | 36 | PathTracerGraph = render_graph_PathTracerGraph() 37 | try: m.addGraph(PathTracerGraph) 38 | except NameError: None 39 | -------------------------------------------------------------------------------- /Source/RenderPasses/ToneMapper/Luminance.ps.slang: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | SamplerState gColorSampler : register(s1); 29 | 30 | Texture2D gColorTex; 31 | 32 | float luminance(float3 color) 33 | { 34 | return dot(color, float3(0.299, 0.587, 0.114)); 35 | } 36 | 37 | float4 main(float2 texC : TEXCOORD) : SV_TARGET0 38 | { 39 | float4 color = gColorTex.Sample(gColorSampler, texC); 40 | float logLuminance = log2(max(0.0001, luminance(color.xyz))); 41 | return float4(logLuminance, 0, 0, 1); 42 | } 43 | -------------------------------------------------------------------------------- /Source/RenderPasses/DebugPasses/ColorMapPass/ColorMapParams.slang: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #include "Utils/HostDeviceShared.slangh" 29 | 30 | BEGIN_NAMESPACE_FALCOR 31 | 32 | enum class ColorMap 33 | #ifdef HOST_CODE 34 | : uint32_t 35 | #endif 36 | { 37 | Grey, 38 | Jet, 39 | Viridis, 40 | Plasma, 41 | Magma, 42 | Inferno, 43 | }; 44 | 45 | struct ColorMapParams 46 | { 47 | float minValue = 0.f; 48 | float maxValue = 1.f; 49 | float2 _pad; 50 | }; 51 | 52 | END_NAMESPACE_FALCOR 53 | -------------------------------------------------------------------------------- /Source/RenderPasses/DebugPasses/InvalidPixelDetectionPass/InvalidPixelDetection.ps.slang: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | Texture2D gTexture; 29 | 30 | float4 main(float2 texC : TEXCOORD) : SV_TARGET0 31 | { 32 | uint2 uv; 33 | gTexture.GetDimensions(uv.x, uv.y); 34 | int2 xy = int2(uv * texC); 35 | float4 value = gTexture.Load(int3(xy, 0)); 36 | if (any(isnan(value))) return float4(1, 0, 0, 1); 37 | else if (any(isinf(value))) return float4(0, 1, 0, 1); 38 | return float4(0, 0, 0, 1); 39 | } 40 | -------------------------------------------------------------------------------- /Source/RenderPasses/SSAO/ApplyAO.ps.slang: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | SamplerState gSampler; 29 | 30 | Texture2D gColor; 31 | Texture2D gAOMap; 32 | 33 | float4 applyAmbientOcclusion(float4 color, Texture2D aoTex, SamplerState s, float2 texC) 34 | { 35 | float aoFactor = aoTex.SampleLevel(s, texC, 0).r; 36 | return float4(color.rgb * aoFactor, color.a); 37 | } 38 | 39 | float4 main(float2 texC : TEXCOORD) : SV_TARGET0 40 | { 41 | return applyAmbientOcclusion(gColor.SampleLevel(gSampler, texC, 0), gAOMap, gSampler, texC); 42 | } 43 | -------------------------------------------------------------------------------- /Source/Falcor/Experimental/Scene/Material/TexLODTypes.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | # Copyright (c) 2015-21, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # * Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # * Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # * Neither the name of NVIDIA CORPORATION nor the names of its 13 | # contributors may be used to endorse or promote products derived 14 | # from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY 17 | # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 20 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | **************************************************************************/ 28 | #pragma once 29 | 30 | #include "stdafx.h" 31 | #include "TexLODTypes.slang" 32 | #include 33 | 34 | namespace Falcor 35 | { 36 | SCRIPT_BINDING(TexLODTypes) 37 | { 38 | pybind11::enum_ texLODMode(m, "TexLODMode"); 39 | texLODMode.value("Mip0", TexLODMode::Mip0); 40 | texLODMode.value("RayCones", TexLODMode::RayCones); 41 | texLODMode.value("RayDiffs", TexLODMode::RayDiffs); 42 | } 43 | } 44 | --------------------------------------------------------------------------------