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

Home » Public Forums » archive » Re: Z-Buffer question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Z-Buffer question [message #8211] Wed, 19 February 1997 00:00
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Astrid Kuhr writes:

> I have a question during using the Z-Buffer:
> I read all the articles about the z-buffer contest, but I understand
nothing... :(((((

Well, you are in good company here, Astrid. I am still trying to puzzle out
that solution George sent in. :-)

> 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. 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 say this because I don't want to get a ton of e-mail about
my proposed solution to your problem. I *know* it is not
a perfect solution. I *know* it sometimes makes the
situation worse and not better. Etc. etc. (I'm open ears
for a *better* solution, however!)

So what I have done in the past in similar situations is
incorporate a "fudge factor" into my code. (Physicists
will understand this.) What I try to do is "raise" the
second surface just ever so slightly off the first.

I will admit that this doesn't always work, but it has
worked often enough for me in the past that I remember it
when someone asks the question. So here is how I would
try to solve your example problem:

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

Even this simple example introduces artifacts that may be
undesirable. For example, now I don't see any surface lines
drawn on the "under" surface of the shaded plot. (I might
be able to correct this by *subtracting* a fudge factor
and drawing still another surface.)

Anyway, here is a *suggestion*, not a *solution*. :-)

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
-----------------------------------------------------------
[Message index]
 
Read Message
Previous Topic: write_mpeg.pro
Next Topic: Constructing Color Tables in IDL

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

Current Time: Wed Dec 03 15:09:55 PST 2025

Total time taken to generate the page: 2.47139 seconds