• Tristan Rice's avatar
    renderer: add support for rendering high dimensional textures for... · 8d10ba52
    Tristan Rice authored
    renderer: add support for rendering high dimensional textures for classification/segmentation use cases (#1248)
    
    Summary:
    For 3D segmentation problems it's really useful to be able to train the models from multiple viewpoints using Pytorch3D as the renderer. Currently due to hardcoded assumptions in a few spots the mesh renderer only supports rendering RGB (3 dimensional) data. You can encode the classification information as 3 channel data but if you have more than 3 classes you're out of luck.
    
    This relaxes the assumptions to make rendering semantic classes work with `HardFlatShader` and `AmbientLights` with no diffusion/specular. The other shaders/lights don't make any sense for classification since they mutate the texture values in some way.
    
    This only requires changes in `Materials` and `AmbientLights`. The bulk of the code is the unit test.
    
    Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/1248
    
    Test Plan: Added unit test that renders a 5 dimensional texture and compare dimensions 2-5 to a stored picture.
    
    Reviewed By: bottler
    
    Differential Revision: D37764610
    
    Pulled By: d4l3k
    
    fbshipit-source-id: 031895724d9318a6f6bab5b31055bb3f438176a5
    8d10ba52