Game Development Community

Translucent Glow in MS4

by Mike Kuklinski · in Torque Game Engine Advanced · 09/12/2006 (5:32 pm) · 9 replies

In MS3, I was able to make a material translucent, and yet make it glow (like, Engine Glow) -- in MS4, however, if I set the material to translucent, glow will not... glow. Any ideas?

Here is an example material:

new Material(flareThrust_m)
{
mapto = flareThrust;
baseTex[0] = "flareThrust_m.dds";
glow[0] = true;
emissive[0] = true;
translucent = true;
translucentBlendOp = Add;
translucentZWrite = 1;
doubleSided = true;
};

#1
09/12/2006 (5:48 pm)
Ahhah, I fixed it.

In RenderInstManager::addInst

before the switch, and after the Assert, change it to this:

// handle special cases that don't require insertion into multiple bins
if( inst->translucent || (inst->matInst && inst->matInst->getMaterial()->translucent ) )
{
mRenderBins[ Translucent ]->addElement( inst );
if( inst->matInst )
{
CustomMaterial *custMat = dynamic_cast( inst->matInst->getMaterial() );
if( custMat && custMat->refract )
{
mRenderBins[ Refraction ]->addElement( inst );
}

if( inst->matInst->hasGlow() &&
!gClientSceneGraph->isReflectPass() &&
!inst->obj )
{
mRenderBins[ Glow ]->addElement( inst );
}
}
return;
}
#2
09/12/2006 (6:18 pm)
Nice fix.

Also, way off topic, but, Kuklinski, you gotta send me your TSE sun/lens flare implementation. :) Pleeeease.
#3
09/13/2006 (12:38 am)
Its not a bug. It is intended, though I do not know what side effects your change will bring. There was a thread where Brian gave a comment about it.
#4
09/13/2006 (12:36 pm)
If you set the $translucentGlow variable to 1 is this change necessary?
#5
09/13/2006 (12:50 pm)
Ok,

The $translucentGlow does't help in this situation. (Can't really imagine a situation where you would want to set that to false.)

Todd
#6
09/13/2006 (9:50 pm)
"Its not a bug. It is intended, though I do not know what side effects your change will bring. There was a thread where Brian gave a comment about it."

Strange, I cannot imagine when you would want to disable it -- seems to work fine for me..
#7
09/14/2006 (1:21 am)
Me neither, really. But that's what he said. Perhaps there's sorting issues.
#8
09/14/2006 (5:48 pm)
Yes, it can cause sorting issues with the glow, ie, glow will draw over any translucent renders which will look odd in many cases.

here is the thread:

http://www.garagegames.com/mg/forums/result.thread.php?qt=47391


$translucentGlow is just a debug switch so you can see only what is being glowed.
#9
09/14/2006 (6:10 pm)
Thanks Brian.