Hello,
I need help with perspective graphics, I made orthographic 3D renderer, now I want to make it perspective:
I have made functions that might help:
- _3DGetPos($PosX,$PosY,$PosZ) (To get 3D position, output is array with X and Y positions)
- _3DGetDistance($PosX,$PosY,$PosZ, [$CameraPosX, $CameraPosY, $CameraPosZ] ) (Gets distance between positions)
- _DrawCubeSolidColor( $Color, $PosX, $PosY, $PosZ, $SizeX, $SizeY, $SizeZ ) (I rendered 4 cubes if you see in the picture)
I tried to make things smaller if they are far with this in _3DGetPos(...):
$Output[0] = ($Output[0]*(1/_3DGetDistance($PosX,$PosY,$PosZ)(Gets distance between camera and position)) + $PosXReal(This makes everything shown in center of GUI)
$Output[1] = ($Output[1]*(1/_3DGetDistance($PosX,$PosY,$PosZ))) + $PosXReal
What I get:
Weird... What to do?
Thanks
(Sorry for my bad English.)