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

Home » Public Forums » archive » Z-Buffer question
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
Z-Buffer question [message #8214] Wed, 19 February 1997 00:00 Go to next message
rew032 is currently offline  rew032
Messages: 14
Registered: July 1996
Junior Member
Hello!

I have a question during using the Z-Buffer:

IDL> shade_surf, dist(20)
IDL> surface, dist(20), /noerase
IDL> a=tvrd()
IDL> set_plot, 'x'
IDL> tv, a
IDL>

This is an example, what I do. But the result is :((, because I get the surface-
lines not all very clean, at some places, they are gone away.

Want I want to get is a picture, same as without using the z-buffer. There I can
see all the lines from the surface very clear, without broken parts.

But because of other things, I have to use the 'awfull' z-buffer....

I read all the articles about the z-buffer contest, but I understand nothing... :(((((
(I am a beginner user of IDL).

Can anybody help me?

Regards, Astrid Kuhr

--
Forschungszentrum Juelich GmbH
Re: Z-Buffer question [message #8261 is a reply to message #8214] Fri, 21 February 1997 00:00 Go to previous message
Robert Moss is currently offline  Robert Moss
Messages: 74
Registered: February 1996
Member
David Fanning wrote:
>
> I've seen this reductionist tendency before. But, of
> course, this doesn't go far enough. We could have
> left the whole Z-buffer completely out of it! :-)
>

We could have, but Kuhr wrote:
>I have a question during using the Z-Buffer:


> The only *problem* with this line of reasoning, so
> far as I can see--but you understand I got a Ph.D. in
> Biochemistry--is that without the Z-buffer we don't
> have much of a question here. I just presumed there
> was some reason the guy was fooling around in there,
> but he wanted us to see the essential part of the problem.
>

Well, just for the record, I based my "reductionist" answer on the
following clue from Astrid Kuhr's original post:

Astrid Kuhr wrote:
>(I am a beginner user of IDL).

I took this to mean that Kuhr may not have been familiar with the
Z_BUFFER keyword to the DEVICE routine.


Astrid Kuhr wrote:
>Want I want to get is a picture, same as without using the z-buffer.

Perhaps I assumed incorrectly that Kuhr may have been using the Z device
simply to avoid using the screen (as in a batch process, for example).


> Well, the other possible moral is that more of us should
> have paid attention during that reductio absurdo (I skipped
> the Latin class) lecture in Philosoply 101. :-)
>

Well, the moral for me is to be sure not to specifically mention
anyone when I post replies if I am going to post something that may
be taken as some kind of criticism.


--
Robert M. Moss, Ph.D. - mossrm@texaco.com - FAX (713)954-6911
------------------------------------------------------------ -----
This does not necessarily reflect the opinions of Texaco Inc.
Re: Z-Buffer question [message #8274 is a reply to message #8214] Fri, 21 February 1997 00:00 Go to previous message
Struan Gray is currently offline  Struan Gray
Messages: 178
Registered: December 1995
Senior Member
David Fanning, davidf@dfanning.com writes:

> An excellent job, Struan. Thanks for letting us in on
> the secrets.

Thanks for the plug. I'll post a more complete announcement to the
newsgroup when I've added the example code. For now the presentation
of the ideas is complete but the only way to try them out in IDL is
to cut and paste all code snippets from the pages in sequence. I welcome
comments and bug reports (IDL or html) from people, but for the moment
bear in mind that the pages are not quite finished. I'd of kept them
quite for now but the original question seemed best answered by a page
reference.

If anyone missed it, the URL is:

http://www.sljus.lu.se/stm/IDL/Surf_Tips/


Struan
Re: Z-Buffer question [message #8289 is a reply to message #8214] Thu, 20 February 1997 00:00 Go to previous message
brian.jackel is currently offline  brian.jackel
Messages: 23
Registered: May 1996
Junior Member
Here's my (horrible) fix for the problem of lines not
showing up (or being dashed) when using the Z-buffer.

Use THICK=3 when plotting the surface.

The result has lines just about everywhere that they're
supposed to be, and doesn't look too smeared. THICK=4
or =5 makes all the lines show up, but it looks like it was
drawn with a crayon, so that's not so hot.


Brian Jackel
Re: Z-Buffer question [message #8290 is a reply to message #8214] Thu, 20 February 1997 00:00 Go to previous message
Struan Gray is currently offline  Struan Gray
Messages: 178
Registered: December 1995
Senior Member
A.Kuhr, rew032@isr141.isr.kfa-juelich.de writes:

[SURFACE routine's z-buffer woes deleted]

> Can anybody help me?

I'm just putting the finishing touches to a surface
plotting tutorial:

http://www.sljus.lu.se/stm/IDL/Surf_Tips/

which describes another way round this problem. The
idea is to plot just the grid and then use that as a mask
to overlay or extract information on/from other pictures.
See the web page for more detail.


Struan
Re: Z-Buffer question [message #8292 is a reply to message #8214] Wed, 19 February 1997 00:00 Go to previous message
Robert Moss is currently offline  Robert Moss
Messages: 74
Registered: February 1996
Member
David Fanning wrote:
>
> Astrid Kuhr writes:
>
>
>> This is an example, what I do. But the result is :((, because I get the
> surface-
>> lines not all very clean, at some places, they are gone away.
>> Want I want to get is a picture, same as without using the z-buffer.
> There I can
>> see all the lines from the surface very clear, without broken parts.
>
>> IDL> shade_surf, dist(20)
>> IDL> surface, dist(20), /noerase
>> IDL> a=tvrd()
>> IDL> set_plot, 'x'
>> IDL> tv, a
>> IDL>
>
> Well, let me say upfront that I don't believe there *is* a
> real solution to this.

Sorry David, but at least for this simple example there is a real
solution. You'll probably kick yourself when I tell you what it is...


> I think the problem really has to do with
> "round-off" error in how the Z-buffer calculates what is in
> front of something else, when the two objects have the
> same value.
>

I suspect that this is true.


>
> So what I have done in the past in similar situations is
> incorporate a "fudge factor" into my code. (Physicists
> will understand this.)

I think this is an insult, but I'll let it slide :P


So, what is this "real solution" that I mentioned?
It's very simple... turn _off_ the Z buffering.

For this simple example, you'd do this:

thisDevice = !D.Name
colors = !D.N_Colors
SET_PLOT, 'Z'
DEVICE, Set_Resolution=[300,300], Set_Colors=colors, z_buffer=0
SHADE_SURF, DIST(20)
SURFACE, DIST(20), /NoErase
picture = TVRD()
SET_PLOT, thisDevice
WINDOW, XSize=300, YSize=300
TV, picture

Voila! The exact same output that you would have seen had you used
the X device. The moral of the story is simple... if you don't
specifically need 3D hidden line removal, don't use it.



--
Robert M. Moss, Ph.D. - mossrm@texaco.com - FAX (713)954-6911
------------------------------------------------------------ -----
This does not necessarily reflect the opinions of Texaco Inc.
Re: Z-Buffer question [message #8295 is a reply to message #8214] Wed, 19 February 1997 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Robert Moss writes:

> So, what is this "real solution" that I mentioned?
> It's very simple... turn _off_ the Z buffering.

You wouldn't be a physicist would you, Robert?
I've seen this reductionist tendency before. But, of
course, this doesn't go far enough. We could have
left the whole Z-buffer completely out of it! :-)

The only *problem* with this line of reasoning, so
far as I can see--but you understand I got a Ph.D. in
Biochemistry--is that without the Z-buffer we don't
have much of a question here. I just presumed there
was some reason the guy was fooling around in there,
but he wanted us to see the essential part of the problem.

> Voila! The exact same output that you would have seen had you used
> the X device. The moral of the story is simple... if you don't
> specifically need 3D hidden line removal, don't use it.

Well, the other possible moral is that more of us should
have paid attention during that reductio absurdo (I skipped
the Latin class) lecture in Philosoply 101. :-)

I appreciate the correction though. As usual, you are
absolutely right!

Cheers!

David

-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
2642 Bradbury Court, Fort Collins, CO 80521
Phone: 970-221-0438 Fax: 970-221-4762
E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
-----------------------------------------------------------
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Running time display
Next Topic: A faster way to INTERPOL

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

Current Time: Wed Oct 08 15:21:19 PDT 2025

Total time taken to generate the page: 0.00643 seconds