yafray-devel
[Top][All Lists]
Advanced

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

Re: [Yafray-devel] Autosmoothed meshes


From: Alfredo de Greef
Subject: Re: [Yafray-devel] Autosmoothed meshes
Date: Wed, 27 Jul 2005 21:43:48 -0700 (PDT)

--- Arne Schmitz <address@hidden>
wrote:
> 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.

Oh, I see what you mean, that makes sense, much more
clear explanation. I think Blender does do something
like that.
There are however also some shading problems that
could have something to do with this.
Anyway, you sound like you definitly know what you're
talking about, so if you ever do look though the
yafray code, you might find a lot more of such
mistakes/assumptions and ad-hoc code, especially in
the parts that I did, I'm just a hobby coder, 
practically don't know anything about math, so I
apologize for that in advance ;)

btw, if you really hate the forums, just mail Jandro
directly, he is not likely to answer questions on the
forum anyway.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




reply via email to

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