Infer face_normals=True/False according to .use_smooth attribute of polygons
waytobehigh opened this issue · 5 comments
Hi folks! I believe, it would be really helpful to toggle the export of face/vertex normals naturally by using Shade smooth
or Shade flat
options in Blender. It can be inferred via .use_smooth
property of faces on export stage.
If that makes sense, I can draft a PR.
Hello,
The add-on should already support exporting both flat & smooth shaded meshes by setting Mitsuba's face_normals
flag as you can see below.
mitsuba-blender/mitsuba-blender/io/exporter/geometry.py
Lines 139 to 141 in 2b9365f
If this does not do what you expect, can you please explain in more details what issue you are experiencing and how to reproduce it ? Also, can you indicate which version of Blender & the add-on you are testing this with ?
Thank you!
Thank you for the prompt reply!
All shapes created in Blender have vertex normals. For imported meshes, afaik Blender auto-generates them if they were not present. However, whether to use them or not is determined by toggling Shade Smooth / Shade Flat as shown below.
That would be great if Mitsuba add-on reacted to this toggling, or if there was a separate option to give preference to face normals and ignore vertex ones during export.
Which version of Blender are you using? This works with Blender 2.93 but something may have changed in later versions.
I am using Blender 2.93 and current master branch for the add-on
Oh, I actually double-checked with the sphere and it worked for me too... I did not understand yet why, but worked :)
Never mind, sorry for raising the issue and thank you for looking into that!