[x3d-public] Updated SimpleShader.x3d example

Michalis Kamburelis michalis.kambi at gmail.com
Mon Apr 24 10:25:47 PDT 2017


2017-04-24 18:55 GMT+02:00 Don Brutzman <brutzman at nps.edu>:
>> The example will now work with Cobweb. As the Appeareance »shaders« field
>> can hold multiple shaders I added a second ComposedShader after the existing
>> one for Cobweb.
>>
>>  >
>> http://www.web3d.org/x3d/content/examples/Basic/Shaders/SimpleShaderIndex.html
>>  [...]> Am 18.04.2017 um 11:35 schrieb yottzumm at gmail.com:
>>>
>>> [...]
>>>
>>> I don’t think this Cobweb version is working on the X3D examples website:
>>>
>>>
>>> http://www.web3d.org/x3d/content/examples/Basic/Shaders/SimpleShaderIndex.html
>>>
>>> I think it may have something to do with some gl_ shader variables not
>>> being available.  Try replacing with x3d_ for cobweb, and declaring them
>>> in the shader (I don’t think it will work otherwise, but I could be
>>> wrong).  You will probably have to provide modified shader code in
>>> addition to the normal glsl shader.  If providing an alternate URL for
>>> cobweb will work, I would do it—I am unsure what would happen.  We may
>>> have to provide an alternate URL for each X3D vendor.  Sigh!
>
>
> Thanks for the improvements gentlemen.  I've tuned this up a bit further
> (naming conventions, c14n canonicalization) and checked it in.
>
> Also "quoted" some of the MFString entries, where more than one string value
> was present, but we likely have more work to do there.  Not yet runnable by
> me.
>

Hm, are you sure that SimpleShader.x3d is correct?

1. I thought that the CDATA should only occur once, and hold the
actual shader code *contents*. It should not sometimes contain URLs
(toon.vs, http://www.web3d.org/x3d/content/examples/Basic/Shaders/toon.vs)
and sometimes the shader content. If you have URLs, you should place
them in the "url" field of the ShaderPart. The CDATA is read as a
"last resort", if no URL is suitable. I remember reading about it in
the spec, although I can't find it now.

2. I don't think that surrounding the CDATA parts in " " is correct
either. In CDATA, you just place the contents.

3. It uses # as 1-line comments in GLSL, which doesn't work. In GLSL,
use // for comments.

I'm attaching a fixed version that runs in view3dscene, and I think is
correct X3D, so should work in other browsers too.

Note that the GLSL was not changed, this was compatible.

Regards,
Michalis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SimpleShader.x3d
Type: application/vnd.hzn-3d-crossword
Size: 6376 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20170424/78057222/attachment.x3d>


More information about the x3d-public mailing list