-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
MeshPhysicalMaterial: Rename .transparency → .transmission, add .transmissionMap #19690
Conversation
For a more realistic example use, see https://discourse.threejs.org/t/gltfloader-does-not-display-all-materials-of-model/16281. |
As a reminder: https://threejs.org/docs/index.html#api/en/materials/MeshPhysicalMaterial.transparency |
This PR is excellent, IMO. The glTF extension is intended to model thin-surface plastics and glass. I am not aware of transparent metals. I find the label "metalic transmission" odd. As in https://threejs.org/examples/webgl_materials_physical_transparency.html, I'd render front and back faces separately to prevent artifacts. (Remove that example?) |
Yes, sorry that's unclear. The metallic rows are included only to demonstrate materials with
Good clarification — this glTF extension, alone, models only thin-surface plastics and glass. However, in the longer-term roadmap the format will also have an extension for refraction which builds on transmission rather than introducing yet another transparency-like property. So it is not our intention that Or that is the glTF roadmap, at least. Whether MeshPhysicalMaterial should work the same way is up for discussion! |
This is exciting! Can you give any more detail on the differences between your approximation and the equations in the extension? And do you know why those four spheres end up nearly completely transparent, as opposed to the reference? |
@WestLangley Thanks, the description in that PR is just what I was looking for. I'd love to look deeper in to the physical model, but I'm afraid that's going to have to wait until someday when I have slightly less on my plate... |
Khronos has finalized the spec and is close to ratifying it. Filament will be a reference implementation so we require cgltf support. More information at: KhronosGroup/glTF#1698 ThreeJS support is arriving here: mrdoob/three.js#19690
Khronos has finalized the spec and is close to ratifying it. Filament will be a reference implementation so we require cgltf support. More information at: KhronosGroup/glTF#1698 ThreeJS support is arriving here: mrdoob/three.js#19690
I don't think I'm going to be able to invest time improving the physical model any time soon either. 😞 Would it be OK to merge the |
Khronos has finalized the spec and is close to ratifying it. Filament will be a reference implementation so we require cgltf support. More information at: KhronosGroup/glTF#1698 ThreeJS support is arriving here: mrdoob/three.js#19690
21a782e
to
b2e251e
Compare
Ok, I think this is ready for review. I've pulled the glTF example out for now, since we aren't implementing enough of the transmission physical model to display the glTF asset as intended. |
Thanks! |
I guess we should remove if ( json.transparency !== undefined ) material.transparency = json.transparency; from |
Renames
.transparency
->.transmission
on MeshPhysicalMaterial, and adds.transmissionMap
. Implements theKHR_materials_transmission
thin transparency extension in GLTFLoader.The mechanical aspects of this are easy enough, but our implementation (below) is a bit simpler than what
KHR_materials_transmission
suggests for implementation.three.js/src/renderers/shaders/ShaderLib/meshphysical_frag.glsl.js
Lines 107 to 110 in 64fe3f8
^There may be a texture scaling issue in this screenshot as well, but that can be ignored for now.
@WestLangley based on the proposed spec here, do these look like reasonable changes for us to make in MeshPhysicalMaterial? Or does anything there concern you?