Cousin Ricky <ric### [at] yahoocom> wrote:
> On 2022-11-13 18:47 (-4), Bald Eagle wrote:
> > Maybe if someone has coded an entire basic (meta)raytracer in SDL, then I could
> > go that route.
> Did someone say "meta"?
Heh. Shortly after that, I went hunting, and found exactly that.
That's written so that it cycles through all the light sources and
updates/accumulates all of the illumination calculations for a surface pixel,
doing a single analytical calculation for phong each time.
I'm guessing that I'd have to scrap that and go wholly with a global sampling of
the surface normal's hemisphere to have importance sampling make any sense? Not
sure how I'd do that with point lights either.
At the moment, the Monte Carlo approach makes sense when you don't know WHAT the
illumination is, like when using a pigmented sky sphere or an HDR image. Since
point lights seem to be an example of a Dirac delta function in this context, it
almost seems like there ought to be a mechanism to force sampling from _those
vectors_, or to explicitly block those vectors and do a second pass using
standard phong highlighting.
I've never played in the part of the pool, so I don't have enough context to
understand what to do with this tool, now that I've built it.
I guess I will keep web searching and reading and watching until I figure
Until then, I adjusted the raytracer code to just use two spheres, and I figured
I could use a flag to have one of them importance sampled, while the other was
stock Phong model for comparison. Pretty neat - only takes 20 sec.
Post a reply to this message
Download 'raytraced_importancesampledphong.pov.txt' (7 KB)