castle-engine / castle-model-viewer

Viewer for many 3D and 2D model formats: glTF, X3D, VRML, Collada, 3DS, MD3, Wavefront OBJ, STL, Spine JSON, sprite sheets in Cocos2D and Starling XML formats

Home Page:https://castle-engine.io/castle-model-viewer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Data issue identified by CGE, hundred of similar error reports in Castle Model Viewer

coderextreme opened this issue · comments

You've probably seen this before. This example has data errors as reported by CGE and Castle Model Viewer 5.0 release (CMV). My only complaint is that there's literally hundreds of errors as the animation plays in CMV (fortunately just one in CGE, with my drag and drop program--no animation). Help! I'm not sure you need to do anything about this. Close as a data issue is probably your best bet. The errors have been reported to responsible parties.

Here are the errors from CMV (some of them):

JoeKick.zip


X3D: Invalid number of items in an attribute array for shape "Joe_Humanoid/Joe_Kick/Joe_Shape/IndexedFaceSet(Joe_skin_IndexedFaceSet)": Invalid index: 9, but we have 4 items in 2D texture coordinates
X3D: Invalid number of items in an attribute array for shape "Joe_Humanoid/Joe_Kick/Joe_Shape/IndexedFaceSet(Joe_skin_IndexedFaceSet)": Invalid index: 9, but we have 4 items in 2D texture coordinates
X3D: Invalid number of items in an attribute array for shape "Joe_Humanoid/Joe_Kick/Joe_Shape/IndexedFaceSet(Joe_skin_IndexedFaceSet)": Invalid index: 9, but we have 4 items in 2D texture coordinates
X3D: Invalid number of items in an attribute array for shape "Joe_Humanoid/Joe_Kick/Joe_Shape/IndexedFaceSet(Joe_skin_IndexedFaceSet)": Invalid index: 9, but we have 4 items in 2D texture coordinates
X3D: Invalid number of items in an attribute array for shape "Joe_Humanoid/Joe_Kick/Joe_Shape/IndexedFaceSet(Joe_skin_IndexedFaceSet)": Invalid index: 9, but we have 4 items in 2D texture coordinates
X3D: Invalid number of items in an attribute array for shape "Joe_Humanoid/Joe_Kick/Joe_Shape/IndexedFaceSet(Joe_skin_IndexedFaceSet)": Invalid index: 9, but we have 4 items in 2D texture coordinates
[snip]
Scene URL: "JoeKick.x3d".
Use "File->View Warnings" menu to view these warnings again.```

The model is invalid, and it should fail in X3D browsers (because it is undefined what author wants, and trying to "guess" what the author wants in this case would be bad -- various authors could want different things).

This specific model has been discussed a number of times on x3d-public mailing list. See e.g. "HAnim sample failing in X3DOM, error in view3dscene, additional tests". It's an obvious error, castle-model-viewer message is right (BTW, please don't shorten it to CMV, I'm afraid people will not know what it means). It's not easy for us to make this message less often, due to the fact that these things may change each frame.

The model has 4 texture coordinates (8 floats below):

<TextureCoordinate point='0 0 0.5 0.5 0.5 0 0 0.5'/>

but this array is accessed using coordIndex (since there's no texCoordIndex) which has values outside of 0..3 range:

<IndexedFaceSet DEF='Joe_skin_IndexedFaceSet' coordIndex='0 9 5 -1 0 7 9 -1 0 5 1 
...

The author should fix the model. How? It depends on what the author wants. Applying a texture means you need to tell what texture coordinate should be used to display each vertex. I don't know how the author wanted to map this texture.