Ok,
The title may sound corny, but this is what i have so far (thanks root
for giving me msot of this code ;) ).
I'm trying to copy CSS's Nightvision, except i'm trying to make it light
DARK spots as well as brigthen existing lit-up spots.

Here's what i have so far, it brightens the scene but not enough for me:
This is in CViewRender::RenderView.
//Imperio59 NVG
   if ( C_BasePlayer::GetLocalPlayer() &&
C_BasePlayer::GetLocalPlayer()->m_bNVG )
   {
       IMaterial *pMaterial = materials->FindMaterial(
"effects/nightvision", TEXTURE_GROUP_CLIENT_EFFECTS, true );

       if ( pMaterial )
       {

               // This copies the contents of the framebuffer (drawn
during RenderView) into our nightvision texture.

               UpdateScreenEffectTexture( 0 );//"_rt_FrameBufferFB"

               materials->MatrixMode( MATERIAL_PROJECTION );
               materials->PushMatrix();
               materials->LoadIdentity();

               materials->MatrixMode( MATERIAL_VIEW );
               materials->PushMatrix();
               materials->LoadIdentity();

               materials->MatrixMode( MATERIAL_MODEL );
               materials->LoadIdentity();

               materials->DrawScreenSpaceQuad( pMaterial );
               materials->DrawScreenSpaceQuad( pMaterial );

               //Draw twice + a third time modulated.

               pMaterial->AlphaModulate(cl_nvg_brightness.GetFloat());
               materials->DrawScreenSpaceQuad( pMaterial );

               materials->MatrixMode( MATERIAL_PROJECTION );
               materials->PopMatrix();
               materials->MatrixMode( MATERIAL_VIEW );
               materials->PopMatrix();
       }
   }
   //END NVG

Except drawing twice + modulated doesn't make it brighter than drawing
ONCE! I think this is because of me just slapping a quad with the
texture on top of the scene, no matter how many times i do it it's still
the same texture. Right.

So what i wanted to do was get a fullbright image (i want to get an
image of what you see when mat_fullbright is 1) and slap that onto my
screen, alpha'ed of course, and with my green screenfade (to make it
look NVG-ish ;) )
I haven't been able to figure this out yet, i've tried calling
UpdateScreenEffectTexture( 0 ); before the call to RenderLights, at the
beginning of the frame, lots of places, with various unwanted results.

Can someone from valve explain to me where i need to stick this call so
i get my fullbright image, or somehow manage to unload the lightmaps
from all textures, get the image of the scene, then reload the lightmaps
(sounds like it's going to drag performance down).

I also thought of using a post-processing shader, but most cards don't
support them (am I wrong?) and you would need to turn on Shaders in the
options to have a working NVG, wich is not what i want.

Am i stuck with what i have now ( a semi-bright NVG wich brightens lit
up spots but not dark spots) or is there a way to do this right?

Imperio59


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.322 / Virus Database: 267.3.0 - Release Date: 30/05/2005



_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to