[comp.graphics] phunky phong triangles in rayshade 4.0

gt4417a@prism.gatech.EDU (SKELTON,JOEL PHILLIP) (06/12/91)

Has anyone else noticed problems with shading discontinuities
on objects composed of phong triangles in rayshade 4.0? As an
example if I create a sphere out of phong triangles (with all
of the normals defined correctly, i checked on that) and render
it with a light somwhewhere close to the eye point then I get
a picture of a smoothly shaded sphere. If I put the light away from
the eye and to the side of the sphere then I see a line that traces
the edge of some of the triangles where the shading suddenly
goes to almost black. The effect is something like this:


                     .....
                   .    \  .
smoothly shaded -.      /    . ------- almost black
                 .      \    .
                 .      /    .
                   .	\  .
                     .....


This is not just Mach-banding, I know what that looks like. 

If anyone else has seen this effect or has a guess as to 
why it is happening I'd really appreciate hearing from
you.

btw. , I just used the sphere as a simplified example
so I don't need any suggestions to "just use the sphere
primitive".


jps
bongo fury

-- 
SKELTON,JOEL PHILLIP
Georgia Institute of Technology, Atlanta Georgia, 30332
uucp:     ...!{allegra,amd,hplabs,ut-ngp}!gatech!prism!gt4417a
Internet: gt4417a@prism.gatech.edu

nwatson@enuxha.eas.asu.edu (Nathan F. Watson) (06/13/91)

In article <31202@hydra.gatech.EDU>, gt4417a@prism.gatech.EDU (SKELTON,JOEL PHILLIP) writes:
> Has anyone else noticed problems with shading discontinuities
> on objects composed of phong triangles in rayshade 4.0?

> ... If I put the light away from
> the eye and to the side of the sphere then I see a line that traces
> the edge of some of the triangles where the shading suddenly
> goes to almost black. The effect is something like this:
> 
> 
>                      .....
>                    .    \  .
> smoothly shaded -.      /    . ------- almost black
>                  .      \    .
>                  .      /    .
>                    .	\  .
>                      .....
> 
> jps
> bongo fury

My guess is that triangles to the left of the boundary have their TRUE
outward normals pointing toward the light source, and so include the
mentioned light source in their shading calculations.  The triangles to the
right have their TRUE outward normals pointing away from the light source
and so eliminate the mentioned light source in shading calculations.
The left triangles along the boundary will be smoothly shaded using the
light source, whereas right triangles will be "black".  Because the
phongly-calculated normals along the boundary are not necessarily
normal to the vector to the light source (and may, indeed, point away
from the light source), the transition will not be smooth.

A proposed solution (that I'm not sure will work):

Handle lighting calculations w.r.t. the mentioned light source as follows:
   (a) For triangles whose vertex normals all point toward the light
       source:  Use phongly-calculated normals as usual.
   (b) For triangles whose vertex normals all point away from the light
       source:  Reject the triangle as it is not lit by the light source.
   (c) For triangles with vertex normals point both at and away from the
       light source:  Calculate the phong-normal at each point and determine
       whether the light source should be used.

I suspect that triangles in (a) will usually have their outward normals
pointing toward the light source, those in (b) will usually have their
outward normals pointing away from the light source.

Those in (c) will have outward normals pointing toward and away from
the light source.  The mentioned check should be applied in either case
to provide a smooth transition.

Sorry for the wordy description.


-- 
---------------------------------------------------------------------
Nathan F. Watson                             Arizona State University
nwatson@enuxha.eas.asu.edu                Computer Science Department
"Remember:  No matter where you go, there you are." - Mr. B. Banzai