reanjr Posted July 29, 2003 Posted July 29, 2003 Has anyone tried/had any success with using the Stencil Buffer to do Translucency. The primary benefit as I see it would be that you wouldn't have to render polygons behind a transluscent object prior to rendering the transluscent object. It seems like this would be a viable way of doing a front to back method of transluscency, but I've never heard of it, so I was wondering if anyone else has seen it done. Quote
*Experts* Nerseus Posted July 31, 2003 *Experts* Posted July 31, 2003 I've never seen it tried, though I've only studied the basics of the stencil buffer. I would think using the built in alpha channel transparency (to do transluncey, like cloudy windows) would be easier, and probably supported better. Plus you could use pixel shaders to do even more complex translucency (if the card supported it). As you pointed out, it would require sorting polygons to work right, but you should already be doing that, right? :) -Ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
reanjr Posted August 1, 2003 Author Posted August 1, 2003 I was actually hoping to sort them the other way. If you draw from front to back, then alot more polygons will be cut out due to the z-buffer; you would only draw to each pixel once. I wanted to play around with the idea for performance reasons. It seems that a scene with only a few translucent polygons would render better front to back with a stencil buffer, while one with lots of translucent polys would run better back to front with the more efficient alpha. In addition you could play with only doing real easy (processor wise) sorts and not worrying about testing certain polys which may or may not be an efficient way of doing things, I'm not sure. I was just kind of floating the idea around and wondering if anyone else has tried it or thinks it might work in some cases. For instance what I am working on right now will rarely have translucency, so it would be nice to be able to speed up the rest of the engine for when there aren't. It's still in the early stages which is why I haven't really tested the theory. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.