ProcessedShaderMaterial bug
by Gerald Fishel · in Torque Game Engine Advanced · 03/03/2009 (5:17 am) · 2 replies
Since I'm either blind or delirious and don't see a bug forum, I'll post this here. It might be useful for anybody who's been bugged with this like me anyway.
In ProcessedShaderMaterial::setEyePosition we have this code:
I'm not quite sure what the point of the convolveInverse call is supposed to be, maybe it's necessary for something else, but when rendering a scaled object it hoses the eyePos param by scaling it after it's already been transformed into object space. For some things this results in silliness like specular highlights appearing behind the view position, for other things it completely kills the effect.
Removing the convolveInverse line makes things right again. Not sure if it breaks anything else in the process, but I haven't noticed anything.
Cheers
In ProcessedShaderMaterial::setEyePosition we have this code:
if (handles->mEyePosSC)
{
objTrans.inverse();
objTrans.mulP( position );
position.convolveInverse(objTrans.getScale());
shaderConsts->set(handles->mEyePosSC, position);
}I'm not quite sure what the point of the convolveInverse call is supposed to be, maybe it's necessary for something else, but when rendering a scaled object it hoses the eyePos param by scaling it after it's already been transformed into object space. For some things this results in silliness like specular highlights appearing behind the view position, for other things it completely kills the effect.
Removing the convolveInverse line makes things right again. Not sure if it breaks anything else in the process, but I haven't noticed anything.
Cheers
#2
03/16/2009 (1:15 pm)
Ooops I just now realized that I posted this in the public forum, sorry about that. Maybe move it to the private forum? (Guess I should have spent more time checking out the new forum setup)
Associate Tom Spilman
Sickhead Games
I suspect the convolveInverse() with the scale was necessary back in an old version of the shader constants code where it was the callers responsibility to pass D3D compatible row major transforms.
Thats all now handled internally by the shader constant system.