Advertisement

How do you write directly to the z-buffer in hardware?

Started by November 09, 1999 02:50 PM
3 comments, last by SnowMonster 25 years, 4 months ago
With some cards, you may be able to Lock() and modify the surface directly. However, this is a very bad idea, it'll cause the pipeline to flush, meaning the Lock() will take forever while waiting for all previously submitted primitives to be drawn, and thus a performance hit. Also, not all cards let you lock the Z-Buffer.

So, it may be possible, but you shouldn't do it.

Why do you want to render a primitive yourself instead of letting hardware do it for you?

To add voxel support to the CrystalSpace engine, while still being able to use the hardware for triangles.
Advertisement
Is there a way to draw 3D points quickly, and check the z-buffer value?
How do you write directly to the z-buffer when using hardware accelleration? Is it possible, given a 3D point to transform and display it myself, writing directly to the primary surface and z-buffer? Someone told me it wasn't possible without displaying some kind of primitive.

How is it done in D3D?

In OpenGL?

In Glide?

I'd be interested in knowing about this too - Suppose you want to do a lens flare for a bright light, and you need to know whether the light is visible.. Well you can transform the light's coordinates and tell whether or not it's on the viewport, but is there a way to tell if something in your scene is obstructing it via the zbuffer? (I looked but didn't find anything about it)
-ns

[This message has been edited by NightShade (edited November 09, 1999).]

-ns-

This topic is closed to new replies.

Advertisement