POV-Ray : Newsgroups : povray.general : how to make the mesh looks more reality and smooth? : Re: how to make the mesh looks more reality and smooth? Server Time
1 Aug 2024 12:22:22 EDT (-0400)
  Re: how to make the mesh looks more reality and smooth?  
From: Hasan3
Date: 10 Oct 2005 08:40:01
Message: <web.434a5f98a30b828fb550aba90@news.povray.org>
"Tim Nikias" <JUSTTHELOWERCASE:timISNOTnikias(at)gmx.netWARE> wrote:
> If you have the same amount of vertices as you have normals, the mesh will
> use the first vertex with the first normal, the second vertex with the
> second normal and so on.
>
> But, if you have tons of the same normal (e.g. in a very planar mesh, you
> might have lots of <0,1,0> normals), you can use normal_indices. For every
> triangle defined with face_indices, you'd need to index which normals you
> want to use.
>
> Regards,
> Tim
>
> --
> "Tim Nikias v2.0"
> Homepage: <http://www.nolights.de>


Like Tim says , you must each vertex normals. But common sides's vertex
numbers
must same. For normal calc, My visual basic code :

'    x1 , x2, x3 vertex point.

    Dim v1(2) As Single, v2(2) As Single
    Dim nX As Single, nY As Single, nZ As Single


    ' Calculate two vectors from the three points
    v1(0) = X2 - x1
    v1(1) = Y2 - y1
    v1(2) = z2 - z1

    v2(0) = x3 - x1
    v2(1) = y3 - y1
    v2(2) = z3 - z1

    ' Take the cross product of 2 vectors to get the normal
    ' vector which will be stored in out
    nX = (v1(1) * v2(2)) - (v1(2) * v2(1))
    nZ = (v1(2) * v2(0)) - (v1(0) * v2(2))
    nY = (v1(0) * v2(1)) - (v1(1) * v2(0))

Regards.

Hasan


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.