Computer Science Canada

Thuvs"s 3D Engine Demo

Author:  DIIST [ Mon Apr 09, 2007 11:22 am ]
Post subject:  Thuvs"s 3D Engine Demo

Well it works, a tad bit fater than before:

Features:
Lighting,
Rotation,
Loading from file,
and primitive object(right now only a box, but i'll get there Wink)

Next realease, hopefully Cool :
cellshading,
culling,
more primitive objects. Get the ball rolling!
conversion from raw and arf formats to .seki files Arrow
documentations
and some serious optimizations Mr. Green


How to use:
Arrow keys to turn light!
Mose to rotate
Esc key to quit

Author:  uberwalla [ Mon Apr 09, 2007 12:26 pm ]
Post subject:  Re: Thuvs"s 3D Engine Demo

edit: never saw it, now i do

edit2: very nice man i like the way the ship moves fluently. the flickering is kinda freaky cuz i didn't know it would do that right away. you should add moving stars in the bg, that'd be sick lol Smile

gj, i like it Very Happy

Author:  Geostigma [ Mon Apr 09, 2007 9:47 pm ]
Post subject:  RE:Thuvs"s 3D Engine Demo

Okay, impressed youhave a omni system created, now I want to see you render a texture to the model. Then you can actually use this engine.

Author:  DIIST [ Mon Apr 09, 2007 10:18 pm ]
Post subject:  Re: Thuvs"s 3D Engine Demo

I tried renedering textures before but fps drops quite a lot. Laughing.
But it will ber interesting, i'll give it a shot for the next realease.

Author:  Geostigma [ Mon Apr 09, 2007 10:24 pm ]
Post subject:  RE:Thuvs"s 3D Engine Demo

Well the problem is that you want to make 3d in Turing, thats great. You should be able to do textures.

SNES had star fox which was a 3d game. If they could create a successful game on a shaddy snes engine, then why can you do the same with Turing? HOWEVER they just coloured the polygons because they couldn't do textures for your obvious reason.

Get selective poly colouring. and try to get a few ships move across the screen doing something to test the functionality of your engine.

Author:  ericfourfour [ Tue Apr 10, 2007 9:23 pm ]
Post subject:  RE:Thuvs"s 3D Engine Demo

Fortunately for the SNES programmers, they were using much more developed programming languages than Turing. Although, the high processing power in today's computers (compared to SNES) will probably balance it out.

Author:  Geostigma [ Tue Apr 10, 2007 9:35 pm ]
Post subject:  RE:Thuvs"s 3D Engine Demo

Exactly.

Author:  DIIST [ Thu Apr 19, 2007 12:35 pm ]
Post subject:  Re: Thuvs"s 3D Engine Demo

Lates BugFixed Engine plus file chooser and a bunch of compatable meshes i got from this site, Very Happy
+a lot faster thats for sure.

Trying to push for textures, and coloured polygons + easy to use functionality for next release.
Maybe enbeded objects if chem teacher lightens the load Smile

Author:  petree08 [ Thu Apr 19, 2007 2:55 pm ]
Post subject:  RE:Thuvs"s 3D Engine Demo

Wow this program is crazy!
I thought 3d in turing was impossible
Thanks man for posting this

Author:  DIIST [ Sun Apr 29, 2007 9:24 am ]
Post subject:  Re: Thuvs"s 3D Engine Demo

Im getting close to doing textures. Check this out.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
I basically used fractals to make it look like i applied a texture. The real thing will come when i start to quadsplice. Well the code for it is attached. + I forgot to send the meshes last time so i'll send that too Very Happy .

Author:  Geostigma [ Sun Apr 29, 2007 10:06 am ]
Post subject:  RE:Thuvs"s 3D Engine Demo

game engines do use tri's so I don't know why your doing quad splicing unless its for textures

Author:  DIIST [ Sun Apr 29, 2007 10:41 am ]
Post subject:  Re: Thuvs"s 3D Engine Demo

Quads can free up resources when you are using square face planes like cubes. Cubes would render lot faster with quads than with triangles. Most 3d engines do both. I planing to do both but first bring textures to quad faces then tri's. Because i noticed coding for with quads is a lot easier than with triangles, especially for textures.

Author:  Andy [ Sun Apr 29, 2007 8:38 pm ]
Post subject:  Re: Thuvs"s 3D Engine Demo

it's not hardware accelerated so it doesnt matter whether he uses quads or triangles. windows gdi will drow them as bitmaps so its all the same.

Author:  DIIST [ Wed May 02, 2007 8:25 am ]
Post subject:  Re: Thuvs"s 3D Engine Demo

So for this is how it looks! But it runs at 3FPS, once i make it go faster i'll post the code!
Posted Image, might have been reduced in size. Click Image to view fullscreen.

Author:  program_x [ Wed May 02, 2007 9:33 am ]
Post subject:  Re: Thuvs"s 3D Engine Demo

WOOT!! star fox for SNES!! i beat it many times, but thats not the point. i like the lighting but i agree, is there any way to speed it up ?

Author:  zylum [ Wed May 02, 2007 9:40 am ]
Post subject:  Re: Thuvs"s 3D Engine Demo

very nice though 3 fps is a bit impractical. i doubt you will be able to improve the frame rate enough to make it practical. if youre calculation for each pixel is relatively fast compared to the drawing of the pixel (ie just looking up an RGB value in memory) i have a method to improve the drawing speed though its a bit of a hack.

Author:  DIIST [ Wed May 02, 2007 12:21 pm ]
Post subject:  Re: Thuvs"s 3D Engine Demo

program_x wrote:

WOOT!! star fox for SNES!! i beat it many times, but thats not the point. i like the lighting but i agree, is there any way to speed it up ?

4th Guy to say that. Its really a giant red Panda. Wink

zylum wrote:

very nice though 3 fps is a bit impractical. i doubt you will be able to improve the frame rate enough to make it practical. if youre calculation for each pixel is relatively fast compared to the drawing of the pixel (ie just looking up an RGB value in memory) i have a method to improve the drawing speed though its a bit of a hack.


I'm guessing the hack cant be posted, would be nice to increase the frame rate. The speed can increase with my program but its inconsistent. It jumps to 10fps then goes back to 3. Reason is I'm using fractals to texture and the depth of the fractals is all dependent on the object orientation, and angle. I'll post the code in a bit, but everything is all over the place and i have to organize it. + Document it

Author:  zylum [ Wed May 02, 2007 11:25 pm ]
Post subject:  RE:Thuvs"s 3D Engine Demo

its a hack in the sense that i draw using something that wasnt intended to be used for drawing.

basically i use the sizepic and takepic methods and the associated array as a buffer and draw to that then i output it all at once. though upon further testing it seems to be about as fast as offscreenonly Razz the advantage of my method though is that you can draw at what ever resolution you are rendering at and automatically draw it as full screen.

here is some example code. basically the buffer array stores the image in a sort of bitmap format so you might wanna read up on that. also i didnt really optimize the code so maybe you can speed that up (probably a lot).

code:
View.Set ("graphics:640;480,nobuttonbar")

const scale := 0.25

const x := round (maxx * scale)
const y := round (maxy * scale)

var b : array 1 .. sizepic (1, 1, x, y) of int

takepic (1, 1, x, y, b)
b (7) := 48
for i : 19 .. upper (b)
    b (i) := 0
end for

var id := 19
var n := 0
var t := Time.Elapsed

for j : 1 .. y
    for i : 1 .. x
        b (id)| = 255 * i * j div (x * y) shl n    %b
        if n < 24 then
            n += 8
        else
            n := 0
            id += 1
        end if

        b (id)| = 255 * i * j div (x * y) shl n     %g
        if n < 24 then
            n += 8
        else
            n := 0
            id += 1
        end if

        b (id)| = 255 * i * j div (x * y) shl n     %r
        if n < 24 then
            n += 8
        else
            n := 0
            id += 1
        end if
    end for
    if n > 0 then
        id += 1
        n := 0
    end if
end for

drawpic (0, 0, b, 1)

var p := Pic.New (1, 1, x, y)

Pic.Draw (Pic.Scale (p, maxx, maxy), 1, 1, picCopy)

put "Draw Time: ", Time.Elapsed - t, " Milliseconds"

Author:  DIIST [ Thu May 03, 2007 4:06 pm ]
Post subject:  Re: Thuvs"s 3D Engine Demo

Very usefull Smile but the way it going I'm probably just gonna make two engines, a rendering engine and a 3d engine.
Leave texture for the rendering engine, so you can expect lag.

Author:  DIIST [ Sat May 05, 2007 12:05 pm ]
Post subject:  Re: Thuvs"s 3D Engine Demo

Well heres the code for texturing on cubes. Didnt manage to get any further. The codes not organized but i eventuall do it Cool .

Author:  Wing_Wing [ Sat May 26, 2007 7:18 pm ]
Post subject:  Re: Thuvs"s 3D Engine Demo

After I just downloaded the file and ran it, I received an error:

I/O attempted on unopened stream number -10. Open failed with message 'File "C:\Users\Home\AppData\Local\Temp\Rar$Dl01\ship.seki" not found'.

or something like that. Ringing any bells?

Author:  Saad [ Sat May 26, 2007 9:40 pm ]
Post subject:  RE:Thuvs"s 3D Engine Demo

You ned to extract the files to a folder, else it wont work

Author:  Tallguy [ Mon May 28, 2007 8:06 am ]
Post subject:  RE:Thuvs"s 3D Engine Demo

sweet!!!!!!!!!!!!!!!!!!!!!!!!!!!!! so tripy

Author:  CodeMonkey2000 [ Mon May 28, 2007 6:53 pm ]
Post subject:  RE:Thuvs"s 3D Engine Demo

Wow. I wish I knew more about 3d graphics Sad. By the way what grade are you in?

Author:  DIIST [ Mon May 28, 2007 8:44 pm ]
Post subject:  Re: RE:Thuvs"s 3D Engine Demo

CodeMonkey2000 @ Mon May 28, 2007 6:53 pm wrote:
Wow. I wish I knew more about 3d graphics Sad. By the way what grade are you in?
I started out thing the way to solve a 3d problem was using a 3 dimensional array. I had weirder ideas than that too about 3d graphics. Currently I'am in grade 12 taking discrete math and geometry. Decided to test out what i learned. I usually just write my programs in turing cause its faster(an im used to it), but i know c and java and an assortment of other languages too. This was actually based off my original engine i built in grade 11, man has it improved after learning OOP. Laughing

Author:  CodeMonkey2000 [ Wed May 30, 2007 10:44 am ]
Post subject:  RE:Thuvs"s 3D Engine Demo

I've been think about collision in 3d. You can still use 2d tile method of colliding for basic plat formers. Each height level checks from a different text map though. Or if you want a more precise method , imagine a sphere around your objects. You need incorperate Z into the equation: sqrt((deltaX)^2+(deltaY)^2). This equation will give you the distance between two objects. If the distance between the two polygons is greater than the sum of the radiis then *boom!* they collide, game over. Both of these methods are more efficient than the whatdot colour method, and this is important since 3d is slow in turing.

Author:  Tallguy [ Wed May 30, 2007 11:28 am ]
Post subject:  RE:Thuvs"s 3D Engine Demo

when i ran ur texture program i get a blank screen....i can't open any of ur files at all

Author:  DIIST [ Wed May 30, 2007 11:44 am ]
Post subject:  Re: Thuvs"s 3D Engine Demo

For some odd reason turing has a problem with setcolor if your on a win98 or lower environment. It works on the P3 xp computer at school. If you want ill post up the code that dosent use RGB.SetColor, but it wont have any lighting. As for the files, there not written in quads. Im currently working on newer engine, by the looks seems to be a lot faster with more improvements which will include texture for triangle mesh files. Probably release it in a month. Its going to take a while because i want to make a game with the engine to test its capabilities.

Author:  DIIST [ Wed May 30, 2007 4:14 pm ]
Post subject:  Re: RE:Thuvs"s 3D Engine Demo

CodeMonkey2000 @ Wed May 30, 2007 10:44 am wrote:
I've been think about collision in 3d. You can still use 2d tile method of colliding for basic plat formers. Each height level checks from a different text map though. Or if you want a more precise method , imagine a sphere around your objects. You need incorperate Z into the equation: sqrt((deltaX)^2+(deltaY)^2). This equation will give you the distance between two objects. If the distance between the two polygons is greater than the sum of the radiis then *boom!* they collide, game over. Both of these methods are more efficient than the what dot color method, and this is important since 3d is slow in turing.
Spherical collision would be the best for 3d but like the Perfect Circle Collision tut showed you have to take into the account that object may pass through one an another on two separate frames but still never collide. Solid Boxed collision could be better thought. With solid box collision you just compare the points of one objects collision box to see weither it is inside the collision box of another object. It is faster in the since that you are just using comparisons as opposed to actual calculations using math and the distance formula. You still have to worry about collision missing thought Sad ! As for the tile method it would be usefull if you make a 3drpg of any sort. It is possible, and i am considering creating tilemap support for my engine soon. It works like any other 2d tilemap but in 3d using heightmaps.

Author:  CodeMonkey2000 [ Wed May 30, 2007 4:25 pm ]
Post subject:  RE:Thuvs"s 3D Engine Demo

I believe many games from the ps1/n64 era used the tile system. I know metal gear sold, crash bandicoot and spyro used the tile system. Many fps used raycasting along with a tile system (such as doom, wolfen Stien 3d, etc.). And the great thing about a tile system is that level editing is 10 times easier.

Author:  DIIST [ Wed May 30, 2007 4:47 pm ]
Post subject:  Re: RE:Thuvs"s 3D Engine Demo

CodeMonkey2000 @ Wed May 30, 2007 4:25 pm wrote:
level editing is 10 times easier.
Tell Me About It. Laughing
I saw your level editor, not bad.

My new engine is on the works. I made a few improvements, and i'm actually documenting this time so some user that are making their own engines can understand what i did. I plan to create a complied html file of my class and methods kinda like f10 in turing once i learn how.

Well this is what i plan on adding. Tell me what you guys think. If you have any special request, post them up to.
This is the list that i plan to code on the next release :
-textures (done for the most part)
-colored polygons
-directional lighting
-point lighting
-enabling 2d graphics to be drawn 3d surfaces (a supplement for textures)
-3d mouse movements and keyboard support
-camera,scene and world class
-height maps (tile maps)
-special class that lets you draw grass, water and clouds
-3d particle engine (fire, rain, stars, etc)
-reading from variety of formats like .raw, .obj, and lwo
-mesh compressor (reduces the number of polygons & points in mesh )
-3d file editor
-3d scene creator
-ray tracing engine (going to be written in C) that will render a scene to a image

If any one wants to help me on this engine and make it a joint project feel free to pm me, or add my msn. I will share the credit.

Author:  DifinityRJ [ Thu May 31, 2007 3:55 pm ]
Post subject:  Re: Thuvs"s 3D Engine Demo

my god.......i envy...you... Shocked

This is soo cool, i'm trying to learn 3d , not as easy as i thought it would be.

Author:  Tallguy [ Fri Jun 01, 2007 8:20 am ]
Post subject:  RE:Thuvs"s 3D Engine Demo

according to my comuter ur program has several errors, like pics wont load etc, i don't think its ur program, so good work so far

Author:  DIIST [ Thu Jun 07, 2007 11:46 am ]
Post subject:  Re: Thuvs"s 3D Engine Demo

Can any one give me their opinion on how close this looks to cell shading?
Posted Image, might have been reduced in size. Click Image to view fullscreen.
I basically reduced the pallet size and color variation from my previous engine to produce this effect. And added the weird outline. I'lll post the code up in a bit.

Author:  Nick [ Sun Aug 12, 2007 5:13 am ]
Post subject:  RE:Thuvs"s 3D Engine Demo

DUDE YOU ARE GOD!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
TEACH ME!!! lol
in all seriousness tho this is amazing and u are amazing for doing this...
also as a programmer myself this would work wonders in my games i make althoguh lag might be a problem Razz
all in all YOU ARE GOD!!!!!!!!!!!!!!!!
keep up the good work


: