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

Home » Public Forums » archive » 3d graphics
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
3d graphics [message #2845] Mon, 26 September 1994 09:12 Go to next message
mallozzi is currently offline  mallozzi
Messages: 60
Registered: August 1994
Member
I am trying to make a sphere by drawing a number of great circles.
I have made a great circle in the xy plane as follows:

Make 3d box using SURFACE
x = 1.0 * COS(theta)
y = 1.0 * SIN(theta)
z = 0.0
plots, x, y, z, /t3d

Next I tried to rotate the circle by 90 degrees about x-axis, for example:
t3d, rotate=[90, 0, 0]
plots, x, y, z, /t3d
but this doesn't work. How do I redraw circle at different orientations?

Thanks, Bob Mallozzi
mallozzi@ssl.msfc.nasa.gov
Re: 3D graphics [message #7227 is a reply to message #2845] Wed, 16 October 1996 00:00 Go to previous messageGo to next message
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
Nigel Helliwell wrote:
> Can anyone give me any pointers to publically available 3D graphics
> code and/or related material. I've recently started on a new project
> involving Three dimensional modeling and the manuals for Idl are lacking
> in detail in this area, so I need to know what is possible

If you are going to display/animate three dimensional volumes of
time-series
data (e.g. numerical weather model output), then check out Vis5D. It's
free,
and available at

http://www.ssec.wisc.edu/~billh/vis5d.html

Cheers,
Liam.
Re: 3d graphics [message #34150 is a reply to message #2845] Tue, 25 February 2003 07:09 Go to previous message
Karl Schultz is currently offline  Karl Schultz
Messages: 341
Registered: October 1999
Senior Member
"Dan Madeira" <d.madeira@ucl.ac.uk> wrote in message
news:b3fia0$j4k$1@uns-a.ucl.ac.uk...
>
> Thanks everyone for the info, we'll try it out asap.
>
> We're using a mac (another thing that we've never used before) with dual
> Geforce 4 TIs so it should be able to handle anything that we can throw at
> it... And luckily I'm not working by myself, its a 6 man group project, so
I
> have someone else to share the programming misfortune with.
>
> I suspect you`ll all be hearing about about our other problems in the near
> future.

If you're on a Mac with OS X, then be sure to get the Apple X Server Beta so
that you get hardware accelerated graphics. I have a hard time imagining
poor graphics performance drawing a few orbs in this configuration.
Hey, if you end up with something that looks cool, we'd love to see a screen
shot.

Karl
Re: 3d graphics [message #34156 is a reply to message #2845] Tue, 25 February 2003 02:59 Go to previous message
Dan Madeira is currently offline  Dan Madeira
Messages: 2
Registered: February 2003
Junior Member
Thanks everyone for the info, we'll try it out asap.

We're using a mac (another thing that we've never used before) with dual
Geforce 4 TIs so it should be able to handle anything that we can throw at
it... And luckily I'm not working by myself, its a 6 man group project, so I
have someone else to share the programming misfortune with.

I suspect you`ll all be hearing about about our other problems in the near
future.

Cheers,

Dan Madeira
Re: 3d graphics [message #34162 is a reply to message #2845] Mon, 24 February 2003 10:14 Go to previous message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
"Dan Madeira" wrote in message ...



> We have drawn four globes representing the Earth, moon, mars and the sun
> using the `orb` procedure, and then used a for loop to translate the
globes
> according to a specified orbit, redrawing the view in both the right view
> and left view widgets each time. However this results in a large lag
between
> each update, which ruins the steroscopic effect. Has anyone got any ideas
of
> a faster technique?


Your biggest problem may be with the orb object (which IMO it was written
poorly). The orb object recalculates it's vertices for every SetProperty
call. If you are moving your orbs directly you are paying this price. You
have two options, you can place your orbs in another model and manipulate
that model or you can "fix" the orb (you may want/need to copy orb__define
to a local directory before you fix it and you will want to make sure that
the fixed orb__define get's called and not the old one). Here is the simple
fix:

PRO orb::SetProperty, POS=pos, RADIUS=radius, DENSITY=density, _EXTRA=e

rebuild = 0B

; Pass along extraneous keywords to the superclass and/or to the
; polygon used to represent the orb.
self->IDLgrModel::SetProperty, _EXTRA=e
self.oPoly->SetProperty, _EXTRA=e

IF (N_ELEMENTS(pos) EQ 3) THEN BEGIN
self.pos = pos
rebuild = 1B
ENDIF

IF (N_ELEMENTS(radius) EQ 1) THEN BEGIN
self.radius = radius
rebuild = 1B
ENDIF

IF (N_ELEMENTS(density) EQ 1) THEN BEGIN
self.density = density
rebuild = 1B
ENDIF

; Rebuild the polygon according to keyword settings.
IF (rebuild) THEN self->BuildPoly
END


If this isn't your problem other possibilities could be bad code or bad
hardware. Make sure you aren't doing more than you need to when it comes to
drawing your scene. Object graphics requires a decent graphics adapter to
render all but the simplest of scenes quickly so if you are stuck on an slow
machine reduce the complexity of your models as much as possible (use the
orb's DENSITY keyword).


You may also want to take a look at my camera object. Spice up that project
by moving the viewer thru the solar system. It probably would simplify the
creation of the stereographic views too. I have been wanting to try this
with a couple of LCD projectors with polarized glasses and lenses for a long
time but haven't gotten around to it. Maybe you can put your classmates to
shame by presenting your project in this way. Just get back to me and let
me know how it went :)

http://www.acoustics.washington.edu/~towler/



> Also, we would like to have a globe, which is internally lit, representing
> the sun. However when we placed a light source inside the orb, its surface
> remained unlit though the other objects were properly lit. Is there any
> simple way of solving this?

Lights don't illuminate the back sides of polygons which is why your sun is
dark whilst your planets are illuminated. Just position another light so
that it illuminates your sun. David's suggestion of a directional light
oriented towards the sun is good. If you use my camera object you can query
it for the viewing vector and use that to orient your light. Easy, if you
can get away with a "headlight" setup where the light is positioned the same
place as the viewer. If a planet passes between the viewer and the sun you
won't be able to do this because the headlight will shine on the dark side
of the planet so you'll need to do some extra math to place the light on the
view vector inside the smallest orbit.

Do keep your lights to a minimum. Depending on your hardware they can be
costly additions.

-Rick
Re: 3d graphics [message #34163 is a reply to message #2845] Mon, 24 February 2003 10:12 Go to previous message
Karl Schultz is currently offline  Karl Schultz
Messages: 341
Registered: October 1999
Senior Member
"Dan Madeira" <d.madeira@ucl.ac.uk> wrote in message
news:b3blob$j42$1@uns-a.ucl.ac.uk...
> Hi all,
>
> I'm doing a undergrad group project where we have to use IDL to code a
> sterographic representation of the solar system. However we have no prior
> knowledge of this language, and so we are a little bit stuck....
>
> We have drawn four globes representing the Earth, moon, mars and the sun
> using the `orb` procedure, and then used a for loop to translate the
globes
> according to a specified orbit, redrawing the view in both the right view
> and left view widgets each time. However this results in a large lag
between
> each update, which ruins the steroscopic effect. Has anyone got any ideas
of
> a faster technique?

The orb object creates an orb that has a fairly large number of facets or
polygons. You can use the DENSITY keyword on the orb object to reduce the
number of polygons in an orb, which will increase rendering speed at the
expense of orb quality. You'll have to play with this value to get to a
setting that gives you the best compromise between speed and quality.

A faster graphics card will also help. Make sure that you are using
hardware rendering if you have a good card.

David's suggestion of capturing frames and playing them back is good if you
still can't get it to run fast enough.

How large are your views? Sometimes large windows take a long time to draw
because of the clearing operation between draws. Again, a better graphics
card helps here.

> Also, we would like to have a globe, which is internally lit, representing
> the sun. However when we placed a light source inside the orb, its surface
> remained unlit though the other objects were properly lit. Is there any
> simple way of solving this?

I'd try using a spot light. Place it inside of the orbit of the innermost
planet, on a line between the viewer and the sun. Aim it at the sun. Keep
the spot cone as close as you can to the extent of the sun orb. This won't
light the back of the sun, but you can't see that anyway. If some of the
light gets past the sun and hits a planet on the other side of the sun, the
effect of that light will not be that noticable, since the planet will be
getting lit anyway by the light inside the sun.

Hope this helps,
Karl
Re: 3d graphics [message #34169 is a reply to message #2845] Sun, 23 February 2003 18:54 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Dan Madeira (d.madeira@ucl.ac.uk) writes:

> I'm doing a undergrad group project where we have to use IDL to code a
> sterographic representation of the solar system. However we have no prior
> knowledge of this language, and so we are a little bit stuck....
>
> We have drawn four globes representing the Earth, moon, mars and the sun
> using the `orb` procedure, and then used a for loop to translate the globes
> according to a specified orbit, redrawing the view in both the right view
> and left view widgets each time. However this results in a large lag between
> each update, which ruins the steroscopic effect. Has anyone got any ideas of
> a faster technique?

This isn't that class with Professor Machiavelli, is it?
This seems just a tad too ambitious for someone with
no IDL experience. :-(

In any case, I think you are going to want to capture
your drawings as images and animate them in something like
XInterAnimate. I presume you are using object graphics,
so you can use the READ method on the window (or draw widget)
to take a snapshot of the window. Then get the actual image
data out of the image object you create. You can use the
image data as input to XInterAnimate.

> Also, we would like to have a globe, which is internally lit, representing
> the sun. However when we placed a light source inside the orb, its surface
> remained unlit though the other objects were properly lit. Is there any
> simple way of solving this?

I don't think so. Or, I should say, I didn't come up with
anything in a couple of hours of fooling around with it.
It seems like there should be a way, but the surface of
the orb object (a polygon object) seems opaque to the light
source inside. I even tried adding a texture map to the orb
and allowing alpha transparency. I can manage to see other
things inside the orb, but not the light. :-(

I thought about putting a directional spotlight just
outside the surface of the "sun" object and rotating it
so that it always points to the viewer's eye, but I'm trying
to get a life and this seemed like WAY too much work!

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Upgrade the 'double' accuracy in IDL 5.5
Next Topic: Reading a table of data quickly

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

Current Time: Wed Oct 08 16:01:00 PDT 2025

Total time taken to generate the page: 0.00783 seconds