Scaling.

Started by
2 comments, last by BasicMind 13 years, 4 months ago
I have a pseudo 3d game I'm working on. I say pseudo, I am actually using a 3d projection algorithm but for most it has more in common with a pseudo 3d game.

I have game objects that go up and down the z axis, I've botched together a simple scaling factor, It works sort of but I'd rather do it better. Is there a better way to do this?

I am using

screenx = worldx * constant / worldz
screeny = worldy * constant / worldz

game objects only travel up and down the z axis for the most part, I know I could convert every point using the above algorithm but this seems overly verbose and expensive.

currently I'm using

float scaleFactor = 1 - std::max(2 * (zCoord * 0.001), 0.0);

and applying a transformation matrix on both x and y with the result

But this method is hard to tweak and get looking correctly.

Advertisement
What graphics API(s) are you using? Are you using a software renderer?
I'm using the PS2's GS
Ok I've got it working although not elegantly. by saying when z = 0 scaling is 100% when z = max distance scaling = 0% and so on.

This topic is closed to new replies.

Advertisement