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

Add support for gltf::Material::unlit #1341

Merged
merged 7 commits into from
Feb 1, 2021

Conversation

willcrichton
Copy link
Contributor

This PR enables materials loaded from a gLTF file to use the "KHR_materials_unlit" extension to disable lighting via the Material::unlit method.

@@ -298,6 +298,7 @@ fn load_material(material: &Material, load_context: &mut LoadContext) -> Handle<
LoadedAsset::new(StandardMaterial {
albedo: Color::rgba(color[0], color[1], color[2], color[3]),
albedo_texture: texture_handle,
shaded: !material.unlit(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is shaded the standard name here? It feels like lit is a more direct version of !unlit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not, I just used shaded because that was already in the engine. I can rename the symbol though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

godot uses "shadeless" in its materials (which inspired this), unity uses "unlit", unreal uses "unlit", and gltf uses "unlit".

I generally don't like "negative bools", as that can result in double negatives. But given that we're calling this StandardMaterial, we should probably align with the crowd here and rename this to "unlit" (and adjust the forward.frag shader to use # ifndef STANDARDMATERIAL_UNLIT instead of # ifdef STANDARDMATERIAL_SHADED)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I've changed the name in 3241fb8.

@cart cart merged commit e6e23fd into bevyengine:master Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants