ShapeNet / shapenet-viewer

ShapeNet Viewer
MIT License
187 stars 25 forks source link

Disable shading #10

Closed renmengye closed 7 years ago

renmengye commented 7 years ago

Hi,

Thank you for your great contribution of releasing ShapeNet and an amazing viewer. I am wondering if I can disable shading entirely, and just look at the color of the object from all view angles. I tried a few settings of the MTL file, but I can only get shader-free image from the intial camera angle. Could you point me where I should change in the code to make it happen?

Thanks a lot!

Mengye Ren

msavva commented 7 years ago

You can get unshaded materials (i.e. flat colors) by setting the illumination mode appropriately in your MTL file. Specifying illum 0 for each material you want to be unshaded, should result in flat shading of that material. Please refer to the documentation of the MTL illum directive at http://paulbourke.net/dataformats/mtl/

If you would like to override this in the code, you can set the shadeless variable to always be true in https://github.com/ShapeNet/shapenet-viewer/blob/f4fefe4ccd3a0fc31f836e8098b7386f1b80c1d9/src/main/java/edu/stanford/graphics/shapenet/jme3/plugins/MTLLoader.java#L132