Fix vertex colored flat shading#1289
Conversation
bigbike
left a comment
There was a problem hiding this comment.
Have you tried to load any vertex colored mesh?
Post the result image in the comments, will you? :)
| Screenshot requested by @bigbike of a vertex colored mesh. Better before/after pictures will be uploaded later. |
|
Interesting. This mesh is vertex colored mesh for the Replica dataset. We can display it before even without your change. Can you try the "master" branch on this mesh? I suspect you can display it already. |
Context on this test model: I provided it to Lawrence. It is a GLB that I created (not the Replica source PLY). I agree that we'd like to see another vertex-colored test model here. |
|
You'll need to add the HasVertexColor flag here habitat-sim/src/esp/assets/ResourceManager.cpp Line 1171 in 8ec2ef5 |
I pushed a change that does this, although I'm not sure if this is actually a good idea. It will apply to all instance meshes because currently, there's no way to determine whether it's actually supposed to be vertex colored or not (see the warning comment under the changed line). This is a bigger issue than this PR is trying to address. |
|
Yep, not the job of this PR to address that issue, but currently we default to instance meshes have vertex coloring, so we shouldn't change that unintentionally. |
…st test cases to agree with the new rendering
|
Good job, @ldcWV ! I approved this PR but left a question for you to consider. Also please wait the CI tests passes. |
…st test cases to agree with the new rendering
|
Pull from master to fix the Habitat-Lab issue. |
…itat-sim into ldchen/vertex-coloring
|
Wait. Why I cannot see any comments from @eundersander ? I received a lot of comments in email notification. But cannot see any here? To answer the "invisible" question: |
He replied to an already resolved conversation. The thread is the second one in your approval comments. |


Motivation and Context
Currently, it is impossible to view a mesh that is flat shaded because this case is being handled incorrectly. Flat shaded meshes show up completely black. This PR fixes that issue.
Before:

After:

In addition, the property
vertexColoredis now removed fromPhongMaterialData, as this is not technically a property of a material because it depends on the geometry of the mesh. It has now been changed to a flag forDrawable.How Has This Been Tested
A flat shaded mesh was loaded into the viewer successfully. If more testing is necessary, please give suggestions.
Types of changes
Checklist