Oysi's 3D Rendering & Physics Engine

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
Oysi
Prole
Posts: 48
Joined: Fri May 02, 2014 11:18 pm
Location: Earth

Oysi's 3D Rendering & Physics Engine

Post 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):
Last edited by Oysi on Sun Jul 20, 2014 6:30 pm, edited 7 times in total.
Follow the potato. Achieve enlightenment.
User avatar
HugoBDesigner
Party member
Posts: 403
Joined: Mon Feb 24, 2014 6:54 pm
Location: Above the Pocket Dimension
Contact:

Re: 3D Rigid Body Physics

Post 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!
@HugoBDesigner - Twitter
HugoBDesigner - Blog
User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: 3D Rigid Body Physics

Post by Ranguna259 »

WOW ! Realy great work here, I hope you share this some day :)
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.
User avatar
ArchAngel075
Party member
Posts: 319
Joined: Mon Jun 24, 2013 5:16 am

Re: 3D Rigid Body Physics

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

goodluck!
User avatar
Oysi
Prole
Posts: 48
Joined: Fri May 02, 2014 11:18 pm
Location: Earth

Re: 3D Rigid Body Physics

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

Image
Image

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 (https://love2d.org/imgmirrur/V9pph5t.png) 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. =)
Follow the potato. Achieve enlightenment.
User avatar
Kingdaro
Party member
Posts: 395
Joined: Sun Jul 18, 2010 3:08 am

Re: 3D Rigid Body Physics

Post 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.
User avatar
HugoBDesigner
Party member
Posts: 403
Joined: Mon Feb 24, 2014 6:54 pm
Location: Above the Pocket Dimension
Contact:

Re: 3D Rigid Body Physics

Post 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 :)
@HugoBDesigner - Twitter
HugoBDesigner - Blog
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: 3D Rigid Body Physics

Post 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.
User avatar
qaisjp
Party member
Posts: 490
Joined: Tue Sep 04, 2012 10:49 am
Location: United Kingdom
Contact:

Re: 3D Rigid Body Physics

Post by qaisjp »

MUST.. HAVE... CODE!
Lua is not an acronym.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: 3D Rigid Body Physics

Post 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
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Post Reply

Who is online

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