Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow mesh Vertex Colors to be imported from Blender file even when not used by material #97984

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TheSofox
Copy link
Contributor

@TheSofox TheSofox commented Oct 8, 2024

Fixes #97953

Vertex Colours were not being imported in Blender files if they were on meshes that didn't have materials attached. This is because export_vetex_color was set to MATERIAL (see here: https://docs.blender.org/api/current/bpy.ops.export_scene.html ). This PR switches the option to ACTIVE so that Vertex Colors get imported even when the mesh they're on doesn't use a material (check linked Issue for screenshots).

@TheSofox TheSofox requested a review from a team as a code owner October 8, 2024 17:31
@AThousandShips AThousandShips added this to the 4.x milestone Oct 8, 2024
@clayjohn
Copy link
Member

clayjohn commented Oct 8, 2024

CC @fire @lyuma We made a similar change to the GLTF or FBX importer recently too right?

@fire
Copy link
Member

fire commented Oct 8, 2024

Remember that the definition of vertex color is that it affects the PBR rendering, if you are using it for data or for example visualizing the weight painting it will give invalid pbr results. (Like base color multiplied with the flow map per vertex for example)

Also vertex color is most commonly an unused channel because the preferred workflow is uvs and a map [texture]. We have up to 8 uvs.

Edited:

For the longest time Godot Engine removed vertex colours so adding this should be defaulted to that status quo of removing vertex colors and letting the developer swap to this other mode.

Edited:

There was a debate about vertex colors on the blender io repository for GLTF, research into the conclusion of may inform our decisions.

@fire
Copy link
Member

fire commented Oct 8, 2024

See also #81740 (Enable vertex colors by default on Blender importer settings)

@aaronfranke
Copy link
Member

@fire Perhaps we should change this user-facing boolean to be a dropdown enum? "None", "Material", "All"?

@TheSofox
Copy link
Contributor Author

TheSofox commented Oct 11, 2024

@fire Perhaps we should change this user-facing boolean to be a dropdown enum? "None", "Material", "All"?

That might get a bit messy. "None", "Material", "All" only applies to Blender 4.2 and later. Earlier version use a simple boolean value. (eg. from 3.0 export_colors (boolean, (optional)) – Vertex Colors, Export vertex colors with meshes). Godot code already handles this. I'm guess that the bug doesn't apply to earlier versions of Blender.

@Knairda0
Copy link

I'm guess that the bug doesn't apply to earlier versions of Blender.

Correct - I had been using Blender 4.0 as the importer previously (with vertex colors importing correctly) but had to switch over after realizing that sharp edges weren't importing, which was fixed by switching to Blender 4.2.2 (can't find the PR for that, but unrelated)

The vertex color bug I reported (#97953) is only present for Blender 4.1 onwards. I believe that's because of this controversial Blender 4.1 PR. Then that default behavior was turned into the export toggle for 4.2 with this PR.

The effects of these Blender changes are still felt for Godot's importer because of the lack of an import toggle (like Blender's 4.2 export toggle), or this thread's PR making all active colors imported by default (pre-Blender 4.1 behavior)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.blend files import vertex colors inconsistently
7 participants