artifacts - any idea

Practical and theoretical implementation discussion.
sajis997
Posts: 27
Joined: Thu Jul 12, 2012 11:59 pm

artifacts - any idea

Postby sajis997 » Wed May 08, 2013 12:18 pm

Hi forum ,

I have generated the following image with path tracing. But i am getting an artifact over the sphere (a light dark disk shaped lobe). Any idea what may it be ?

http://imgur.com/RS61Ti9

I think it is the reflection of the area light over the sphere. What do you think ? I have separated and evaluated the direct and indirect lighting.


Looking forward to some hint to get rid of it ?

Thanks

Sajjadul

friedlinguini
Posts: 82
Joined: Thu Apr 11, 2013 5:15 pm

Re: artifacts - any idea

Postby friedlinguini » Wed May 08, 2013 12:46 pm

Offhand it looks like your LSE (possibly LS(S|D)*E) paths are broken. How are you calculating direct lighting on specular surfaces? If you're doing explicit connections to the light source (e.g., picking a point on the source, casting a shadow ray, and evaluating the BSDF), then the specular component will likely always be zero.

sajis997
Posts: 27
Joined: Thu Jul 12, 2012 11:59 pm

Re: artifacts - any idea

Postby sajis997 » Thu May 09, 2013 3:01 pm

Hi

I am not dealing with specularity while calculating the direct lighting . Here goes the generated image with direct Lighting :

http://imgur.com/EdZ0yza

I am adding the reflectivity and refractivity while doing the indirect light calculation. And this is when the artifacts shows up. Let me break down more on how i am doing the indirect lighting calculation.
Initially i am forcing recursion of depth 5 before falling back to russian roulette.


Code: Select all


Color trace(const Ray &ray, int depth, int E)
{
     if(the scene is hit)
     {
            if(the intersected material is emissive )
                 return the emissive color of the luminaire.
           else
                  return computeRadiance(intersection information, depth).
     }
     else
           return black.
}


Color computeRadiance(const Intersection &intersection, int depth)
{
      Color directLighting = compute direct illumination; // the output is already shown in the above link

      Color indirectLighting = computeIndirectIllumination(intersection, depth);
}


Color computeIndirectIllumination(const Intersection &is, int depth)
{
    ........
    ........

    if(depth != 0)
    {
          1. generate a canonical random number
 
          2. if(generated random number < refractivity coefficient)
              {
                    Get a refracted ray.
                    refractedColor = trace(refracted ray, depth -1, 0);
              }
          3. else if(generated random number < reflectivity coefficient)
              {
                    Get the reflected ray.
                    reflectedColor = trace(reflected ray, depth - 1, 0);
              } 
          4.else if(generated random number < (1 - reflectivity coefficient - refractivity coefficient))
             {
                    Get a random direction using the cosine sampling.
                    Calculate the pdf

                    if(pdf > 0.0f)
                    {
                           Create a ray with the new random direction.
                           Calculate the incident angle between intersection normal and vector of the new ray (with random direction)

                           directColor =  (trace(newRay,depth - 1, 0)  * is.material->evalBRDF(is,newRay.dir) * incidentAngle) / pdf;
                    }
             }

                  out = directColor * (1 - reflectivityCoefficient - refractivityCoefficient) +
    (reflectedColor * reflectivityCoefficient) +
    (refractedColor * refractivityCoefficient);
    }
   else
   {
            Add the russian roulette here and The choice between reflectivity, refractivity is done in the same manner as mentioned above
   }
}




Did i elaborated enough to address this issue ?

Regards
Sajjadul

friedlinguini
Posts: 82
Joined: Thu Apr 11, 2013 5:15 pm

Re: artifacts - any idea

Postby friedlinguini » Thu May 09, 2013 4:20 pm

When computing indirect illumination, what happens when one of your secondary rays from a diffuse material happens to hit a light source? Is it possible that you are doubling up on your direct illumination? One quick experiment might be to double the intensity of your light source, omit direct illumination, and see if that converges to the image you're trying to get.

sajis997
Posts: 27
Joined: Thu Jul 12, 2012 11:59 pm

Re: artifacts - any idea

Postby sajis997 » Thu May 09, 2013 5:23 pm

I am dealing with it with flag named "E" inside the trace() function as follows:

Code: Select all

      if(intersection.mMaterial->emissive())
   return E * (intersection.mMaterial->evalBRDF(intersection,dummyLightVec) * intersection.mMaterial->getEmissionFactor());
      else
   return computeRadiance(intersection,depth);


While calculating the indirect illumination the value to E is always 0.

This is the way i am doing it, if i understood your question correctly.

Thanks
Sajjadul

friedlinguini
Posts: 82
Joined: Thu Apr 11, 2013 5:15 pm

Re: artifacts - any idea

Postby friedlinguini » Thu May 09, 2013 7:01 pm

Given that, along with the fact that the specular materials are effectively removed from your direct lighting calculations, wouldn't

Code: Select all

...
    else if(generated random number < reflectivity coefficient)
    {
        Get the reflected ray.
        reflectedColor = trace(reflected ray, depth - 1, 0);
    }


mean no specular highlights at all?

sajis997
Posts: 27
Joined: Thu Jul 12, 2012 11:59 pm

Re: artifacts - any idea

Postby sajis997 » Thu May 09, 2013 7:42 pm

I am sorry , i did not get this question. I apologize again for missing one small important thing in my previous pseudocode .

In direct lighting calculation i do not consider any material properties and they are only considered in the indirect lighting calculation .

Then both the colors are accumulated and returned in the computeRadiance() function. I missed the accumulation part in me previous post.

I think i m getting the specular highlights now , but along with the artifacts over it.

http://imgur.com/RS61Ti9


Any more hint ?

friedlinguini
Posts: 82
Joined: Thu Apr 11, 2013 5:15 pm

Re: artifacts - any idea

Postby friedlinguini » Thu May 09, 2013 8:49 pm

OK, let me put it this way. It looks to me like you're not getting a specular reflection of the light source in the mirror ball. That is, LSE paths (light -> mirror -> eye) are not showing up in your rendering. LDSE paths are showing up (light -> ceiling -> mirror ->eye), so you wind up with a dark circle surrounded by a bright halo.

LSE paths are arguably part of direct illumination, since they consist of a single bounce. There are two ways of sampling direct illumination. You could either sample the light source, or you could sample the BSDF.

If you sample the light source, you cast a shadow ray between the point you are shading and another point you pick on the light source, and if things are unoccluded you work out the geometric terms (BSDF, cosine term, EDF, etc.) and finally add the result to your frame buffer. This is presumably what you did for diffuse surfaces, but it doesn't work for specular surfaces because the probability of choosing a point on the light source that happens to lie in the mirror direction is vanishingly small. That was what I hypothesized in my first post.

The other way to handle direct illumination is to generate a scattered ray by importance sampling the BSDF and seeing if it happens to hit a light source. If so you then accumulate to the frame buffer. This is really the only thing you can do for specular surfaces for the reason I mentioned above.

In your case, the direct lighting image does not include any specular highlights, and the pseudocode and description you've provided for the indirect lighting explicitly culls any LS(D|S)*E contributions, so I would expect to see a dark void where the reflection of the light source ought to appear. Am I missing anything? If so, during which portion of the rendering would you expect the LSE contributions to occur?

sajis997
Posts: 27
Joined: Thu Jul 12, 2012 11:59 pm

Re: artifacts - any idea

Postby sajis997 » Mon May 13, 2013 3:25 am

Since i am explicitly sampling the light source, what should be my step to get the specular reflection on the mirrored ball.

According to your last post , i think you meant that i should keep my direct lighting calculation intact, but make the necessary changes inside the indirect lighting to solve the issue.

Are you suggesting to explicitly trace reflected ray instead of probabilistically?

friedlinguini
Posts: 82
Joined: Thu Apr 11, 2013 5:15 pm

Re: artifacts - any idea

Postby friedlinguini » Mon May 13, 2013 5:16 pm

In a pinch, I think

Code: Select all

if(generated random number < refractivity coefficient)
{
    Get a refracted ray.
    refractedColor = trace(refracted ray, depth -1, 1 /* formerly 0 */);
}
else if(generated random number < reflectivity coefficient)
{
    Get the reflected ray.
    reflectedColor = trace(reflected ray, depth - 1, 1 /* formerly 0 */);


along with making the BSDF functions for reflective and refractive components unconditionally return zero (mathematically, the probability of needing to do this is zero, but the probability is nonzero when dealing with floating point representations) should solve your problems. It's not really a matter of direct vs. indirect; it's light source sampling vs. BSDF sampling. Note that BSDF sampling for direct lighting generally useful for glossy reflectors and/or large light sources. If you ever implement multiple importance sampling you get a nice bridge between the two.


Return to “General Development”

Who is online

Users browsing this forum: No registered users and 11 guests