Not logged in, Join Here! or Log In Below:  
News Articles Search    

Submitted by Joshua Shagam, posted on September 16, 2000

Image Description, by Joshua Shagam

Inspired by a number of things (such as a recent discussion regarding the Lights & Shadows demo contest and a recent IOTD with some one-bit graphics), I decided to finally get around to do a couple of scenes with my engine ( which simulate ultra-hard lights.

Nothing fancy, nothing special code-wise here, I just felt like being kinda artistic-ish for a change. Oh, and for the technical info: those shadows are all done with stencil-based shadow volumes, and the screenshot was running at 5fps (I had my tesselation turned up as high as possible for those objects). No modifications were made to the engine to produce these results, I simply removed all specular lighting and textures and set my lightsource's color to 1000,1000,1000. It's a simple but effective trick I hope to take advantage of in any actual game I end up making with this engine.

Oh, and yeah, I know there's some pixel gaps in my shadow volumes. I've been trying to fix that for quite some time now, thanks. ;) Actually, if anyone has any insights, they'd be greatly appreciated. The situation under which they're happening SHOULD be covered by the OpenGL invariance rules, but I'm not positive about that.

Joshua Shagam

Image of the Day Gallery


Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
Timothy Barnes

September 16, 2000, 02:54 AM

That looks weird and blurry. It's weird though. Is it cartoon rendering?

Pablo de Heras Ciechomski

September 16, 2000, 08:34 AM

Cool. You just raised the barr for low-bit graphics :)



September 16, 2000, 09:18 AM

Cool screenshot.

It does look cartoony. I think this is because of the ~1bit shading and the dark outlines around objects. Are those an artifact of the image compression, or are you really rendering them? I like this look a lot.

Does anybody know where I can find some source or a really in-depth description of the shadow buffer algorithm everyone is using? I know the basic concept, but I've never done it myself and would like to try.


The Wolf

September 16, 2000, 09:31 AM

cool, I like how it is projected onto a corner an not just the ground.


September 16, 2000, 09:59 AM

it does look kind of cartoony but I think that's because of the colors, but it doesn't look blurry to me, nor does anything have dark outlines... only the hard shadows


September 16, 2000, 01:36 PM

It's not technically cartoon rendering - again, it's just rendering with the lights turned up to 1000*white. :)

morgan: Unfortunately, those edges are an artifact of the image compression as you guessed. There's a reason I always submit my images as PNG, but I guess Kurt doesn't like the added bandwidth for that (even though the PNG is usually smaller in the case of solid colors). However, someday I was planning on adding in true cartoon rendering (i.e. putting the outlines around it) by using my shadow volume producing code (which operates in O(n) time for n polygons - yes, someday I'll get around to finishing a paper on this like I've been promising for almost a year now).

wolf: Well, they're not groundplane shadows, they're shadow volumes. They can be projected however they want - notice the shadows on the objects. Those are completely implicit with shadow volumes. Oh, and none of the lighting is precalculated - no lightmaps or anything (if I were to move the light, the shadows would immediately follow).

pablo: But that was all done using 32-bit RGBA and an 8-bit stencil buffer, I swear! :) It only looks low-bit...


September 16, 2000, 04:00 PM

Oh, and Morgan, sorry for missing your question about the shadow algorithms... I'm not using shadow buffers (I'm actually not sure what you mean by that - per-light zbuffers?), I'm using shadow volumes, which require a stencil buffer (preferrably more than one bit). The basic idea is that you render the scene with only ambient/non-shadowing/etc. lights, extend a shadow volume (i.e. an object describing the object's shadow as a solid with respect to the light) and intersect it with the zbuffer in order to set up a mask in your stencil buffer, then you render the scene with that light.

Mark Kilgard's written up a nice tutorial on it, though his method for calculating the shadow volume is quite slow and has a few rather crippling limitations (like, the light has to be outside the object, and you have to be using a complete implementation of GLU 1.2). A naive approach is to generate one shadow volume per polygon in your objects, but that generates 2+n polygons per n-gon, so in a typical model of 600 triangles you end up with 3000 shadow polygons - hardly useful.

My method operates in O(n) time and puts out a near-optimal shadow volume, though it does require a specific mesh representation scheme (which I use everywhere in my engine). Its excess polygon count is O(sqrt(n)) on average (though for pathological geometry it could conceivably get up to O(n), but that's only a very limited case).

Again, I'll someday get around to finishing a paper I'm writing on my 'miracle' geometry scheme. Or I might put it off even longer and turn it into my dissertation or something. :) This is the same mesh representation scheme which allows me to do arbitrary LOD resampling in O(n) time for n polygons on the output, and other cool shit like that. It's also one of those things which seems incredibly freaking obvious once you've seen it, which is why I'm being so secretive about it until I can get a claim to it by writing a paper...


September 17, 2000, 04:44 AM

A new screenshot - enjoy.

Basically, I hacked in the cartoon rendering stuff I mentioned above. :) I would have included shadows in the screenshot too but for some reason an 'improvement' I made to it (after the original 30-second hackjob) broke having shadows and cartoon outlines at the same time.

Oh, and that was done at 15fps. It would have been the same if it weren't fullbright-white. :)


September 17, 2000, 04:54 AM

Heh, I fixed the shadow issue, and here's another screenshot from another scene (no shadows on this one either, though, but trust me, they work together). Wow, the Solace renderer now has a bunch of extra cruft in it which is still cool (wireframe rendering, cartoonish outlines, etc)...

I wonder if maybe I should specify cartoon outlines on a per-object basis. I know that it'd be cool if someone could play a cartoon character and show up as a cartoon while nobody else does. As a per-object attribute does seem like a good idea in that respect... but what if someone wants to make a cartoon environment and have everything appear cartoony? Maybe it should be on a per-room basis. I suppose there's always both... hurm.

Right now it's either on for all objects or off for all objects. It's a renderer option. Whee.

Okay, I think that's enough for me now. Goodnight everyone.

This thread contains 9 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.