Re: [osg-users] VRML Normal Issue

2009-03-27 Thread Jan Ciger
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ben Axelrod wrote:
> I think we are agreeing with each other.

Yes, I think so.

> 
> I agree the simplest thing for a user is to specify normals in the
> file for the best control over shading.  And I agree that in order to
> support the crease angle property, we will have to duplicate
> vertices.  Despite the crease angle being a "kludge", I do think that
> it should be implemented.  That is why I submitted the code, in case
> anyone wanted to implement the crease angle, I think that would be
> how to do it.

OK, great - I didn't see your submission. Unfortunately I do not have as
much time to develop and maintain this code as I would like, so I do
appreciate people contributing to it and keeping this code alive.

> Before, you said that duplicating vertices would lead to artifacts.
> Can you elaborate on this?  I don't see how it would when we are in
> the sharp edge case, and we give it a proper normal, and point the
> proper face index at the new vertex.

It was off-the-cuff remark, but I can imagine issues with z-fighting for
small crease angles. It increases the amount of data needed to be
transferred to the GPU as well.

Regards,

Jan


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFJzT91n11XseNj94gRAq4wAKDCpOcyHBWpqQVsyURuxaM9wJtaDwCg8qmU
2i5zzecjdCNmMe+C6D7r1lQ=
=oLOR
-END PGP SIGNATURE-
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] VRML Normal Issue

2009-03-27 Thread Ben Axelrod
I think we are agreeing with each other.

I agree the simplest thing for a user is to specify normals in the file for the 
best control over shading.  And I agree that in order to support the crease 
angle property, we will have to duplicate vertices.  Despite the crease angle 
being a "kludge", I do think that it should be implemented.  That is why I 
submitted the code, in case anyone wanted to implement the crease angle, I 
think that would be how to do it.

Before, you said that duplicating vertices would lead to artifacts.  Can you 
elaborate on this?  I don't see how it would when we are in the sharp edge 
case, and we give it a proper normal, and point the proper face index at the 
new vertex.

Thanks,
-Ben

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Jan Ciger
Sent: Thursday, March 26, 2009 5:07 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] VRML Normal Issue

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ben Axelrod wrote:

> Can normals per primitive and normals per vertex both be used in a
> single shape?

Not that I am aware of.

>
> If not, the only way I can imagine having a shape with some smooth
> and some sharp edges is if there is one normal per vertex per face.
> Just like the diagram in the VRML spec shows, if a vertex has 2 faces
> connected to it, it needs 2 normals for a sharp edge, and either 1 or
> 2 for a smooth edge.

That's right, however, if you do not specify the vertex normals
explicitly in the model, the vertex normals are calculated from the
*face normals* using the crease angle. If the face normals have an angle
smaller than the crease angle, the vertex normals will be an average of
the two face normals. For sharp edges you will indeed have to duplicate
the vertices to accommodate the different face normals (as explained
here: http://www.songho.ca/opengl/gl_vertexarray.html)

On the other hand, if you want only sharp edges, you can bind normals
per face and save yourself this whole escapade.

Honestly, it is simpler to export the vertex normals from whatever tool
you are using to produce the data than to fidget with the crease angle -
it is only a kludge to let the program guess the model author's intentions.

Regards,

Jan
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFJy+5tn11XseNj94gRAvHGAKCZxOcaPU9FnL73O06533yTtpSalwCg6GFc
Kz6Y4w31hZgcHRjbDyna/jY=
=dKWV
-END PGP SIGNATURE-
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] VRML Normal Issue

2009-03-26 Thread Jan Ciger
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ben Axelrod wrote:

> Can normals per primitive and normals per vertex both be used in a
> single shape?

Not that I am aware of.

> 
> If not, the only way I can imagine having a shape with some smooth
> and some sharp edges is if there is one normal per vertex per face.
> Just like the diagram in the VRML spec shows, if a vertex has 2 faces
> connected to it, it needs 2 normals for a sharp edge, and either 1 or
> 2 for a smooth edge.

That's right, however, if you do not specify the vertex normals
explicitly in the model, the vertex normals are calculated from the
*face normals* using the crease angle. If the face normals have an angle
smaller than the crease angle, the vertex normals will be an average of
the two face normals. For sharp edges you will indeed have to duplicate
the vertices to accommodate the different face normals (as explained
here: http://www.songho.ca/opengl/gl_vertexarray.html)

On the other hand, if you want only sharp edges, you can bind normals
per face and save yourself this whole escapade.

Honestly, it is simpler to export the vertex normals from whatever tool
you are using to produce the data than to fidget with the crease angle -
it is only a kludge to let the program guess the model author's intentions.

Regards,

Jan
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFJy+5tn11XseNj94gRAvHGAKCZxOcaPU9FnL73O06533yTtpSalwCg6GFc
Kz6Y4w31hZgcHRjbDyna/jY=
=dKWV
-END PGP SIGNATURE-
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] VRML Normal Issue

2009-03-26 Thread Ben Axelrod
But normals per primitive or per vertex are 'global' for the entire shape.  
Aren't they?  The crease angle is a 'local' feature so that you can have a 
shape with some smooth and some sharp edges.

Can normals per primitive and normals per vertex both be used in a single shape?

If not, the only way I can imagine having a shape with some smooth and some 
sharp edges is if there is one normal per vertex per face.  Just like the 
diagram in the VRML spec shows, if a vertex has 2 faces connected to it, it 
needs 2 normals for a sharp edge, and either 1 or 2 for a smooth edge.

-Ben

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Jan Ciger
Sent: Thursday, March 26, 2009 9:08 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] VRML Normal Issue

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

Ben Axelrod wrote:
> Thanks for the info.
>
> I took a look at the code.  Adding crease angle support does seem
> tricky since I think we would have to create new vertex points on the
>  fly to accommodate 2 or more different normal vectors at that point.
>  Here is some off the cuff pseudo code.
>


I do not see why you would want to do that. Just set the normal binding
to be per primitive/face and not per vertex if you want to have sharp
edges and define face normals.

Otherwise, if the corners/edges are to be smoothed, you use normal
binding per vertex and calculate normal as an average of the face
normals of the faces adjacent to the vertex.

There is no need to duplicate any vertices - in fact, that would only
give you artifacts.

Regards,

Jan

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFJy34Vn11XseNj94gRAlKlAJ49ebboolwzo75PcdLNog6W5y5vtgCggSZC
2e+pdTpYqi/E3IcYBd6wj1E=
=+rJG
-END PGP SIGNATURE-
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] VRML Normal Issue

2009-03-26 Thread Jan Ciger
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

Ben Axelrod wrote:
> Thanks for the info.
> 
> I took a look at the code.  Adding crease angle support does seem 
> tricky since I think we would have to create new vertex points on the
>  fly to accommodate 2 or more different normal vectors at that point.
>  Here is some off the cuff pseudo code.
> 


I do not see why you would want to do that. Just set the normal binding
to be per primitive/face and not per vertex if you want to have sharp
edges and define face normals.

Otherwise, if the corners/edges are to be smoothed, you use normal
binding per vertex and calculate normal as an average of the face
normals of the faces adjacent to the vertex.

There is no need to duplicate any vertices - in fact, that would only
give you artifacts.

Regards,

Jan

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFJy34Vn11XseNj94gRAlKlAJ49ebboolwzo75PcdLNog6W5y5vtgCggSZC
2e+pdTpYqi/E3IcYBd6wj1E=
=+rJG
-END PGP SIGNATURE-
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] VRML Normal Issue

2009-03-25 Thread Ben Axelrod
Thanks for the info.

I took a look at the code.  Adding crease angle support does seem tricky since 
I think we would have to create new vertex points on the fly to accommodate 2 
or more different normal vectors at that point.  Here is some off the cuff 
pseudo code.

for (int i = 0; i != *it; ++i) // line 268 of IndexedFaceSet.cpp
{
float angle = acos((*normals)[indices[index + i]] * normal);

if (angle <= creaseAngle)
{
(*normals)[indices[index + i]] += normal;
}
else
{
// clone this vertex so we can give it 2 normals
coords.push_back(coords[indices[index + i]]);

// give it the new normal
normals.push_back(normal)

// now point this face at the new vertex
indices[index + i] = coords.size() - 1;
}
}

I am not sure if modifying the vertex and normal array on the fly is wise, 
possible, or even if that is how it's done.  But like I said, it is pseudo code.

What do you think?
-Ben


-Original Message-
From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Jan Ciger
Sent: Wednesday, March 25, 2009 4:43 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] VRML Normal Issue

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ben Axelrod wrote:
> Just to clarify, the way the normals *should* work is sketched in the
> attached image.  Please verify.
>
> When the angle between 2 faces is sharper than the crease angle,
> there is one normal per face, and when the angle is smoother than the
> crease angle, the normal is averaged.

Correct - what I had in mind was the angle between the normals, not the
faces. The end result would be the same, but this is how the VRML spec
specifies it and it is easier to calculate:

> The creaseAngle field, used by the ElevationGrid, Extrusion, and
> IndexedFaceSet nodes, affects how default normals are generated. If
> the angle between the geometric normals of two adjacent faces is less
> than the crease angle, normals shall be calculated so that the faces
> are smooth-shaded across the edge; otherwise, normals shall be
> calculated so that a lighting discontinuity across the edge is
> produced. For example, a crease angle of .5 radians means that an
> edge between two adjacent polygonal faces will be smooth shaded if
> the geometric normals of the two faces form an angle that is less
> than .5 radians. Otherwise, the faces will appear faceted. Crease
> angles must be greater than or equal to 0.0.

(from:
http://accad.osu.edu/~pgerstma/class/vnv/resources/info/AnnotatedVrmlRef/ch2-26.htm)

However, as I said - right now the loader will average *always*,
regardless of the crease angle. This is even documented in the code:

IndexedFaceSet.cpp, line 241:
> // GvdB: So I ended up computing the smoothing normals myself. Also,
> I might add support for "creaseAngle" if a big need for it rises. //
> However, for now I can perfectly live with the fact that all edges
> are smoothed despite the use of a crease angle.

Regards,

Jan



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFJypdon11XseNj94gRAkaaAKDfByiriOZH8ntvtFI6hYbA/7VW2QCfX1nX
Bpzs2QlM9aiHrkhk40HJt64=
=KjWi
-END PGP SIGNATURE-
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] VRML Normal Issue

2009-03-25 Thread Ben Axelrod
Thanks for the info.

I took a look at the code.  Adding crease angle support does seem tricky since 
I think we would have to create new vertex points on the fly to accommodate 2 
or more different normal vectors at that point.  Here is some off the cuff 
pseudo code.

for (int i = 0; i != *it; ++i) // line 268 of IndexedFaceSet.cpp
{
float angle = acos((*normals)[indices[index + i]] * normal);

if (angle <= creaseAngle)
{
(*normals)[indices[index + i]] += normal;
}
else
{
// clone this vertex so we can give it 2 normals
coords.push_back(coords[indices[index + i]]);

// give it the new normal
normals.push_back(normal)

// now point this face at the new vertex
indices[index + i] = coords.size() - 1;
}
}

I am not sure if modifying the vertex and normal array on the fly is wise, 
possible, or even if that is how it's done.  But like I said, it is pseudo code.

What do you think?
-Ben


-Original Message-
From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Jan Ciger
Sent: Wednesday, March 25, 2009 4:43 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] VRML Normal Issue

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ben Axelrod wrote:
> Just to clarify, the way the normals *should* work is sketched in the
> attached image.  Please verify.
>
> When the angle between 2 faces is sharper than the crease angle,
> there is one normal per face, and when the angle is smoother than the
> crease angle, the normal is averaged.

Correct - what I had in mind was the angle between the normals, not the
faces. The end result would be the same, but this is how the VRML spec
specifies it and it is easier to calculate:

> The creaseAngle field, used by the ElevationGrid, Extrusion, and
> IndexedFaceSet nodes, affects how default normals are generated. If
> the angle between the geometric normals of two adjacent faces is less
> than the crease angle, normals shall be calculated so that the faces
> are smooth-shaded across the edge; otherwise, normals shall be
> calculated so that a lighting discontinuity across the edge is
> produced. For example, a crease angle of .5 radians means that an
> edge between two adjacent polygonal faces will be smooth shaded if
> the geometric normals of the two faces form an angle that is less
> than .5 radians. Otherwise, the faces will appear faceted. Crease
> angles must be greater than or equal to 0.0.

(from:
http://accad.osu.edu/~pgerstma/class/vnv/resources/info/AnnotatedVrmlRef/ch2-26.htm)

However, as I said - right now the loader will average *always*,
regardless of the crease angle. This is even documented in the code:

IndexedFaceSet.cpp, line 241:
> // GvdB: So I ended up computing the smoothing normals myself. Also,
> I might add support for "creaseAngle" if a big need for it rises. //
> However, for now I can perfectly live with the fact that all edges
> are smoothed despite the use of a crease angle.

Regards,

Jan



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFJypdon11XseNj94gRAkaaAKDfByiriOZH8ntvtFI6hYbA/7VW2QCfX1nX
Bpzs2QlM9aiHrkhk40HJt64=
=KjWi
-END PGP SIGNATURE-
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] VRML Normal Issue

2009-03-25 Thread Jan Ciger
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ben Axelrod wrote:
> Just to clarify, the way the normals *should* work is sketched in the
> attached image.  Please verify.
> 
> When the angle between 2 faces is sharper than the crease angle,
> there is one normal per face, and when the angle is smoother than the
> crease angle, the normal is averaged.

Correct - what I had in mind was the angle between the normals, not the
faces. The end result would be the same, but this is how the VRML spec
specifies it and it is easier to calculate:

> The creaseAngle field, used by the ElevationGrid, Extrusion, and
> IndexedFaceSet nodes, affects how default normals are generated. If
> the angle between the geometric normals of two adjacent faces is less
> than the crease angle, normals shall be calculated so that the faces
> are smooth-shaded across the edge; otherwise, normals shall be
> calculated so that a lighting discontinuity across the edge is
> produced. For example, a crease angle of .5 radians means that an
> edge between two adjacent polygonal faces will be smooth shaded if
> the geometric normals of the two faces form an angle that is less
> than .5 radians. Otherwise, the faces will appear faceted. Crease
> angles must be greater than or equal to 0.0.

(from:
http://accad.osu.edu/~pgerstma/class/vnv/resources/info/AnnotatedVrmlRef/ch2-26.htm)

However, as I said - right now the loader will average *always*,
regardless of the crease angle. This is even documented in the code:

IndexedFaceSet.cpp, line 241:
> // GvdB: So I ended up computing the smoothing normals myself. Also,
> I might add support for "creaseAngle" if a big need for it rises. //
> However, for now I can perfectly live with the fact that all edges
> are smoothed despite the use of a crease angle.

Regards,

Jan



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFJypdon11XseNj94gRAkaaAKDfByiriOZH8ntvtFI6hYbA/7VW2QCfX1nX
Bpzs2QlM9aiHrkhk40HJt64=
=KjWi
-END PGP SIGNATURE-
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] VRML Normal Issue

2009-03-25 Thread Ben Axelrod
Just to clarify, the way the normals *should* work is sketched in the attached 
image.  Please verify.

When the angle between 2 faces is sharper than the crease angle, there is one 
normal per face, and when the angle is smoother than the crease angle, the 
normal is averaged.

Thanks,
-Ben

-Original Message-
From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Jan Ciger
Sent: Tuesday, March 24, 2009 1:36 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] VRML Normal Issue

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ben Axelrod wrote:
> Thanks for the info.  Is this standard procedure with mesh files?
> Because I have noticed similar affects with a variety of file
> formats.
>
> I agree that when no normals are specified, the proper behavior for
> the parser is to use one normal per face, and calculate the face
> normals from the vertex points, but the shading I see in badbox.wrl
> does not look like one normal per face, it looks like one normal per
> vertex.  The shading of goodbox.wrl looks like one normal per face to
> me.  Am I mistaken on how these should look?

I can't test it right now, because I do not have the VRML plugin
compiled at the moment. I have loaded the models in WhiteDune editor,
and both look OK to me, with the badbox one showing some artifacts.

I had a look at the code and if you do not specify any normals, the OSG
loader will not really handle it right. It seems that in that case an
average normal out of the adjacent faces is computed and used per-vertex
(i.e. the edges and corners are smoothed ...) This isn't completely
correct, the VRML spec specifies use of crease angle parameter that will
make all angles smaller than this one averaged and ones larger sharp.
However, this is not intended to be a 100% compliant VRML viewer.
Originally, the case without normals was not handled at all.

You have basically two options:

- - generate your VRML including normals
- - fix the VRML plugin code to include handling of the crease angle (in
IndexedFaceSet.cpp, around lines 240 and on in the VRML plugin)


Regards,

Jan
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFJyRn8n11XseNj94gRAhPtAKDd+ov0409iUlfCEoPs0Jgz8z2V/QCfTV6C
trLfTvJTRgm+KjV2GCYphTA=
=dT7/
-END PGP SIGNATURE-
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
<>___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] VRML Normal Issue

2009-03-24 Thread Jan Ciger
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ben Axelrod wrote:
> Thanks for the info.  Is this standard procedure with mesh files?
> Because I have noticed similar affects with a variety of file
> formats.
> 
> I agree that when no normals are specified, the proper behavior for
> the parser is to use one normal per face, and calculate the face
> normals from the vertex points, but the shading I see in badbox.wrl
> does not look like one normal per face, it looks like one normal per
> vertex.  The shading of goodbox.wrl looks like one normal per face to
> me.  Am I mistaken on how these should look?

I can't test it right now, because I do not have the VRML plugin
compiled at the moment. I have loaded the models in WhiteDune editor,
and both look OK to me, with the badbox one showing some artifacts.

I had a look at the code and if you do not specify any normals, the OSG
loader will not really handle it right. It seems that in that case an
average normal out of the adjacent faces is computed and used per-vertex
(i.e. the edges and corners are smoothed ...) This isn't completely
correct, the VRML spec specifies use of crease angle parameter that will
make all angles smaller than this one averaged and ones larger sharp.
However, this is not intended to be a 100% compliant VRML viewer.
Originally, the case without normals was not handled at all.

You have basically two options:

- - generate your VRML including normals
- - fix the VRML plugin code to include handling of the crease angle (in
IndexedFaceSet.cpp, around lines 240 and on in the VRML plugin)


Regards,

Jan
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFJyRn8n11XseNj94gRAhPtAKDd+ov0409iUlfCEoPs0Jgz8z2V/QCfTV6C
trLfTvJTRgm+KjV2GCYphTA=
=dT7/
-END PGP SIGNATURE-
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] VRML Normal Issue

2009-03-24 Thread Ben Axelrod
Thanks for the info.  Is this standard procedure with mesh files?  Because I 
have noticed similar affects with a variety of file formats.

I agree that when no normals are specified, the proper behavior for the parser 
is to use one normal per face, and calculate the face normals from the vertex 
points, but the shading I see in badbox.wrl does not look like one normal per 
face, it looks like one normal per vertex.  The shading of goodbox.wrl looks 
like one normal per face to me.  Am I mistaken on how these should look?

Thanks,
-Ben


-Original Message-
From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Jan Ciger
Sent: Saturday, March 21, 2009 12:23 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] VRML Normal Issue

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello Ben,

Ben Axelrod wrote:
> I have noticed a very strange issue regarding VRML file rendering.  This
> issue happens in OSG viewer version 2.6, with openVRML version 0.14.3.
>
...
> Are there some VRML flags to prevent this behavior?  Is this a bug in
> the VRML parser?  If so, is this part of OSG or openVRML?

I happen to be one of the authors of the VRML plugin. I had a look at
your files and badbox.wrl is incorrect. You need to explicitly specify
the vertex normals, otherwise it will assume normal per face and if even
those are not provided, calculate them from the vertices - leading to
the behavior you are describing. The behavior is correct, IMO - the
parser has no means to know what you want if you do not specify the normals.

Regards,

Jan
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFJxRRkn11XseNj94gRAsiVAKCNve8MXKvwkJ75hLM6kZcn1gZzfwCdH+Pr
A8CF98dTVjegSqXWeKQdNm4=
=NbCl
-END PGP SIGNATURE-
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] VRML Normal Issue

2009-03-21 Thread Jan Ciger
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello Ben,

Ben Axelrod wrote:
> I have noticed a very strange issue regarding VRML file rendering.  This
> issue happens in OSG viewer version 2.6, with openVRML version 0.14.3.  
> 
...
> Are there some VRML flags to prevent this behavior?  Is this a bug in
> the VRML parser?  If so, is this part of OSG or openVRML?

I happen to be one of the authors of the VRML plugin. I had a look at
your files and badbox.wrl is incorrect. You need to explicitly specify
the vertex normals, otherwise it will assume normal per face and if even
those are not provided, calculate them from the vertices - leading to
the behavior you are describing. The behavior is correct, IMO - the
parser has no means to know what you want if you do not specify the normals.

Regards,

Jan
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFJxRRkn11XseNj94gRAsiVAKCNve8MXKvwkJ75hLM6kZcn1gZzfwCdH+Pr
A8CF98dTVjegSqXWeKQdNm4=
=NbCl
-END PGP SIGNATURE-
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org