[x3d-public] glTF in Castle Game Engine / view3dscene

Michalis Kamburelis michalis.kambi at gmail.com
Mon Dec 24 06:28:27 PST 2018


Something that may be interesting to people implementing glTF + X3D integration:

One issue I discovered is that glTF expects (0,0) texture coordinate
to be the upper-left image corner. This is contrary to X3D, OpenGL and
OpenGLES that expect texture coord (0,0) to be in bottom-left corner.

One solution is to flip the texture coordinates ("for all texcoords,
texcoord.y := 1 - texcoord.y"). But this is unoptimal, as then it is
impossible to load glTF buffers directly to GPU. The solution I have
made is to introduce "ImageTexture.flipVertical" field to instead flip
images at loading.

A more detailed overview of the issue is at
https://castle-engine.io/x3d_implementation_texturing_extensions.php#section_flip_vertically
. This is the solution used in Castle Game Engine and view3dscene to
load glTF as X3D scene graph, and keep everything correct and
sensible.

Regards,
Michalis

niedz., 23 gru 2018 o 03:58 Michalis Kamburelis
<michalis.kambi at gmail.com> napisał(a):
>
> Hi,
>
> I'm sorry I wasn't able to attend X3D teleconference lately. In
> exchange, here's a little gift: Castle Game Engine and view3dscene
> support now glTF! :)
>
> All the details are in the news post on:
>
> https://castle-engine.io/wp/2018/12/23/gltf-2-0/
>
> Highlights:
>
> - We support basic glTF features. No animations, no PBR yet. We
> support only static models with textures (diffuse and normal map).
>
> - You can open glTF in view3dscene, you can refer to glTF in X3D
> Inline/Anchor nodes, you can use view3dscene to convert glTF to X3D.
>
> - A beta build of view3dscene with glTF support included is on
> http://michalis.ii.uni.wroc.pl/view3dscene-snapshots/ .
>
> - We use a cool glTF reading library in Pascal: PasGLTF,
> https://github.com/BeRo1985/pasgltf/ , by Benjamin Rosseaux. It
> supports both text+binary (gltf) and pure binary (glb) formats.
>
> This is of course just a beginning of the glTF work :) We convert glTF
> "naively" to X3D graph now, which means that:
>
> - We "decode" the mesh, instead of directly loading glTF binary chunk into GPU.
>
> - We use traditional X3D (Phong) Matertial, simply using baseColor
> from glTF as Phong's diffuse color.
>
> - glTF animations are not handled at all yet.
>
> More stuff to come in 2019!
>
> Regards and happy holidays to all!
> Michalis



More information about the x3d-public mailing list