3D engine

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
ishkabible
Party member
Posts: 241
Joined: Sat Oct 23, 2010 7:34 pm
Location: Kansas USA

3D engine

Post 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
Attachments
3Dprojection4.love
added a lot of little things
(406.47 KiB) Downloaded 1028 times
3Dprojection3.love
tuned the poly sort some more, it's still not perfect
(406.07 KiB) Downloaded 475 times
3Dprojection2.love
got lighting working and kinda got poly sorting working, there is a glitch in it that i haven't fixed yet
(406.07 KiB) Downloaded 520 times
Last edited by ishkabible on Mon Feb 07, 2011 1:11 am, edited 2 times in total.
EMB
Citizen
Posts: 70
Joined: Sat Jan 08, 2011 8:49 pm

Re: 3D engine

Post 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.
Request Programs
If Linux were a beer, it would be shipped in open barrels so that anybody could piss in it before delivery
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: 3D engine

Post 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...
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
User avatar
Thursdaybloom
Citizen
Posts: 81
Joined: Mon Feb 15, 2010 3:43 am
Location: Australia

Re: 3D engine

Post 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?
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: 3D engine

Post 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.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
User avatar
middlerun
Citizen
Posts: 64
Joined: Tue Nov 25, 2008 4:31 am
Location: Sydney, Australia
Contact:

Re: 3D engine

Post 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.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: 3D engine

Post by Robin »

Why? Because you can.

Or just ask Wolfram|Alpha.
Help us help you: attach a .love.
User avatar
ishkabible
Party member
Posts: 241
Joined: Sat Oct 23, 2010 7:34 pm
Location: Kansas USA

Re: 3D engine

Post 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.
User avatar
ishkabible
Party member
Posts: 241
Joined: Sat Oct 23, 2010 7:34 pm
Location: Kansas USA

Re: 3D engine

Post 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.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: 3D engine

Post 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
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 46 guests