here_I_am wrote:
> Jan Dvorak <jan### [at] centrum cz> wrote:
>
>>here_I_am napsal(a):
>>
>>>Hey everybody!
>>>
>>>I am in the middle of a project, where i have to do smooth shading from a scene
>>>file of 15000 triangles which have thge data as triangles rather that having in
>>>smooth_traingle.And since the number of triangles is very large I simple can't
>>>calculate vnormalize(vcross(v1-v2,v3-v2)) manually and implement to
>>>smooth_triangle for every triangle
>>
>>either you can or you don't have to ;-)
>
>
>
> yeah! I don't have :)
> So could you please suggest something here??
>
It's a little puzzling, if you know how to derive the normal then you
must realize that you have to reparse the data somehow. You could
probably get pov to do it but it will probably require that you edit the
data externally such that there is a single triangle per line.
Its a little bit trickier than you suggest though because you have to
grab all the triangles containing a given vertex and average the
cross-product from each triangle. So I think there would be some
intermediate steps involved. I think you would have to produce a list of
vertices and a corresponding list of triangles referencing the vertex
list. Then produce a list of normals calculated for each vertex. For
each vertex you would have to retrieve all the triangles containing it.
Finally rewrite the sdl for smooth_triangles now contructed with
vertex-normal pairs.
It would might be easier to do it in some other external scripting
language with flexible string manipulation abilities. I found Python
very easy to learn.
Post a reply to this message
|