Skip to content

Commit 7464cf3

Browse files
authored
Merge pull request #54 from Pjbomb2/Dev
Dev
2 parents f3875fe + 4251f34 commit 7464cf3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+8431
-14912
lines changed

.Images/Caustics1.png

3.92 MB
Loading

README.md

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@
4444
<li>Lambert or EON diffuse models</li>
4545
<li>Chromatic Aberation, Saturation, Colored Vignette</li>
4646
<li>Full Multiscatter Fog(Not realtime)</li>
47-
<li>Orthographic Camera</li>
47+
<li>Orthographic Camera Support</li>
48+
<li>Photon Mapping for fast(but not realtime) caustics</li>
49+
<li>Animatable Material Properties</li>
4850
</ul>
4951

5052
MASSIVE thanks to
@@ -80,8 +82,7 @@ for bringing bindless textures to unity!
8082

8183
### Manual method
8284
<ul>
83-
<li>First, add your gameobjects as a child of the "Scene" gameobject created by TrueTrace.</li>
84-
<li>Each gameobject that contains a mesh needs the script "RayTracingObject" added to it.</li>
85+
<li>First, each gameobject that contains a mesh needs the script "RayTracingObject" added to it.(This keeps track of per-mesh materials)</li>
8586
<li>For non-skinned meshes: </li>
8687
<ul>
8788
<li>Add the script "ParentObject" to either:</li>
@@ -104,25 +105,24 @@ for bringing bindless textures to unity!
104105
<li>DX12 is recommended, as it enables use of OIDN, Bindless texturing, RT Cores, and higher performance</li>
105106
<li>The camera you want to render from, you attach the RenderHandler script to(if you have a camera tagged MainCamera, this will be done automatically)</li>
106107
<li>The green/red rectangle shows when the acceleration structure is done building, and thus ready to render, red means that its not done, and green means its done building, a ding will sound when it completes if it takes longer than 15 seconds(Turn on Truetrace Settings -> Functionality Settings</li>
107-
<li>Objects can be added and removed at will simply by toggling the associated GameObject with a ParentObject script on/off in the hierarchy(clicking on parent objects with complex objects for children will lag), but they will take time to appear as the acceleration structure needs to be rebuilt for them</li>
108+
<li>Objects can be added and removed at will simply by toggling the associated GameObject with a ParentObject script on/off in the hierarchy(clicking on parent objects with complex objects for children will lag), but they will take time to appear as the acceleration structure needs to be rebuilt for them</li>
108109
<li>Emissive meshes need to be have a non-zero emissive value when they are built or rebuilt to work with NEE, but after that can have their emissiveness changed at will</li>
109110
<li>To set up PBR with the DEFAULT BIRP material, all textures go into their proper names, but Roughness goes into the Occlusion texture(This can be changed in the MaterialPairing menu)</li>
110111
<li>If you are using blendshapes to change geometry of a skinned mesh, you may need to go to the import settings of it(in the inspector), turn off Legacy Blendshape Normals, and make sure all normals are imported, not calculated, otherwise the normals for blendshapes might be wrong</li>
111112
<li>If you use HDRIs, or CubeMaps for the skybox, you need to format as the texture to a Texture2D in the inspector of the image, unity will convert it automatically, then put it in the slot in "Scene Settings" in the TrueTrace settings menu</li>
113+
<li>Some settings will be hidden behind an "Advanced Mode" toggle found in "Functionality Settings"</li>
114+
</ul>
115+
116+
## Animating TT Materials
117+
<ul>
118+
<li>To animate properties of a truetrace material, you need to add the script "MaterialAnimationView" to the same gameobject as the RayTracingObject</li>
119+
<li>Next, you need to select the targeted submaterial in the dropdown of the newly added script</li>
120+
<li>Finally, you can now animate any material property by animating the SelectedMaterial properties.</li>
112121
</ul>
113122

114123
## URP Setup
115124
<ul>
116-
<li>If using Unity 6000 or above, you need to go to Project Settings -> Graphics -> (at the bottom)Turn on Compatability Mode</li>
117-
<li>In the Universal Renderer Asset being used turn on "Native RenderPass"</li>
118-
<li>EITHER:</li>
119-
<ul>
120-
<li>In the camera, turn on PostProcessing, and turn the Anti-Aliasing to TAA(This is the only way I have found to reliably force motion vector generation in URP for some reason...)</li>
121-
<li>OR</li>
122-
<li>In Truetrace Settings -> Functionality Settings -> Turn ON "Use Custom Motion Vectors"</li>
123-
</ul>
124-
<li>Finally, add the "URPTTInjectPass" script to an empty gameobject if it has not been automatically added</li>
125-
<li>Reccomended - Go to the Universal Render Pipeline Asset you are using, and turn the render scale to 1</li>
125+
<li>Add the URPTTInjectPass to the currently used renderer as a renderfeature(The name of which can be found in the Camera)</li>
126126
</ul>
127127

128128
## Creating Non-Standard Images
@@ -148,29 +148,35 @@ for bringing bindless textures to unity!
148148

149149
## Functionality Settings Contents
150150
<ul>
151-
<li>NOTE FIRST: MOST OF THESE IN THIS TABLE NOW HAVE TOOLTIPS THAT APPEAR IF YOU HOVER OVER THEM!</li>
151+
<li>NOTES 1: MOST OF THESE IN THIS TABLE HAVE TOOLTIPS THAT APPEAR IF YOU HOVER OVER THEM!</li>
152+
<li>NOTES 2: SOME OF THESE ARE HIDDEN BEHIND TTAdvancedMode, WHICH CAN BE TOGGLED IN THIS MENU.</li>
152153
<li>Enable RT Cores - (DX12 Only, REQUIRES UNITY 2023 OR HIGHER)Enables Hardware RT for cards that support it.</li>
153-
<li>Disable Bindless Textures - DX11(/vulkan/metal) compatability, Disables bindless texturing, and uses the atlas fallback(Limits resolution).</li>
154154
<li>Use Old Light BVH Instead of Gaussian Tree - Disables the Gaussian Tree for higher performance but worse light sampling on metallics.</li>
155-
<li>Use DX11 - Disables DX12 only toggles, but allows truetrace to run in DX11(/vulkan/metal).</li>
156155
<li>Enable OIDN - (DX12 Only) Adds the OIDN denoiser to the Denoiser list in "Main Options"</li>
157-
<li>FULLY Disable Radiance Cache - Will free the memory usually used by the Radiance Cache</li>
158-
<li>Remove Rasterization Requirement - Truetrace stops using rasterization for anything(other than upscaling with TAAU), so you can turn off rasterization rendering in your cameras for extra performance</li>
156+
<li>FULLY Disable Radiance Cache - Will free the memory(RAM/VRAM) usually used by the Radiance Cache</li>
157+
<li>Use Rasterized Lighting For Direct - Experimental, only known to work in BIRP, Forces truetrace to only render indirect</li>
159158
<li>Enable Emissive Texture Aware Light BVH - Allows for smarter/better sampling of emissive meshes by considering their emissive masks/textures; Can use lots of RAM.</li>
160159
<li>Enable Verbose Logging - Truetrace will yell more information into the console.</li>
160+
<li>Enable Triangle Splitting - Optimization for SWRT that splits triangles to improve tracing performance.</li>
161+
<li>Enable Strict Memory Reduction - Shrinks compute buffers when objects are removed, which reduces performance but saves VRAM.</li>
162+
<li>Save Multiple Maps On Screenshot - Any sort of image saved by truetrace will also generate images of the corrosponding material and mesh IDs.</li>
163+
<li>Enable Photon Mapping - Enables the experimental photon mapping pass for caustic generation. Materials will need to have their flag enabled to generate caustics.</li>
164+
<li>Remove TT Scripts During Save - Will delete all unmodified raytracingobject and parentobject scripts when the scene is saved, then add them back. This helps with version control.</li>
161165
<li>Fade Mapping - Not super compatable with realtime denoisers, but allows for surfaces with variable transparency, based on alpha texture.</li>
162166
<li>Stained Glass - Whether or not to color shadow rays that pass through colored glass, dictated by material parameters: Thin, Albedo, Scatter Distance.</li>
163167
<li>Use Light BVH - Toggles the use of EITHER the Light BVH or Gaussian Tree on/off; uses the RIS count of NEE if off. Turn off for maximum speed, but poor emissive mesh sampling quality.</li>
164168
<li>Quick Radcache Toggle - Toggles the radcache on/off. Useful for comparing to ground truth pathtracing.</li>
169+
<li>Use Texture LOD - Samples LOD of textures based on bounce number, can improve performance.</li>
170+
<li>Double Buffer Light Tree - Enables double buffering of the light tree, allowing for stable moving emissive objects with ASVGF, but hurts performance with ASVGF.</li>
165171
</ul>
166172

167173

168174
## Editor Window Guide
169175
TrueTrace Options Description -
170176
<ul>
171177
<li>Build Aggregated BVH(Recommended to do any time you change objects in edit mode)- Allows you to pre-build objects BVH's before running so you dont have to wait every time you go into play mode for it to build.</li>
172-
<li>Clear Parent Data - Clears the data stored in parent GameObjects, allowing you to actually click them without lagging</li>
173178
<li>Take Screenshot - Takes a screenshot to the path under "Functionality Settings" in the TrueTrace options</li>
179+
<li>Clear Parent Data - Clears the data stored in parent GameObjects, allowing you to actually click them without lagging</li>
174180
<li>Auto Assign Scripts - Assigns all required scripts to all objects under the Scene GameObject, best way to add objects</li>
175181
<li>Remaining Objects - Objects still being processed</li>
176182
<li>Max Bounces - Sets the maximum number of bounces a ray can achieve</li>
@@ -193,7 +199,7 @@ TrueTrace Options Description -
193199
</ul>
194200
<li>Upscaler(ONLY when "Interal Resolution Ratio" is NOT 1) - Allows selection from one of a few upscaling methods</li>
195201
<li>Use Partial Rendering - Traces only 1 out of (X*X) rays, improving performance</li>
196-
<li>Enable AntiFirefly - Enables RCRS filter for getting rid of those single bright pixels</li>
202+
<li>Enable AntiFirefly - Enables RCRS filter for getting rid of those single bright pixels, will produce artifacts in image if activated too early(frames accumulated)</li>
197203
<ul>
198204
<li>Frames Before Anti-Firefly - Frames accumulated before triggering Anti-Firefly</li>
199205
<li>Anti-Firefly Frame Interval - Anti-Firefly will run once every X frames, this is X</li>
@@ -224,10 +230,7 @@ GlobalDefines.cginc Description -
224230
<ul>
225231
<li>HardwareRT - This is handled from the CPU side under Functionality Settings</li>
226232
<li>HDRP - This is handled from the CPU side automatically</li>
227-
<li>DX11 - This is handled from the CPU side automatically/Under Functionality Settings</li>
228-
<li>UseBindless - This is handled from the CPU side automatically/Under Functionality Settings</li>
229233
<li>UseSGTree - This is handled from the CPU side under Functionality Settings</li>
230-
<li>TTCustomMotionVectors - This is handled from the CPU side under Functionality Settings; named "Remove Rasterization Requirement"</li>
231234
<li>MultiMapScreenshot - This is handled from the CPU side under Functionality Settings; named "Save Multiple Maps On Screenshot"; Truetrace will also save images of material ID and mesh ID maps when using TTAdvancedImageGen or the Screenshot button</li>
232235
</ul>
233236
<li>These are fine to modify yourself:</li>
@@ -243,7 +246,6 @@ GlobalDefines.cginc Description -
243246
<li>IgnoreBackfacing - Rays will not intersect triangle facing away from the ray(also accessable from Functionality Settings)</li>
244247
<li>LBVH - Whether or not to use RIS for triangle sampling or one of the light trees(also accessable from Functionality Settings)</li>
245248
<li>AccurateEmissionTex - Whether or not to sample emission textues</li>
246-
<li>TrueBlack - Legacy option, allows for actual black, which used to cause issues but no longer does</li>
247249
<li>UseTextureLOD - When bindless is on, this allows for dumb sampling of texture LOD's(also accessable from Functionality Settings)</li>
248250
<li>EONDiffuse - Whether to use Lambert diffuse model or EON diffuse model(also accessable from Functionality Settings)</li>
249251
<li>AdvancedBackground - Allows selected surfaces to instead be treated as hitting the skybox(also accessable from Functionality Settings)</li>
@@ -252,14 +254,12 @@ GlobalDefines.cginc Description -
252254
<li>Fog - Toggles multiscatter fog, not denoiser compatable(also accessable from Functionality Settings)</li>
253255
<li>RadCache - Quick toggle for the Radiance Cache(also accessable from Functionality Settings)</li>
254256
<li>ClampRoughnessToBounce - Clamps the material roughness to be higher for each bounce, helps fight fireflies</li>
255-
<li>RasterizedDirect - Experimental, BIRP only, will make truetrace only contribnute to indirect, and use unity rasterization for direct</li>
256257
<li>ReSTIRSampleReduction - Experiemental, only pathtraces half the rays and lets ReSTIR fill in the gaps</li>
257-
<li>ReSTIRRestrictSpatial - Experiemental option to allow for cleaner reflections in near-mirrors</li>
258-
<li>SmartRestriction - Additional cleanup ontop of previous define</li>
259-
<li>ReSTIRAdditionalAO - Adds fake AO through restir, can help with brightened corners</li>
258+
<li>ReSTIRReflectionRefinement - Experiemental option to allow for cleaner reflections in near-mirrors</li>
260259
<li>ShadowGlassAttenuation - Advancement of "StainedGlassShadow"; still experimental</li>
261260
<li>DisableNormalMaps - Debug thing</li>
262261
<li>ClayMetalOverride - Allows for clay mode to also define a constant metallic/roughness</li>
262+
<li>MoreAO - Adds fake AO, can help with brightened corners</li>
263263
</ul>
264264
</ul>
265265

@@ -300,6 +300,7 @@ GlobalDefines.cginc Description -
300300

301301
![](/.Images/Yanus2.png)
302302
![](/.Images/Yanus0.png)
303+
![](/.Images/Caustics1.png)
303304
![](/.Images/ModernBistro.png)
304305
![](/.Images/NewSponza3V2.png)
305306
![](/.Images/NewSponza2V2.png)

TrueTrace.unitypackage

-9.21 KB
Binary file not shown.

TrueTrace/DemoScene.asset

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,24 @@ MonoBehaviour:
3131
PPToneMap: 0
3232
PPTAA: 0
3333
RenderScale: 1
34-
DenoiserMethod: 1
34+
DenoiserMethod: 0
3535
UpscalerMethod: 0
3636
UseReSTIRGITemporal: 1
3737
UseReSTIRGISpatial: 1
3838
UseReSTIRGI: 0
39-
ReSTIRGISpatialCount: 24
40-
ReSTIRGISpatialRadius: 50
4139
ReSTIRGITemporalMCap: 4
4240
DoReSTIRGIConnectionValidation: 1
43-
Exposure: 5.4
41+
Exposure: 50
4442
DoPartialRendering: 0
45-
PartialRenderingFactor: 1
43+
PartialRenderingFactor: 2
4644
DoFirefly: 0
4745
ImprovedPrimaryHit: 1
4846
RISCount: 12
4947
ToneMapper: 0
5048
SkyDesaturate: 0
5149
ClayColor: {x: 0.5, y: 0.5, z: 0.5}
52-
ClayMetalOverride: 1
53-
ClayRoughnessOverride: 0.3
50+
ClayMetalOverride: 0
51+
ClayRoughnessOverride: 0
5452
DoClayMetalRoughOverride: 0
5553
GroundColor: {x: 0.11320752, y: 0.11320752, z: 0.11320752}
5654
FireflyFrameCount: 0
@@ -74,10 +72,10 @@ MonoBehaviour:
7472
UseTransmittanceInNEE: 1
7573
SecondarySkyDesaturate: 0
7674
MatChangeResetsAccum: 1
77-
PPFXAA: 1
75+
PPFXAA: 0
7876
OIDNBlendRatio: 1
7977
ConvBloom: 1
80-
ConvStrength: 0.04
78+
ConvStrength: 0.4
8179
ConvBloomThreshold: 0
8280
ConvBloomSize: {x: 1, y: 1}
8381
ConvBloomDistExp: 0
@@ -103,3 +101,10 @@ MonoBehaviour:
103101
ColorVignette: {x: 0, y: 0, z: 0}
104102
aoStrength: 1
105103
aoRadius: 2
104+
CurrentTargetFile: C:/Unity/Unity Raytracing V277/Assets/TrueTrace-Unity-Pathtracer/TrueTrace/Resources/Utility/MaterialPresets/MaterialPresets.xml
105+
SamplesPerFrame: 1
106+
PhotonMapRadiusCoverage: 12
107+
CausticIntensityMultiplier: 1
108+
PhotonGuidingRatio: 0.15
109+
PhotonGuidingPerLightGuidingResolution: 128
110+
PhotonGuidingTotalPhotonsPerFrame: 2000000

0 commit comments

Comments
 (0)