How can I add overbright lighting to Quake engine?
-
- Posts: 207
- Joined: Tue Sep 26, 2006 2:48 am
- Contact:
-
- Posts: 207
- Joined: Tue Sep 26, 2006 2:48 am
- Contact:
gonna get this working
thanks guys for all your help so far.
ok here's what i did
R_BuildLightMaps
changed this
to this
R_BlendLightMaps
changed this
to this
in R_DrawSequentialPoly. No shifts as far as i can tell
did this in gl_rmain, and gl_rsurf:
Find this:
Code:
and replace it with this:
Code:
and added this to the end of every function where i did the above ^ replacement
just as dark as ever
here is mh's bengtglob.exe
any ideas?
ok here's what i did
R_BuildLightMaps
changed this
Code: Select all
case GL_RGBA:
stride -= (smax<<2);
bl = blocklights;
// CDL - epca@powerup.com.au
blcr = blocklightcolors[0];
blcg = blocklightcolors[1];
blcb = blocklightcolors[2];
// CDL
for (i=0 ; i<tmax ; i++, dest += stride)
{
for (j=0 ; j<smax ; j++)
{
// CDL - epca@powerup.com.au
q = *blcr++; q >>= 7;
if (q > 255) q = 255;
r = *blcg++; r >>= 7;
if (r > 255) r = 255;
s = *blcb++; s >>= 7;
if (s > 255) s = 255;
dest[0] = 255-q;
dest[1] = 255-r;
dest[2] = 255-s;
// CDL
t = *bl++;
t >>= 7;
if (t > 255)
t = 255;
// epca@powerup.com.au
// Fix bug in quake where this mode is just fullbright
//dest[0] = dest[1] = dest[2] = 255-t;
// End of fix
dest[3] = 255-t;
dest += 4;
}
}
break;
Code: Select all
case GL_RGBA:
stride -= (smax<<2);
bl = blocklights;
// CDL - epca@powerup.com.au
blcr = blocklightcolors[0];
blcg = blocklightcolors[1];
blcb = blocklightcolors[2];
// CDL
for (i=0 ; i<tmax ; i++, dest += stride)
{
for (j=0 ; j<smax ; j++)
{
// CDL - epca@powerup.com.au
q = *blcr++; q >>= 8;
if (q > 255) q = 255;
r = *blcg++; r >>= 8;
if (r > 255) r = 255;
s = *blcb++; s >>= 8;
if (s > 255) s = 255;
dest[0] = 255-q;
dest[1] = 255-r;
dest[2] = 255-s;
// CDL
t = *bl++;
t >>= 8;
if (t > 255)
t = 255;
// epca@powerup.com.au
// Fix bug in quake where this mode is just fullbright
//dest[0] = dest[1] = dest[2] = 255-t;
// End of fix
dest[3] = 255-t;
dest += 4;
}
}
break;
changed this
Code: Select all
if (gl_lightmap_format == GL_LUMINANCE)
glBlendFunc (GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
else if (gl_lightmap_format == GL_INTENSITY || gl_lightmap_format == GL_RGBA)
{
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor4f (0,0,0,1);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
...
glDisable (GL_BLEND);
if (gl_lightmap_format == GL_LUMINANCE || gl_lightmap_format == GL_RGBA)
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
else if (gl_lightmap_format == GL_INTENSITY)
{
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glColor4f (1,1,1,1);
}
Code: Select all
if (gl_lightmap_format == GL_LUMINANCE)
glBlendFunc (GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
else if (gl_lightmap_format == GL_INTENSITY || gl_lightmap_format == GL_RGBA)
{
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor4f (0,0,0,1);
glBlendFunc (GL_DST_COLOR, GL_SRC_COLOR);
}
...
glDisable (GL_BLEND);
if (gl_lightmap_format == GL_LUMINANCE || gl_lightmap_format == GL_RGBA)
glBlendFunc (GL_DST_COLOR, GL_SRC_COLOR);
else if (gl_lightmap_format == GL_INTENSITY)
{
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glColor4f (1,1,1,1);
}
did this in gl_rmain, and gl_rsurf:
Find this:
Code:
Code: Select all
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
Code:
Code: Select all
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PRIMARY_COLOR);
glTexEnvf (GL_TEXTURE_ENV, GL_RGB_SCALE, 2.0f);
Code: Select all
glTexEnvf (GL_TEXTURE_ENV, GL_RGB_SCALE, 1.0f);
glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
here is mh's bengtglob.exe
any ideas?
-
- Posts: 207
- Joined: Tue Sep 26, 2006 2:48 am
- Contact:
-
- Posts: 207
- Joined: Tue Sep 26, 2006 2:48 am
- Contact:
DONE
thanks guys. tried also replacing this line
with this
now the hud is too bright, but ask me if i care engine snobs! (not you really nice helpful guys of course--you guys are awesome)
Code: Select all
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
Code: Select all
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); //try glTexEnvf?
glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PRIMARY_COLOR);
glTexEnvf (GL_TEXTURE_ENV, GL_RGB_SCALE, 2.0f);
now the hud is too bright, but ask me if i care engine snobs! (not you really nice helpful guys of course--you guys are awesome)
-
- Posts: 207
- Joined: Tue Sep 26, 2006 2:48 am
- Contact:
Re: DONE
maybe i'll fix that laterhondobondo wrote:thanks guys. tried also replacing this linewith thisCode: Select all
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
Code: Select all
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); //try glTexEnvf? glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE); glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE); glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PRIMARY_COLOR); glTexEnvf (GL_TEXTURE_ENV, GL_RGB_SCALE, 2.0f);
now the hud is too bright, but ask me if i care engine snobs! (not you really nice helpful guys of course--you guys are awesome)
Re: DONE
maybe you willhondobondo wrote:maybe i'll fix that laterhondobondo wrote:thanks guys. tried also replacing this linewith thisCode: Select all
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
Code: Select all
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); //try glTexEnvf? glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE); glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE); glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PRIMARY_COLOR); glTexEnvf (GL_TEXTURE_ENV, GL_RGB_SCALE, 2.0f);
now the hud is too bright, but ask me if i care engine snobs! (not you really nice helpful guys of course--you guys are awesome)
i should not be here
You need this during your takedown:Stick it in maybe GL_Set2D and it should work fine.
Code: Select all
glTexEnvf (GL_TEXTURE_ENV, GL_RGB_SCALE, 1.0f);
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
You could use a 256 element byte array as a lookup (just using the calculated result from blocklights as the index) and put anything you wanted into it. Making it dynamically changable at runtime would be just a matter of setting modified = true and expanding rectchange to cover the full texture rectangle.
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
Aye.. Unfortunately, with HLBSP comes me greedy for coloured lighting, and since I've got support for that, I'd need 256^3 elements and that just seems sloppy.. Also, are you aware which function actually builds the final RGB values into the texture? In which case I'd know how to modify a bunch more stuff.
-
- Posts: 207
- Joined: Tue Sep 26, 2006 2:48 am
- Contact:
that works great! thanks againmh wrote:You need this during your takedown:Stick it in maybe GL_Set2D and it should work fine.Code: Select all
glTexEnvf (GL_TEXTURE_ENV, GL_RGB_SCALE, 1.0f);
You could just use a single array and put each colour into it:Downsider wrote:Aye.. Unfortunately, with HLBSP comes me greedy for coloured lighting, and since I've got support for that, I'd need 256^3 elements and that just seems sloppy.. Also, are you aware which function actually builds the final RGB values into the texture? In which case I'd know how to modify a bunch more stuff.
Code: Select all
dst[0] = r_lighttable[r];
dst[1] = r_lighttable[g];
dst[2] = r_lighttable[b];
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
It's fair to give warning that it's not the best place to do it, but it won't cause you any problems (at least so far as the 2D stuff is concerned). You might also get sky, water, particles and sprites being drawn too bright though.hondobondo wrote:that works great! thanks againmh wrote:You need this during your takedown:Stick it in maybe GL_Set2D and it should work fine.Code: Select all
glTexEnvf (GL_TEXTURE_ENV, GL_RGB_SCALE, 1.0f);
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
-
- Posts: 14
- Joined: Tue Apr 13, 2010 8:55 am