Dark Bit Factory & Gravity

PROGRAMMING => General coding questions => Topic started by: Stonemonkey on December 12, 2007

Title: Lighting scaled objects?
Post by: Stonemonkey on December 12, 2007
At present I calculate my vertex shading by transforming my camera to object space but I'm now wanting to be able to scale objects preferably by different amounts along each axis, is it still possible to transform the camera to object space taking the scaling into account and so be able to calculate the shading so it's correct for the scaled object in world space?

I'd like to be able to do this to avoid having to transform the normals and re-normalise them.

Cheers, Fryer.
Title: Re: Lighting scaled objects?
Post by: Stonemonkey on December 12, 2007
I'm not sure if it can, I can see it being done in 2d but having problems seeing it in 3d. Still, if anyone has any ideas about it...
Title: Re: Lighting scaled objects?
Post by: Jim on December 12, 2007
I think in general you need to recompute the normals.  If your scales aren't too extreme, you could light it and then scale it?  It would be wrong, obviously, but it would look pretty much OK.

Jim
Title: Re: Lighting scaled objects?
Post by: Stonemonkey on December 12, 2007
I've pretty much come to that conclusion but there is something I'm going to try before giving up and settling for re calculating the normals.