comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Object graphics polygons
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Object graphics polygons [message #19762] Fri, 14 April 2000 00:00 Go to next message
Steven Chetelat (CS) is currently offline  Steven Chetelat (CS)
Messages: 11
Registered: February 2000
Junior Member
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?

K-Bye,
STEVE! (chetelat@csee.usf.edu)(steve@moffitt.usf.edu)
Re: Object graphics polygons [message #19841 is a reply to message #19762] Wed, 19 April 2000 00:00 Go to previous message
Struan Gray is currently offline  Struan Gray
Messages: 178
Registered: December 1995
Senior Member
Steven Chetelat, chetelat@csee.usf.edu writes:

> My problem lies in figuring where to put them -- perhaps
> it is a matter of no training in the theater arts, but all
> my lights (positional, directional, and spotlights) only
> illuminate a small portion of my surface, even with
> intensities set very high. Do I need to modify the ambient
> lighting as well?


The following code works pretty well as a default setup and
simulates semi-directional daylight. It uses the RSI-provided routine
SET_VIEW, which sometimes puts the objects in slightly odd positions,
but they're always visible.

Assume that you have put your polygon in an IDLgrModel object
called theModel, and that you have already created an object graphics
window with an ID stored in a variable called mainWindow. Then do
this:

; make a seperate model for the lights, plus default lighting

lightModel = obj_new('IDLgrModel')
dirLight = obj_new('IDLgrLight', type=2, location=[1,1,1],
intensity=0.7)
ambLight = obj_new('IDLgrLight', type=0, intensity=0.4)
lightModel -> Add, dirLight
lightModel -> Add, ambLight

; make a view object and set a default viewplane rectangle

mainView = Obj_New('IDLgrView', color=[100,100,100])
mainView -> Add, lightModel
mainView -> Add, theModel
set_view, mainView, mainWindow, /do_aspect, /isotropic


If you rotate your model the lights will stay put, which is what
most users expect to happen. If you want to rotate the lights you can
either add them en-masse to your model, or turn them off and use other
lights of your own creation.


Struan
Re: Object graphics polygons [message #19846 is a reply to message #19762] Tue, 18 April 2000 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Steven Chetelat (CS) (chetelat@csee.usf.edu) writes:

> I think I've managed to figure this out, right now I have a very simple
> widget program that lets me translate the light across the surface, which
> is part of the reason I feel I'm overlooking something. I can't
> illuminate more than a small fraction of the surface no matter where I put
> the light.

Humm. I don't know. I would guess from the description that
the lights are probably too close to the surface, if they
only illuminate small fractions of the surface. Have you
tried backing them off a bit?

Ambient light is NOT what you want, I think, since this
will light everything up uniformly. You want light that
will show the edges of things.

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
Re: Object graphics polygons [message #19848 is a reply to message #19762] Tue, 18 April 2000 00:00 Go to previous message
Steven Chetelat (CS) is currently offline  Steven Chetelat (CS)
Messages: 11
Registered: February 2000
Junior Member
On Fri, 14 Apr 2000, David Fanning wrote:

> Steven Chetelat (CS) (chetelat@csee.usf.edu) writes:

>> 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. :-(

:-( Thanks for the pointers, nonetheless, I've made definite progress
over the last couple of days... :-)

> 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.)

My problem lies in figuring where to put them -- perhaps it is a matter of
no training in the theater arts, but all my lights (positional,
directional, and spotlights) only illuminate a small portion of my
surface, even with intensities set very high. Do I need to modify the
ambient lighting as well?

> 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.

I think I've managed to figure this out, right now I have a very simple
widget program that lets me translate the light across the surface, which
is part of the reason I feel I'm overlooking something. I can't
illuminate more than a small fraction of the surface no matter where I put
the light.

K-Bye,
STEVE! (chetelat@csee.usf.edu)(steve@moffitt.usf.edu)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Free SAR Geocoding Software
Next Topic: Reading 12-bit TIFF Images

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:11:56 PDT 2025

Total time taken to generate the page: 0.00666 seconds