Author Topic: Lighting scaled objects?  (Read 2534 times)

0 Members and 1 Guest are viewing this topic.

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Lighting scaled objects?
« 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.

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: Lighting scaled objects?
« Reply #1 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...

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Lighting scaled objects?
« Reply #2 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
Challenge Trophies Won:

Offline Stonemonkey

  • Pentium
  • *****
  • Posts: 1315
  • Karma: 96
    • View Profile
Re: Lighting scaled objects?
« Reply #3 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.