Page MenuHome

Bands artifacts in dense volumetrics
ClosedPublic

Authored by Mikhail Matrosov (ktdfly) on Mar 1 2021, 10:04 PM.
Tags
Tokens
"Party Time" token, awarded by ToumiX."Love" token, awarded by Draise."Like" token, awarded by EAW."Love" token, awarded by Schamph.

Details

Summary

Problem

See T56925. Ray marching produces artifacts that look like dark bands and flickering. It is very noticeable on a dense (>100) Volume Scatter shader.

Proposed solution

Randomize the first marching step. Rendering time is not affected within a margin of 1%.

Alternative solutions

One could randomize a step size, but this still produces artifacts near the boundary of the domain. This randomization can still be introduced into this suggested solution, but it is not required.

Diff Detail

Repository
rB Blender

Event Timeline

Mikhail Matrosov (ktdfly) requested review of this revision.Mar 1 2021, 10:04 PM
Mikhail Matrosov (ktdfly) created this revision.

That looks much better!

It seems step_offset does not take into account the smaller first step size, so the shading position can fall outside the first segment?

For the seeds the only thing that matters is that they are unique and not used anywhere else in the kernel. The hashing should be good enough, even if you'd use e.g. 0 and 1 as seeds. But using some random integer makes it easy for them to be unique.

Mikhail Matrosov (ktdfly) edited the summary of this revision. (Show Details)
Mikhail Matrosov (ktdfly) changed the edit policy from "All Users" to "Administrators".

@Brecht Van Lommel (brecht) Thank you for your help on seeds.
Yes, you are right, step_offset didn't take into account the smaller first step size - I've fixed it.
I also found out that the same modification introduced into kernel_volume_shadow_heterogeneous() strangely enough creates similar banding. The only difference is that they are associated only with lights and not with the background (for scattering functions it was both). I couldn't find an explanation to this, and just left this function unmodified - just took a responsibility to refactor it accordingly to kernel_volume_step_init().

Add comments and improve variable naming.

This revision is now accepted and ready to land.Mar 15 2021, 5:53 PM