[x3d-public] Should Appearance material be an SFNode (current) or MFNode?

John Carlson yottzumm at gmail.com
Tue Apr 27 04:28:42 PDT 2021


I'm seeing more than one XML element under Appearance in other places.   
Anyone care to explain to me and Michalis?  It's different under X3D 
JSON, where you can have a map with the field names prefixed by - or @.  
For example, it's very easy to fit both -material and -backMaterial in I 
believe

On 4/26/21 6:05 AM, Michalis Kamburelis wrote:
> "Shape.appearance" is, always was, and should be, SFNode, IMHO.
>
> I can think of some possible uses of "Shape.appearance" being MFNode
> (fallback materials), but it would be a big complication (both in spec
> and in implementation), not justified IMHO.
>
> Regards,
> Michalis
>
> pt., 16 kwi 2021 o 08:54 John Carlson <yottzumm at gmail.com> napisał(a):
>> Indeed, Appearance material is an SFNode, not an MFNode in X3DV4.   What do you think?
>>
>> On 4/16/21 1:17 AM, John Carlson wrote:
>>
>> Traceback:
>>
>> Found the following error with my ~/x3dschema JSON parse test, done by running `base validate.sh`, results in javaresults.txt, which is filtered (also need to filter "node_modules") here: https://github.com/coderextreme/x3dschema/blob/master/jsonparseresults.txt Cleaned up results here:
>>
>> json-parse json Expected a ':' after a key at 196859 [character 37 line 216] x3d/content/examples/X3dForAdvancedModeling/AudioSpatialSound/SingleAudio.json
>> json-parse json Expected a ':' after a key at 7359 [character 31 line 198] x3d/content/examples/X3dForAdvancedModeling/AudioSpatialSound/SplitChannels.json
>> json-parse json Expected a ':' after a key at 287624 [character 37 line 270] x3d/content/examples/X3dForAdvancedModeling/AudioSpatialSound/SpatialAudioCameraAnimation.json
>>
>>
>> Note that there are two Material objects in SplitChannels.json, so -material should probably be an array.   Will check XML.
>>
>> SplitChannels.x3d excerpt:
>>
>>        <Transform DEF='volumeRight' rotation='1 0 0 -0.5' scale='10 10 10' translation='0 -10 0'>
>>          <Shape>
>>            <Appearance>
>>              <Material diffuseColor='0.345 0.345 0.882' transparency='0'/>
>>              <Material ambientIntensity='0.0933' diffuseColor='1 1 1' emissiveColor='0 0 0' shininess='0.51' specularColor='0.46 0.46 0.46'/>
>>            </Appearance>
>>            <Text solid='false' string='Right Channel Volume'>
>>              <FontStyle family=''Times'' horizontal='true' justify='BEGIN' leftToRight='true' size='1' spacing='1' style='BOLD' topToBottom='true'/>
>>            </Text>
>>          </Shape>
>>        </Transform>
>>
>>
>> The following will show the two Material Appearances in all three .x3d files.
>>
>> x3d/content/examples/X3dForAdvancedModeling/AudioSpatialSound$ egrep 'Appearance|Material' *.x3d
>>
>> Will check for error/warning/development.  An allied file in same folder has a warning, but none in these .x3d files that I can tell.
>>
>> Will check web. https://x3dgraphics.com/examples/X3dForAdvancedModeling/AudioSpatialSound/SplitChannelsIndex.html looks like above.
>>
>>
>> Will check X3DV4 schema:
>>
>> <xs:element name="Appearance">
>>          <xs:annotation>
>>              <xs:appinfo>
>>                  [snip]
>>                  <xs:element name="material" type="SFNode" fixed="inputOutputField" default="X3DMaterialNode"/>
>>
>> I'm reading this that there shouldn't be more that one Material, otherwise, material would be an MFNode.
>>
>> Running the XML files through X3D validator:   All three .x3d files fail
>>
>> Don't forget to validate before checking in.  I'm aware these files are under development. My best guess is we'll have to wait for a new copy of the X3D validator and schema?
>>
>> If we make -material an array, this will be a pretty significant change, basically affecting practically everything.  It's easy for XML, and we haven't defined X3D JSON in a standard, but in the future, I recommend changing SFNode to MFNode with care.
>>
>> jsonlint errors follow:
>>
>> SingleAudio.json
>> Error: Parse error on line 207:
>> ...                    { "Material":
>> -----------------------^
>> Expecting 'STRING', got '{'
>>      at Object.parseError (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:55:11)
>>      at Object.parse (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:132:22)
>>      at parse (/usr/local/lib/node_modules/jsonlint/lib/cli.js:82:14)
>>      at main (/usr/local/lib/node_modules/jsonlint/lib/cli.js:135:14)
>>      at Object.<anonymous> (/usr/local/lib/node_modules/jsonlint/lib/cli.js:179:1)
>>      at Module._compile (internal/modules/cjs/loader.js:1138:30)
>>      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
>>      at Module.load (internal/modules/cjs/loader.js:986:32)
>>      at Function.Module._load (internal/modules/cjs/loader.js:879:14)
>>      at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
>> SpatialAudioCameraAnimation.json
>> Error: Parse error on line 261:
>> ...                    { "Material":
>> -----------------------^
>> Expecting 'STRING', got '{'
>>      at Object.parseError (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:55:11)
>>      at Object.parse (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:132:22)
>>      at parse (/usr/local/lib/node_modules/jsonlint/lib/cli.js:82:14)
>>      at main (/usr/local/lib/node_modules/jsonlint/lib/cli.js:135:14)
>>      at Object.<anonymous> (/usr/local/lib/node_modules/jsonlint/lib/cli.js:179:1)
>>      at Module._compile (internal/modules/cjs/loader.js:1138:30)
>>      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
>>      at Module.load (internal/modules/cjs/loader.js:986:32)
>>      at Function.Module._load (internal/modules/cjs/loader.js:879:14)
>>      at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
>> SplitChannels.json
>> Error: Parse error on line 189:
>> ...                    { "Material":
>> -----------------------^
>> Expecting 'STRING', got '{'
>>      at Object.parseError (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:55:11)
>>      at Object.parse (/usr/local/lib/node_modules/jsonlint/lib/jsonlint.js:132:22)
>>      at parse (/usr/local/lib/node_modules/jsonlint/lib/cli.js:82:14)
>>      at main (/usr/local/lib/node_modules/jsonlint/lib/cli.js:135:14)
>>      at Object.<anonymous> (/usr/local/lib/node_modules/jsonlint/lib/cli.js:179:1)
>>      at Module._compile (internal/modules/cjs/loader.js:1138:30)
>>      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
>>      at Module.load (internal/modules/cjs/loader.js:986:32)
>>      at Function.Module._load (internal/modules/cjs/loader.js:879:14)
>>      at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
>>
>> _______________________________________________
>> x3d-public mailing list
>> x3d-public at web3d.org
>> http://web3d.org/mailman/listinfo/x3d-public_web3d.org



More information about the x3d-public mailing list