[x3d-public] Sorry for not being able to attend today's teleconference, glTF stuff that I planned to mention

Michalis Kamburelis michalis.kambi at gmail.com
Fri Jan 11 21:32:47 PST 2019


Hi Leonard,

In this initial approach to glTF in Castle Game Engine, I simply do
not handle PBR. A *subset* of the glTF material (with PBR) is
trivially converted to an X3D CommonSurfaceShader (
https://castle-engine.io/x3d_implementation_texturing_extensions.php#section_ext_common_surface_shader
, this supports Phong properties and a normalmap).

More precisely:

- glTF baseColorFactor (RGBA) is converted to X3D
CommonSurfaceShader.diffuseFactor (RGB) and
CommonSurfaceShader.alphaFactor

- glTF baseColorTexture is converted to
ImageTexture/PixelTexture/MovieTexture and placed in
CommonSurfaceShader.multiDiffuseAlphaTexture and
CommonSurfaceShader.diffuseTextureCoordinatesId .

- glTF normalTexture is converted to
ImageTexture/PixelTexture/MovieTexture and placed in
CommonSurfaceShader.normalTexture and
CommonSurfaceShader.normalTextureCoordinatesId .

- glTF alphaMode is converted to Appearance.alphaChannel (extension of
CGE linked in my mail above).

As you can see on screenshots on
https://castle-engine.io/wp/2018/12/23/gltf-2-0/ , the results look
completely reasonable for simple models. Despite the fact that they
calculate lighting using Phong, not PBR equations, and they ignore
almost everything from glTF pbrMetallicRoughness structure except
baseColor information.

This is of course only a temporary state. The plan is to introduce to
X3D a "PhysicalMaterial" node that supports the same properties as
glTF standard material (with pbrMetallicRoughness). "PhysicalMaterial"
node would allow to configure all factors using a simple value
(scalar/vector) and/or a texture, similar to "CommonSurfaceShader" and
to glTF materials. My plans are sketched on

- https://github.com/michaliskambi/x3d-tests/wiki/Include-PBR-(PhysicalMaterial-and-related-concepts)-in-the-official-X3D-specification
and
- https://github.com/michaliskambi/x3d-tests/wiki/How-to-add-PBR-to-X3D%3F .

Regards,
Michalis

pt., 11 sty 2019 o 16:55 Leonard Daly <Leonard.Daly at realism.com> napisał(a):
>
> Michalis,
>
> I am curious how you handle the differences in texture/appearance. glTF only handles PBR. It is possible to create the equivalent appearance of Phong-shaded material, but it takes quite a bit of work during modeling/texturing. If that work was not done, then you need to merge multiple maps for texture (aka base color), metallic, roughness, plus optionally those for normals (already in place in X3D), ambient occlusion, emissive (as a map, not just a scalar), and environmental light map.
>
> I see some obvious mappings from glTF --> X3D. [This material included for those not deeply familiar with PBR or glTF's implementation of PBR.]
>
> Things with obvious relationships
> glTF        -->        X3D
> base color    ->    texture
> normals        ->    normals
>
> Things with obvious relationships, but dimension reduction
> glTF (map)        --> X3D (scalar)
> emissive        ->    emissive
> environment    -> multiple discrete lights
>
> Things that don't map
> glTF
> metallic
> roughness
> ambient occlusion
>
> Things that don't receive
> X3D
> diffuseColor (unless the texture is flat)
> specular (computer in PBR)
> emissive (unless the emissive map is flat -- see above)
>
>
> Note that transparency and discrete lighting is separate and handled in both systems.
>
> The page at https://github.com/KhronosGroup/glTF-WebGL-PBR is a good place to start for a description of the glTF implementation.
>
> Leonard Daly
>
>
>
> Hi,
>
> My apologies, I will not be able to attend today's web3d
> teleconference. I'm falling asleep after 24h of work :) Man, I thought
> I'm stronger! :)
>
> For anyone interested, I wanted to briefly mention what has happened
> in Castle Game Engine / view3dscene about glTF. I can talk about it
> next Friday, but those interested can also read links below:
>
> - Castle Game Engine / view3dscene can now read glTF 2.0 (without
> animations): https://castle-engine.io/wp/2018/12/23/gltf-2-0/ . Both
> .gltf and .glb versions, images/buffers can be provided either as
> separate files or packed into a single file. You can open glTF files,
> you can refer to them using X3D "Inline" or "Anchor", you can use
> view3dscene/tovrmlx3d to convert glTF to X3D. The resulting X3D uses
> CommonSurfaceShader to express a Phong material with possible
> normalmaps.
>
> - I wanted to mention important "mismatch" between glTF and X3D, and
> how we deal with it by a new "flipVertically" field at texture nodes
> (like "ImageTexture.flipVertically"):
> https://castle-engine.io/x3d_implementation_texturing_extensions.php#section_flip_vertically
>
> - I wanted to mention "Appearance.alphaChannel", which is a CGE
> extension to X3D:
> https://castle-engine.io/x3d_implementation_shape_extensions.php#section_ext_alpha_channel
> . It is generally useful (even if you don't care about glTF), and also
> it allows to perfectly express the glTF "alphaMode" field at glTF
> materials.
>
> Best regards,
> Michalis
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
>
> --
> Leonard Daly
> 3D Systems & Cloud Consultant
> LA ACM SIGGRAPH Past Chair
> President, Daly Realism - Creating the Future
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org



More information about the x3d-public mailing list