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

Need to manually set thickness property when importing gltf scene #10931

Open
GitGhillie opened this issue Dec 10, 2023 · 5 comments
Open

Need to manually set thickness property when importing gltf scene #10931

GitGhillie opened this issue Dec 10, 2023 · 5 comments
Labels
A-Assets Load files from disk to use for things like images, models, and sounds C-Bug An unexpected or incorrect behavior S-Needs-Investigation This issue requires detective work to figure out what's going wrong

Comments

@GitGhillie
Copy link
Contributor

Bevy version

0.12.1

What you did

  1. Create new principled BSDF material in Blender
  2. Set transmission close to 1
  3. Set IOR to something other than 1 to get some refraction going
  4. Export gltf
  5. Load the scene in Bevy using the following code:
commands.spawn(SceneBundle {
        scene: asset_server.load("scene.glb#Scene0"),
        ..default()
    });

What went wrong

No refraction is seen when the scene is loaded in the Bevy app. Need to manually set the thickness property of the StandardMaterial to achieve a similar look to the Eevee renderer in Blender. The StandardMaterial documentation does not seem to include how to approach this exactly. But ideally it would work out of the box.

transmission

Additional information

Let me know if a reproducer would help, wanted to post first in case I just missed some export setting in Blender.

@GitGhillie GitGhillie added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Dec 10, 2023
@alice-i-cecile alice-i-cecile added A-Assets Load files from disk to use for things like images, models, and sounds S-Needs-Investigation This issue requires detective work to figure out what's going wrong and removed S-Needs-Triage This issue needs to be labelled labels Dec 21, 2023
@alice-i-cecile
Copy link
Member

A reproducer would be great. Once you have something small working; can you check if the property is correctly set in the gltF file? There's a chance this bug is on the Blender end, not the Bevy one.

@GitGhillie
Copy link
Contributor Author

GitGhillie commented Dec 22, 2023

We had some discussion about the issue ⁠here.
IMO we should ignore Blender for now and try to figure out the following:
How does one create a solid glass material in Bevy?

For example, if you have a Suzanne made of solid glass, you'd set the IOR to 1.5, but what do you set thickness to? Shouldn't it not be necessary to set a thickness value?

Once that is clear it should be easy to create a workaround and/or figure out if it's a Blender issue.

@mockersf
Copy link
Member

Thickness in gltf is defined in an extension: KHR_materials_volume
https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_materials_volume/README.md

This is loaded by Bevy if it's available.

So you need to setup Blender to export materials with this extension. It can do it (KhronosGroup/glTF-Blender-IO#1646) but I don't know Blender enough to know how to set it there.

@GitGhillie
Copy link
Contributor Author

Yeah just to be clear, when I ask "How does one create a solid glass material in Bevy?" I'm talking about a Bevy material, nothing gltf related

@janhohenheim
Copy link
Member

janhohenheim commented Mar 3, 2024

Quick googling for the Blender export settings says:

Blender 3.3 allows you to add a glTF Material Output node, which includes values for occlusion, thickness, and specular – all the data needed for outputting volumes into a glTF file. When importing a glTF file, this node and associated values are automatically added and set.

If you are creating an object from scratch and wish to output to glTF, you can enable the glTF Output Node in preferences: Preferences > Add-ons > Import-Export: glTF 2.0 format > Shader Editor Add-On

Once enabled, the glTF Material Output Node will appear in the menu under Output Nodes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds C-Bug An unexpected or incorrect behavior S-Needs-Investigation This issue requires detective work to figure out what's going wrong
Projects
None yet
Development

No branches or pull requests

4 participants