mmp / pbrt-v4

Source code to pbrt, the ray tracer described in the forthcoming 4th edition of the "Physically Based Rendering: From Theory to Implementation" book.
https://pbrt.org
Apache License 2.0
2.75k stars 407 forks source link

Specify Volume with Transform and Camera Inside Volume in a Scene File #415

Open Fiona730 opened 5 months ago

Fiona730 commented 5 months ago

The medium that camera rays start out in must be specified before world block. However, in order to specify a volume with some transform (which is of particular interest for heterogeneous volume), it must be placed after WorldBegin, since only objects there are allowed to have attributes and hence incorporate transformation information.

This leads to a situation where a medium is referenced (for camera ray) before its definition. With such an incorrectly-defined scene file, PBRT displays weird behavior: sometimes it is able to run the file, other times it would output "xxx medium is not defined". This random crashing behavior seems to be related to some caching mechanism.

Any help / information regarding this aspect would be very much appreciated!