Steven Chetelat (CS) (chetelat@csee.usf.edu) writes:
> Greetings, all. I'm slowly delving my way into object graphics, and I'm
> having some pretty serious problems with my lighting. Specifically, I
> have a set of polygons representing an isosurface of a solid. I generated
> them using shade_volume. In direct graphics, I used them as input to
> polyshade, like this:
>
> shade_volume, new, .5,vert,poly, /low
> shade_volume, new, 1,lvert,lpoly, /low
> scale3, xrange=[0,xr], yrange=[0,yr], zrange=[0,zr],ax=xa,az=za
> tv,bytscl(polyshade(vert,poly,/t3d))+bytscl(polyshade(lvert, lpoly,/t3d))
>
> I didn't specify any lighting. When I try to get a decent display of the
> polygons using object graphics like this:
>
> shade_volume, full, .5,vert,poly, /low
> mypol = OBJ_NEW('IDLgrPolygon', vert, polygons = poly)
> mypol -> SetProperty, XCOORD_CONV=[-1.0, 1.0/170.0]
> mypol -> SetProperty, YCOORD_CONV=[-1.0, 1.0/79.0]
> mypol -> SetProperty, ZCOORD_CONV=[-1.0, 1.0/49.0]
> mywindow = OBJ_NEW('IDLgrWindow', DIMENSIONS=[340,158])
> myview = OBJ_NEW('IDLgrView', VIEWPLANE_RECT=[-1,-1,1,1], ZCLIP=[1,-1])
> mymodel = OBJ_NEW('IDLgrModel')
> myview -> Add, mymodel
> mymodel -> Add, mypol
> mywindow -> Draw, myview
>
> The view completely lacks definition. When I add lights, very small
> sections light up, but I can't seem to position the lights to illuminate
> the whole object. How can I reproduce the lighting model used by
> polyshade in direct graphics, or at least get enough intensity out of
> light objects to suit my purposes?
Yes, you are going to have to add lights. I'd point you
to a couple of programs, but it seems my ISP has misplaced
my FTP directories at the moment. :-(
The most common problem people have with lighting (aside from
no training in the theater arts) is that they forget
their lights also need to be scaled, rotated, translated, etc.
into the view. You can't just put them *anywhere* and have
them work. (Well, you *can* put them anywhere in object graphics.
I guess *that* is the real problem.)
I like to have a least one or two lights in non-rotatable models
so that I can rotate a surface underneath them, and sometimes
one or two lights that rotate with the surface to pull out
particular surface features. If I even figure out where my
anonymous ftp directories went, I'll see if I can rustle up
an example for you. In the meantime, you could look at something
like XSURFACE for an example of how rotating lights are added.
http:/www.dfanning.com/programs/xsurface.pro
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|