making a better texture managment system for tenebrae
Re: making a better texture managment system for tenebrae
http://code.google.com/p/realm/download ... z&can=2&q=
First release version.
Added hardware gamma (probably needs to have some sort of contrast as it tends to make the colors wash out) curtesy of fitzquake.
Added more light types to the rt_lights. light_fluoro etc.
Reordered skybox code (pushed it back where it belongs and it works fine so i dunno why they moved it out in the first place).
First release version.
Added hardware gamma (probably needs to have some sort of contrast as it tends to make the colors wash out) curtesy of fitzquake.
Added more light types to the rt_lights. light_fluoro etc.
Reordered skybox code (pushed it back where it belongs and it works fine so i dunno why they moved it out in the first place).
Productivity is a state of mind.
Re: making a better texture managment system for tenebrae
http://code.google.com/p/realm/download ... z&can=2&q=
compiled version for those unlucky enough to not be coders drop in yer quake folder and fire it up, hopefully it wont crash (unconfirmed)
nah its pretty stable but some mods do crash with it. mostly the speedrun ones.
compiled version for those unlucky enough to not be coders drop in yer quake folder and fire it up, hopefully it wont crash (unconfirmed)
nah its pretty stable but some mods do crash with it. mostly the speedrun ones.
Productivity is a state of mind.
Re: making a better texture managment system for tenebrae
Im beating my head on one last bugger.
Tenebrae is unable to use the glquake depth hack to avoid having models poke through walls. The problem is that the model gets pushed out of its space as far as i can see so bumpmapping stops working on view models cause theres no light ever hitting them. It also affects shadows from time to time but not to the same degree.
I wonder how LH got around that one ?.
Oh and a weird one... i tried using MH's water warp from his GL_Perspective function but it seems not doing anything in tenebrae it works everywhere else though.
Tenebrae is unable to use the glquake depth hack to avoid having models poke through walls. The problem is that the model gets pushed out of its space as far as i can see so bumpmapping stops working on view models cause theres no light ever hitting them. It also affects shadows from time to time but not to the same degree.
I wonder how LH got around that one ?.
Oh and a weird one... i tried using MH's water warp from his GL_Perspective function but it seems not doing anything in tenebrae it works everywhere else though.
Productivity is a state of mind.
Re: making a better texture managment system for tenebrae
Tenebrae might load it's own custom projection matrix at some point which would explain the waterwarp.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
Re: making a better texture managment system for tenebrae
hmm aye that might explain it.
Productivity is a state of mind.
Re: making a better texture managment system for tenebrae
Ouch aye it has several actually guess i need to find another way to make this possible.
Cleaned up some more and removed the Q2 stuff.
Working on creating project settings with openal and sdl, and going to yank in fitz video menu.
Removed the lcd code.
Modified V_CalcBlend and renamed V_Updatepalette to V_UpdateBlend acoording to fitzquake.
Moved GL_PolyBlend to view.c and renamed it to V_PolyBlend (now uses glOrtho).
Starnge bug with V_PolyBlend encountered it needs to have glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); or else the sbar and pain flashes go totally bonkers.
Renamed several occurences of local vars that where shadowing global ones.
Encountered a new bug also it seems. The mirror shader works as i can see the projection on walls but it stopped projecting on the haze effect hmmm ???.
And not a bug but tenebraes md3 armor model looses it skin in some maps, this is not a bug but is caused by tenebrae not having skin support for md3 (only one skin so if quake tries to draw a red armor it just cannot find its skin cause theres only the same and it has no index). Gonna look at joequakes md3 skin support to see if i can cook something up.
Cleaned up some more and removed the Q2 stuff.
Working on creating project settings with openal and sdl, and going to yank in fitz video menu.
Removed the lcd code.
Modified V_CalcBlend and renamed V_Updatepalette to V_UpdateBlend acoording to fitzquake.
Moved GL_PolyBlend to view.c and renamed it to V_PolyBlend (now uses glOrtho).
Starnge bug with V_PolyBlend encountered it needs to have glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); or else the sbar and pain flashes go totally bonkers.
Code: Select all
void V_PolyBlend (void)
{
if (!gl_polyblend.value) return;
GL_DisableMultitexture();
glDisable (GL_TEXTURE_2D);
glDisable (GL_DEPTH_TEST);
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glMatrixMode(GL_PROJECTION);
glLoadIdentity ();
glOrtho (0, 1, 1, 0, -99999, 99999);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity ();
if (vid_blend[3])
{
glColor4fv (vid_blend);
glBegin (GL_QUADS);
glVertex2f (0, 0);
glVertex2f (1, 0);
glVertex2f (1, 1);
glVertex2f (0, 1);
glEnd ();
}
glDisable (GL_BLEND);
glEnable (GL_ALPHA_TEST);
glEnable (GL_TEXTURE_2D);
}
Encountered a new bug also it seems. The mirror shader works as i can see the projection on walls but it stopped projecting on the haze effect hmmm ???.
And not a bug but tenebraes md3 armor model looses it skin in some maps, this is not a bug but is caused by tenebrae not having skin support for md3 (only one skin so if quake tries to draw a red armor it just cannot find its skin cause theres only the same and it has no index). Gonna look at joequakes md3 skin support to see if i can cook something up.
Productivity is a state of mind.
Re: making a better texture managment system for tenebrae
Hopefully someone can comment on this.
cleaned up and calculated a normal that takes backfacing into acc. (mh's work actually).
some problems here unfortunatly (atleast i think its here) tenebrae was using the mirror shader on windows to project light from the window on the haze effect (SURF_GLASS yeah the name stinks as its pretty hard to figure out what its supposed to mark). water mirrors work it i do out->flags & (SURF_MIRROR | SURF_WATER) but plats go invisible at some angles. it also has a weird effect at times where it reflects the sky even if theres no sky in that room.
One thing that was buggering me especially was that tenebrae assumed to mark mirrors in the turb texes but as far as i could see from the qc data its not prefixed with a turb * so i moved those parts out of the turb
check and instead marked them if we had both types needed to apply a mirror effect.
Code: Select all
void Mod_LoadFaces (lump_t *l)
{
dface_t *in;
msurface_t *out;
int i, count, surfnum;
int planenum, side;
in = (dface_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
{
Sys_Error ("MOD_LoadBmodel: funny lump size in %s", loadmodel->name);
}
count = l->filelen / sizeof(*in);
out = (msurface_t *) Hunk_AllocName (count * sizeof(*out), loadname);
loadmodel->surfaces = out;
loadmodel->numsurfaces = count;
for ( surfnum=0 ; surfnum<count ; surfnum++, in++, out++)
{
out->firstedge = LittleLong(in->firstedge);
out->numedges = LittleShort(in->numedges);
out->flags = 0;
planenum = LittleShort(in->planenum);
side = LittleShort(in->side);
if (side)
{
out->flags |= SURF_PLANEBACK;
}
out->plane = loadmodel->planes + planenum;
// Quake's normal is used for BSP tree traversal, but does not take backfacing
// into account, and so is inappropriate for OpenGL use. Here we calculate one that does.
if (side)
{
out->truenormal[0] = out->plane->normal[0] * -1;
out->truenormal[1] = out->plane->normal[1] * -1;
out->truenormal[2] = out->plane->normal[2] * -1;
}
else
{
out->truenormal[0] = out->plane->normal[0];
out->truenormal[1] = out->plane->normal[1];
out->truenormal[2] = out->plane->normal[2];
}
// make it unit length
Normalize (out->truenormal);
out->texinfo = loadmodel->texinfo + LittleShort (in->texinfo);
Mod_CalcSurfaceExtents (out);
// lighting info
for (i=0 ; i<MAXLIGHTMAPS ; i++)
{
out->styles[i] = in->styles[i];
}
i = LittleLong(in->lightofs);
if (i == -1)
{
out->samples = NULL;
}
else
{
out->samples = loadmodel->lightdata + i;
}
// set the drawing flags (tenebrae had some of these in the turb block but neither mirror nor glass nor caulk has a turb surface...)
if (ISMIRRORTEX(out->texinfo->texture->name)) // mirrors
{
out->flags |= SURF_MIRROR;
}
else if (ISGLASSTEX(out->texinfo->texture->name)) // glass
{
out->flags |= SURF_GLASS;
}
else if (ISCAULKTEX(out->texinfo->texture->name)) // caulk
{
out->flags |= SURF_CAULK;
}
else if (ISSKYTEX(out->texinfo->texture->name)) // sky
{
out->flags |= (SURF_DRAWSKY | SURF_DRAWTILED);
}
else if (ISTURBTEX(out->texinfo->texture->name)) // turbulent
{
out->flags |= (SURF_DRAWTURB | SURF_DRAWTILED);
for (i=0 ; i<2 ; i++)
{
out->extents[i] = 16384;
out->texturemins[i] = -8192;
}
GL_SubdivideSurface (out); // cut up polygon for warps
// set the content types here (might not match names in some mods so expect weirdness).
if (strstr (out->texinfo->texture->name, "tele") || strstr (out->texinfo->texture->name, "slip")) // teleport or slipgate
{
out->flags |= SURF_TELE;
}
else if (strstr (out->texinfo->texture->name, "lava")) // lava
{
out->flags |= SURF_LAVA;
}
else if (strstr (out->texinfo->texture->name, "slime")) // slime
{
out->flags |= SURF_SLIME;
}
else // water
{
out->flags |= SURF_WATER;
}
/* i hope mh can shed some light here ?.
draw mirrors in glass and water ?
mirror in water only worked when forced and broke plats.
projection on glass (haze actually weird name eh ?) has gone sigh... */
if (out->flags & SURF_MIRROR)
{
if (out->flags & SURF_WATER)
{
out->flags |= SURF_MIRROR;
}
}
if (out->flags & SURF_MIRROR)
{
if (out->flags & SURF_GLASS)
{
out->flags |= SURF_MIRROR;
}
}
}
}
}
some problems here unfortunatly (atleast i think its here) tenebrae was using the mirror shader on windows to project light from the window on the haze effect (SURF_GLASS yeah the name stinks as its pretty hard to figure out what its supposed to mark). water mirrors work it i do out->flags & (SURF_MIRROR | SURF_WATER) but plats go invisible at some angles. it also has a weird effect at times where it reflects the sky even if theres no sky in that room.
One thing that was buggering me especially was that tenebrae assumed to mark mirrors in the turb texes but as far as i could see from the qc data its not prefixed with a turb * so i moved those parts out of the turb
check and instead marked them if we had both types needed to apply a mirror effect.
Productivity is a state of mind.
Re: making a better texture managment system for tenebrae
http://code.google.com/p/realm/download ... z&can=2&q=
Oh its a beauty mirror shader still bitches at me but its getting there. Overbright not even needed now to make it look nice (and i do mean nice hehe just have a look)
kinda out of ideas to make some nicer caustics code so if any willing to lend a hand it would be nice. (newer tried creating caustics code for an engine using texture sorting and the old one had some nasty looking stuff )
Oh its a beauty mirror shader still bitches at me but its getting there. Overbright not even needed now to make it look nice (and i do mean nice hehe just have a look)
kinda out of ideas to make some nicer caustics code so if any willing to lend a hand it would be nice. (newer tried creating caustics code for an engine using texture sorting and the old one had some nasty looking stuff )
Productivity is a state of mind.
Re: making a better texture managment system for tenebrae
I can't get this one to work. It asks for libssp-0.dll?
Re: making a better texture managment system for tenebrae
whoops forgot to include that one
http://code.google.com/p/realm/download ... z&can=2&q=
unzip in your quake folder. remember you need tenebraes data pak just install the one from there site and use my executable.
http://code.google.com/p/realm/download ... z&can=2&q=
unzip in your quake folder. remember you need tenebraes data pak just install the one from there site and use my executable.
Productivity is a state of mind.
Re: making a better texture managment system for tenebrae
Thanks reckless!
Re: making a better texture managment system for tenebrae
after a lot of work im getting a bit stuck.
much of the code for bumpmaps and stuff is pretty sound but there where a few hickups in quakes normal drawing routine... elaborating.
the tmu shift for lightmaps where done wrong as they set GL_Texture1 but forgot to enable texturing so lightmaps looked dark as hell GL_EnableMultiTexture to the rescue and hello there lightmaps are now bright. sh_colormaps set texenv to modulate but its allready enabled at the top of the functions but heh luma and lightmap uses replace texenv so i had to change these.
good thing now is that it looks like it should for surfs but bmodels are now to dark and i seem to have introduced a bug in my rewrite somewhere because now plats and doors flicker wildly when theres dynamic light near them (also seems to affect monsters which get bad artifacts).
overbrights are not even needed now but i think the code in GL_Rsurf.c needs a total rewrite, possibly also some of the code in GL_Rmain.c.
oh and another bugger which tenebrae had from the start but only affected slime/lava before now its affecting water as well sigh (after diving in liquid the screen color goes red and refuses to change back untill map load) i suspect the fog code has something to do with that as the color seems to follow the color of the world fog but is very dense.
having someone else looking at the code would probably be the best help i could get even if they dont want to help do the rewrite ideas would help a lot.
much of the code for bumpmaps and stuff is pretty sound but there where a few hickups in quakes normal drawing routine... elaborating.
the tmu shift for lightmaps where done wrong as they set GL_Texture1 but forgot to enable texturing so lightmaps looked dark as hell GL_EnableMultiTexture to the rescue and hello there lightmaps are now bright. sh_colormaps set texenv to modulate but its allready enabled at the top of the functions but heh luma and lightmap uses replace texenv so i had to change these.
good thing now is that it looks like it should for surfs but bmodels are now to dark and i seem to have introduced a bug in my rewrite somewhere because now plats and doors flicker wildly when theres dynamic light near them (also seems to affect monsters which get bad artifacts).
overbrights are not even needed now but i think the code in GL_Rsurf.c needs a total rewrite, possibly also some of the code in GL_Rmain.c.
oh and another bugger which tenebrae had from the start but only affected slime/lava before now its affecting water as well sigh (after diving in liquid the screen color goes red and refuses to change back untill map load) i suspect the fog code has something to do with that as the color seems to follow the color of the world fog but is very dense.
having someone else looking at the code would probably be the best help i could get even if they dont want to help do the rewrite ideas would help a lot.
Productivity is a state of mind.
Re: making a better texture managment system for tenebrae
agh i cant get any further alone removed the mirror shader (by testing i found out it was actually newer used unless you forced water mirrors in which case it caused more problems than nessary).
The window projection is actually done with a cubemap but it eludes me where it gets its data from.
i rewritten large parts of the rt_light parser since parts of it newer worked to begin with (light where newer parsed from the edo's since nothing beyong worldspawn gets through) it works now but causes
a few things to behave a bit weird. Plats and doors seem to flicker wildly when dynamic lights on them and monsters near them get heavy texture corruption with black spots lines and other weirdness.
The good thing is that rt_lights actually work now and colors - light levels - angles etc. actually get parsed from the edo.
Some help getting the last buggers above removed would be nice, and i suspect some peeps like mh or spike could probably spot the problem quite quickly if they had a look at my current source.
The window projection is actually done with a cubemap but it eludes me where it gets its data from.
i rewritten large parts of the rt_light parser since parts of it newer worked to begin with (light where newer parsed from the edo's since nothing beyong worldspawn gets through) it works now but causes
a few things to behave a bit weird. Plats and doors seem to flicker wildly when dynamic lights on them and monsters near them get heavy texture corruption with black spots lines and other weirdness.
The good thing is that rt_lights actually work now and colors - light levels - angles etc. actually get parsed from the edo.
Some help getting the last buggers above removed would be nice, and i suspect some peeps like mh or spike could probably spot the problem quite quickly if they had a look at my current source.
Productivity is a state of mind.
Re: making a better texture managment system for tenebrae
as far as I'm aware, cubemap projection textures are just numbers. the entire image is loaded from disk with no consideration for actual entities nearby.
if you're getting z-fighting with shadows, there's a few things that can cause it.
if mixing glsl+fixed function, make sure your glsl code uses ftransform(), or the coords will not match exactly.
make sure any depthrange etc values are specified exactly the same.
GL_DEPTH_CLAMP_ARB, if used, needs to be set up the same way too, annoyingly enough, even when not clamping that pixel.
if you're recalculating things often, make sure you use exactly the same algorithm to interpolate etc each model, those coords must be exactly the same.
you should not need glPolygonOffset for anything other than attempting to fix z-fighting with coplaner world/submodel surfaces. If you do use it, make sure you use the same values for both your depth/ambient/fullbright passes and your rtlighting.
If you never enable it, your stencil shadows should function perfectly. Except for those coplaner surfaces.
I would expect this is the cause of your buggy lighting on plats, and possibly even models too.
if your lights etc are coplaner with any of the surfaces that they light, you may end up getting really fruity zfighting due to precision. For one pixel its infront, for the next its behind.
if you're getting z-fighting with shadows, there's a few things that can cause it.
if mixing glsl+fixed function, make sure your glsl code uses ftransform(), or the coords will not match exactly.
make sure any depthrange etc values are specified exactly the same.
GL_DEPTH_CLAMP_ARB, if used, needs to be set up the same way too, annoyingly enough, even when not clamping that pixel.
if you're recalculating things often, make sure you use exactly the same algorithm to interpolate etc each model, those coords must be exactly the same.
you should not need glPolygonOffset for anything other than attempting to fix z-fighting with coplaner world/submodel surfaces. If you do use it, make sure you use the same values for both your depth/ambient/fullbright passes and your rtlighting.
If you never enable it, your stencil shadows should function perfectly. Except for those coplaner surfaces.
I would expect this is the cause of your buggy lighting on plats, and possibly even models too.
if your lights etc are coplaner with any of the surfaces that they light, you may end up getting really fruity zfighting due to precision. For one pixel its infront, for the next its behind.
Re: making a better texture managment system for tenebrae
hmm that hit something... i remember i replaced the shadow volume code in gl_rmain.c with a later incarnation from tenebrae2 then i noticed this ->
the polygon offset there was removed in tenebrae2 (possibly they fixed it somewhere else) so i tried yanking it in again and the flickering was gone :? but it disabled bumpmapping on the vmodels sigh.
Code: Select all
if (!sh_visiblevolumes.value)
{
R_DrawWorldBumped();
glPolygonOffset(0,-5);
glEnable(GL_POLYGON_OFFSET_FILL);
R_DrawLightEntities(l);
glDisable(GL_POLYGON_OFFSET_FILL);
}
Productivity is a state of mind.