Computer Science Canada

Attempt at 3D ...

Author:  Kuntzy [ Sat Jan 31, 2004 5:53 pm ]
Post subject:  Attempt at 3D ...

This is my first attempt at a 3d anything, the pyrimd moves into the distance ... i'm still messing around with other stuff to make it rotate.

Author:  Paul [ Sat Jan 31, 2004 5:55 pm ]
Post subject: 

wow that looks really good, would it work if the faces were colored?
BTW, I kept on clicking "just click here" and nothing happened. Wink

Author:  TheXploder [ Sat Jan 31, 2004 6:03 pm ]
Post subject: 

hey that's great I once did something like that and it was a race game as a brids eye view ans the tall buildings moved by, it wasn't in turing though...

Author:  Kuntzy [ Sat Jan 31, 2004 6:07 pm ]
Post subject: 

Yeah, i'm not quite sure how to add faces to the object, if someone can i'd be interested in seeing the code.

Author:  Cervantes [ Sat Jan 31, 2004 6:25 pm ]
Post subject: 

that's the simplest 3d engine I've seen that I might actually have a chance of understanding Smile (esp cuz the others are exe Laughing)

good work!!

Author:  Andy [ Sat Jan 31, 2004 6:41 pm ]
Post subject: 

it looks the same if u use pic.scale

Author:  Catalyst [ Sat Jan 31, 2004 7:01 pm ]
Post subject: 

nice work Very Happy

Author:  sport [ Sun Feb 01, 2004 12:10 pm ]
Post subject: 

Nice program

Author:  Cervantes [ Sun Feb 01, 2004 1:50 pm ]
Post subject: 

dodge its not just scaled its rotated too Very Happy
(forgive me if that'd didn't make any sense, I haven't read the code yet Confused )

Author:  shorthair [ Sun Feb 01, 2004 1:52 pm ]
Post subject: 

The code isnt that complex , it gives off an awsome affect , you should texture the sides to show rotation

Author:  Cervantes [ Sun Feb 01, 2004 2:07 pm ]
Post subject: 

that's what he was trying to do I would assume when he said "Yeah, i'm not quite sure how to add faces to the object, if someone can i'd be interested in seeing the code."

Cheers

Author:  Homer_simpson [ Sun Feb 01, 2004 11:07 pm ]
Post subject: 

sexy!
now try adding rotation...
note: you're going to have rotating every point of yer object around a center... you can find the center of yer object by getting the average of x,y and z pointes separately..

Author:  sport [ Mon Feb 02, 2004 6:58 pm ]
Post subject: 

It is rotating, just can't see cause it is the same color.

Author:  Catalyst [ Mon Feb 02, 2004 7:03 pm ]
Post subject: 

its not rotating thats just a perspective effect

Author:  shorthair [ Mon Feb 02, 2004 7:12 pm ]
Post subject: 

Are you sure , if you slow it down it loks like its rotating

Author:  Andy [ Mon Feb 02, 2004 7:19 pm ]
Post subject: 

no the shrinking of it makes it look like its rotating cuz the lines arent straight

Author:  Catalyst [ Mon Feb 02, 2004 8:11 pm ]
Post subject: 

i think its being moved inward probably makes the rotational effect

Author:  Kuntzy [ Mon Feb 02, 2004 9:24 pm ]
Post subject: 

yeah it's not rotating its just the persepective, the math for rotation is still a bit fussy to me, but anyway homer and catalyst are right. and also pic scale or pic rotate is slower for turing to run, simple lines and math and a much faster approach for your game.

Author:  TheXploder [ Mon Feb 02, 2004 11:03 pm ]
Post subject: 

but what if you draw polygons instead of simple lines, that could work...

Author:  Catalyst [ Mon Feb 02, 2004 11:04 pm ]
Post subject: 

this should help

code:

    proc Rotate (X,Y,Z, XA, YA, ZA : real)

            relZ := (((Z - z) * cosd (XA)) + ((Y - y) * sind (XA)))
            relY := (((Y - y) * cosd (XA)) - ((Z - z) * sind (XA)))
            y := Y - relY
            z := Z - relZ

            relZ := (((Z - z) * cosd (YA)) + ((X - x) * sind (YA)))
            relX := (((X - x) * cosd (YA)) - ((Z - z) * sind (YA)))
            x := X - relX
            z := Z - relZ

            relX := (((X - x) * cosd (ZA)) + ((Y - y) * sind (ZA)))
            relY := (((Y - y) * cosd (ZA)) - ((X - x) * sind (ZA)))
            y := Y - relY
            x := X - relX

    end Rotate

Author:  Kuntzy [ Tue Feb 03, 2004 8:58 pm ]
Post subject: 

wow, thanx catalyst ... don't know what to say

Author:  valor [ Wed Mar 24, 2004 10:33 pm ]
Post subject: 

wow thats sweet, i didnt know that turing could make 3d things, very interesting

Author:  zylum [ Wed Mar 24, 2004 11:58 pm ]
Post subject: 

here's the source to a very simple wireframe program which is really a simplified version of my full 3d engine:

code:
setscreen ("offscreenonly")

const faces := 8
const perspective := 250

var xpp : array 1 .. faces, 1 .. 3 of real := init (-50, 0, 50, 50, 0, 50, -50, 0, 50, -50, 0, -50, -50, 0, 50, 50, 50, 50, -50, 0, 50, -50, -50, -50)
var ypp : array 1 .. faces, 1 .. 3 of real := init (0, 50, 0, 0, 50, 0, 0, 50, 0, 0, 50, 0, 0, -50, 0, 0, -50, 0, 0, -50, 0, 0, -50, 0)
var zpp : array 1 .. faces, 1 .. 3 of real := init (50, 0, 50, 50, 0, -50, -50, 0, -50, -50, 0, 50, 50, 50, 50, 50, 0, -50, -50, -50, -50, -50, 0, 50)

var xp : array 1 .. faces, 1 .. 3 of real
var yp : array 1 .. faces, 1 .. 3 of real
var zp : array 1 .. faces, 1 .. 3 of real

var x : array 1 .. 3 of int
var y : array 1 .. 3 of int
var z : array 1 .. 3 of int

var ax, ay, az : int := 0

var mx, my, md : int

procedure rotate (face : int)
    var temp : real
    for i : 1 .. 3
        yp (face, i) := ypp (face, i) * cosd (ax) - zpp (face, i) * sind (ax)
        zp (face, i) := zpp (face, i) * cosd (ax) + ypp (face, i) * sind (ax)
        temp := zp (face, i)
        zp (face, i) := zp (face, i) * cosd (ay) - xpp (face, i) * sind (ay)
        xp (face, i) := xpp (face, i) * cosd (ay) + temp * sind (ay)
        temp := xp (face, i)
        xp (face, i) := xp (face, i) * cosd (az) - yp (face, i) * sind (az)
        yp (face, i) := yp (face, i) * cosd (az) + temp * sind (az)
        x (i) := round (xp (face, i) / (1 - zp (face, i) / perspective)) + maxx div 2
        y (i) := round (yp (face, i) / (1 - zp (face, i) / perspective)) + maxy div 2
    end for
end rotate

loop
    drawfillbox (0, 0, maxx, maxy, 200)
    mousewhere (mx, my, md)
    ax := my mod 360
    ay := mx mod 360
    for i : 1 .. faces
        rotate (i)
        drawpolygon (x, y, 3, black)
    end for
    View.Update
end loop


-zylum

Author:  the_short1 [ Fri Mar 26, 2004 6:29 pm ]
Post subject: 

leave it to zylum to create the most complex and wicked programs....
.

nice 3d triangle...kruntz......... have urs rotate would look wicked.... also having the lines drawn in a neon ./ bright color and having the backround color black would look sweet

and zylumm... THAT IS AMZING!!!!!!!!!!!!!!!

Author:  zylum [ Fri Mar 26, 2004 6:51 pm ]
Post subject: 

it's really not that complicated once you know trig... the hard part is rotating the points in 3d space (the rotate procedure)... and that's ALL trig... so after grade 10 math you should be able to make a basic 3d wireframe program like the one above Wink

-zylum

Author:  the_short1 [ Fri Mar 26, 2004 7:02 pm ]
Post subject: 

im from BC.,.,. since highscoll in BC starts at gr.8... i did trig and everyting last year.... so... i have done everything for most clases last year,... sucks repeating... but meh.!.... some things they teach are different ... but the basics i already learned... geting VERY BORING in math...

next year in compsci i will be integrating math into compsci... rite now its still too much object thinking... and ill just wait...

but math.,.. ERR!!!! feel like killing myself having to listen to the teacher explain something i alredy know for like 2 hours... Rolling Eyes Evil or Very Mad Evil or Very Mad Evil or Very Mad Evil or Very Mad Evil or Very Mad Mad Mad Mad Mad Mad Mad Mad

Author:  RETARD32 [ Sat Apr 03, 2004 10:24 pm ]
Post subject: 

If you think that wire fram is good than you should see some of the things that catalyst has made.

Author:  Delta [ Sun Apr 18, 2004 11:24 pm ]
Post subject: 

Your wireframe is screwed to the max zylum... your rotating something in there wrong because if you make the spikes (open sides) face towards you and then move them left and right you can see that they rotate wrongly. But otherwise it looks nice... just fix the rotation problem


: