avoid rejection sampling

Practical and theoretical implementation discussion.
Post Reply
koiava
Posts: 47
Joined: Thu Apr 24, 2014 8:18 am
Location: Tbilisi, Georgia
Contact:

avoid rejection sampling

Post by koiava » Tue Jul 01, 2014 9:47 am

Hi guys, I have problem about rejection sampling.
I have surface with perturbed normals(smooth shaded or perturbed with normal map) and I want to evaluate BRDF to get reflected ray.
There is a probability that angle between reflected ray direction and face normal may be greater then π/2.
In this case I'm using rejection sampling to avoid this problem.
I'm generating brdf proportional reflected rays until reflected ray isn't directed as desired. It works correctly but dramatically decreases performance.
Any suggestions will be helpful :)
Colibri Renderer

sriravic
Posts: 20
Joined: Fri Jun 22, 2012 6:48 pm

Re: avoid rejection sampling

Post by sriravic » Wed Jul 02, 2014 7:28 pm

You can use cosine weighted sampling (pdf proportional to the cos(theta) term) which is where I feel its more important to sample since you're using a normal map to perturb the normals.

koiava
Posts: 47
Joined: Thu Apr 24, 2014 8:18 am
Location: Tbilisi, Georgia
Contact:

Re: avoid rejection sampling

Post by koiava » Wed Sep 24, 2014 8:09 am

Image
this is a figure illustrating this problem. If surface is highly specular then probability that reflected ray will fall under the surface is high.
Actually, this is a reason of "shadow terminator" problem... (When Angle between light direction and perturbed surface normal is less then π/2, And angle between light direction and face normal is greater then π/2). One solution for this is to do always flat shading and subdivide surface to make correct smooth shading. Is there any different solutions for this?
Image
Colibri Renderer

Dade
Posts: 206
Joined: Fri Dec 02, 2011 8:00 am

Re: avoid rejection sampling

Post by Dade » Thu Sep 25, 2014 7:18 am

koiava wrote: Actually, this is a reason of "shadow terminator" problem... (When Angle between light direction and perturbed surface normal is less then π/2, And angle between light direction and face normal is greater then π/2).
Another solution is to use only the geometry normal (i.e. face normal in your figure) for this kind of check and not the shading normal (i.e. perturbed normal). You are going to have less problems: energy conservation, no rays reflected inside the sphere, etc. However there will be still some noticeable shading artifact on the transition between the dark side and the illuminated side.

koiava
Posts: 47
Joined: Thu Apr 24, 2014 8:18 am
Location: Tbilisi, Georgia
Contact:

Re: avoid rejection sampling

Post by koiava » Thu Sep 25, 2014 8:30 am

Energy Conservation is another problem here. When I evaluate BRDF, if it always gives me a ray from hemisphere(directed to perturbed normal) minus solid angle(which fall under surface), then a corresponding pdf isn't normalized anymore and correct normalization isn't easy task for complicated BRDFs. :)
Colibri Renderer

koiava
Posts: 47
Joined: Thu Apr 24, 2014 8:18 am
Location: Tbilisi, Georgia
Contact:

Re: avoid rejection sampling

Post by koiava » Fri Sep 26, 2014 6:48 am

according to SolidAngle documentation, Arnold has shadow_terminator_fix option, but this solution doesn't work in some cases.
It works great for convex meshes, but may produce artifacts in concave areas of high curvature. A proper solution in this situation to reduce the shadow terminator artifact is to increase the number of subdivision iterations in the mesh
.
I think that for unbiased physical bases production renderers proper solution is to avoid normal perturbing, replace fake smooth shading with subdivision surfaces, and normal mapping with displacement.
Colibri Renderer

bod
Posts: 1
Joined: Fri Sep 26, 2014 9:53 pm

Re: avoid rejection sampling

Post by bod » Sat Sep 27, 2014 9:06 am

The LEADR paper proposes an non-centred BRDF that only relies on the geometric normal, the offset usually comes from the bump normal, but perhaps the shading normal could also be part of the offset.

http://hal.inria.fr/hal-00858220/en

Sampling theory comes here: http://hal.inria.fr/hal-00996995/en

Post Reply