POV-Ray : Newsgroups : povray.advanced-users : Need help creating "flat" quadradural panels with smooth_triangle : Need help creating "flat" quadradural panels with smooth_triangle Server Time
28 Jul 2024 12:27:41 EDT (-0400)
  Need help creating "flat" quadradural panels with smooth_triangle  
From: Mesh Mongrel
Date: 20 Oct 2005 12:05:01
Message: <web.4357bfb42c8909645f0b7e880@news.povray.org>
I have a situation where I have a model with a section that consists of
panels that connect a base of a model to a midsection of a model.  Now I
created this POVRay model by measuring plastic pieces of a physical model
that you glue together and then paint.  In reality there is a slight
warping of the pieces when you assemble the physical model as the corners
of the panels are not all in the same plane.  This works because the pieces
are plastic and in real life the human eye doesn't really pick up the
slight warping and the panels apear flat.

So in POVRay I have the midsection polygon and the bottom polygon that need
a skirting made of panels to connect the two peices.  It seemed like the
logical construct for this particular problem is a mesh.  However since the
panels this mesh are made up of don't perfectly fit in the same plan some
of the panels show the triangle when light hits them at certain angles.

Now I had the idea that I could fix this problem by adjusting the shading
vector and use shmooth_triangle instead of triangle.  I got the idea by
reading this thread:

http://news.povray.org/povray.general/thread/%3Cweb.431fd888f4e5b5152f6d7a0@news.povray.org%3E/

Now I got the idea from the above thread that I could get the illusion of a
smooth panel by doing the following with x1-z4 replaced with actual
coordinate values:

mesh {
        #local P1 = <x1, y1, z1>;
        #local P2 = <x2, y2, z2>;
        #local P3 = <x3, y3, z3>;
        #local P4 = <x4, y4, z4>;
        #local N1 = vnormalize(vcross(P1 - P2, P3 - P1));
        #local N2 = vnormalize(vcross(P2 - P3, P4 - P1));
        #local N = (N1 + N2)/2;
        smooth_triangle { P1, N, P2, N, P3, N }
        smooth_triangle { P4, N, P3, N, P2, N }
}

It doesn't work.  I seem to get the same effect if I would just use
triangle.

I'm not understanding something here.  Am I wrong in my application of
vcross and vnormalize to get the normal vector for the triangles?  Am I
wrong in thinking that I can average the two vectors together as I have
done?  Am I wrong in thinking that if I give both triangles the same vector
I'll end up with the same shading?

Is there a better way to do this?  Maybe I shouldn't be using
smooth_triangle for this problem.  I cannot use polygons as they would
leave holes and I'm reticent to adjust the other portions of the model as
they look good.

Any advice would be appreciated.  Thanks.


Post a reply to this message

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