Page 1 of 3

3D engine

Posted: Sun Feb 06, 2011 1:24 am
by ishkabible
ok so i know Jasoco already made am engine but i failed to be able to read his code or understand his logic behind why he did things. i have rotations abd projection down and now i need to sort the polygons and add shading then it will be mostly done. if i haven't looked at how to make shadows yet but i think i can figure it out

edit: i got lighting working and i got the poly sort mostly working. the lighting is static and the poly sort has an issue; under some scenario small triangles will show up in 1 or 2 of the corners of the cube but i haven't figured out how to fix it yet. ill look more into that tomorrow

edit2: i tuned the poly sort some, it's still not perfect but it works pretty well

edit3: i improved performance by 2 fold. oddly enough love.graphics.getColor() was 8.5% of the issue :shock: even more shocking the sort only took 1.1% of time :ultrashocked: ... that's why we profile our codes kids ;)
i also added in push and pop matrix operations so that you can rotate, move, and alter the projection of a selected set of polygons with out having to back trace everything you did.the poly sort bug is still aloft however :x. also there may be performance issue with this on some computers as it's rendering 600 triangles, i was using this to test performance. i get 30fps with regular love on this now

Re: 3D engine

Posted: Sun Feb 06, 2011 10:44 am
by EMB
NICE!
But what is the console for? And could you make the screen size a bit smaller, I had to force close it.

Re: 3D engine

Posted: Sun Feb 06, 2011 11:52 am
by Taehl
Why bother making 3D for a 2D game engine? If someone wanted to make a 3D game, they could use a 3D engine...

Re: 3D engine

Posted: Sun Feb 06, 2011 12:25 pm
by Thursdaybloom
Taehl wrote:Why bother making 3D for a 2D game engine? If someone wanted to make a 3D game, they could use a 3D engine...
Why bother doing anything?

Re: 3D engine

Posted: Sun Feb 06, 2011 1:23 pm
by Taehl
For the result. I don't see how this could result in something worth spending the time to make, unless they're trying to learn how to make their 3D engine, and this is a prototype or something.

Re: 3D engine

Posted: Sun Feb 06, 2011 2:04 pm
by middlerun
That's pretty cool. I was more or less without internet for the last week or so, and out of boredom I started experimenting with 3D LÖVE. So it's interesting to looks though your code and see what we did the same/differently.

And as for why: Why climb a mountain? Because it's there.

Re: 3D engine

Posted: Sun Feb 06, 2011 2:43 pm
by Robin
Why? Because you can.

Or just ask Wolfram|Alpha.

Re: 3D engine

Posted: Sun Feb 06, 2011 5:25 pm
by ishkabible
i have actually learned a lot from doing it, i can't find any reading martial on poly sorting other than z-buffering witch is far too expensive for this. i haven't figured out how to move the light correctly either, right now if you move the light the sides of the cube do some wired stuff that doesn't look right at all. im having a lot of fun making this however, i think im going to add textured billboards so i can get more creative with a game.

edit: i have an idea on poly sorting, im gonna test the normals to get the display order. if the normal points towards the viewer then it goes in front of the one that points away form the viewer, that should help.

Re: 3D engine

Posted: Sun Feb 06, 2011 6:28 pm
by ishkabible
i tuned the poly sort somemore, i wish i could find some algorithm that would give me the sorting order I'm looking for. i'm not looking for clipping or z-buffering just poly sorting by visual depth.

Re: 3D engine

Posted: Sun Feb 06, 2011 7:15 pm
by BlackBulletIV
Nice work! I'm impressed.

I found a bug (you probably already know) where at around the coordinates listed below two sides of the box look like they've caved in.

Code: Select all

x,y,z: -1.3,-4.4,18.9
rx,ry,rz: 0,0,-2.5
EDIT: Oh here's another one:

Code: Select all

x,y,z: 4.6,5,21.1
rx,ry,rz: 0,-5.5,-2.5