1

I am using POV-ray raytracer for rendering. I have a mesh of triangles, when I render that using :

 mesh
{
    triangle
   {
           < corner_1>, <corner_2>, <corner_3>
   }

}

I am not getting smooth shading, there is also a provision for smooth shading in POV-ray which is using :

smooth_triangle
{
    <Corner_1>, <Normal_1>, <Corner_2>,
    <Normal_2>, <Corner_3>, <Normal_3>
    [OBJECT_MODIFIER...]
}

But the problem is that it requires normal of corners of triangle ( it uses phong shading ), How to calculate normal at corners of triangle? How to have a smooth shading in POV-ray?

NOTE: triangles sharing common vertices will have same normal at those vertices

genpfault
  • 51,148
  • 11
  • 85
  • 139
user2481909
  • 376
  • 2
  • 5
  • 13
  • The `'corner of triangle'` is the `vertex`. Checkout [this](http://gamedev.stackexchange.com/questions/8408/best-way-to-compute-vertex-normals-from-a-triangles-list) answer, which shows how to calculate vertex normals given a trimesh. – Arun R Sep 24 '13 at 20:51
  • Just wanted to add that this is typically pre-computed before you enter the 'shader' stage. So each vertex know what its normal is in a `vertex shader` and by extension, each pixel will know what the per-pixel normal is in the `pixel shader`. – Arun R Sep 24 '13 at 20:59

0 Answers0