Page 1 of 1

avoid rejection sampling

Posted: Tue Jul 01, 2014 9:47 am
by koiava
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 :)

Re: avoid rejection sampling

Posted: Wed Jul 02, 2014 7:28 pm
by sriravic
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.

Re: avoid rejection sampling

Posted: Wed Sep 24, 2014 8:09 am
by koiava
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

Re: avoid rejection sampling

Posted: Thu Sep 25, 2014 7:18 am
by Dade
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.

Re: avoid rejection sampling

Posted: Thu Sep 25, 2014 8:30 am
by koiava
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. :)

Re: avoid rejection sampling

Posted: Fri Sep 26, 2014 6:48 am
by koiava
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.

Re: avoid rejection sampling

Posted: Sat Sep 27, 2014 9:06 am
by bod
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