<p>Well actually I think I was doing it wrong. I stored raymarching effects in 2D texture. This is not correct because it suffers from issues.</p>

<p>Correct way is store raymarching effect in 3D texture, to get linear interpolation and no banding. And then perform sampling from it.</p>

<p>It seems to improve the result because it fixes some discontinuities. However it still needs temporal blending to get it smooth during camera movement.</p>

<p>Indeed the way to get smooth temporal blending independent of camera movement is to add some jitter which is shifted each frame, but it is hard to get it working right.</p>

CC BY-SA 3.0
2016-09-10T18:57:16.533Z
2016-10-12T16:54:59.383Z
2016-10-12T16:54:59.383Z
mdkdy
<p>You can look into <a href="https://github.com/huwb/volsample" rel="nofollow">alias-free volumetric sampling algorithm</a> by Huw Bowles for potential solution to the ray marching aliasing issues. The basic idea is to snap your samples to planes based on the ray direction that's best explained with <a href="https://www.shadertoy.com/view/ll3GWs" rel="nofollow">this Shadertoy demo</a>.</p>

CC BY-SA 3.0
2016-10-12T16:04:54.783Z
This sounds interesting. Could you expand on the basic idea and explain why it works?
trichoplax is on Codidact now
CC BY-SA 3.0
2016-10-12T17:03:38.600Z
It's quite clever. I will study it more.
mdkdy
CC BY-SA 3.0
2016-10-12T13:29:42.360Z
2016-10-12T13:29:42.360Z
JarkkoL
<p>Raw volume raymarching especially aligned with frustum seem to produce a lot of aliasing/banding on edges of shadow map. Especially when fragment pos is far because step length is then getting bigger. Making some research how to correct it I found out about temporal reprojection technique.</p>

<p>So basically I have an two 2D textures, current and previous where I store exponential moving average of raymarching result of previous frames like:</p>

<p>$s(n) = w*f(n)+(1-w)*s(n-1)$</p>

<p>where:</p>

<p>$w$ - weight</p>

<p>$f(n)$ - current frame calculation</p>

<p>$s(n-1)$ - result of previous frames calculation</p>

<p>This seem to be working when camera is moving because then bands are moving and blending with each other. But when camera stands still everything returns to normal. I tried to:</p>

<ul>
<li>add some noise aligned with ray direction to starting position every other frame but banding is still at the same positions</li>
<li>add noise not aligned with ray direction but then bands are shifted ramdomly and raymarching results are wrong</li>
</ul>

<p><a href="https://www.youtube.com/watch?v=yjoD6RCuM4c" rel="nofollow">Here</a> (FrostBite engine) it is smooth constantly independent of camera movement.  </p>

<p>So is there a way to simulate camera movements? Or any other technique to correct the issue?</p>

<p><a href="http://www.frostbite.com/2015/08/physically-based-unified-volumetric-rendering-in-frostbite/" rel="nofollow">Here</a> you can download some content describing subject.</p>

<texture><3d><volumetric><raymarching><3dtexture>
Frustum aligned volume integration - aliasing issue - temporal reprojection
mdkdy
# Frustum aligned volume integration - aliasing issue - temporal reprojection

(Asked by: username_0 on 2016-09-07)

Raw volume raymarching especially aligned with frustum seem to produce a lot of aliasing/banding on edges of shadow map. Especially when fragment pos is far because step length is then getting bigger. Making some research how to correct it I found out about temporal reprojection technique.

So basically I have an two 2D textures, current and previous where I store exponential moving average of raymarching result of previous frames like:

$s(n) = w\*f(n)+(1-w)\*s(n-1)$

where:

$w$ - weight

$f(n)$ - current frame calculation

$s(n-1)$ - result of previous frames calculation

This seem to be working when camera is moving because then bands are moving and blending with each other. But when camera stands still everything returns to normal. I tried to:

* add some noise aligned with ray direction to starting position every other frame but banding is still at the same positions
* add noise not aligned with ray direction but then bands are shifted ramdomly and raymarching results are wrong

[Here](https://www.youtube.com/watch?v=yjoD6RCuM4c) (FrostBite engine) it is smooth constantly independent of camera movement.

So is there a way to simulate camera movements? Or any other technique to correct the issue?

[Here](http://www.frostbite.com/2015/08/physically-based-unified-volumetric-rendering-in-frostbite/) you can download some content describing subject.

**Tags:** texture, 3d, volumetric, raymarching, 3dtexture


---

## 2 answers

### Answer by username_0 on 2016-09-10. Score: 1

Well actually I think I was doing it wrong. I stored raymarching effects in 2D texture. This is not correct because it suffers from issues.

Correct way is store raymarching effect in 3D texture, to get linear interpolation and no banding. And then perform sampling from it.

It seems to improve the result because it fixes some discontinuities. However it still needs temporal blending to get it smooth during camera movement.

Indeed the way to get smooth temporal blending independent of camera movement is to add some jitter which is shifted each frame, but it is hard to get it working right.


---

### Answer by username_1 on 2016-10-12. Score: 1

You can look into [alias-free volumetric sampling algorithm](https://github.com/huwb/volsample) by Huw Bowles for potential solution to the ray marching aliasing issues. The basic idea is to snap your samples to planes based on the ray direction that's best explained with [this Shadertoy demo](https://www.shadertoy.com/view/ll3GWs).

> **Comments:**
> **username_2**: This sounds interesting. Could you expand on the basic idea and explain why it works?  
> **username_0**: It's quite clever. I will study it more.  

---

