[x3d-public] Tessellation…convert to IFS?

Holger Seelig holger.seelig at yahoo.de
Mon Apr 24 02:46:48 PDT 2023


It's fine to convert a primitive like a box, sphere or cone to an IndexedFaceSet, but there are some caveats: because an IndexedFaceSet is the Swiss army knife of geometry nodes, it's a bit slow at generating a drawable form of its geometry, because all polygons in the set have to be triangulated first.

But there are other nodes that can be built faster. The best would be to use a TriangleSet or an IndexedTriangeSet. These nodes can be built much faster.

Holger Seelig
Leipzig, Germany

holger.seelig at yahoo.de
https://create3000.github.io/x_ite/





> Am 24.04.2023 um 01:58 schrieb Joseph D Williams <joedwil at earthlink.net>:
> 
> Next, If I have Transform scale 2 2 2 Shape Box defaults then the browser will multiply each point coordinate of the box by 2 2 2 and draw those points. Again, the Box points will not appear in the user code and it would be the same as Transform defaults Shape Box 2. If you had Transform translation 2 2 2 Shape Box defaults then the browser would move each box point 2 2 2 and draw them. 
>  
> All this happens when the user draws a shape somewhere in some coordinate space then actually wants it drawn in another coordinate space. 
> For instance Transform translation 5 3 2 scale 0.2 0.2 0.2 Shape IFS geometry drawn to a scale 40 times the target coordinate space and needs to get moved to appear in the correct location of the target coordinate space for viewing. 
> Now the coordinates of the points get scaled and then moved. If the browser does it right it is the same as if the points had been drawn directly in the target space. 
>  
> Thanks, 
> Joe
>  
>  
> From: Joseph D Williams <mailto:joedwil at earthlink.net>
> Sent: Sunday, April 23, 2023 4:18 PM
> To: John Carlson <mailto:yottzumm at gmail.com>
> Cc: X3D Graphics public mailing list <mailto:x3d-public at web3d.org>
> Subject: Re: [x3d-public] Tessellation…convert to IFS?
>  
> Understood, Joe! 
>  
> Fine. Are you sure you see how we drew that part of a box? The coordinates of the points and how to make triangles?
>  
> There is a default 0 0 0 for the root scene. You are not really supposed to draw in this space but recommended to have a Group or Transform to hold geometry. If I say Transform defaults, Shape Box defaults then I get a box 1x1x1 centered at 0 0 0 in ancestor space so the thing should be hanging there around the middle of the scene. For other standard shapes, when the user asks for a cone, he will expect standard cone, but a cone that is not carefully specced out but will probably consist of about what 20 to 50 points. If the user wants more detail or less points then it is fairly easy diyofs in basic IFS user code. 
>  
> Thanks, 
> Joe
>  
>  
> From: John Carlson <mailto:yottzumm at gmail.com>
> Sent: Saturday, April 22, 2023 6:35 PM
> To: Joseph D Williams <mailto:joedwil at earthlink.net>
> Cc: GPU Group <mailto:gpugroup at gmail.com>; X3D Graphics public mailing list <mailto:x3d-public at web3d.org>
> Subject: Re: [x3d-public] Tessellation…convert to IFS?
>  
> Understood, Joe!  My issue is what do we do with sphere coordinates when transforms are multiplied out and deleted?   It would seem natural to replace non-coordinate shapes with some kind of shape set, whether indexed or not (X3D JSON to STL code does this). Especially something where triangles must share edges.  So yes, in the case of Sphere, Box and other non-coordinate shapes, the user code should change.
>  
> I think the solution may be to retain lowest level transforms in the scene in order to maintain shapes like spheres, cones, cylinders, etc.  in user code.   Then, do we need to apply the transforms to geometry?
>  
> Joe,  it seems like you’re leaning towards changing the shape user code to sets?  This is getting  more and more like X3D JSON to STL, we just need to support different output formats and additional shapes.  Should we translate to glTF instead of STL?
>  
> Doug, this is primarily to produce a standardized human model.
>  
> John
>  
> On Sat, Apr 22, 2023 at 7:03 PM Joseph D Williams <joedwil at earthlink.net <mailto:joedwil at earthlink.net>> wrote:
>  
>  
> Also note there are several ways to represent a shape in x3d. If the name includes Indexed then the user code includes the coordinates for the points and the sets of coordindex numbers that tell the browser how to make the triangles. 
> Some styles of shapes do not require the user to supply coordIndex, then the points are default auto-indexed into triangles by a standardized  formula depending on name and included user code for points. 
>  
> So, when you say shape Sphere then the browser encodes that depending on its internal spec sphere. 
> You can see the result in a browser that can just show the points or triangles of the shape sphere otherwise it will appear as a solid but the details of the actual coordinates of points and tessellation (indexing) of those points will not appear in the user code because what does the user care about what the browser uses to create your Sphere? . 
>  
> So, for the default shape Box, probably uses two triangles per side. 
> I think there is x3d Shape user code to present a box in both indexed and auto-indexed form. 
>  
> Here is classic-style user code with lots of defaults for one side of a box. 
>  
> DEF boxfront Shape {
>   appearance Appearance {
>     material Material { }
>     texture ImageTexture {
>       url [ "textures/boxfront.jpg" ]
>     }
>   }
>   geometry IndexedFaceSet {
>     coordIndex [ 0 1 2 3 -1 ]
>     coord Coordinate {
>       point [ -1 -1 1, 1 -1 1, 1 1 1, -1 1 1 ]
>     }
>     texCoordIndex [ 0 1 2 3 -1 ]
>     texCoord TextureCoordinate {
>       point [ 0 0 1 0 1 1 0 1 ]
>     }
>   }
> }
>  
> Joe
>  
>  
> From: GPU Group <mailto:gpugroup at gmail.com>
> Sent: Saturday, April 22, 2023 2:33 PM
> To: John Carlson <mailto:yottzumm at gmail.com>
> Cc: X3D Graphics public mailing list <mailto:x3d-public at web3d.org>
> Subject: Re: [x3d-public] Tessellation…convert to IFS?
>  
> Depends what you're doing. Assuming you're starting with a point cloud, if you're tessellating something almost flat, and with irregular points, then you can use something like Delaunay algorithm to optimize the edges between points to give triangles that are more equi-angular.
> If you are on a 3D dimensional surface, but know its close to being convex -- like a sphere or cube -- then you can move the planar math around a spherical center, and crop points in the distance / on the other side of center when triangulating. 
> Or you can remove and add points from a pre-triangulated sphere (I just made this up). Looking orthogonally at an existing triangle on your sphere, add a point from your point cloud, to the appropriate triangle, based on its yaw and pitch, or latitude, longitude, while ignoring its radius/height. When you have all your points added, then start removing the sphere's points. After each step of adding (or removing sphere points at the end), do Delaunay recursive triangle swaps on the local plane. 
> Or ask ChatGPT - it might know.
> -Doug
>  
> On Sat, Apr 22, 2023 at 3:05 PM John Carlson <yottzumm at gmail.com <mailto:yottzumm at gmail.com>> wrote:
> When one is tessellating a shape, like Box, is it typical to convert to IFS?
>  
> Thanks!
>  
> John
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org <mailto:x3d-public at web3d.org>
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>  
>  
>  
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org <mailto:x3d-public at web3d.org>
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20230424/43302996/attachment-0001.html>


More information about the x3d-public mailing list