yafray-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Yafray-devel] Autosmoothed meshes


From: Arne Schmitz
Subject: Re: [Yafray-devel] Autosmoothed meshes
Date: Wed, 27 Jul 2005 09:18:52 +0200
User-agent: KMail/1.7.2

Am Dienstag, 26. Juli 2005 19:02 schrieb Alfredo de Greef:
> First, this mailing list is not really used anymore,
> better to post in the yafray forums, more people might
> comment there.

Oh, ok. Although I hate forums.... :-) 

> I'm not exactly sure what you mean. I suppose with
> 'component' you mean a triangle? Or something else?

No, I meant (partially) disconnected components, i.e. the Vertices at a 
feature edge that triggers the autosmoothing threshold will be duplicated, so 
that there is no topological connection between triangles on either side of 
the feature edge.

> All objects are just a list of vertices and the faces
> are just a list of indices to the vertices.
> As for vertex normals, I did rewrite that a while ago
> to only store one vertex normal for the total smoothed
> case, or none if no smoothing is needed.

Yeah, that makes sense, but even with that the above mentioned vertex 
duplication is not necessary. Maybe I'll elaborate about that in the forum...

> > Moreover the interpolated normal calculation and
> > thus specular reflections and
> > refractions are not done correctly in yafray. The
> > vertex normals should be
> > weighted with the acos of the angle of the incident
> > triangles. Again, I do
> > not know, where Yafray does this, but I am willing
> > to help, if someon tells
> > me where to look.
>
> incident triangles? Well, again, not sure what you're
> referring to, but I suppose that has something to do
> with shading? Then looking at the shader code might
> help, specifically the fromLight() functions.

No, shading is only implicitly affected. The problem are the vertex normals, 
that are computed by yafray for smoothed meshes. They are computed 
incorrectly. Suppose we have the following triangulation (view with fixed 
width font), which often happens with e.g. a tesselated tube:

 +----+----+
 |\  2|\   |  |
 | \  | \  |  |
 |  \ | 3\ |  |
 |1  \|   \|  | No curvature
 +----X----+  |
 |   /| 4 /|  |
 |6 / |  / |  V
 | / 5| /  |
 |/   |/   |
 +----Y----+
 |\   |\   |
 | \  | \  |
 |  \ |  \ |
 |   \|   \|
 +---------+
  -------->
  direction of
  curvature

Now we want to calculate the vertex normal for vertex X. The incident (i.e. 
neighboring) triangles 1,2,5 and 6 will have a *larger* influence than the 
triangles 3 and 4. Suppose 1,2,5,6 have normals pointing to the left, and 3,4 
have normals pointing to the right. the resulting normal for X will point 
slightly to the left. 

Suppose we now want to compute the vertex normal for Y. The normal will 
obviously slightly point to the right. That way we get a wobbly reflection. 

The correct way would be to weight each triangle with the arccos of the angle 
that it shares with the vertex X. That way triangles 3 and 4 would get a 
cumulated normalized weight of 0.5 and triangles 1,2,5 and 6 also would get a 
weight of 0.5.

> In any case, all this should go to Jandro, apparently
> he has started the rewrite already. So maybe try
> emailing him directly, if any changes have to be made,
> the time is now to point out anything that
> should/could be improved.

Ok, I'll CC him.

Arne

-- 
Computer Graphics Group, RWTH Aachen, http://www-i8.informatik.rwth-aachen.de

Attachment: pgp1nlQ80zD6z.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]