PDA

Click to See Complete Forum and Search --> : Perspective


/\/\isanThr0p
Oct 15th, 2000, 12:17 AM
Does anyone here know some math or where I could get the math for making pictures looking like they had a perspective?

(little bit like texturing, but only in an own graphics program?)

HarryW
Oct 15th, 2000, 08:30 AM
I don't understand what you mean. Do you mean like drawing a cube with lines so that it has some perspective? Only with more complicated stuff.

/\/\isanThr0p
Oct 15th, 2000, 09:40 AM
No, not more complicated at all!
I only want to have pictures between the lines, like texturing, but I want to know how to calculate how I can give perspective to the pictures.

PaulLewis
Oct 15th, 2000, 10:10 AM
With respect to distance from point of origin I mean.


I think I have a good book that will help in either case.
But with your knowledge of DirectX, I presume you only need
help in working out the modified shape of the region you
want to stretch a texture over?


I'll see what I can find in a couple of hours when I get to work.

Cheers

kedaman
Oct 15th, 2000, 01:28 PM
Hey, it's ok, he got my 3disotiler project for sloped tiles ;)

PaulLewis
Oct 15th, 2000, 03:24 PM
Cheers

/\/\isanThr0p
Oct 15th, 2000, 06:08 PM
NO! I still need some other stuff! PAUL!!! The tiler is a nice piece of programming, I want want some more stuff in my program. So I still need advice!
Thanks!

kedaman
Oct 16th, 2000, 03:42 AM
Aye, theres a problem with my tiler too, when i tried to extrapolate it to work for all size tiles, then something screwed up, it works only for 32*32 -> 64*32 tiles.
Hehe, paul look it up for me too :)

kedaman
Oct 16th, 2000, 03:44 AM
BTW, if you find something about smooth slopes, like you have in the elevations in Settlers2 or 3, i would be interested in that too ;)

PaulLewis
Oct 16th, 2000, 04:54 AM
and how many dimensions is the object? From the fact that it is a tile game I assume 2-D tiles and 1 or 2 points of perspective?

Regards

kedaman
Oct 16th, 2000, 08:43 AM
I'm not sure how to interpret your qwestion so i'll tell you instead what i'm doing (yeah, and Misantrop needs it too)
Each tiles can be elevated one step, that means we have two digit tiles, one level of slope. There are 4 corners so we need 2^4 = 16 different slopes for each tile, here's an example:
http://www.geocities.com/kedasu/isotiler.jpg
Then when the horizontal corners are in a different elevation, the stretch will be done by left and right part independently, creating a line in the middle
And when the vertical corners are in a different elevation, the top and bottom are stretched independently.
WEll that's the kind of elevation you have in TRansport tycoon or Tiberian Sun, In settlers you will have 4 levels of elevations and the last and first one starts a slope up or down. That means 2*3^4 = 162 types of slope (yeah they are hexagonal so you have two types of triangles)

/\/\isanThr0p
Oct 16th, 2000, 09:45 AM
Hm sorry, but I really got some Problems with understanding your question. In general I want the same thing like kedaman.
Except I want something more. On a normal Slope-tile in ISO I also want the hmmm Triangle that is also visible if there is nothing in front of it. When I'm home again, I'll send you an email with a handdrawn Paintbrush graphic, that will show to you what I mean.
Let us say every tile is cut of a 3D cube. So if you see the slopething you should also see two side, that were already on the cube.

Hope you understood this
CU

PaulLewis
Oct 16th, 2000, 04:09 PM
Yeah, guys I think I was looking at it rather more methematically and not so functionally. What I mean is, I was thinking of how to draw an object on paper in perspective. You guys are far more switched into the application of the drawn tiles into a game. You both know far more about it than I probably ever will.

I think my question should be ignored because I was definitely thinking in terms of a 3D model being projected onto a plane with 1, 2 or 3 vanishing points.

From the example you gave kedaman, I now understand the term ISO (isometric right?) and in the context of the topic, I don't know if perspective is the right term for the technique used to generate the tiles. What you are actually doing it seems to me is translating one of the corners by a preset elevation (plus and minus). The same effect can be generated using 2 vanishing points and a perspective projection but I admit I have not done this personally in an application. I have a very good book here that might help so I can send some sample code soon if you like.

I fear though, that it will not help a great deal...

Regards

/\/\isanThr0p
Oct 16th, 2000, 05:25 PM
Would be nice if you'd give it a try!

I have really some troubles doing this stuff!
Man where dou you have all those books from!!!

Thanks

kedaman
Oct 16th, 2000, 05:48 PM
Yeah, look it up and see if you find something!
WEll it wasn't my word either, that perspective, but isometric is kind of a perspective. But that's not the point, the point is to generate the smooth elevation,like calculated by a generic formula or something.
Thanks :)

parksie
Oct 16th, 2000, 05:57 PM
I saw this somewhere:

x_screen = x_obj / z_obj
y_screen = y_obj / z_obj

where the object coordinates have already been transformed into eye coordinates.

[Edited by parksie on 10-16-2000 at 07:00 PM]

Koralt
Oct 16th, 2000, 06:06 PM
There are way too many perspectives to just say "perspective" in a question like that! Some examples:


-Tile, z ignored (2D)
Examples: Mario Brothers

screenx = x
screeny = y


-Isometric 3/4 view.
Examples: X-COM, Sim City 2000

screenx = (x - y) * half_of_width
screeny = (x + y) * half_of_height_minus_one - z * zheight


-Isometric slanted z view
Examples: X-COM bases, Battle Tech: The Crescent Hawks' Inception / The Crescent Hawks' Revenge (ancient games, both!)

screenx = x - z
screeny = y - z


-Isometric z vertical
Examples: Early Final Fantasy games, EMail XCOM

screenx = x
screeny = y - z


-3D perspective view

'Assuming about 90 degree FOV
'Note that y * halfofviewwidth is *not* a typo
screenx = (x * halfofviewwidth) / z + halfofviewwidth
screeny = (y * halfofviewwidth) / z + halfofviewheight


There are way more, but ...

kedaman
Oct 17th, 2000, 07:23 AM
I thought Early Final Fantasy versions were top-down
I'm looking for Settler2/3 slopes you know, they are curved with a math formula like Bezier or something.

PaulLewis
Oct 17th, 2000, 01:23 PM
I'm trying to do up a test app to allow you to easily
experiment with transformation code on wireframe grids.
I'll be happy when I can get the simple spherical elevation
model up and running. then I might actually try and make
the elevation look realistic..

I would probably go for a stretched sine wave (or cosine
depends on the direction). But if there is already an
agreed standard to get "realistic" looking slopes then let
me know.

Cheers

/\/\isanThr0p
Oct 17th, 2000, 05:24 PM
Paul! You are so far beyond me! I was thinking a just a little bit perspective, and you do realistic slopes! If you get it really to work. I mean it connects to other tiles, ti would be just great!!
I was looking for a possibility to make something that gives me tiles like used in Sim city 2000 or Transport or Rollercoaster Tycoon.

Thanks

PaulLewis
Oct 17th, 2000, 05:51 PM
Wait till you see the sample I sent you. You won't be
thinking I'm advanced after that. I am struggling to
understand how the tiles will match up. At present, my
sample doesn't care about the edges matching up because I
only give you a wireframe view of a single matrix of points
(connected by lines). It should give you an idea I hope of
how to (or not to) render the tiles in order to give the 3-
D effect.


Oh, and my sample is not in isometric view either - it's
merely a square shape :)

I'll wait to see how you get on.

Regards

/\/\isanThr0p
Oct 17th, 2000, 06:19 PM
Hehe I already saw your mail!!! That's why I wrote that you are ahead of me!!!!!

Cu

VBD
May 12th, 2001, 06:12 AM
If you want fast simple 3-D, goto the thread CHeap 3-D and download the file