Skip to content

Commit d711135

Browse files
committed
Documentation for shadow volumes, DLSS, FidelityFx upscaling
1 parent bdc1dd4 commit d711135

File tree

6 files changed

+42
-5
lines changed

6 files changed

+42
-5
lines changed

Documentation/Documentation.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- [Importing datasets](General/Importing/ImportingDatasets.md)
66
- [Using the imported datasets](General/VolumeRendering/GameObjectManipulation.md)
77
- [Changing the appearance](General/VolumeRendering/VolumeRenderingSettings.md)
8+
- [Shadow volumes](General/VolumeRendering/ShadowVolumes.md)
89
- [Transfer Functions](General/TransferFunctions/TransferFunctions.md)
910
- [Cross section tools](General/CrossSectionTools/CrossSectionTools.md)
1011
- [Slice renderer](General/SliceRenderer/SliceRenderer.md)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Shadow volumes
2+
3+
To get more realistic rendering, you can optionally enable shadow volumes.
4+
5+
<img src="../../../Screenshots/shadow-volume.jpg" width="300px">
6+
7+
This can be enabled from the VolumeRenderedObject inspector in the editor, or by adding a `ShadowVolumeManager` component:
8+
9+
<img src="../../../Screenshots/volume-inspector-settings.jpg" width="300px">
10+
11+
## How it works
12+
13+
A shadow volume 3D texture is generated for the whole dataset.
14+
A compute shader is repsonsible for updating the shadow volume, by casting rays from the light source through the dataset, and storing information about shadows.
15+
Since this can take a long time, and async compute is not available on all platforms, the shadow volume manager divides the shadow volume into smaller chunks, and updates one chunk every frame.
16+
17+
## Performance
18+
19+
Because of the extra work of computing the shadow volume (compute shader) and the extra texture lookups during volume rendreing, this can have a bad impact on performance.
20+
21+
There are luckily some ways to work around this, at least on desktop applications (Windows, Linux, etc.).
22+
- If you're using HDRP: [Enable DLSS](https://docs.unity3d.com/Packages/[email protected]/manual/deep-learning-super-sampling-in-hdrp.html) and reduce the render scale.
23+
- If you're using URP: [Enable FidelityFX Super Resolution](https://forum.unity.com/threads/amd-fidelityfx-super-resolution-fsr-preview-now-available.1141495/) and reduce the [render scale](https://docs.unity3d.com/Packages/[email protected]/manual/universalrp-asset.html).
24+
25+
This works by rendering to a smaller render target (which is usually the bottleneck during volume rendering) and then doing "magic" upscaling on the rendered image.

Documentation/General/VolumeRendering/VolumeRenderingSettings.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
**Table of contents:**
44
<!-- TOC -->
55

6-
- [Cross section tools](#cross-section-tools)
7-
- [Cross section plane](#cross-section-plane)
8-
- [Box cutout](#box-cutout)
9-
- [Sphere cutout](#sphere-cutout)
6+
- [Render Mode](#render-mode)
7+
- [Lighting](#lighting)
8+
- [Shadow volumes](#shadow-volumes)
9+
- [Cubic interpolation](#cubic-interpolation)
10+
- [Early ray termination](#early-ray-termination)
1011

1112
<!-- /TOC -->
1213

@@ -33,6 +34,11 @@ This comes at a cost, and performance may suffer (both memory and rendering spee
3334

3435
To apply lighting to the volume rendering, we calculate the gradient at each voxel and use this to calculate a normal, which we use to apply phong lighting.
3536

37+
## Shadow volumes
38+
39+
Improve the rendered image by using shadow volumes.
40+
This is expensive, but there are ways to still get good performance with this enabled. See [shadow volume documentation](ShadowVolumes.md)
41+
3642
## Cubic interpolation
3743

3844
<img src="cubic-interpolation.png" width="300px">

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ There are 3 render modes:
8484

8585
There are also some other settings that you can adjust:
8686
- "Enable lighting": Enable lighting calculations during volume rendering.
87+
- "Enable shadow volume": Expensive, but may look much better!
8788
- Enable early ray termination: Optimisation (you usually want this on). Requires the above setting to be disabled.
8889
- Enable cubic interpolation: Use cubic interpolation of the 3D volume texture and gradient texture.
8990

@@ -161,14 +162,18 @@ Yes, it's free even for commercial projects. The license ([MIT](https://chooseal
161162

162163
## How can I make it look better?
163164
- Try [enabling cubic sampling](https://github.com/mlavik1/UnityVolumeRendering/pull/121#issuecomment-1281289885) in the inspector.
165+
- Try [enabling shadow volumes](Documentation/General/VolumeRendering/ShadowVolumes.md) in the inspector.
164166
- Try increasing the value of "MAX_NUM_STEPS" in the [DirectVolumeRenderingShader.shader](https://github.com/mlavik1/UnityVolumeRendering/blob/master/Assets/Shaders/DirectVolumeRenderingShader.shader)
165167

168+
## How can I get better rendering performance with lighting enabled?
169+
If you're on a platform that supports it (Windows, etc.), try [enabling DLSS (HDRP)](https://docs.unity3d.com/Packages/[email protected]/manual/deep-learning-super-sampling-in-hdrp.html) or [FidelityFX Super Resolution (URP)](https://forum.unity.com/threads/amd-fidelityfx-super-resolution-fsr-preview-now-available.1141495/) and reduce the render scale.
170+
166171
## How can I raycast the scene to find an intersection?
167172
- See the [VolumeRaycasting documentation](Documentation/Scripting/VolumeRaycasting.md).
168173

169174
## I'm stuck! How can I get help?
170175
[Create an issue](https://github.com/mlavik1/UnityVolumeRendering/issues).
171-
You can also reach me on [Mastodon](https://floss.social/@sigsegv).
176+
You can also reach me on [the fediverse](https://nattomaki.social/@matias).
172177

173178
# Contributing
174179
See [CONTRIBUTING.md](CONTRIBUTING.md) for how to contribute.

Screenshots/shadow-volume.jpg

37.6 KB
Loading
3.28 KB
Loading

0 commit comments

Comments
 (0)