Computer Science Canada 3D in turing?? |
Author: | Jonny Tight Lips [ Tue Nov 23, 2004 5:45 pm ] |
Post subject: | 3D in turing?? |
Yah, I have a very general question about 3D graphics in turing. OK, all I want to knwo if how I would render 3D stuff in turing. I know there are many different ways and any of them would be helpful. And don't tell me it can't de done becasue I've seen it b4. Any and all sugestions are good. I've been messing around with drawing a cube using Draw.Line and a lot of math to get it to rotate but I'm sure and would hope that there is an easyer way to do it. There might be a post already about this so sry but I was unable to find it so if there is just link me plz. Thanks |
Author: | Mazer [ Tue Nov 23, 2004 5:55 pm ] |
Post subject: | |
No, it's really not possible. Go make your Zelda clone. (Haha, kidding. Seriously, go make the game). Anyways... An easy way to get 3D points on a 2D screen is shown here. |
Author: | Tony [ Tue Nov 23, 2004 7:28 pm ] |
Post subject: | |
besides, if you've seen it done, just look over the source code - namely their draw function to see how exactly 3D image is being rendered. |
Author: | Jonny Tight Lips [ Tue Nov 23, 2004 7:52 pm ] |
Post subject: | |
Well, I saw it done by Dan. SO Dan if you would please post your code for that 3D space game you made it would be nice. ty |
Author: | Cervantes [ Tue Nov 23, 2004 8:09 pm ] |
Post subject: | |
Or you could just go to the Best of the Turing Submissions and scroll down a little bit until you get to the link to the Engines. Homer's and Zylum's are both listed there. EDIT: I guess I should mention this, just in case. You can also use the function. |
Author: | Jonny Tight Lips [ Tue Nov 23, 2004 8:10 pm ] | ||
Post subject: | |||
Also, Coutsos I need a lil help understanding that site you linked. This is the code they give at the end of the page.
yah well here are my questions. 1) how can they have pan.x? Is that one var or is it some combination of the 2? 2) What would be the point of my point after all of these steps? x,y? 3) What is the different between screen.x and just x 4) What is the variable pan for? Its for paning yes but if it = 1 what would that mean? 5) What programing language is this meant for? |
Author: | Mazer [ Tue Nov 23, 2004 8:51 pm ] | ||
Post subject: | |||
OK, how about this: ignore pan. In fact, why don't you go ahead and ignore the whole thing. The point of that was this:
Really, that was the main thing. |
Author: | Jonny Tight Lips [ Tue Nov 23, 2004 9:07 pm ] |
Post subject: | |
ok.... thas easy. Wow that site mad everything so complicated with the sin and cos and AHHHHHHHHHHHHhhhhhhhhhhhhhhhhhhhhhh Thanx for the help |
Author: | Mazer [ Tue Nov 23, 2004 9:12 pm ] |
Post subject: | |
You'll need cos and sin for rotating things. Check out rotation matrices. |
Author: | Jonny Tight Lips [ Tue Nov 23, 2004 9:43 pm ] |
Post subject: | |
Yay I want to rotate a cube. So where would I go to find these Matrixes you speek of? And how would I use them? Is there a 3d equation?? like for example if I have a cube and I want it to rotate, is there some equations that will tell me that the points are supposed to be? Also those 3d engines are great but where can I get the source code for them and not just the exe |
Author: | Dan [ Wed Nov 24, 2004 2:23 pm ] |
Post subject: | |
Jonny Tight Lips wrote: Well, I saw it done by Dan. SO Dan if you would please post your code for that 3D space game you made it would be nice. ty
I made that 3D engion for C++ and not turing.......if u are looking for one in turing, there is the sorce code for them posts some where in the turing sections. try using the sreach thing. |
Author: | rizzix [ Wed Nov 24, 2004 3:34 pm ] |
Post subject: | |
i can never understand these sites, for ex the one Mazer pointed out. #1: Quote: screen.x = x / z * zoom
dosen't make sense.
screen.y = y / z * zoom ha! dividing by z will NOT give you the 3D-normalized-perspective-projection of any point onto your screen |
Author: | Mazer [ Wed Nov 24, 2004 8:13 pm ] |
Post subject: | |
Why not? Perhaps you're doing something wrong? don't forget to add half the screen width and half the screen height so that the origin is at the middle of the window. Dividing by z: I'm sure you know that z represents the depth of the point. For our purposes, a greater z value means a greater depth and therefore, a point that is further of the camera. Which kinda makes sense because dividing x by a greater number will give you a smaller result. Right? Let z = 2, x = 6 x / z = 3. OK. Now let z = 8, x = 6 x / z = 0.75. Quite a bit smaller, right? Just like objects further away from your viewpoint appear smaller. Does that make sense now? |
Author: | Jonny Tight Lips [ Wed Nov 24, 2004 9:41 pm ] |
Post subject: | |
Ok, but dividing by z will give you a one point perspective. So how would I make that into 2 point perspective so that I can draw a cube with it? |
Author: | Mazer [ Wed Nov 24, 2004 10:11 pm ] |
Post subject: | |
I'm not sure what you mean. Try drawing a cube with this. It'll be hard to visualise, but just pick 8 points and draw them. Have a variable for the angle, and for each point do this: pointz := round (15 * sind(angle)) pointx := round (15 * cosd(angle)) The 15 is just a scalar because sin and cos will give you small values (between -1 and 1). You can change the 15 to whatever you want so you can see the points better. |
Author: | rizzix [ Wed Nov 24, 2004 10:43 pm ] |
Post subject: | |
yea but Coutsos, i don't believe u'll get accurate results this way.. and i think the perspective will be messed up if the object is too close to the edges of the screen. |
Author: | Jonny Tight Lips [ Thu Nov 25, 2004 12:04 pm ] | ||
Post subject: | |||
Ok, thatis helping a lot but I still con't get it into a prog. here is my code. Fix it if you can.
Thank You |
Author: | Mazer [ Thu Nov 25, 2004 12:39 pm ] | ||
Post subject: | |||
OK, here's an example for the perspective (not real perspective, just that objects get smaller as they get further away). It's a bit long because I've added crap to let you move the triangle (arrow keys for x/y, w and s for z).
|
Author: | Jonny Tight Lips [ Thu Nov 25, 2004 10:04 pm ] |
Post subject: | |
Yes, That is a very nice pergrom and it does explain a lot about how the perspective works but I am still wondering how to rotate things? |
Author: | Jonny Tight Lips [ Thu Nov 25, 2004 10:49 pm ] | ||
Post subject: | |||
Ok, here is my prototype rotating cude. Use left and right arrows to rotate it. Still havn't been able to work in the perspective tho. Also any sugestions on how to make it rotate verticaly?
|
Author: | Jonny Tight Lips [ Sat Nov 27, 2004 7:58 pm ] |
Post subject: | |
So, anyone have any ideas how to make it roate verticaly? Or how to mark there be some perspective? Anyone at all? Well I'll keep trying... |
Author: | rizzix [ Sat Nov 27, 2004 11:55 pm ] |
Post subject: | |
well.. if u know a little bit of Geometry, Vectors in pericular.. then it's a whole other story. |
Author: | Jonny Tight Lips [ Sun Nov 28, 2004 1:32 pm ] |
Post subject: | |
Well I don't know them particularly. But I'm willing to learn Maybe you could just make a sample code and then I could go from there? Well thanx anyway. |