|
Post by mrwetsnow on Nov 16, 2019 16:27:00 GMT
Hi, I am working on implementing area lights and soft shadows. What is the order of magnitude of the number of rays I need to send in order to get a good result (say what's in the book on page 240)? I am also not convinced my algorithm is correct. I changed the inShadow() function to send N number of rays to *random* points on the area light. It counts how many rays were blocked and how many were not, and returns: unblocked / numRays (between 0 and 1). (I've special cased 0 = no blocks and 1 = total blocks). Then I pass this into the lighting function. // as before, if in total shadow, just return the ambient if shadowFactor == 1 { return ambient.Add(emissive) } Otherwise it does the normal calculations, and, at the very end, it scales the result by shadowFactor. Which, with 200 shadow rays, produces something plausible (see attachment)... result = (emissive.Add(ambient).Add(diffuse).Add(specular)).Scale(shadowFactor) Is this the right general approach? Is the number of shadow rays really that high? Thank you Dan Attachments:
|
|
|
Post by mrwetsnow on Nov 16, 2019 16:28:51 GMT
|
|
|
Post by Jamis on Nov 18, 2019 15:21:47 GMT
I hope it's helpful! It seems like it should probably answer your questions. If anything isn't clear, let me know.
|
|
|
Post by mrwetsnow on Nov 18, 2019 15:30:53 GMT
Yes it did, thank you for writing it. Somehow I feel I should have been less surprised at how much longer something like this takes to render though
|
|