[X3D-Public] Does anyone export per-vertex normals?

Keith keithrvictor at gmail.com
Sat Feb 12 12:35:38 PST 2011


Hey:

As for tools;  Vivaty studio will let you convert any mesh to an indexedTriangleSet. That will generate the normals using the cease angle. The export will then contain all your normals, and other per vertex attributes using a single index array. ( that's the format that gets pushed to hardware ). 

If you want to see the algorithm, I'd suggest looking at the indexedfaceset class in the open source flux player code, or any other open source player. 

It's a pretty hairy algorithm. You first generate the normals for each coordindex element using the crease angle. ( like Michalis says ). Then consolidate the vertex normals that are are identical.  Or, if you're looking to send the data to the hardware, consolidate verts when all per vertex per face attributes are identical. Then, you end up with that indexedTriangleSet. 

Keith Victor

Sent from my iPhone

On Feb 11, 2011, at 3:10 PM, Michalis Kamburelis <michalis.kambi at gmail.com> wrote:

> Dave A wrote:
>> If only a crease angle is given, I should, at each vertex, find the
>> angle between faces, and if greater than crease, create a 'smooth'
>> normals based on surrounding faces. If less (flat), create a NEW mesh,
>> removing that face from the rest, and for each of its vertices, set the
>> normals same as the face's normal. If flat shaded, might as well create
>> a separate mesh for each face, with such normals.
> 
> Like Sergey says, creating another mesh sounds excessive. Also, the fact
> that a face has a sharp angle at one vertex, doesn't mean that all it's
> normals are flat. It may be smooth at other vertexes.
> 
> When handling creaseAngle, you just want to create as many normals as
> there are coordIndex items (well, ignoring the -1 inside coordIndex).
> This allows you to set appropriate normal for each occurrence of a
> vertex. Nothing more should be needed. (You may also consider optimized
> implementations for creaseAngle = 0 and creaseAngle >= pi cases, this is
> what I have in my engine.)
> 
> Michalis
> 
> _______________________________________________
> 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