<div dir="auto">I don't know as the shader should follow the X3DOM/x_ite path or the BS contact path.   Certainly BS Contact looks a bit better.<div dir="auto"><br></div><div dir="auto">John</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, May 22, 2018, 1:54 PM Andreas Plesch <<a href="mailto:andreasplesch@gmail.com">andreasplesch@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It looks like the simpleShader scene was just updated to use light<br>
direction rather than light location:<br>
<br>
<a href="http://www.web3d.org/x3d/content/examples/Basic/Shaders/SimpleShaderIndex.html" rel="noreferrer noreferrer" target="_blank">http://www.web3d.org/x3d/content/examples/Basic/Shaders/SimpleShaderIndex.html</a><br>
(The CDATA does not show but should in the xml:<br>
<a href="http://www.web3d.org/x3d/content/examples/Basic/Shaders/SimpleShaderCanonical.xml" rel="noreferrer noreferrer" target="_blank">http://www.web3d.org/x3d/content/examples/Basic/Shaders/SimpleShaderCanonical.xml</a><br>
)<br>
<br>
So I updated the x3dom port accordingly:<br>
<a href="https://rawgit.com/andreasplesch/x3dom/inlineShader/test/regression-suite/test/cases/composedShader/inlineShader.xhtml" rel="noreferrer noreferrer" target="_blank">https://rawgit.com/andreasplesch/x3dom/inlineShader/test/regression-suite/test/cases/composedShader/inlineShader.xhtml</a><br>
<br>
It is more sensible to use direction since the headlight is a directional light.<br>
<br>
In x3dom it was necessary to invert the light direction, and the<br>
center ring is broader.<br>
<br>
BTW: x_cite produces this helpful warning on<br>
<a href="http://www.web3d.org/x3d/content/examples/Basic/Shaders/SimpleShaderIndex.html" rel="noreferrer noreferrer" target="_blank">http://www.web3d.org/x3d/content/examples/Basic/Shaders/SimpleShaderIndex.html</a>:<br>
<br>
x_ite.min.js:15 ComposedShader Cobweb Using uniform location name<br>
»x3d_LightDirection[0]« is depreciated. See<br>
<a href="http://create3000.de/x_ite/custom-shaders/" rel="noreferrer noreferrer" target="_blank">http://create3000.de/x_ite/custom-shaders/</a>.<br>
<br>
One is supposed to use vec3(x3d_LightSource[0].direction) where<br>
uniform x3d_LightSourceParameters x3d_LightSource[8] .<br>
as in:<br>
vec3 light_dir = x3d_LightSource[0].direction;<br>
intensity = dot (-light_dir, n);<br>
Hm, I just found that with the new uniform, it is also necessary to<br>
invert the direction in x_ite.<br>
<br>
-Andreas<br>
<br>
On Tue, May 22, 2018 at 12:57 PM, Andreas Plesch<br>
<<a href="mailto:andreasplesch@gmail.com" target="_blank" rel="noreferrer">andreasplesch@gmail.com</a>> wrote:<br>
>> Date: Tue, 22 May 2018 00:52:54 -0400<br>
>> From: John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank" rel="noreferrer">yottzumm@gmail.com</a>><br>
>> To: Don Brutzman <<a href="mailto:brutzman@nps.edu" target="_blank" rel="noreferrer">brutzman@nps.edu</a>>,  X3D Graphics public mailing list<br>
>>         <<a href="mailto:x3d-public@web3d.org" target="_blank" rel="noreferrer">x3d-public@web3d.org</a>><br>
>> Subject: [x3d-public] CDATA sections don't show up on this X3D<br>
>>         Resources Example, Basic Shaders, that  I can see in the decorated X3D<br>
>> Message-ID: <<a href="mailto:5b03a226.1c69fb81.c965e.d3da@mx.google.com" target="_blank" rel="noreferrer">5b03a226.1c69fb81.c965e.d3da@mx.google.com</a>><br>
>> Content-Type: text/plain; charset="utf-8"<br>
>><br>
>> I haven?t tried copy/paste.<br>
>><br>
>> <a href="http://www.web3d.org/x3d/content/examples/Basic/Shaders/SimpleShaderIndex.html" rel="noreferrer noreferrer" target="_blank">http://www.web3d.org/x3d/content/examples/Basic/Shaders/SimpleShaderIndex.html</a><br>
>><br>
>> This is on the web page itself.<br>
>><br>
>> Also X_ITE is drastically different from something like BS Contact for example.<br>
>><br>
>> We need more ports. FreeWRL? X3DOM (maybe put a switch in for the Proto?).<br>
><br>
> Here is John's port to x3dom:<br>
> <a href="https://rawgit.com/andreasplesch/x3dom/inlineShader/test/regression-suite/test/cases/composedShader/inlineShader.xhtml" rel="noreferrer noreferrer" target="_blank">https://rawgit.com/andreasplesch/x3dom/inlineShader/test/regression-suite/test/cases/composedShader/inlineShader.xhtml</a><br>
> . It is a literal port and it is unclear if it results in the expected<br>
> rendering.<br>
><br>
> I believe the main difference between browsers is in the naming of the<br>
> uniforms supplied to the shader code. I think there was a discussion<br>
> on the list about these naming conventions.<br>
><br>
> Another source of incompatibility in shaders is the choice of shading<br>
> language. Even within the glsl language, probably the dominant<br>
> language, there are different versions.<br>
><br>
> A large step towards compatibility would therefore be requiring the<br>
> restricted subset of glsl GLSL ES v3 (for composed custom shaders) as<br>
> the single glsl version:<br>
><br>
> <a href="https://www.khronos.org/registry/OpenGL/specs/es/3.0/GLSL_ES_Specification_3.00.pdf" rel="noreferrer noreferrer" target="_blank">https://www.khronos.org/registry/OpenGL/specs/es/3.0/GLSL_ES_Specification_3.00.pdf</a><br>
><br>
> This had the additional benefit that shaders would be largely<br>
> compatible with webgl2.<br>
><br>
> Another potential source of incompatibility in the example is in the<br>
> definition of what data uniforms should supply, independent from the<br>
> naming. It looks like some browsers may supply the direction and<br>
> location of lights in object space, others in eye space (already<br>
> transformed by the view matrix). Eye space seems to be what gl<br>
> traditionally supplies for lights.<br>
><br>
> -Andreas<br>
<br>
<br>
<br>
-- <br>
Andreas Plesch<br>
Waltham, MA 02453<br>
<br>
_______________________________________________<br>
x3d-public mailing list<br>
<a href="mailto:x3d-public@web3d.org" target="_blank" rel="noreferrer">x3d-public@web3d.org</a><br>
<a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" rel="noreferrer noreferrer" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a><br>
</blockquote></div>