View Issue Details

IDProjectCategoryView StatusLast Update
0002222FreeCADBugpublic2015-12-15 13:17
ReporterhyOzd Assigned Towmayer  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformLinuxOSUbuntu 15.04 
Fixed in Version0.16 
Summary0002222: Number of normals in exported VRML is wrong
DescriptionWhen I export a simple Box shape created with Part workbench to VRML, exported file has some problems. I've noticed the problem with view3dscene program. Shape is not shaded correctly by view3dscene and these warnings are displayed;

VRML/X3D: Invalid number of items in a normal or texture array of shape "IndexedFaceSet": not enough items: 24, but at least 32 required.

This problem happens with all solid primitives of Part workbench. But doesn't happen with some other shape types. For example fusion is exported fine.

I've investigated the exported file myself and indeed there are 32 vertices but only 24 normals are defined.

I'm using latest freecad build, 0.16 5351 git.
Steps To Reproduce1. Create a new document
2. Switch to Part Workbench
3. Create a box shape
4. Select the box shape
5. Export to VRML using menu File->Export
6. Open the exported file using view3dscene viewer
Additional InformationRemoving Normals node from the VRML file hand seems to solve the problem.
TagsNo tags attached.
FreeCAD Information

Activities

hyOzd

2015-08-19 18:02

reporter  

broken.wrl (Attachment missing)

hyOzd

2015-08-19 18:02

reporter  

broken_0.png (Attachment missing)

wmayer

2015-09-14 11:15

administrator   ~0006416

I can confirm that the VRML file has 24 normals but this is actually correct. The cube has only sharp edges which means that the normals are for the four corners of the six faces (4*6=24). This means that each vertex has three associated normals to get the sharp edges.

Now, the transition from Inventor nodes to VRML nodes may lose some information which may cause the rendering artefacts. However, it's also possible that 'view3dscene' just doesn't support this situation very well because Coin3d does the rendering correctly.

hyOzd

2015-09-14 11:34

reporter   ~0006417

After your comment, I've checked the file again. I think there are no missing normals but 'extra coordinate points'.

If you look at the "DEF _+1 Coordinate{}" from line 38, it contains 32 coordinate points. But these points are not used for either IndexedLineSet or IndexedFaceSet. I've removed 8 points from the end of coordinate list. In this case view3dscene rendered the file correctly and gave no warnings.

But on the other hand, these 'extra' points are actually used by "PointSet" at line 151. So they may not be unnecessary or extra.

wmayer

2015-09-14 12:09

administrator   ~0006418

It looks like there are too many points but this is actually OK. A part shape has an SoBrepPointSet, an SoBrepLineSet and an SoBrepFaceSet. All of them share the same SoCoordinate3 node but they use the coordIndex attribute to reference the actual points they render.

So, for the example of the box we have this situation:
* there are 8 vertexes => 8 points
* the edges append all their points to the list => 12 edges => 12*2 = 24 points
* the faces share all of the points of the edges and have no extra points => 0

In total we have 8 + 12*2 = 32 points. And since we use index-based shape nodes this works all fine.

So, I'm still not sure if the transition to VRML doesn't handle this special case or if 'view3dscene' doesn't support this.

Anyway, a workaround is to tmp. set the normal binding to 'overall' so that the VRML file doesn't include the normals.

Related Changesets

FreeCAD: master c135ca40

2015-09-14 14:45:34

wmayer

Details Diff
+ fixes 0002222: Number of normals in exported VRML is wrong Affected Issues
0002222
mod - src/Gui/SoFCDB.cpp Diff File
mod - src/Gui/SoFCUnifiedSelection.cpp Diff File
mod - src/Gui/SoFCUnifiedSelection.h Diff File

Issue History

Date Modified Username Field Change
2015-08-19 18:02 hyOzd New Issue
2015-08-19 18:02 hyOzd File Added: broken.wrl
2015-08-19 18:02 hyOzd File Added: broken_0.png
2015-09-13 23:06 wmayer Status new => confirmed
2015-09-14 11:15 wmayer Note Added: 0006416
2015-09-14 11:34 hyOzd Note Added: 0006417
2015-09-14 12:09 wmayer Note Added: 0006418
2015-09-14 12:45 wmayer Changeset attached => FreeCAD Master master c135ca40
2015-09-14 12:45 wmayer Assigned To => wmayer
2015-09-14 12:45 wmayer Status confirmed => closed
2015-09-14 12:45 wmayer Resolution open => fixed
2015-12-15 13:17 yorik Fixed in Version => 0.16