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

glTF: Use the vertex colors when available #21087

Closed
capnm opened this issue Aug 16, 2018 · 11 comments · Fixed by #41007
Closed

glTF: Use the vertex colors when available #21087

capnm opened this issue Aug 16, 2018 · 11 comments · Fixed by #41007

Comments

@capnm
Copy link
Contributor

capnm commented Aug 16, 2018

Godot version:

tip de0fb07

Issue description:

image

After the import you have to change each material manually:

image

@fire
Copy link
Member

fire commented Jan 9, 2020

Can you post a sample project?

@paulmiller
Copy link

I think they're saying they want "use as albedo" to be enabled automatically if the model has vertex color info. I personally wouldn't want that - at least, not for materials outside the model's own gltf file. It'd be very confusing for the material's properties to change depending on which models are using it.

@fire
Copy link
Member

fire commented Aug 2, 2020

I'm not able to find a gltf2 spec description that allows this. https://github.com/KhronosGroup/glTF/tree/master/specification/2.0

Edited:

So I'm asking for a valid gltf2 file.

@capnm
Copy link
Contributor Author

capnm commented Aug 3, 2020

So I'm asking for a valid gltf2 file.

It feels like someone is calling me from the grave :-)

waiting-for-godot-5.0.zip

grafik

Validation report

    Format: glTF 2.0
    Generator: Khronos glTF Blender I/O v1.2.75
    Stats:
        1 draw calls
        0 animations
        0 materials
        22269 vertices
        8217 triangles
    Extensions: None

https://docs.blender.org/manual/en/latest/addons/import_export/scene_gltf2.html#geometry

grafik

@fire
Copy link
Member

fire commented Aug 3, 2020

Try this #41007.

@capnm
Copy link
Contributor Author

capnm commented Aug 4, 2020

Try this #41007.

I guess for 3.2.x this should be:


				Ref<Material> mat;
				mat.instance();
				mat->set_flag(Material::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);

right?

@fire
Copy link
Member

fire commented Aug 4, 2020

Looks good on a first glance. Haven't ported the vertex color patch over though. In the middle of something.

@capnm
Copy link
Contributor Author

capnm commented Aug 4, 2020

Looks good on a first glance. Haven't ported the vertex color patch over though. In the middle of something.

I figured it out, someone renamed the SpatialMaterial 🤕
Also works with objects that have textured and vertex-colored surfaces combined.

Added to my 3.2.x patch set :-)
Thanks!

texture-and-vertex-color-a01.zip

grafik

@akien-mga
Copy link
Member

See #41007 (comment), this can be done on a per-project basis by setting the default import preset for glTF in the Import dock.

@capnm
Copy link
Contributor Author

capnm commented Sep 3, 2020

See #41007 (comment), this can be done on a per-project basis by setting the default import preset for glTF in the Import dock.

I'm not sure which preset you're talking about, at least in the glTF / Scene preset in 3.2.x I couldn't find any related options.
Please try to import the waiting-for-godot-5.0.zip file.

Anyway, thaks for the fish ...

@akien-mga
Copy link
Member

Reopening as per #41007 (comment) and further IRC discussion.

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