by Spike » Mon May 04, 2015 5:10 pm
I'm not sure that I understand.
which clipping algorithm do you refer to? the software renderer clipping polys to the screen/each other to avoid overdraw, or the opengl-esque workaround for the lack of fragment programs/cubemaps? if the former then you've completely lost me, if the latter then WHY?!?!?
as I see it, its just a single cubemap lookup. these things are fully opaque, there's no need to use additional passes (assuming that colour and depth writing are conceptually different aspects of the same pass).
presumably if you splice D_DrawSkyScans8 a little, you should be able to determine the s+t+face values for the start+end pixels for each span, and subdivide until they're the same skybox face, and then just sample from that face as you would any other texture (subdiv 16 or whatever for perspective correction). there's no scrolling textures/dual layer textures to contend with either. really all you need is the screenspace coords and the worldspace-eye coords, and the cubemap/2d texture array that you're sampling from.
zero overdraw (well, unless you have shamblers, anyway).
Ages ago, before I even started FTE, I had a software renderer that would simply not draw colour for skies (still drew depth). This meant that I could draw a skyroom, then the regular room, and you'd have a portal type thing you could see the skyroom through.
fun times.
q3 has 'RT_PORTALSURFACE' entities. if you had the same you could pvs+frustum check them in advance so that you'd know whether you need to generate that skyroom first or not.
If you want to get all fancy, you can clip (viewport or whatever) that skyroom to the portal's bounding box to avoid excessive overdraw. you can then figure out the viewmatrix required to transform the far side according to the viewing angle+relative position to the portal surface. you do tend to need to generate an extra frustum plane for the far-side scene in order to avoid weird geometry entering the near side.
and if you want to get even more fancy, you can draw that view to some texture, figure out the texture coords for the view and then reuse them any other times you see that portal through another portal.
the physics is a different matter, as you need some kind of csg subtraction for collisions, such that your view is allowed to actually cross the portal plane gracefully (FTE has solid_portal for this sort of thing, which provides both the csg thing and automatic teleports for engine physics when the central point of a trace crosses the plane).
*cough*
urr, yeah, skybox = simple cubemap. yup. that's all I have to say.
.