PDA

View Full Version : Camera Evaluator DOF



Pomfried
02-10-2009, 09:51 AM
Hi everyone,

I am currently working on something where I need to use the camera evaluation functions from the SDK.
From what I understand, in order to generate rays affected by DOF you need to sample positions on the lense randomly distributed inside a circle of the radius 1. The rendered results I get from this look perfectly fine it seems, but when I added code to account for the diaphragm shape I got a bit lost...

What I am doing right now is this:

Generate an n-sided polygon on a unit-circle
Generate a random point (either inside the unit-circle or a square of length 1)
Check whether it is inside the generated polygon
If not, repeat step 2
If it is inside, call camera evaluator and raytrace


My problem now is that the scale of the diaphragm in the resulting image seems to differ from what LW uses internally. I already tried scaling it to a bounding box of side-length 2, but that still does not seem to cut it... I also get slightly weird noise patterns when the diaphragm shape is enabled, but I guess that is my smallest problem right now.

What I am now seeking an answer for is how LW internally scales the diaphragm shape and (not as important, but still interesting to know) if there is a more efficient way to distribute the points inside the polygon?

I really hope a developer can help me out here or maybe someone else who has got another idea :)

Thanks in advance