POV-Ray : Newsgroups : povray.text.tutorials : S-Triangle normal help Server Time
23 Nov 2024 22:19:56 EST (-0500)
  S-Triangle normal help (Message 1 to 2 of 2)  
From: Phil Clute
Subject: S-Triangle normal help
Date: 10 Jun 1999 20:00:21
Message: <37605326.F74D4E0F@tiac.net>
I am trying to work out how the normal vector in a 
smooth triangle works(I posted a similar question in
povray.advanced-users and quickly realised I need to
back up a bit and start at the begining).

The docs say that the default for normals is 0.5, I assume
this is supposed to give me a regular(normal) surface. But
I put a smooth_triangle with 0.5 normals next to a plain ol'
triangle, each with the same pigment{Red}, and got two different
colors. Am I just making a dumb mistake? Or is this correct
for smooth_triangles?
Here's my code:

#include "colors.inc" 
global_settings{
     assumed_gamma 1.0
}
camera{
     location  <0.0, 1.0, -4.0>
     direction <0, 0, 1>
     right     <1.33, 0, 0>
     look_at   <0.0, 0.0, 0.0>
}
light_source{
     0*x
     rgb <1.0,1.0,1.0>
     translate <-10, 30, -30>
     fade_distance 55
     fade_power 100
}
plane { y, -1 pigment {color rgb <0.8,0.4,0.1>}}
sky_sphere{
  pigment{
    gradient y
    color_map { [0.0 color blue 0.6] [1.0 color rgb 1] }
  }
}
smooth_triangle{
	< 0, 0, 0> < .5, .5, .5>  // <Vertex1>  <SurfaceNormal1>
	< 1, 0, 0> < .5, .5, .5>  // <Vertex2>  <SurfaceNormal2>
	< 0, 1, 0> < .5, .5, .5>  // <Vertex3>  <SurfaceNormal3>
	pigment{Red}
}
triangle{
  < 0,  0, 0> // <Vertex1>
  <-1,  0, 0> // <Vertex2>
  < 0,  1, 0> // <Vertex3>
  pigment{Red}
}

-- 
...coffee?...yes please! extra sugar,extra cream...Thank you.


Post a reply to this message

From: Nieminen Mika
Subject: Re: S-Triangle normal help
Date: 11 Jun 1999 03:56:43
Message: <3760c13b@news.povray.org>
Phil Clute <pcl### [at] tiacnet> wrote:
: smooth_triangle{
: 	< 0, 0, 0> < .5, .5, .5>  // <Vertex1>  <SurfaceNormal1>
: 	< 1, 0, 0> < .5, .5, .5>  // <Vertex2>  <SurfaceNormal2>
: 	< 0, 1, 0> < .5, .5, .5>  // <Vertex3>  <SurfaceNormal3>
: 	pigment{Red}
: }

  Your triangle is placed in the x-y-plane and your normal vectors are
pointing to the <1,1,1>-direction (ie. imagine the line which goes through
the points <0,0,0> and <1,1,1>).
  If you want a regular triangle and since your triangle is in the
x-y-plane, the normal vectors should point to the negative z direction,
which is the perpendicular to that plane, ie:

smooth_triangle{
	< 0, 0, 0> < 0,0,-1>  // <Vertex1>  <SurfaceNormal1>
	< 1, 0, 0> < 0,0,-1>  // <Vertex2>  <SurfaceNormal2>
	< 0, 1, 0> < 0,0,-1>  // <Vertex3>  <SurfaceNormal3>
	pigment{Red}
}

  Note that the direction of the normal vectors is independent of the
location of the triangle as long as they point to the perpendicular
direction. For example, this is the equivalent triangle located in another
position:

smooth_triangle{
	< 10, 20, 30> < 0,0,-1>  // <Vertex1>  <SurfaceNormal1>
	< 11, 20, 30> < 0,0,-1>  // <Vertex2>  <SurfaceNormal2>
	< 10, 21, 30> < 0,0,-1>  // <Vertex3>  <SurfaceNormal3>
	pigment{Red}
}

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

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