[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Image plot on back wall

raouldukey@my-deja.com (raouldukey@my-deja.com) writes:

> I thought it would be easy to modify the Show3.pro
> routine to place the image plot on the back wall
> of the cube instead of the floor.  However, after
> struggling with it for a long time, I find that
> I am totally confused by the multiple coordinate
> transformations made.  Has anyone got
> some tips on how to do this?
> What I would like
> is to create the cube with the shaded surface
> command, work out the coordinates of the back
> wall, and use polywarp to work out where to
> project the image.  Then, afterwards replace
> the shaded surface on the floor of the cube.
> I know....I know.....I need to learn object
> graphics.  Any tips would be appreciated!

Well, after telling someone the other day,
"Oh, it would be simple with object graphics.",
I decided to see how simple it would be.


There are just one or two gotchas here that make
life a wee bit difficult at times, starting with
the fact that the documentation is wrong--again.
However, this is the same wrongness I uncovered
in another long, frustrating day not too long ago,
so I think I can now safely offer this rule of 
thumb: if the documentation says you can do something
in object graphics with a 2D image, the documentation
is almost certainly wrong. In any case, before you
spend three hours making life miserable for the poor
dog, try it with a 24-bit image. Life will be easier
that way. 

OK, so we think we can approach this by rotating
the object image (24-bit, please), but it ain't
so. Images don't rotate in object graphics. (The
documentation does point this out, somewhere.)
So, no problemo. We're gonna make a polygon 
object and add the image to it with the Texture_Map
keyword. I've used this for surfaces and it
works like a champ. Very easy.

Except...How come my image is black? :-(

Ah, I need a 24-bit image. Did I mention this?

Ok, 24-bit image, texture map, rockin' and rollin' now.
Except...oough. Still black. Well, not *midnight* black,
but black enough. Let's see. What about if I put the
image here, instead of where I really want it. Humm.
Not so black. What about there? Only black on one
side, but not too bad on the other. Only problem
now is that it's across the street from where I want
it. :-(

OK, must be a light problem. Add a light to the image.
(Why didn't I think of this? Every picture in an
art gallery has a light above the image to illuminate
it. Stupid.) Whoops! Wrong kind of light. Add
*ambient* light there, Jose.

All right! The image is looking gooood. Try to put
a shaded surface in front of it. Uh, oh. That 
surface was also looking good before I added that
damn light to see the image. Now it looks like I've
got the stadium lights shining on the surface.
Sure enough. If you want a shaded surface, better
turn the image lights off...

And so it goes. I'm looking for my slide rule right
now so I can calculate the optimum distance and viewing
angles for the lights in the scene. While I futz around
with it, you might want to look at a simple example
of what I came up with. You can find it here:


In the end, I pretty much decided this is not going to
be what you had in mind. But that's how it goes some
times. Another day, another ... well, dollar's not
right. Another story, I guess. Better than nothing,
and a whole lot more entertaining for the paying
customers. :-)


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