Game Development Community

Hiden model elements are being Shadowed

by Edward Smith · in Torque Game Engine Advanced · 09/23/2006 (10:06 pm) · 5 replies

I just got the lastest HEAD and noticed that now my rifle model which has a hidden flash at the front is turning up in the shadow.

This can be seen with the Jill models Assault rifle as below:
users.on.net/~rnesmith/Hidden%20model%20shadow%20MS4%20HEAD%2024-09-2006.jpg

About the author

Games have always been a huge part of my life. I've always enjoy military games such as SEAL Team and Delta Force. Large open areas, an objective and your choice to deal with it. Or the choices in Deus Ex, that is what games should be about.


#1
09/25/2006 (12:40 pm)
Hi Edward,

Thanks for pointing this out - I'll add it to my ToDo list.
#2
09/25/2006 (2:20 pm)
It should be fixed, but can you double check it against your assets:

In sgObjectBasedProjector.cc line 441 change the following:

void sgShadowProjector::sgRenderShape(TSShapeInstance *shapeinst, const MatrixF &trans1,
		S32 vertconstindex1, const MatrixF &trans2, S32 vertconstindex2)
{
	U32 detaillevel = shapeinst->getCurrentDetail();
	if(detaillevel == -1)
		return;

	TSShape *shape = shapeinst->getShape();
	AssertFatal((detaillevel >= 0) && (detaillevel < shape->details.size()), "TSShapeInstance::renderShadow");
	const TSDetail *detail = &shape->details[detaillevel];
	AssertFatal((detail->subShapeNum >= 0), "TSShapeInstance::renderShadow: not with a billboard detail level");

	shapeinst->setStatics(detaillevel);

	S32 s = shape->subShapeFirstObject[detail->subShapeNum];
	S32 e = s + shape->subShapeNumObjects[detail->subShapeNum];

	for(U32 i=s; i<e; i++)
	{
		TSMesh *mesh = shapeinst->mMeshObjects[i].getMesh(detail->objectDetailNum);
		[b]if(mesh && (shapeinst->mMeshObjects[i].visible > 0.01))[/b]
		{
			MatrixF *meshtrans = shapeinst->mMeshObjects[i].getTransform();
			MatrixF mat;

			// one of those hidden issues with torque...
			TSShapeInstance::smRenderData.currentObjectInstance = &shapeinst->mMeshObjects[i];

			if(meshtrans)
				mat.mul(trans1, (*meshtrans));
			else
				mat = trans1;
			mat.transpose();
			GFX->setVertexShaderConstF(vertconstindex1, mat, 4);

			if(vertconstindex2 > -1)
			{
				if(meshtrans)
					mat.mul(trans2, (*meshtrans));
				else
					mat = trans2;
				mat.transpose();
				GFX->setVertexShaderConstF(vertconstindex2, mat, 4);
			}

			mesh->render();
		}
	}

	shapeinst->clearStatics();
}
#3
09/26/2006 (1:07 am)
That works great for me too, thanks John!
#4
09/26/2006 (4:02 am)
Good fix, thanks! Thought something looked screwy in my weapon shadows.
#5
09/26/2006 (4:33 am)
Great fix, thanks alot!