-- [ Picked text/plain from multipart/alternative ] First, I think that you should give an alpha value less than 1 to each quad and enable alpha blending. If you dont do it, the material will be completely opaque and won´t add to the "layer" below. Second, I will use a shader (in fact, I achieve this effect with one :) ). I convert the entire imge to grayscale (dot product of the pixel color with the eye sensitivity to each color component), multiply each color component by an amplification factor (try until you find a value that looks good), and multiply now only the green component by another factor (doubling it should be ok). This can be improved adding a noise texture and applying some blurring. I think that this should be done with a second pass. Regards, Newen
2005/5/31, Imperio59 <[EMAIL PROTECTED]>: > > 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 > > -- _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders