Page 1 of 2

3D Proof of Concept

Posted: Wed Dec 03, 2014 4:57 pm
by gnomish
3D Proof of Concept

Image

Recently, I've been hacking on a small 3D proof of concept. Here are some bullet points:
  • * Includes a very (very) basic WaveFront OBJ loader
    * Works with Love 0.9.1 out-of-the-box
    * Uses Luajit's FFI to enable/disable OpenGL's depth testing
Future work:
  • * Get vertex normals working
    * Explore possibility of using advanced opengl functionality
    * Break the OBJ loader out into a separate library on Github
    * Break out math library - either into it's own repo, or submit patches to shakesoda/cpml
Download:
3d-obj-loader-december-2-2014-v3.love


Many thanks to Karai, Madoka, Slime, and everyone else who helped get this working.


Also see:

LÖVE3D
viewtopic.php?f=5&t=78943

Oysi's 3D Rendering & Physics Engine
viewtopic.php?f=5&t=77896

Re: 3D Proof of Concept

Posted: Wed Dec 03, 2014 5:56 pm
by Tjakka5
Looks great, and that fps too!

Can you also provide a example with multiple 3d objects?
And maybe even some with alpha and the such?

Re: 3D Proof of Concept

Posted: Wed Dec 03, 2014 8:40 pm
by soulaymenc
Amazing work! Would love to see more features coming, so I can start making 3d games in love2d .. uhh that's sounds wrong .., love3d :D

Re: 3D Proof of Concept

Posted: Wed Dec 03, 2014 9:19 pm
by gnomish
Tjakka5 wrote: Can you also provide a example with multiple 3d objects?
The example I posted has two meshes (two chests).
Tjakka5 wrote: And maybe even some with alpha and the such?
Could you clarify what you mean by alpha? Do you mean transparent textures? Could you provide a screenshot of what you mean?

Thanks

Re: 3D Proof of Concept

Posted: Thu Dec 04, 2014 1:19 am
by Jasoco
The part I'm most interested in is the pixel depth shading. (Texture clipping when models overlap) This is the first time I've seen it done in Löve. I'd be interested in seeing a real stress test however. How would it handle a large scene with many models?

Re: 3D Proof of Concept

Posted: Thu Dec 04, 2014 2:29 am
by slime
Jasoco wrote:The part I'm most interested in is the pixel depth shading. (Texture clipping when models overlap) This is the first time I've seen it done in Löve. I'd be interested in seeing a real stress test however. How would it handle a large scene with many models?
About as well as any 'real' 3D game, since it uses the same hardware functionality. :)

Re: 3D Proof of Concept

Posted: Thu Dec 04, 2014 5:48 am
by gnomish
slime wrote:
Jasoco wrote:The part I'm most interested in is the pixel depth shading. (Texture clipping when models overlap) This is the first time I've seen it done in Löve. I'd be interested in seeing a real stress test however. How would it handle a large scene with many models?
About as well as any 'real' 3D game, since it uses the same hardware functionality. :)
Exactly.

@Jasoco: This demo I posted is not like the 3D work you've been doing -- which is much more impressive, btw. If I'm not mistaken, you're writing a 3D rasterizer. With my demo, I was simply trying to find a way to inject a call to glEnable(GL_DEPTH_TEST).

Re: 3D Proof of Concept

Posted: Thu Dec 04, 2014 6:16 am
by Jasoco
gnomish wrote:
slime wrote:
Jasoco wrote:The part I'm most interested in is the pixel depth shading. (Texture clipping when models overlap) This is the first time I've seen it done in Löve. I'd be interested in seeing a real stress test however. How would it handle a large scene with many models?
About as well as any 'real' 3D game, since it uses the same hardware functionality. :)
Exactly.

@Jasoco: This demo I posted is not like the 3D work you've been doing -- which is much more impressive, btw. If I'm not mistaken, you're writing a 3D rasterizer. With my demo, I was simply trying to find a way to inject a call to glEnable(GL_DEPTH_TEST).
I would kill to have pixel depth shading though. Without it it means all my quads (I have to use 4 corner quads instead of triangles because of the way my texture library works) are sorted as it by depth and if something is complex, you get improper z-sorting on certain polygons which looks terrible. Plus it means I can't have shapes intersect with other shapes as it will draw the entire polygon instead of clipping it.

I don't know how your demo really works even though I looked at the code, but as soon as I saw the two chests intersect with each other, you got my attention. Plus the detail and texturing of the model in that example was lovely. It's the style I'd love to go for but can't because of my limitations.

I'd always wondered if there was a way to take all my polygons, throw them into a shader with each ones four screen x and y and distance from camera for each corner and have it draw everything all at once with each textured polygon intersecting properly.

But thanks for saying mine is impressive even though it's quite simple and limited. Perhaps you'd like to go into more detail about what exactly is going on in this demo?

Re: 3D Proof of Concept

Posted: Thu Dec 04, 2014 8:17 am
by Karai17
Jasoco wrote:The part I'm most interested in is the pixel depth shading. (Texture clipping when models overlap) This is the first time I've seen it done in Löve. I'd be interested in seeing a real stress test however. How would it handle a large scene with many models?
I'm gonna use this opportunity to remind you that the LOVE3D that myself and shakesoda are working has had depth buffering from the beginning (among many other things).

Re: 3D Proof of Concept

Posted: Thu Dec 04, 2014 6:47 pm
by foo0
I would love love.graphics.newMesh3D() function that would allow passing xyz coordinates to the shader without hacks :)