
-----------------------------------
zylum
Sun Feb 15, 2004 6:03 pm

my crappy 3d engine
-----------------------------------
heres a crappy 3d engine i made, use the mouse to rotate it shape. take the mouse off the screen and the you could use the left/right arrows to rotate and up/down to zoom in/out

-----------------------------------
Tony
Sun Feb 15, 2004 6:07 pm


-----------------------------------
you forgot to attach the file :?

-----------------------------------
shorthair
Sun Feb 15, 2004 7:00 pm


-----------------------------------
Ummmm Is there a file to be attached ,  Well anyways , Im sure its great and will look at it when its up , Are you new to turing ? or have you been programming for a while

-----------------------------------
zylum
Sun Feb 15, 2004 7:58 pm


-----------------------------------
oh damn, i thought i did attach it -_-

btw, i'm fairly new to turing, i have had 1 semester of turing last year and have had 2 weeks worth of turing this year so far (new semester)

-----------------------------------
Tony
Sun Feb 15, 2004 8:07 pm


-----------------------------------
lol :lol: I wanted to delete one of 2 attachments but seeing as they got the same filename, I guess it deleted them both :lol: 

sorry about that :P

-----------------------------------
zylum
Sun Feb 15, 2004 8:09 pm


-----------------------------------
lol, i guess i'll post it again...

-----------------------------------
TheXploder
Sun Feb 15, 2004 8:24 pm


-----------------------------------
wow, that is amazing...who would of though that Turing would be capable of this, good job.

-----------------------------------
Tony
Sun Feb 15, 2004 8:25 pm


-----------------------------------
looks sweet :D And turing is capable... Catalyst and Homer already wrote their engines a while back...

thought this one errors out if I move my mouse to the right far enough (array out of range)

-----------------------------------
jonos
Sun Feb 15, 2004 8:28 pm


-----------------------------------
that is awesome, so smooth and unexpected. one of the best ive seen and has a lot of potential for some cool stuff like making a program in turing to build models and whatnot. great program  :D  :D

-----------------------------------
shorthair
Sun Feb 15, 2004 9:28 pm


-----------------------------------
turing cant build moels although it may with immense tweaking beable to move them like move blocks aroud ot make shapes , actually though i guess if you had impoorted all hte model shapes , you could make models but this is very very complicated, good old basic has commands to do it for you

-----------------------------------
AsianSensation
Sun Feb 15, 2004 9:32 pm


-----------------------------------
not bad, here, have some bits

+50 bits

-----------------------------------
zylum
Sun Feb 15, 2004 9:35 pm


-----------------------------------
lol i just noticed that this engine is only 100 lines long!!!

btw, thanks for the input guys...

-----------------------------------
Maverick
Sun Feb 15, 2004 9:36 pm


-----------------------------------
Sweet prog u got there.

-----------------------------------
Andy
Sun Feb 15, 2004 9:39 pm


-----------------------------------
wait... u just noticed??? you programed this thing... unless oh man... we got a nother noobie scamming bits off us

-----------------------------------
zylum
Sun Feb 15, 2004 9:44 pm


-----------------------------------
newbie, wtf... i just programmed it yesterday and it ended up being 200 lines long with an assortment of controls but the engine itself is 100 lines long an i just noticed that looking through my program trying to fix a couple of bugs...

plz don't be so hasty as to accuse me without all the facts...

-zylum

-----------------------------------
AsianSensation
Sun Feb 15, 2004 9:46 pm


-----------------------------------
we are in the western world now dodge, it's innocent until proven guilty, not the other way around  :roll: (too much chinese propaga...I meant education does mess with your morals...)

besides, 3D isn't that bad, it's basicly asking whether you have the ability to think outside of the xy plane, and into the xyz plane, do some vector stuff, 3D pythagoras, as I said, not that bad.

-----------------------------------
Maverick
Sun Feb 15, 2004 9:46 pm


-----------------------------------
psst. He was joking

-----------------------------------
zylum
Sun Feb 15, 2004 9:52 pm


-----------------------------------
i wasn't under the impression that he was joking ie smileys. 

i don't mind anyways, it's his job as a mod to look for cheaters and such

-----------------------------------
shorthair
Sun Feb 15, 2004 9:57 pm


-----------------------------------

Zylum Said : btw, i'm fairly new to turing, i have had 1 semester of turing last year and have had 2 weeks worth of turing this year so far (new semester) 

 :think:  :think:  :think: 

Dosent look like a newbish program to me

-----------------------------------
AsianSensation
Sun Feb 15, 2004 10:02 pm


-----------------------------------
1 semester of turing is plenty, SilverSprite made raycasting engine in 1 semester of turing, I'd know, that was part of our midterm project. It basicly all depends on the person's ability in logical thinking. For all we know, zylum could be an incredible math students who have no trouble with vector laws and etc, and then, wouldn't it be easy for him to make a simple 3D program?

-----------------------------------
jonos
Sun Feb 15, 2004 10:13 pm


-----------------------------------
it also depends on teachers and how good your program at school is. the compsci at our school sucks, i learned almost all on my own.

-----------------------------------
zylum
Sun Feb 15, 2004 10:14 pm


-----------------------------------
thanks for the support asiansensation,

it just so happens that i am quite good at math and logical thinking. i'd also like to note that i have had previous programming experience with flash actionscript and seeing as turing is such a simple language, it was really to switch over 

i thought this would have ended with my previous post -_-

-----------------------------------
shorthair
Sun Feb 15, 2004 10:18 pm


-----------------------------------
Well on that note , im quite impressed with this app , and your isometric was really well done.... Keep up this excellent work , been here for a day and already gettin lots of attention , dont jsust chuck all your stuff in at once ,compsci isnt going anywhere , :D  :D  ...... Whats the array error in hte program though , is the mouse in an array when you move it out of the screen srea

-----------------------------------
zylum
Sun Feb 15, 2004 10:24 pm


-----------------------------------
i ought to fix that... i tried to make my program more efficient by making a look up table for sin and cos so that it wouldnt have to do those calculatoins at runtime... the look up table is an array and i guess when you go to the extreme up and right the specified angle is greater than 360 resulting in an error...

-----------------------------------
Homer_simpson
Sun Feb 15, 2004 11:26 pm


-----------------------------------
nice... both mine and catalyst 3d engine are open-sourced in the forum u might wanna take a look at those...

-----------------------------------
Catalyst
Mon Feb 16, 2004 12:10 am


-----------------------------------
good job  :D 

about the look up table thing just make the array go from like -1200 to 1200 it will solve the problem (well ive never had a problem doing it that way :lol: )

edit : tony's way is better

shorthair:

turing cant build moels although it may with immense tweaking beable to move them like move blocks aroud ot make shapes , actually though i guess if you had impoorted all hte model shapes , you could make models but this is very very complicated, good old basic has commands to do it for you 

turing can be used to edit and create models and its not that complicated (turing can do anything, just not quickly)

-----------------------------------
Tony
Mon Feb 16, 2004 12:15 am


-----------------------------------
you should have used

angle mod 360


that way you can keep on rotating it indefinatly since as soon as the number gets to 360+ it will be cut down to keep it within the range

got to watch out for the negatives thought. If angle is under 0, use

 -(abs(angle) mod 360)


-----------------------------------
zylum
Mon Feb 16, 2004 12:22 am


-----------------------------------
hmm, that's exactly what i used and i tried to replicate the error and it doesnt occur here... does anyone else have this problem???

-----------------------------------
shorthair
Mon Feb 16, 2004 4:04 pm


-----------------------------------
Catalyst how could it bult models , i dont understand how turing could resize an object,  or build an object  , i take it you would need to write many classes to do it , but whats the basis around doing  it

-----------------------------------
Cervantes
Mon Feb 16, 2004 5:06 pm


-----------------------------------
Nice program :D
I like how it follows the mouse

-----------------------------------
Tony
Mon Feb 16, 2004 5:18 pm


-----------------------------------
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 :lol:

-----------------------------------
Mazer
Mon Feb 16, 2004 5:44 pm


-----------------------------------
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
Mon Feb 16, 2004 6:03 pm


-----------------------------------
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
Mon Feb 16, 2004 6:24 pm


-----------------------------------
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
Mon Feb 16, 2004 6:29 pm


-----------------------------------
could you explain that a little better.

-----------------------------------
Mazer
Mon Feb 16, 2004 6:42 pm


-----------------------------------
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.


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
Mon Feb 16, 2004 6:55 pm


-----------------------------------
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
Mon Feb 16, 2004 6:59 pm


-----------------------------------
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...

-----------------------------------
zylum
Mon Feb 16, 2004 7:03 pm


-----------------------------------
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 :(

-----------------------------------
jonos
Mon Feb 16, 2004 7:11 pm


-----------------------------------
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
Mon Feb 16, 2004 7:48 pm


-----------------------------------
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
Mon Feb 16, 2004 7:59 pm


-----------------------------------
Well Mazer explained the basis of it pretty well.  Try making a simple one yourself!  I'm going to try :)

-----------------------------------
zylum
Tue Feb 17, 2004 9:49 pm


-----------------------------------
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
Wed Feb 18, 2004 7:55 am


-----------------------------------
"pseudo" 3d

we have raycasting engine and some other pseudo-raycasting engine here on this website somewhere.....

-----------------------------------
Andy
Thu Feb 19, 2004 8:40 pm


-----------------------------------
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
