POV-Ray : Newsgroups : povray.off-topic : Re: stochastic (monte-carlo) tracing : Re: stochastic (monte-carlo) tracing Server Time
7 Sep 2024 01:22:02 EDT (-0400)
  Re: stochastic (monte-carlo) tracing  
From: Severi Salminen
Date: 13 Sep 2008 09:20:00
Message: <web.48cbbd6c3ac6d32033b2d9360@news.povray.org>
> I've had this problem - can you please explain this direct lighting
> algorithm in more detail?

Ok, I'll try. Let's assume we have found the first intersection point along the
ray. Instead of choosing a random new direction (if it is a diffuse surface)
you can do this:

1. Pick a random point on a light source.
2. Check if it is visible or not.
3. If it is, add the radiance it contributes. You must take the cosine term into
account as well as the ratio of solid angle of the source and hemisphere (the
last one thus handles the distance of the light source).
4. After this you can continue tracing the path normally. But if the ray next
hits the same light source, ignore it as otherwise you have calculated it
twice.

Oh, and there are 2 ways to handle multiple light sources:

A. Sample only 1 source from N light sources and multiply the result by N. This
is unbiased and gives the correct result with many passes.
B. Sample all light sources and add the results together.

Example. We have 3 lights that give these values: 0.4, 0.6, 1.0. Let's do 100
passes.

B gives 100*(0.1+0.5+1.0) = 200.
A might give 40*3*0.4+30*3*0.6+30*3*1.0 = 192.

Increasing passes decreases the error. Nice technique that might give good
results if you have many light sources.

That is the basics. The devil lies in the details and I still have some nasty
bug(s) somewhere.

Severi


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.