Accessing Ray Differentials in BSDF's sample() function #1209
-
Greetings, I am creating a custom BSDF which requires ray differentials to determine the ray's corresponding pixel footprint in texture space. However, currently I do not see a way of accessing the ray differentials' (or even the ray's) information in the BSDF's sample() function. Therefore, may I know if it is possible to do so with a basic BSDF class? If not, may I have some suggestions on how to achieve it, possibly by implementing a custom integrator / renderer? Any insights would be greatly appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hi @AndrewYiBC There's a chain of methods to handle this, when fetching the |
Beta Was this translation helpful? Give feedback.
Hi @AndrewYiBC
There's a chain of methods to handle this, when fetching the
bsdf
of an interaction you should use:SurfaceInteraction3f.bsdf()
. That method will callSurfaceInteraction3f.compute_uv_partials()
which uses the ray's partials (ray.o_x
andray.o_y
). Finally, that last method call will actually fill in theduv_dx
,duv_dy
fields in yoursi
object. This only works well for the first bounce, after which the ray partials don't correctly account for the warping introduced by the first bounce's BSDF.