Page 1 of 3

Proof of concept: Löve3d( or gLöve :P )

Posted: Wed Nov 19, 2008 10:44 pm
by Borsty
Another project I'm working on is adding basic 3d functionality to Löve. It's basically just a proof of concept because I wanted to check how all the 3d to 2d transformation stuff is done. The functions are close to basic openGl, what's implemented yet is translation, rotation, scaling, basic lights, backface culling and matrix push and pop'ing. Functions to position text in 3d space are also available.

Here are some screenshots:

Image
Image

Current gl-alike commands:

Code: Select all

glSet( setting, val )
glGet( setting )
glEnable( setting )
glDisable( setting )
glGetMatrix()

glPush() / glPushMatrix()
glPop() / glPopMatrix()

glLoadIdentity()
glTransform( a, b, c ) / glTranslate( a, b, c )
glRotate( a, b, c, d )
glScale( a, b ,c )

glVertex( x, y, z )
glColor( r, g, b, a )
glString( pos, text, cl )

glBegin( type )
glEnd()
glFlush()
I still need to fix some stuff and add more possibilities.
What's semi-done is frustrum culling which should fix some drawing errors with stuff that's off screen but still gets rendered.

Here's the .love for you to play around or take a look how it's done and maybe you can find a better solution for something :P.
Camera movement is wasd and the arrow keys, but notice that it's bugged, still working on it.
glove.love
gLöve ( or Löve3d )
(16.75 KiB) Downloaded 837 times
## Update ##
The camera movement was bugged because I accidently changed the order of matrix multiplications, which fucked up the result :C
Here's the fixed one :P
glove_2.love
updated gLöve
(16.75 KiB) Downloaded 1108 times

Re: Proof of concept: Löve3d( or gLöve :P )

Posted: Thu Nov 20, 2008 3:10 am
by Ripe
Cool! This thing just keeps getting more and more interesting.

Re: Proof of concept: Löve3d( or gLöve :P )

Posted: Thu Nov 20, 2008 7:56 am
by rude
Crazy stuff!

Re: Proof of concept: Löve3d( or gLöve :P )

Posted: Thu Nov 20, 2008 10:23 am
by mike
Wow.
That's...

Wow.


PROTIP: I am amazed.

Re: Proof of concept: Löve3d( or gLöve :P )

Posted: Thu Nov 20, 2008 3:50 pm
by Borsty
Wrote a wavefront .obj model loader today. But you can't find any good low poly models on the web when you need some :C
Anyone here to make some very basic .obj models without textures etc? :P Like some small cars, houses, etc.

Pic:
Image

Re: Proof of concept: Löve3d( or gLöve :P )

Posted: Thu Nov 20, 2008 4:02 pm
by Kuromeku
Oh my gosh.

+ 100 LÖVE.

Re: Proof of concept: Löve3d( or gLöve :P )

Posted: Thu Nov 20, 2008 4:04 pm
by Kuromeku
Wow. How limited will this be? What's the best you'll be able to do?

Re: Proof of concept: Löve3d( or gLöve :P )

Posted: Thu Nov 20, 2008 4:26 pm
by qubodup
Borsty wrote:But you can't find any good low poly models on the web when you need some :C
Get the packs from the right side bar of LPC. Or look for specific ones on their forums.

PS: I think it looks like a neat toy. But probably not usable for 3D games, though probably usable for some super-special scenes in 2d games..

PPS: lua 3D I know of would be Lugre.

Re: Proof of concept: Löve3d( or gLöve :P )

Posted: Thu Nov 20, 2008 4:51 pm
by Borsty
Kudomiku wrote:Wow. How limited will this be? What's the best you'll be able to do?
Well, on my notebook I ran into low framerates when getting over like 100 polygons.
A 3000 poly model ran at like 0.3 fps.
But that's a 4 years old 1.5 GHz centrino thingy with a geforce 6200 go, nothing you could call a gaming machine :P
Will push it to it's limits on my desktop pc tomorrow.

With low poly I mean really low poly :P when I got the frustrum culling added to increase the performance a little I'll write a small gta alike game, so only buildings are "3d", maybe the cars too, dunno.

Re: Proof of concept: Löve3d( or gLöve :P )

Posted: Thu Nov 20, 2008 7:57 pm
by Borsty
Hmmm... double post? Meh, time has passed :P

Anyway, I rewrote the .obj parser, it now supports groups and materials ( only reads the color but at least it does :D )

Image
Here's a pic of a small car I made, now the biggest issue is the lack of a zBuffer that could stop the wheels from being drawn.... wierdly :P
Maybe I can fix that with tweaking the model a little :/
Another thing is the *not the most accurate* way of calculating the brightness of a face. Could be fixed easily but lowers the fps once more.

Löve just isn't made for this :P

For those who're interested, here's a new .love for ya :P