Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 my crappy 3d engine
Index -> Programming, Turing -> Turing Submissions
Goto page Previous  1, 2, 3
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Tony




PostPosted: Mon Feb 16, 2004 5:18 pm   Post subject: (No subject)

shorthair - you'd just need to design an interface similar to any of 3D design programs (3DSMAX, Maya, etc) to locate vertices in 3D space. After that you'll have your own 3D modeling program in turing Laughing
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
Mazer




PostPosted: Mon Feb 16, 2004 5:44 pm   Post subject: (No subject)

tony, I'm probably annoying you by now (and if not, I will eventually), but I can't help but notice you forgot to mention Blender. Anyways, shorthair, 3D models aren't much more than a bunch of faces made up by 3 (usually) vertices which aren't much more than 3 variables for position. Of course the models could have more than that but it's all you really need for things like rotating, translating, and scaling (with trig of course).
shorthair




PostPosted: Mon Feb 16, 2004 6:03 pm   Post subject: (No subject)

Cool , i jsut couldnt get my heasd around the idea , but after looking at rhino , all you would have to do isceat a z axis , and from there make your variables , would take alot of code to make a nice one , but its all about the z axis
Mazer




PostPosted: Mon Feb 16, 2004 6:24 pm   Post subject: (No subject)

I've never tried my hand at 3D in turing, but I read somewhere that to get simple perspective, just take the Z coord and divide the X and Y coords by it. ie, draw a point (X,Y,Z) at (X/Z, Y/Z).
jonos




PostPosted: Mon Feb 16, 2004 6:29 pm   Post subject: (No subject)

could you explain that a little better.
Mazer




PostPosted: Mon Feb 16, 2004 6:42 pm   Post subject: (No subject)

I guess.
The basic idea is that you need to make the illusion of perspective (which uses 3 dimensions) and display it on a 2D surface (you're screen). Since turing doesn't have a command for drawdot (x,y,z,clr) you have to find a way to make it look like the Z coordinate of your vertice has any affect on it's perceived distance, or depth (whoa, don't I sound smart...).

To do this, you divide both the X and Y coordinates by the Z coordinate.
If you had a 2D point (X, Y) and wanted to draw it in 3D with a depth of Z (let's just make Z = 3 for this example), you would now draw it at (X/3, Y/3).
Here's a basic example of what I mean.

code:

var x, y : array 1 .. 4 of real

x (1) := -50
x (2) := 50
x (3) := 50
x (4) := -50
y (1) := -50
y (2) := -50
y (3) := 50
y (4) := 50

for z : 1 .. 100
    for i : 1 .. 4
        drawdot (round (x (i) / z) + maxx div 2, round (y (i) / z) + maxy div 2, 7)
    end for
    delay (60)
end for

Keep in mind that isn't exactly perfect, but it should give you an example of what I mean. And on the Z axis, it's increasing as it goes into your screen.
jonos




PostPosted: Mon Feb 16, 2004 6:55 pm   Post subject: (No subject)

thanks, that really helped. but is there a way to do that with squares and lines and stuff, i don't understand any of the other things.
zylum




PostPosted: Mon Feb 16, 2004 6:59 pm   Post subject: (No subject)

yup mazer is right. that's also the method i use but ofcoarse you wouldnt just divide it by the z, that would creat some crazy amounts of perspective. would would divide it by (z/your perspective constant) the constant is usually between 200 and 500...
Sponsor
Sponsor
Sponsor
sponsor
zylum




PostPosted: Mon Feb 16, 2004 7:03 pm   Post subject: (No subject)

to do it with lines and stuff, you'd need to store your coordinates in arrays or matrices and have procedures to manipulate them in 3d space. after all these coordinates are manipulated, you add the perspective and then draw the shape.

sorry i can't explain in more detail, i gtg now Sad
jonos




PostPosted: Mon Feb 16, 2004 7:11 pm   Post subject: (No subject)

maybe someone will just do a tutorial on it, i don't think there is one. anyways, to stick to the topic: awesome engine i still want to play with it everytime im in this thread.
josh




PostPosted: Mon Feb 16, 2004 7:48 pm   Post subject: (No subject)

Wow this thing is awsome.

i wish I I could do something like that.

neato

One problem is that the screen isn't big enough so the mous moves of the screen before I can get it to rotate fully and when I put the mouse back on it moves it back to it's original position
Cervantes




PostPosted: Mon Feb 16, 2004 7:59 pm   Post subject: (No subject)

Well Mazer explained the basis of it pretty well. Try making a simple one yourself! I'm going to try Smile
zylum




PostPosted: Tue Feb 17, 2004 9:49 pm   Post subject: (No subject)

if you want to rotate it more just take your mouse off the screen and then use your left/right arrow keys... also you could zoom in/out using the up/down arrow keys...

maybe later i'll make a simple tutorial on "pseudo" 3d which is a lot easier, but it's not really 3d. oh and it only works with wireframe so it's really basic...
AsianSensation




PostPosted: Wed Feb 18, 2004 7:55 am   Post subject: (No subject)

zylum wrote:
"pseudo" 3d


we have raycasting engine and some other pseudo-raycasting engine here on this website somewhere.....
Andy




PostPosted: Thu Feb 19, 2004 8:40 pm   Post subject: (No subject)

lol zylum, i didnt mean to imply that u were cheatin... just saying how its weird that u didnt notice the length of ur code... i usually pride myself on that lol. and lol u called me a n00b... juss wait until u get ur hands on my whatdotcolor programs
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 3 of 3  [ 45 Posts ]
Goto page Previous  1, 2, 3
Jump to:   


Style:  
Search: