On Monday 31 July 2006 12:05 am, Ben Everett wrote: > Consider the most-likely complex case (rendering wise) of an entrance > portal in front of the player, and the exit portal behind the player. > First, this would seem like an "infinite loop" problem, while I beg to > differ. One, you probably know the rough block of the "portal", which can > be seen as a decal (for shits and giggles, we'll just say it's a "64x64 > block"). Now this block can consist of a texture that is color keyed > (magenta, for example), so then you can just see a huge ol' magenta 64x64 > block on the wall. Now you setup different render targets, in this case > rendering to textures with a camera and view matrix setup to properly catch > everything that it'd "see". You'd render this to texture, and do the same > for the other portal. You'd then pass these two textures into a shader that > would allow for certain effects depending on the color key it encounters. > As you would keep running into areas (in the nested case) of there being > more magenta pixels, you could keep looping/scaling/mip-mapping these > pixels into oblivion. Eventually, no magenta pixels would remain.
Call me a computer scientist, but I don't like color keys. They're just... too inelegant. In any case, I think color keying by itself would not work right. In the recursive case, you can't just render each portal once and somehow "mix" the images, in a shader or otherwise. Let's take the example where you're looking into input portal A out of output portal B, which recursively views portal A. The view of portal A, as seen in "normal" view, will differ from the view of portal A as seen through portal B, as the camera angles are different. No amount of shader magic will fix such an issue of differing angles; you're guaranteed the need to render the portal twice. Or more, depending on the level of recursion. This makes me think that a stencil-buffer-based scheme is actually more plausible. Stencil buffers, and dependency graphs. How you populate that dependency graph is another matter... -John Sheu _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders