[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Glowies and the Z-buffer.
- To: email@example.com
- Subject: Glowies and the Z-buffer.
- From: "Adam D. Moss" <firstname.lastname@example.org>
- Date: Fri, 01 Nov 2002 16:25:50 +0000
- Delivered-To: email@example.com
- Delivered-To: mailing list firstname.lastname@example.org
- Delivery-Date: Fri, 01 Nov 2002 11:25:26 -0500
- Mailing-List: contact email@example.com; run by ezmlm
- Reply-To: firstname.lastname@example.org
- Sender: email@example.com
I was playing Descent 3 (on linux, of course) again recently
and was again impressed at how visually impressive the engine
was for a ~1998 game.
This time I was paying more attention to exactly what they're
doing to enhance the visuals.
One thing I noticed was an early use of the now-ubiquitous
There are two ways to do these (and both are arguably correct
depending on the real-world effect you are trying to emulate):
1) Cast a ray from the world's glowing point to the eye
origin, and if it reached the eye without being obscured then
draw a blurry glow-spot (and some lens-flare if you have no
pride) at roughly the point where this ray meets the near clipping
plane. This can be quite expensive but allows the edges of the
glow to obscure objects which are nearer than the glowing point,
simulating an artifact of the virtual eye's lens.
2) (cheaper) Draw the glow-spot in world-space over where the
glowing point (e.g. light) is, billboarded to face the eye.
You don't get the correct fringing of the glow's edges on the
near-plane as if the effect were happening in the virtual lens,
but this is cheap and people are likely to value this effect more
than effect 1)'s drop in frame-rate... Also it's not
an incorrect approach if your glow is just meant to model
a diffusion of light through fog at the source.
My question is this: given approach 2) (and that the renderer
already deals with Z-sorting of blended objects), can anyone
think of a nice way to ensure that the billboarded glow-spot
won't Z-buffer away its fringes if they poke into solid objects
nearby? I could disable Z-testing when drawing glowiest but
I'd have to then draw my whole scene roughly back-to-front.
Don't want to. I think that Descent3 possibly does this
because its glowies seem perfect.
Best I can come up with is to pull the glowies towards the
eye a little (either with glPolygonOffset [negative offsets
are okay, right?] or by just shifting the X,Y,Z) but that carries
the (small) risk of pulling them through an object that would
otherwise have obscured them - ugh.
Adam D. Moss . ,,^^ firstname.lastname@example.org http://www.foxbox.org/ co:3
"You could make a mince pie mountain and
carve yourself a lair inside to live in."