# Very simple pseudo 3d plotting.

## Recommended Posts

Hello gents. I'm interested in making a game using the old "one vanishing point" tecnique. The game won't be 3d but a more distorted 3d. Ok I just want to know how to plot points using the one vanishing point method from elementary art classes. I'll give you an example problem vpoint_x= the x position of the vanishing point vpoint_y= the y position of the vanashing point Last the point's x,y, and z position. How would I plot an arbitrary point in this one vanishing point perspective? The vanishing poit lies along the z axis and the screen coordinates range from (0,0) upper left to (640,480) lower right. I'm not interested in real 3d, I'm trying to make a older style "forced 3D" game. [Edited by - PIxel_Outlaw on November 26, 2006 5:42:43 PM]

##### Share on other sites
Im not completely sure if you mean the technique which was used 15+ yrs ago for displaying of dotted charts in "3D" from ISO perspective (i.e. as in Diablo). As far as I remember, they were using software Z-Buffer for this, but I might be wrong, though. Still, with software Z-Buffer you ant go wrong anyway.

##### Share on other sites
Well No, I mean like the old dungeon crawlers.

(you'll have to copy/paste the link i'm not sure how to show images in this forum)

##### Share on other sites
In the days I used to program 3D apps in QBasic I used to convert world to screen coordinates like this:

screenx = (screenwidth/2) + worldx / worldz;
screeny = (screenheight/2) + worldy / worldz;

I don't know if it's what you're looking for but it gives the objects some depth at least. :)

##### Share on other sites
Great thanks! Your formula was just plotting in one quadrant of the graph. I threw in some trig based directional calculations. The main problem is that the viweing plane has a depth of 0 and anything higher moves to the vanishing point, ex 1,2,3 ect. The problem is that if a point has a z depth less than the viewing plane or behing it ex -1,-2,-3, it is mapped not behind the viewing plane but on the oposite side.

Function plot_3D(x3#,y3#,z3#)     Local direction#=point_direction(x3,y3,320,240)    Local distance#= point_distance(x3,y3,320,240)   	Local new_x#=320+Cos(direction+180)*((distance/z3))    Local new_y#=240+Sin(direction+180)*((distance/z3))    Plot new_x,new_y    End Function

[Edited by - PIxel_Outlaw on November 26, 2006 9:10:52 PM]

##### Share on other sites
Yeah that was a problem I had too. But I guess you would have to do some kind of basic clipping or frustrum culling for the objects. I don't have the psuedo code to do so though but you could figure it out on your own. I belive the thing I did was to just remove the points laying outside the frustrum, I don't remember if I got any good results from it and I can't check out my old apps since I still haven't found a decent QB compiler for XP. :P

##### Share on other sites
Yeah the results make me want to wet myself but that darn z thing is killing it.

The same rings with a z of -2

##### Share on other sites
It's because you have to clip things at the near plane. When you render it, you only care about the XY, the other dimensions are only used with the perspective transformation and such. You need to clip all rendering of Z <= 0, or else things behind the viewer will just flip around and still be rendered as though they were in front (even though their depth is negative).

## Create an account

Register a new account

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627653
• Total Posts
2978433

• 10
• 12
• 22
• 13
• 33