DavidBrainard / RenderToolbox3

Matlab toolbox for managing graphics rendering for psychophysics
MIT License
11 stars 4 forks source link

4x4 transformation matrices from Blender break Cuban Sphere mappings #51

Closed benjamin-heasly closed 10 years ago

benjamin-heasly commented 10 years ago

I re-exported the Cuban Sphere scene from Blender version 2.6. This version of Blender exports 4x4 transformation matrices rather than separate transformations like scale, rotate, and translate.

This breaks the mappings for the Cuban Sphere scene, which expects to manipulate these transformations separately.

In principle, it should be possible to convert any 4x4 matrix to the identity matrix, then specify transformations separately, as before. But this might take some testing/debugging.

Also, there seems to be a PBRT bug where a 4x4 ConcatTansform followed by a Rotate causes an error. This happens with the cube shape in CubanSphere. Or maybe the rotation is not being specified correctly.

benjamin-heasly commented 10 years ago

1000ca18a1e9ce399108419e094ff93100c0ee13 fixes this by clearing out transformations in Blender and making sure transformations are specified in the correct order in the mappings file.

It would be nice to use the mappings file to append transformations to whatever transformations are contained in the Collada file. This should work regardless of the transformation format used in the Collada file (4x4 matrix vs translation, rotation, and scale). But this is tricky because order of transformations matters, and the appended transformations would belong to a coordinate space that is different from the usual "object to world" space. Appending transformations is still a good idea and it should work, I just didn't do the math to compute the correct transformations to append in this example.