RenderToolbox / RenderToolbox4

Matlab toolbox for managing 3D scenes and physically-based rendering.
MIT License
48 stars 7 forks source link

X-axis flip when using mexximp remodeler #39

Open tlian7 opened 7 years ago

tlian7 commented 7 years ago

We've occasionally run into this issue where sometimes the rendered images are flipped horizontally. I've tracked down the issue to the following:

If you are not using the remodeler, the following line:

[scene, mappings] = strategy.applyBasicMappings(scene, mappings, names, conditionValues, cc);

in rtbMakeSceneFiles.m applies a mapping transformation which flips the x-axis on the camera. This transformation is first generated in loadDefaultMappings in RtbAssimpPBRTConverter.m. This flip produces images that are correctly oriented with respect to the original Blender scene.

However, if we move the camera in your mexximp Remodeller, the camera is reset again in the following line:

[scene, mappings] = strategy.remodelPerConditionAfter(scene, mappings, names, conditionValues, cc);

And the mapping transformation seen in the default mappings is lost. The x-axis is flipped (incorrectly) in these images with respect to the original Blender scene.

This needs to be fixed and investigating more carefully. First off, we need to determine why the flip is necessary in the first place?