<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">I finally implemented the new browser option ‚ColorSpace‘ with the three values SRGB, LINEAR_WHEN_PHYSICAL_MATERIAL (default), and LINEAR. It behaves exactly like Castle’s ColorSpace global variable (<a href="https://castle-engine.io/color_space">https://castle-engine.io/color_space</a>), including affecting backgrounds, and image based lighting textures. I think this is a big step forward towards a linear color workflow.<div><br></div><div>Although the LINEAR_WHEN_PHYSICAL_MATERIAL option is perhaps born out of necessity, it is probably justified as it is good as a transition from sRGB to linear color space workflow.<br><div><br></div><div>Additionally, I created a test case, testing UnlitMaterial , Material, PhysicalMaterial. All material with and with<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">out</span> textures. <span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">There are three buttons below the spheres, where you can switch between the three ColorSpace modes in X_ITE. In Castle you can change ColorSpace in the ‚View‘ menu.</span></div><div><br></div><div>Test case:</div><div><a href="https://create3000.github.io/Library/Tests/Components/Shape/ColorSpace.x3d">https://create3000.github.io/Library/Tests/Components/Shape/ColorSpace.x3d</a></div><div><br></div><div>Test case in X_ITE Playground:</div><div><a href="https://create3000.github.io/x_ite/playground/?url=https://create3000.github.io/Library/Tests/Components/Shape/ColorSpace.x3d">https://create3000.github.io/x_ite/playground/?url=https://create3000.github.io/Library/Tests/Components/Shape/ColorSpace.x3d</a></div><div><br></div><div><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">Michalis, you will be probably happy to hear that I have also removed UnlitMaterialExtension in favor of UnlitMaterial and a linear color space setting, which is now active in the glTF Sample Viewer on the X_ITE website, w</span>hat puts everything, including UnlitMaterial, now into the linear color space.</div><div><br></div><div><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">## EXT_sRGB</span></div><div><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><br></span></div><div>I also stumble more or less often over the fact that it would be necessary to know whether a texture is sRGB (e.g. baseColorTexture) or linear (e.g. normalTexture), because then you could 'upload' these textures, as it would be better, as sRGB (or not) to the graphics card, to get rid of the color space conversions. The same problem that you (<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">Michalis</span>) have already mentioned also exists with the possible sRGB framebuffer, which cannot yet be used. If the color space is completely linear, then an sRGB framebuffer would be an option.</div><div><br></div><div>The corresponding test case from glTF is this one:</div><div><a href="https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/TextureLinearInterpolationTest/glTF/TextureLinearInterpolationTest.gltf">https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/TextureLinearInterpolationTest/glTF/TextureLinearInterpolationTest.gltf</a></div><div><br></div><div>And in glTF Sample Viewer:</div><div><a href="https://create3000.github.io/x_ite/laboratory/gltf-sample-viewer/?url=TextureLinearInterpolationTest">https://create3000.github.io/x_ite/laboratory/gltf-sample-viewer/?url=TextureLinearInterpolationTest</a></div><div><br></div><div>The test still fails because texture interpolation is still done in sRGB color space. This only gets solved if WebGL EXT_sRGB is used.</div><div><a href="https://developer.mozilla.org/en-US/docs/Web/API/EXT_sRGB">https://developer.mozilla.org/en-US/docs/Web/API/EXT_sRGB</a></div><div><br></div><div>Best regards,</div><div>Holger</div><div><br></div><div><div>
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="text-align: start; text-indent: 0px; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; -webkit-text-stroke-width: 0px;">--</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; -webkit-text-stroke-width: 0px;">Holger Seelig</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; -webkit-text-stroke-width: 0px;">Leipzig, Germany</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; -webkit-text-stroke-width: 0px;"><br></div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; -webkit-text-stroke-width: 0px;">holger.seelig@yahoo.de</div><div>https://create3000.github.io/x_ite/</div></div></div></div></div></div></div>
</div>
<div><br><blockquote type="cite"><div>Am 27.06.2024 um 17:12 schrieb Holger Seelig via x3d-public <x3d-public@web3d.org>:</div><br class="Apple-interchange-newline"><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div><div>I believe it is possible to add a browser option 'ColourSpace' to X_ITE, as Castle does. (https://castle-engine.io/color_space) With the three options SRGB, LINEAR_WHEN_PHYSICAL_MATERIAL and LINEAR. UnlitMaterial would then behave in the same way as UnlitMaterialExtension does now if LINEAR is selected. However, this would then require switching when glTF is converted to UnlitMaterial with KHR_materials_unlit, because, as in Castle, the default is LINEAR_WHEN_PHYSICAL_MATERIAL, isn't it? And then there is no way back, because ‚ColorSpace' is a global option and all materials are affected.</div><div><br></div><div>With an UnlitMaterialExtension, the LINEAR calculation would be limited to PhysicalMaterial. UnlitMaterial and Material could remain in the sRGB colour space, as it has been for historical reasons. If these materials are in the sRGB colour space, it makes colour mixing with a ColorChooser much easier, as these usually display and output sRGB colours. It also makes it easier to set the same colour in HTML/CSS and X3D, otherwise it gets a bit tricky.</div><div><br></div></div><div>It is a difficult decision.</div><div><br></div><div>Regards,</div><div>Holger</div><div><br id="lineBreakAtBeginningOfMessage"><div>
<div dir="auto" style="caret-color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="caret-color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div dir="auto" style="text-align: start; text-indent: 0px; overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div style="caret-color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; -webkit-text-stroke-width: 0px;">--</div><div style="caret-color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; -webkit-text-stroke-width: 0px;">Holger Seelig</div><div style="caret-color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; -webkit-text-stroke-width: 0px;">Leipzig, Germany</div><div style="caret-color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; -webkit-text-stroke-width: 0px;"><br></div><div style="caret-color: rgb(0, 0, 0); letter-spacing: normal; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none; -webkit-text-stroke-width: 0px;">holger.seelig@yahoo.de</div><div>https://create3000.github.io/x_ite/</div></div></div></div></div></div></div>
</div>
<div><br><blockquote type="cite"><div>Am 27.06.2024 um 14:55 schrieb Michalis Kamburelis <michalis.kambi@gmail.com>:</div><br class="Apple-interchange-newline"><div><div>Thank you for the answers!<br><br>As for KHR_materials_pbrSpecularGlossiness:<br><br>Indeed some Sketchfab models use KHR_materials_pbrSpecularGlossiness ,<br>as internal Sketchfab exporter uses it in some cases. It seems<br>Sketchfab didn't update their tools to follow Khronos recommendations<br>(to use KHR_materials_specular instead of<br>KHR_materials_pbrSpecularGlossiness). Which is also understandable --<br>I don't think there's a straightforward conversion that exactly<br>preserves look from KHR_materials_pbrSpecularGlossiness to<br>KHR_materials_specular, even though they fulfill the same use-case. So<br>Sketchfab doesn't want to break compatibility (look of models).<br><br>That is why I wondered to implement<br>KHR_materials_pbrSpecularGlossiness in some way, though for now just<br>recommend users to ask model authors to not use this material type --<br>https://castle-engine.io/sketchfab . It's on our page about Sketchfab<br>integration, because that's where users in practice encounter this<br>issue :)<br><br>All good, I mean it is of course a practical and valid decision to<br>support KHR_materials_pbrSpecularGlossiness (by equivalent in X3D<br>SpecularGlossinessMaterial) for the time being, since real models use<br>it, despite what Khronos recommends. Thanks for the explanation!<br><br>As for unlit:<br><br>The "unlit" field in X3DOM PhysicalMaterial (<br>https://doc.x3dom.org/developer/x3dom/nodeTypes/PhysicalMaterial.html<br>) -- I'm not sure, but I think it predates the X3D 4.0 and<br>UnlitMaterial node. X3DOM doesn't implement UnlitMaterial for now at<br>all, looking at docs ( https://doc.x3dom.org/developer/classes.html )<br>.<br><br>So here I would vote for sticking to the standard, in both X3DOM and<br>X_ITE :) That is, UnlitMaterial should fulfill the need to translate<br>glTF unlit materials to X3D, and is simpler. X3DOM's<br>PhysicalMaterial.unlit, and X_ITE UnlitMaterialExtension, can<br>hopefully always be replaced by using UnlitMaterial.<br><br>As for sRGB workflow:<br><br>It is indeed not specified in X3D. X3DOM has their extension to<br>specify it ( https://doc.x3dom.org/tutorials/lighting/gamma/ ). Castle<br>Game Engine uses linear workflow it too ( though by default only for<br>PhysicalMaterial, see https://castle-engine.io/color_space , but you<br>can make it used always, it should actually affect Material and<br>UnlitMaterial too ). See<br>https://github.com/michaliskambi/x3d-tests/wiki/Gamma-correction-in-X3D-and-glTF<br>, https://github.com/michaliskambi/x3d-tests/wiki/Gamma-Correction-in-Future-X3D<br>for my knowledge.<br><br>I was recommending a "cautious" approach in X3D 4.0 here, because just<br>saying "use linear workflow for everything, like glTF" *will* change<br>the look of the existing models. But I think in the end we are in<br>situation when this is not specified, and everyone does something a<br>bit different. All in all, we should just all switch to "use linear<br>workflow for everything, like glTF" .<br><br>So, I'm older and wiser now :), and today I'm all after changing X3D<br>spec to just say it. That is, simply "use linear workflow for<br>everything, like glTF". The more exact wording what it should mean are<br>on https://github.com/michaliskambi/x3d-tests/wiki/Gamma-correction-in-X3D-and-glTF<br>, https://github.com/michaliskambi/x3d-tests/wiki/Gamma-Correction-in-Future-X3D<br>, these were made looking at glTF and they just seem to make sense.<br><br>Regards,<br>Michalis<br><br>śr., 26 cze 2024 o 17:48 Holger Seelig <holger.seelig@yahoo.de> napisał(a):<br><blockquote type="cite"><br>I have added SpecularGlossinessMaterial, as there are models on the internet that use it (sketchfab), so that these models can also be displayed. X3DOM also has a way to display this material. Furthermore, it is apparently not possible to convert this material with the associated textures by using PhysicalMaterial.<br><br>I added UnlitMaterialExtension for now, because X3DOM also has an *unlit* field in PhysicalMaterial.<br><br>https://doc.x3dom.org/developer/x3dom/nodeTypes/PhysicalMaterial.html<br><br>An important aspect is also the sRGB workflow, which is specified in PhysicalMaterial, but is not mentioned in X3D (or are there texts about it).<br><br>Best regards,<br>Holger<br><br>--<br>Holger Seelig<br>Leipzig, Germany<br><br>holger.seelig@yahoo.de<br>https://create3000.github.io/x_ite/<br><br>Am 26.06.2024 um 14:54 schrieb Michalis Kamburelis <michalis.kambi@gmail.com>:<br><br>Great news! I'm reading your node docs, excellent work in getting this<br>specified and implemented!<br><br>I have a plan to implement these material extensions in Castle Game<br>Engine / Castle Model Viewer as well (<br>https://castle-engine.io/roadmap#gltf_material_features ). Looks like<br>you beat me to it with X_ITE, and it makes me very happy :) (Also<br>because it means I can look at your nodes and code and my task is much<br>easier :) ).<br><br>Some initial thoughts about the spec of new functionality:<br><br>1. Expressing functionality as "extensions" of PhysicalMaterial (I see<br>you have "PhysicalMaterial.extensions", MFNode with<br>X3DMaterialExtensionNode,<br>https://create3000.github.io/x_ite/components/shape/physicalmaterial/<br>):<br><br> This is great solution, this expressed the intention nicely (this<br>information is extra data, "extension", and without it things look<br>worse but make sense).<br><br> I'm looking at this both from Castle Game Engine / Castle Model<br>Viewer author perspective, also from the perspective of future X3D<br>versions. A lot of your extensions, including the<br>"PhysicalMaterial.extensions" field and nodes like<br>SheenMaterialExtension, ClearcoatMaterialExtension could definitely be<br>part of future X3D (4.1?) version.<br><br>2. Comments specifically about SpecularGlossinessMaterial (<br>https://create3000.github.io/x_ite/components/x-ite/specularglossinessmaterial/<br>):<br><br> Note that KHR_materials_pbrSpecularGlossiness is deprecated, and<br>the recommendation is to follow instead KHR_materials_specular which<br>addresses a similar use-case. In Castle Game Engine / Castle Model<br>Viewer we deliberately decided, for this reason, to not support<br>KHR_materials_pbrSpecularGlossiness and just explain it to users (<br>https://castle-engine.io/sketchfab ).<br><br> I of course understand it is a practical decision, if your users<br>demand KHR_materials_pbrSpecularGlossiness then<br>SpecularGlossinessMaterial makes sense. I'm just saying that this<br>should probably not go to future X3D spec.<br><br> Just like Khronos recommends KHR_materials_specular over<br>KHR_materials_pbrSpecularGlossiness, we should in X3D recommend<br>SpecularMaterialExtension over SpecularGlossinessMaterial.<br><br>3. I see you added also UnlitMaterialExtension, can you expand why do<br>you need it?<br><br> I know your approach is a bit more consistent with glTF, that has<br>"physical material with KHR_materials_unlit".<br><br> That said, I deliberately deviated here for X3D 4.0, adding<br>instead a separate node "UnlitMaterial". "UnlitMaterial" does feel<br>more natural -- being unlit is, conceptually, not an extension of PBR<br>lighting equations (or PBR specular, or Phong lighting equations...).<br>Being unlit means you throw away the usual lighting equations, and<br>just have very simple situation where resulting color is emissiveColor<br>* optional emissiveTexture. This makes "UnlitMaterial" spec simple,<br>this also sidesteps glTF question (that used to be ambiguous in older<br>glTF spec version) of how to combine glTF base and emissive color in<br>case of KHR_materials_unlit (because in X3D, we just have<br>"UnlitMaterial" with "UnlitMaterial,emissiveColor" -- it's simpler),<br>this also allows natural optimizations on the renderer side (unlit can<br>use completely different set of simple shaders).<br><br> So ideally, I see "UnlitMaterial" as X3D-equivalent of<br>"KHR_materials_unlit". If there is a need for UnlitMaterialExtension,<br>I'm curious to know why, and can we avoid it, to keep X3D spec simple<br>:)<br><br>Many thanks for your work. This is great advancement for X3D! I<br>absolutely recommend everyone on this list to click on Holger's links<br>to demos and extensions, we absolutely should look at this<br>functionality as potentially becoming available in other X3D browsers<br>(I will definitely want to implement (subset of it) in Castle Game<br>Engine / Castle Model Viewer) and in future X3D spec versions.<br><br>Best regards,<br>Michalis<br><br><br>wt., 25 cze 2024 o 11:52 Holger Seelig via x3d-public<br><x3d-public@web3d.org> napisał(a):<br><br><br>With the current release v10.0.1, all glTF material extensions are now available, i.e. when a glTF file is parsed, these extensions are automatically converted to X3D. There is now an X3D node for each glTF extension. These nodes can also be referenced directly in X3D files. Extensions for glTF materials are converted to the new X3DMaterialExtensionNode nodes, which can be used as a child of PhysicalMaterial node and the new SpecularGlossinessMaterial node. These material nodes now have a new field »extensions« for this purpose. The introduction of the »extensions« field has only a minimal impact and leads to the greatest possible compatibility.<br><br>To get an idea of what a great difference these new material extensions make, check out our glTF Sample Viewer. Take some time and look through all the examples. I am sure you will be amazed.<br><br>https://create3000.github.io/x_ite/laboratory/gltf-sample-viewer/<br><br>Here are three selected examples, but there are many more:<br><br>https://create3000.github.io/x_ite/laboratory/gltf-sample-viewer/?url=AnisotropyBarnLamp<br>https://create3000.github.io/x_ite/laboratory/gltf-sample-viewer/?url=DragonAttenuation<br>https://create3000.github.io/x_ite/laboratory/gltf-sample-viewer/?url=MosquitoInAmber<br>https://create3000.github.io/x_ite/laboratory/gltf-sample-viewer/?url=ToyCar<br><br>Implemented glTF Extensions:<br><br>All glTF extensions implemented with this version are listed below:<br><br>X3DOneSidedMaterialNode<br><br>* KHR_materials_pbrSpecularGlossiness implemented as SpecularGlossinessMaterial node.<br><br>X3DMaterialExtensionNode<br><br>* KHR_materials_anisotropy implemented as AnisotropyMaterialExtension node.<br>* KHR_materials_clearcoat implemented as ClearcoatMaterialExtension node.<br>* KHR_materials_dispersion implemented as DispersionMaterialExtension node.<br>* KHR_materials_emissive_strength implemented as EmissiveStrengthMaterialExtension node.<br>* KHR_materials_ior implemented as IORMaterialExtension node.<br>* KHR_materials_iridescence implemented as IridescenceMaterialExtension node.<br>* KHR_materials_sheen implemented as SheenMaterialExtension node.<br>* KHR_materials_specular implemented as SpecularMaterialExtension node.<br>* KHR_materials_transmission implemented as TransmissionMaterialExtension node.<br>* KHR_materials_unlit implemented as UnlitMaterialExtension node.<br>* KHR_materials_volume implemented as VolumeMaterialExtension node.<br><br>Switch<br><br>* KHR_materials_variants implemented as Switch node.<br><br>These new nodes are initially available in the X_ITE component and documented here:<br>https://create3000.github.io/x_ite/components/#x_ite<br><br>Make X3D even better!<br>Best regards,<br>Holger<br><br>--<br>Holger Seelig<br>Leipzig, Germany<br><br>holger.seelig@yahoo.de<br>https://create3000.github.io/x_ite/<br><br>_______________________________________________<br>x3d-public mailing list<br>x3d-public@web3d.org<br>http://web3d.org/mailman/listinfo/x3d-public_web3d.org<br><br><br></blockquote></div></div></blockquote></div><br></div></div>_______________________________________________<br>x3d-public mailing list<br>x3d-public@web3d.org<br>http://web3d.org/mailman/listinfo/x3d-public_web3d.org<br></div></blockquote></div><br></div></div></body></html>