Game Development Community

Glow masking 1.7.1

by Kirk Longendyke · in Torque Game Engine Advanced · 12/31/2008 (9:14 am) · 3 replies

At present, no tgea version I'm aware of has a working example of a masked glow effect for compositing a glowing texture pass over a normal one. I've gotten a far as rewiring:

void GlowBuffer::copyToScreen( RectI &viewport )
{
...
   // Mod color texture for this draw because we are providing color information to the PrimBuilder -patw
   GFX->disableShaders();
   GFX->setupGenericShaders( GFXDevice::GSTexture );  //was GSAddColorTexture
   GFX->setTexture( 0, mSurface[0] );
   for (U32 i = 1; i < GFX->getNumSamplers(); i++)
   {
      GFX->setTextureStageColorOp(i, GFXTOPDisable);
   }
   
   GFX->setAlphaBlendEnable( Con::getBoolVariable("$translucentGlow", true) );
   GFX->setSrcBlend( GFXBlendOne ); 
   GFX->setDestBlend( GFXBlendOne ); //wanna say thats significant... but...
   GFX->setAlphaTestEnable( true );
   GFX->setAlphaRef( 1 );
   GFX->setAlphaFunc( GFXCmpGreaterEqual );
...
}


wich, when used in conjunction with the following material setup:

new Material(carriermetal001)
{
	baseTex[0] = "carriermetal";
	bumpTex[0] = "carriermetalb";
	pixelSpecular[0] = true;
	specular[0] = "0.3 0.3 0.3 1.0";
	specularPower[0] = 12.0;
	translucent[0] = false;
 
 
	//=============== pass 2 ===========
	baseTex[1] = "carriermetal2";
	bumpTex[1] = "carriermetal2b";
	emmissive[1] = true;
	glow[1] = true;
	//pixelSpecular[1] = true;
	//specularPower[1] = 8;   
   	translucent[1] = true;
	translucentBlendOp[1] = AddAlpha;
	translucentZWrite[1] = true;
	alphaRef[1] = 20;
};

gives:

( http://img381.imageshack.us/img381/593/glowbuffke4.jpg )
img381.imageshack.us/img381/593/glowbuffke4.jpg
Current thinking is somewhere further down the line (and I'm afraid I'm just not sure where) it's getting overridden by the shadow pass... any suggestions?

#1
12/31/2008 (9:19 am)
Not very helpful, but I can tell you Glow Masking worked just perfectly before 1.7.1. Haven't used it afterwards.
I know I did it the same way as your example too, so it's possible that it's broken now.

(Awesome pictures)
#2
12/31/2008 (9:31 am)
@Kirk
You may be interested in Guy Allard's Blue Marble demo... pretty cool effect as well.
www.garagegames.com/blogs/18484/14821
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=14747
#3
12/31/2008 (10:28 am)
For the record: bumpTex[1] = "carriermetal2b"; turned out to be the problem