CameraToWorld transform initialization

133 views
Skip to first unread message

Srinath Ravichandiran

unread,
Aug 24, 2017, 5:02:22 PM8/24/17
to pbrt
I have a small doubt with regards to the pbrtCamera() function implemented in pbrtv3.

I don't want to use the pbrtLookAt() API call to initialize the camera, but rather provide a rotation and translation component to place the camera. My intent is to move the camera [-100,100,100] from the world origin. I don't have a rotation component. I guess this can be done by using the following syntax in the scene file

Translate -100 100 100
Camera "perspective" "float fov" [45]

The current transformation matrix after the Translate call would be 

[1 0 0  -100
 0 1 0 100
 0 0 1 100
 0 0 0 1]

However the pbrtCamera() API initializes the CameraToWorld as the inverse of the current transformation matrix which would be

[1 0 0 100
 0 1 0 -100
 0 0 1 -100
 0 0 0 1]

In the camera coordinate system, rays have a origin of 0,0,0 and hence when moved from camera to world, shouldn't the rays start from [-100,100,100]. If I use the inverse as the code does, the rays would start from [100, -100, -100]. Is this a genuine bug or am I abusing the file format notation?

Matt Pharr

unread,
Dec 18, 2017, 5:56:32 PM12/18/17
to pbrt
The file format is specified such that the current transformation matrix is used to specify the world-to-camera transformation (http://pbrt.org/fileformat-v3.html#cameras). So that's why pbrt takes the inverse of the CTM to store in CameraToWorld and that's why in that case it's adding (100, -100, -100) when it goes from camera space to world space.

So you'd basically need to specify the inverse of the transformation you're thinking of to get what you expect.

Thanks,
Matt


--
You received this message because you are subscribed to the Google Groups "pbrt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pbrt+unsubscribe@googlegroups.com.
To post to this group, send email to pb...@googlegroups.com.
Visit this group at https://groups.google.com/group/pbrt.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages