<div dir="ltr">Be aware that recent email on this subject from Holger Seelig ended up in spam.<div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 10, 2022 at 1:27 PM GPU Group <<a href="mailto:gpugroup@gmail.com">gpugroup@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I found a flag in shader (sent by uniform) can flip conveniently: if uvs are from gltf, node's internal bufferView/Accessor struct flip uv flag set (during gltf parsing) and in shader if(flip) uv.y = 1.0 - uv.y.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 10, 2022 at 10:12 AM Brutzman, Donald (Don) (CIV) <<a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Michalis, thanks for noting that problems emerged in prior glTF conversions<br>
for the online examples for Web3D.<br>
<br>
If someone is able to help us correct and update them satisfactorily, that<br>
will be welcome.  Likely interesting too since we can then use subversion<br>
diff to look at differences.<br>
<br>
all the best, Don<br>
-- <br>
Don Brutzman  Naval Postgraduate School, Code USW/Br        <a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a><br>
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA    +1.831.656.2149<br>
X3D graphics, virtual worlds, Navy robotics https://<br>
<a href="http://faculty.nps.edu/brutzman" rel="noreferrer" target="_blank">faculty.nps.edu/brutzman</a><br>
<br>
-----Original Message-----<br>
From: x3d-public <<a href="mailto:x3d-public-bounces@web3d.org" target="_blank">x3d-public-bounces@web3d.org</a>> On Behalf Of Michalis<br>
Kamburelis<br>
Sent: Sunday, April 10, 2022 9:00 AM<br>
To: Holger Seelig <<a href="mailto:holger.seelig@yahoo.de" target="_blank">holger.seelig@yahoo.de</a>><br>
Cc: X3D <<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a>><br>
Subject: Re: [x3d-public] (FlipY) Texture coordinates for material textures.<br>
<br>
The examples on<br>
*<br>
<a href="https://x3dgraphics.com/examples/X3dForAdvancedModeling/GltfSampleModels/index.html" rel="noreferrer" target="_blank">https://x3dgraphics.com/examples/X3dForAdvancedModeling/GltfSampleModels/ind<br>
ex.html</a><br>
are incorrect.<br>
<br>
You can instead just use<br>
<a href="https://github.com/KhronosGroup/glTF-Sample-Models/" rel="noreferrer" target="_blank">https://github.com/KhronosGroup/glTF-Sample-Models/</a> examples, and convert<br>
them to X3D yourself using latest view3dscene with "--no-x3d-extensions"<br>
command-line parameter.<br>
<br>
Explanation:<br>
<br>
Unfortunately glTF has different treatment of texture coordinates than X3D,<br>
assuming that Y=0 is "up" and Y=1 is "bottom of the image". This is<br>
consistent with WebGL, but inconsistent with OpenGL, OpenGLES, X3D.<br>
(Yes, it sucks that WebGL is inconsistent with OpenGL/OpenGLES in this<br>
case.)<br>
<br>
OTOH: X3D, OpenGL, OpenGLES, all say that Y=0 is "bottom" and Y=1 is "up of<br>
the texure image".<br>
<br>
There are various possible solutions to this:<br>
<br>
1. CGE/view3scene by default places "flipVertically=true" in texture nodes,<br>
see <br>
*<br>
<a href="https://castle-engine.io/x3d_implementation_texturing_extensions.php#section" rel="noreferrer" target="_blank">https://castle-engine.io/x3d_implementation_texturing_extensions.php#section</a><br>
_flip_vertically<br>
But this is non-standard CGE extension.<br>
<br>
2.  If you perform conversion using CGE/view3scene->glTF with<br>
"--no-x3d-extensions" command-line parameter, than we don't place<br>
"flipVertically" in file, instead we process TextureCoordinates contents to<br>
flip them.<br>
<br>
3. Finally, one can also use TextureTransform as you say.<br>
<br>
"""<br>
      textureTransform TextureTransform {<br>
        translation 0 -1<br>
        scale 1 -1<br>
      }<br>
"""<br>
<br>
achieves what is necessary.<br>
<br>
AD 3 is also what i would advise most X3D browsers. (Because AD 2 requires<br>
per-vertex processing, which should be avoided in general. AD<br>
1 is CGE specific, and probably most X3D viewers don't care about this extra<br>
optimization that "avoids doing TextureTransform at runtime".)<br>
<br>
The examples on<br>
<a href="https://x3dgraphics.com/examples/X3dForAdvancedModeling/GltfSampleModels/index.html" rel="noreferrer" target="_blank">https://x3dgraphics.com/examples/X3dForAdvancedModeling/GltfSampleModels/ind<br>
ex.html</a><br>
are just wrong. Someone used CGE/view3dcene without "--no-x3d-extensions" to<br>
generate glTF outout, and then removed flipVertically=true, thus making<br>
texture coords incorrect. I recall we talked about it with Don,<br>
CGE/view3dscene didn't have "--no-x3d-extensions" initially. Looks like<br>
noone had time to finalize this properly. The examples should be recreated<br>
with "--no-x3d-extensions".<br>
<br>
Regards,<br>
Michalis<br>
<br>
niedz., 10 kwi 2022 o 17:05 Holger Seelig <<a href="mailto:holger.seelig@yahoo.de" target="_blank">holger.seelig@yahoo.de</a>><br>
napisał(a):<br>
><br>
> I recently tested the new glTF examples from<br>
<a href="https://x3dgraphics.com/examples/X3dForAdvancedModeling/GltfSampleModels/index.html" rel="noreferrer" target="_blank">https://x3dgraphics.com/examples/X3dForAdvancedModeling/GltfSampleModels/ind<br>
ex.html</a> with X_ITE alpha version and recognized that the textures<br>
coordinated are y-flipped. I also tested View3DScene and it also happens<br>
there. I know that glTF does no y-flip with textures  as X3D does, thus a<br>
conversion from glTF to X3D should handle this and add a TextureTransform<br>
with translation 0 1 and scale 1 -1. This would mean that this<br>
TextureTransform must be added to the examples. Is this correct, or are the<br>
textures from material nodes somewhere handled specially?<br>
><br>
> Best regards,<br>
> Holger<br>
><br>
> _______________________________________________<br>
> x3d-public mailing list<br>
> <a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a><br>
> <a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" rel="noreferrer" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a> <br>
<br>
_______________________________________________<br>
x3d-public mailing list<br>
<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a><br>
<a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" rel="noreferrer" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a><br>
</blockquote></div>
_______________________________________________<br>
x3d-public mailing list<br>
<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a><br>
<a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" rel="noreferrer" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a><br>
</blockquote></div>