Page 1 of 13

Oysi's 3D Rendering & Physics Engine

Posted: Sat May 03, 2014 12:54 am
by Oysi
I usually don't post my stuff here, but I figured I just as well might. =)

I've always been extremely fond of math, and I've always liked graphics and physics and such. But engines don't do it for me. Even just OpenGL doesn't do it for me either. I need to go deeper! =D So I've been doing 3D stuff in 2D for quite some years now. It's so fun to create everything and learn new things. It also gives me great respect for those who first "invented" this stuff, back in the day. Anyhow, the reason I am doing this in Love, is because I love Lua, and I love how easy it is to do stuff in Love, which allows me to skip all the boring tedious stuff, and jump straight onto the fancy math. =D

Although, I'm not too keen on open sauce, so please don't kill me for it.

However, feel free to peruse through my youtube account, as this is not my first rodeo. I've made other 3D stuff in Love2D, and even some 2D stuff as well. xD

EDIT (new video):

EDIT #2 (new video):

EDIT #3 (new video):

EDIT #4 (new video):

EDIT #5 (new video):

Re: 3D Rigid Body Physics

Posted: Sat May 03, 2014 2:49 am
by HugoBDesigner
That looks REALLY, REALLY AWESOME! I've tried once to make 3D stuff in LÖVE, but I failed horribly. I've seen some good 3D renders here on LÖVE community, but so far your framework is one of the bests! When you finish, I'd find it AMAZING to try out! People would certainly like a lot if you decide to release a library for 3D rendering. And it even has physics! Good job, Oysi!

Re: 3D Rigid Body Physics

Posted: Sat May 03, 2014 1:12 pm
by Ranguna259
WOW ! Realy great work here, I hope you share this some day :)

Re: 3D Rigid Body Physics

Posted: Sat May 03, 2014 5:58 pm
by ArchAngel075
Oh do please share, if i migrate my current babo2(wip) remake to use this i would be the happiest living entity alive!


Re: 3D Rigid Body Physics

Posted: Sun May 04, 2014 9:14 pm
by Oysi
Thanks! =D Although, if you guys are more interested in the rendering engine and less so in the physics, then prepare to be amazed. This demo doesn't really show a whole lot of what the rendering engine is capable of. I made it for the physics, which I have been attempting for quite some time, and I finally got it working. The rendering is merely to be able to see it. xD Anyway, here are some pictures that show a little more of the rendering engine:


It has diffuse and per pixel specular shading. Depth buffer. Near plane clipping. Shadows (compliments of the z buffer). Plus many other tools, such as sorting by depth, backface culling, etc. Not to mention fully functional mat4 (4x4) matrix and vec3 libraries that have been evolving over the years and are currently optimized for maximum performance. A bunch of other stuff as well, now that I think of it, like mesh parsing and whatnot.

It still has some flaws, though. Depth testing, for example, that doesn't work out all too well. The problem is when I setCanvas to a certain canvas, I set a shader, and then I send that canvas to the shader, and proceed to draw polygon shapes. In the shader, it looks up current depth (stored in the canvas that is being drawn) and checks if the new depth is lower. If it is, it rewrites, and if not, it writes the old value back in. But this causes some strange artefacts to happen. Easily seen in this ( picture (the scene there is composed of 2 triangles that are intersecting). So if anyone knows how to fix this problem, I would very much like to hear it. And in the second pic, you can see a small gap between the shadow and the object. This is simply caused by culling front faces when rendering the light z buffer.

Aaaaanyway... I'm still not all too keen on open sauce. I've had a lot of fun making these things. The thing is, though, the process of making it is like 90% of the fun. Fact is, a 3D library in a 2D framework really is incredibly stupid and impractical. It's extremely fun to make, but it's also extremely impractical. Do this in pure OpenGL, and you get like 10000x the speed, easily. So releasing it wouldn't accomplish a whole lot.
On that note, what I could do is release a very basic version, containing the mat4 and vec3 libraries (or even just mat3 for more simplicity), plus a little something for some basic polygon drawing, with no other features. That way you have a place to start, and can begin exploring the beauty of 3D graphics on your own. =)

Re: 3D Rigid Body Physics

Posted: Sun May 04, 2014 10:54 pm
by Kingdaro
Thing is though, nobody isn't going to be making the next CoD using an engine like this, or even complex scenes like the ones you've displayed. But that doesn't mean a 2D game will never have any 3D perspective. A game like Doom or SNES Mario Kart is perfectly viable, as it's only 2.5D, but a 3D library would help to take out all of the effort required in doing the perspective math. Maybe even something like SNES Starfox, where there aren't many polygons being drawn at once.

Re: 3D Rigid Body Physics

Posted: Sun May 04, 2014 11:44 pm
by HugoBDesigner
I think that even though a 3D physics and rendering library would be impractical, a lot of people (including myself) would still like it a lot. I'm not very good with 3D-related maths, so a library like this would be a really great start for me to start working with 3D without requiring a completely pre-made engine. What you've shown in the second post is EVEN MORE AMAZING, and I liked REALLY MUCH the physics simulator, so when you finish it (or feel comfortable enough with some progress), PLEASE, consider sharing your work with us. I can pretty safely say that a lot of people that can't make their own 3D engines would REALLY appreciate this :)

Re: 3D Rigid Body Physics

Posted: Mon May 05, 2014 5:01 am
by Jasoco
Well. This makes my 3D engine look like crap.

Thanks a lot.

Okay maybe not, but still. I see you have the same z-indexing issue as me. Not really something you can solve without actual per-pixel z-indexing. Also an early version of my engine had shadows too. But I haven't implemented them in my remade version yet.

Also the FPS is pretty low. But that's to be expected in Löve.

Re: 3D Rigid Body Physics

Posted: Mon May 05, 2014 10:00 am
by qaisjp

Re: 3D Rigid Body Physics

Posted: Mon May 05, 2014 2:34 pm
by Nixola
If I recall correctly, you shouldn't be using the currently set canvas like this, as it could cause this kind of issues