Inside3D!
     

How can I add overbright lighting to Quake engine?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming
View previous topic :: View next topic  
Author Message
hondobondo



Joined: 26 Sep 2006
Posts: 101

PostPosted: Mon Jul 26, 2010 3:55 pm    Post subject: Reply with quote

thanks mh

by the way, i'm pimping mhquake on my moddb site, and i also uploaded the version of bengtquake with overbrights you gave me. hope you don't mind
Back to top
View user's profile Send private message
hondobondo



Joined: 26 Sep 2006
Posts: 101

PostPosted: Sat Aug 14, 2010 6:29 pm    Post subject: gonna get this working Reply with quote

thanks guys for all your help so far.

ok here's what i did

R_BuildLightMaps
changed this
Code:

    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;
 

to this
Code:

    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;
 

R_BlendLightMaps

changed this
Code:

   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);
   }

to this
Code:

   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);
   }


in R_DrawSequentialPoly. No shifts as far as i can tell

did this in gl_rmain, and gl_rsurf:

Find this:
Code:
Code:
      glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

and replace it with this:
Code:
Code:
      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);

and added this to the end of every function where i did the above ^ replacement

Code:
   glTexEnvf (GL_TEXTURE_ENV, GL_RGB_SCALE, 1.0f);
   glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);


just as dark as ever


here is mh's bengtglob.exe


any ideas?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine Programming All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group