Re: Z-Buffer question [message #8292 is a reply to message #8214] |
Wed, 19 February 1997 00:00   |
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.
|
|
|