A High Performance Compute Shader Based Mesh Pathtracer in Unity3d without RT Cores
A High Performance Compute Shader Based Mesh Pathtracer in Unity3d without RT Cores
High Performance Compute Shader based path tracing without RT cores
Compressed Wide Bounding Volume Hierarchy for High Performance Software RT(no RT Cores)
No specific GPU vendor needed(this will run on integrated graphics if you so wish it, aka no RTX cores needed)
Hardware RT Support for modern cards
Full Disney BSDF for materials
Full support for complex emissive meshes
Runtime transform, add, and removal of objects
Runtime modifiable materials
ASVGF for realtime denoising
OIDN for offline denoising
PBR Texture Support
Next Event Estimation with Multiple Importance Sampling
Spherical Gaussian Light Tree or the Light BVH for Next Event Estimation
Support for all default unity lights(Using Next Event Estimation)
Bloom, Depth of Field, AutoExposure, TAA, Tonemapping
Precomputed Multiple Atmospheric Scattering for the sky
Object Instancing(Without RT Cores)
ReSTIR GI(cursed implementation)
Simple upscaling ability
Supports Built-in, HDRP, and URP
Full skinned mesh support
Supports deformable standard meshes
Supports unity heightmap terrain and heightmap trees
Enironment Map Importance Sampling
Radiance Cache
Material Preset System
Efficient Panorama Rendering
IES for spotlights
True Bindless texturing(Thanks to Meetem)
Convolution Bloom(Not mine)
Vulkan and Metal support(Your mileage may vary)
Mesh slicing using SDFs(Does not modify meshes, for rendering cuts only, like cross-sections)
Lambert or EON diffuse models
Chromatic Aberation, Saturation, Colored Vignette
Full Multiscatter Fog(Not realtime)
Orthographic Camera Support
Photon Mapping for fast(but not realtime) caustics
Animatable Material Properties
MASSIVE thanks to Alex Bakanov(AKA Meetem) for bringing bindless textures to unity! Ylitie et al ebruneton Convolutional Bloom Spherical Gaussian Light Tree Light BVH(PBRT 4) vMF Diffuse Model EON Diffuse Model URP Compatability script inspiration Chromatic Aberation Contrast/Saturation Vignette Base Vignette Color
After you first install TrueTrace, you will need to restart the unity project this one time, so that the bindless plugin can initialize properly.
First, add your gameobjects as a child of the "Scene" gameobject created by TrueTrace.
Global setup: Press "Auto Assign Scripts" in the TrueTrace settings menu.
Local setup: Go to "Hierarchy Options" in the TrueTrace settings menu.
Drag the root gameobject that you added to the "Selective Auto Assign Scripts" section.
Click "Selective Auto Assign".
First, each gameobject that contains a mesh needs the script "RayTracingObject" added to it.(This keeps track of per-mesh materials)
For non-skinned meshes:
Add the script "ParentObject" to either:
Each gameobject that has a "RayTracingObject" script
OR
The Direct Parent gameobject of gameobjects that have a "RayTracingObject" script(Groups their meshes together, increasing performance)
For Skinned Meshes:
Any parent gameobject of the RayTracingObjects(will group together all Skinned Children)
For default unity lights, you just add the "RayTracingLight" script to each one
DX12 is recommended, as it enables use of OIDN, Bindless texturing, RT Cores, and higher performance
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)
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
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
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
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)
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
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
Some settings will be hidden behind an "Advanced Mode" toggle found in "Functionality Settings"
To animate properties of a truetrace material, you need to add the script "MaterialAnimationView" to the same gameobject as the RayTracingObject
Next, you need to select the targeted submaterial in the dropdown of the newly added script
Finally, you can now animate any material property by animating the SelectedMaterial properties.
Add the URPTTInjectPass to the currently used renderer as a renderfeature(The name of which can be found in the Camera)
Attatch the "TTAdvancedImageGen" script to any gameobject in the hierarchy, and fill out the settings you want.
For use with HWRT, you need unity 6000.0.31f1 or LATER, otherwise this ONLY works with SWRT
Firstly, all objects that will be the source of instanced objects will need to go under the InstancedStorage and can be arranged as single dynamic objects(ParentObject + RayTracingObject script both go on the same gameobject as the mesh)
Then, to instance the objects, you just need GameObjects with the InstanceObject script attatched to them under the Scene GameObject, and then drag the desired object instance from the hierarchy to the Instance Parent slot in the InstanceObject script
You only need to do this once per SHADER, not once per material. Unconfigured shaders will just appear white in truetrace
In the PathTracingSettings, click the tab called "Material Pair Options"
Drag any material that has the shader you want to pair into the material slot that appears
From here, you will see 3 buttons, click those to add the input type and connect it to the output tab. Do this with the any material using the default shader for an example
Once this is done, click "Apply Material Links" and rebuild the BVH in the "Main Options" tab to update the objects in the scene
NOTES 1: MOST OF THESE IN THIS TABLE HAVE TOOLTIPS THAT APPEAR IF YOU HOVER OVER THEM!
NOTES 2: SOME OF THESE ARE HIDDEN BEHIND TTAdvancedMode, WHICH CAN BE TOGGLED IN THIS MENU.
Enable RT Cores - (DX12 Only, REQUIRES UNITY 2023 OR HIGHER)Enables Hardware RT for cards that support it.
Use Old Light BVH Instead of Gaussian Tree - Disables the Gaussian Tree for higher performance but worse light sampling on metallics.
Enable OIDN - (DX12 Only) Adds the OIDN denoiser to the Denoiser list in "Main Options"
FULLY Disable Radiance Cache - Will free the memory(RAM/VRAM) usually used by the Radiance Cache
Use Rasterized Lighting For Direct - Experimental, only known to work in BIRP, Forces truetrace to only render indirect
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.
Load TT Settings From Global File - Normally, each scene has its own TTSettings file, but activating this allows you to put any TTSettings file into the RayTracingMaster script(attached to the Scene gameobject), and it will be used instead.
Enable Verbose Logging - Truetrace will yell more information into the console.
Enable Triangle Splitting - Optimization for SWRT that splits triangles to improve tracing performance.
Enable Strict Memory Reduction - Shrinks compute buffers when objects are removed, which causes stuttering on object add/remove but saves VRAM.
Save Multiple Maps On Screenshot - Any sort of image saved by truetrace will also generate images of the corrosponding material and mesh IDs.
Enable Photon Mapped Caustics - Enables the photon mapping pass for caustic generation. Materials/RayTracingObject scripts(attached to each Mesh) will need to have their flag enabled to generate caustics.
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.
Fade Mapping - Not super compatable with realtime denoisers, but allows for surfaces with variable transparency, based on alpha texture.
Stained Glass - Whether or not to color shadow rays that pass through colored glass, dictated by material parameters: Thin, Albedo, Scatter Distance.
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.
Quick Radcache Toggle - Toggles the radcache on/off. Useful for comparing to ground truth pathtracing.
Use Texture LOD - Samples LOD of textures based on bounce number, can improve performance(DX12 only).
Double Buffer Light Tree - Enables double buffering of the light tree, allowing for stable moving emissive objects with ASVGF, but slightly hurts performance with ASVGF.
Use BSDF Lights - Allows naive sampling of emissive triangles using MIS. Turn off if your having some issues with fireflies to rely entirely on the light BVH.
TrueTrace Options Description -
Build Aggregated BVH(Recommended to do any time you add/remove objects in edit mode)- Allows you t
No open issues yet, or sync has not completed.