favre@seas.gwu.edu (Jean M. Favre) (07/25/90)
A few weeks ago, I asked the net how to do the lighting of a surface with a scalar field and I set the following parameters lmcolor(LMC_AD) and draw my surface with a series of cpack(r, g, b) n3f(normal) v3f(vertex) It works well and does the shading with the color specified and the lighting with the normal supplied. The problem is that BOTH sides of the surface are shaded because the material properties are modified. What I want is the side facing away from the normals to be shaded with a uniform gray color so that I can easily distinguish the inside and outside of the surface. Can anyone give me some help? Thanks in advance. -- Jean M. Favre. EE&CS Dept. The George Washington University (202) 994 7532 favre@gwusun.gwu.edu
tjh@bucrf11.bu.edu (Tim Hall) (07/25/90)
In article <2042@sparko.gwu.edu>, favre@seas.gwu.edu (Jean M. Favre) writes: |> |> The problem is that BOTH sides of the surface are shaded because the material |> properties are modified. I think this is because of the position of the light and the normal. Even if the polygon normal is facing away from the eye point the polygon will get diffusely shaded. |> |> What I want is the side facing away from the normals to be shaded with a |> uniform gray color so that I can easily distinguish the inside and outside |> of the surface. One solution is to use backfacing and render your surface twice. Turn on backfacing and draw all your polygons with their colors. This will only draw the polygons facing you. Redraw the surface with the surface normals inverted and a grey material bound. Now the polygons facing away from you will be grey. Be sure to specify your polygons in counter clockwise order. If you have 3.3 use two sided shading. This is a new feature and allows you to specify two materials for the front and back of the surface. See the "Graphics Library Programming Guide" page 9-17. (This is the updated manual with 3.3) |> |> Can anyone give me some help? |> |> Thanks in advance. |> -- |> Jean M. Favre. EE&CS Dept. The George Washington University |> (202) 994 7532 |> favre@gwusun.gwu.edu
tjh@bucrf11.bu.edu (Tim Hall) (07/25/90)
|> will be grey. Be sure to specify your polygons in counter clockwise order. |> Oops...that was supposed to say... Be sure to specify your polygon verticies in counter clockwise order. ^^^^^^^^^ -Tim Hall tjh@bu-pub.bu.edu The night is filled with the cries of dispossessed children in search of paradise. -Dead Can Dance
thant@horus.esd.sgi.com (Thant Tessman) (07/25/90)
In article <2042@sparko.gwu.edu>, favre@seas.gwu.edu (Jean M. Favre) writes: > The problem is that BOTH sides of the surface are shaded because the material > properties are modified. > > What I want is the side facing away from the normals to be shaded with a > uniform gray color so that I can easily distinguish the inside and outside > of the surface. You can use backface(TRUE) if you are careful about the order you specify the vertices. Turn on backface, and draw the lit object with the vertices defined counter-clockwise. Only polygons facing the eye will be drawn. Then turn off lighting and specify a grey color and draw a version of the object with the vertices clockwise to draw only the polygons facing away from the eye. On the VGX you can specify two sided polygons using lmdef and lmbind. thant
thant@horus.esd.sgi.com (Thant Tessman) (07/26/90)
In article <10856@odin.corp.sgi.com>, kurt@cashew.asd.sgi.com (Kurt Akeley) writes: > No need to reverse the order of the vertices when drawing the back-facing > polygons. Just call backface(FALSE) and frontface(TRUE). Then redraw. Cool! I didn't know about 'frontface'. thant
sergio@sergio.uucp (Sergio Perrone/30000) (07/26/90)
Well, the _easy_ way to do that is to do something like this - draw_surface_with_shading(); translate( 0.0, 0.0, -0.01 ); draw_surface_with_grey(); That doubles your drawing time, of course, but I don't see any other fairly easy way to do it... Marc --- Marc Andreessen, IBM AWD Austin, sergio@sergio.austin.ibm.com ---