mlavik1 / UnityVolumeRendering

Volume rendering, implemented in Unity3D. Want to support the project? Donate a small sum to Save The Children(https://www.savethechildren.net/) or another charity, and send me a message, and I will be greatly motivated!
https://fosstodon.org/@unityvolrend
MIT License
458 stars 127 forks source link

Early return optimisation for volume rendering with tricubic interpolation + adjustable sampling rate multiplier #240

Closed mlavik1 closed 7 months ago

mlavik1 commented 7 months ago

Early return optimisation for volume rendering with tricubic interpolation + adjustable sampling rate multiplier

Two changes:

Optimised volume rendering tricubic interpolation

We now fetch the density value without tricubic interpolation first, to see if we can do an early return.

This has a minimal cost, but for transfer functions where the lowest density values are mapped to zero then the performance benefit is great (up to 2-3 times faster).

Sampling rate multiplier setting

Previously I've advised users on very low-end devices (or AR) to modify the "MAX_NUM_STEPS" values in the shader directly, to improve rendering performance at the cost of visual quality. Now there's a setting for this:

图片