Love2D 3D Tutorial #3 - Matrices

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

Love2D 3D Tutorial #3 - Matrices

Post by Oysi » Thu May 15, 2014 11:52 pm

Hello there, folks! Making 3D in Love2D has been a bit of a passion of mine. And I've made some pretty nice things.
(http://love2d.org/forums/viewtopic.php?f=5&t=77896)

So I've decided to make a little video tutorial about some basic 3D rendering, done in Love2D. So if you want to learn some stuff about 3D, through Love2D, then this video should help you out quite nicely. And at the very least, there is code you can test. =) I'm not the best teacher, but I try to explain as best as I can while I write the code. This stuff should be relatively straight forward. I think this is about as simple as 3D gets. But if there's anything you don't understand or don't quite get, feel free to ask.





Feedback would be nice. Such as, is it very horrible? xD Should I keep making such videos? Should I explain more/less, any feedback. =)
Attachments
Love2D 3D Tutorial #3.love
Tutorial #3
(971 Bytes) Downloaded 247 times
Love2D 3D Tutorial #2.love
Tutorial #2
(863 Bytes) Downloaded 177 times
Love2D 3D Tutorial #1.love
Tutorial #1
(606 Bytes) Downloaded 216 times
Last edited by Oysi on Fri Jun 27, 2014 7:06 am, edited 6 times in total.
Follow the potato. Achieve enlightenment.

LuaWeaver
Party member
Posts: 183
Joined: Wed Mar 02, 2011 11:15 pm
Location: Ohio, USA

Re: Love2D 3D Tutorial

Post by LuaWeaver » Fri May 16, 2014 1:19 am

...I see you didn't use my suggestions. :(

Code: Select all

Scene
	* Define scene
	* Collection of verticies and shapes
		- Right now, working with just shapes
Fill scene with rand. verts
	* Explain negative z = forward (why, mr. oysi?)
Start basic render code
	* Explain 'projection'
		- Define
		- Mention we're doing 3d -> 2d, can be done in reverse
	* Explain what dividing by depth is
	* Explain negating y (like you did)
Explain translation+scale step
	* Why?
	* Why is it important that the two numbers are the same?
Translation
	* Briefly go over, like you did
Rotate on Y
	* Explain how to rotate on other axes
	* Mention link in descrption to some other video/website/whatever explaining the trig (for us so math-inclined)
Demonstrate behind-cam issue
	* Explain why
	* Show fix
End video and masturbate.
"your actions cause me to infer your ego is the size of three houses" -finley

User avatar
CrackedP0t
Citizen
Posts: 69
Joined: Wed May 07, 2014 4:01 am
Contact:

Re: Love2D 3D Tutorial

Post by CrackedP0t » Fri May 16, 2014 3:25 am

My mind is now blown.
Thank you very much... I will use this knowledge. :D
/人 ◕‿‿◕ 人\
Here, have an umlaut. Ö

User avatar
Karai17
Party member
Posts: 828
Joined: Sun Sep 02, 2012 10:46 pm

Re: Love2D 3D Tutorial

Post by Karai17 » Fri May 16, 2014 5:01 am

This was legitimately informative, thanks for the tutorial!
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé

User avatar
micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

Re: Love2D 3D Tutorial

Post by micha » Fri May 16, 2014 6:51 am

That is a fantastic tutorial. Very clear and to the point. Thank you for sharing.

User avatar
HugoBDesigner
Party member
Posts: 402
Joined: Mon Feb 24, 2014 6:54 pm
Location: Somewhere in Brazil

Re: Love2D 3D Tutorial

Post by HugoBDesigner » Fri May 16, 2014 3:09 pm

Yeah, that was awesome! Very simple, yet veeeery helpful! The example is also really cool, and I never knew making 3D could be that simple! Please keep up the good work! :awesome:
HugoBDesigner - my Twitter
HugoBDesigner - my Blog

User avatar
DaedalusYoung
Party member
Posts: 402
Joined: Sun Jul 14, 2013 8:04 pm

Re: Love2D 3D Tutorial

Post by DaedalusYoung » Fri May 16, 2014 7:20 pm

Very cool indeed, and very well done. Are you planning to make more? Like, how to make a cube?

User avatar
Jasoco
Inner party member
Posts: 3596
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Love2D 3D Tutorial

Post by Jasoco » Fri May 16, 2014 8:32 pm

DaedalusYoung wrote:Very cool indeed, and very well done. Are you planning to make more? Like, how to make a cube?
A cube is easy.

8 points at -1,-1,-1, 1,-1,-1, 1,1,-1, -1,1,-1, -1,-1,1, 1,-1,1, 1,1,1 and -1,1,1.

What he needs to do is show how to actually use this in a real world situation. This is just how to calculate where the points would be. It does nothing for Z-sorting or displaying polygonal shapes. Hopefully there will be more tutorials.

I'm more interested in seeing how he did his 3D engine just to compare notes since I already know how to do 3D. I just want to see if there's a better way to do it.

User avatar
DaedalusYoung
Party member
Posts: 402
Joined: Sun Jul 14, 2013 8:04 pm

Re: Love2D 3D Tutorial

Post by DaedalusYoung » Fri May 16, 2014 10:47 pm

Well of course, that's what I mean. 8 points marking the vertices of a cube is not a cube, you need to combine them into faces and then find out which faces to draw and which you don't draw. And then a more advanced topic would be how to apply a texture to it.

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

Re: Love2D 3D Tutorial

Post by Oysi » Fri May 16, 2014 11:43 pm

Thank you guys, very much appreciate the feedback! =D

And like I said, this is not actually what I use in my other 3D stuff. I mean, the concept is the same, but I use matricies and I do the transformation (transformation means translation, rotation, etc) stuff in the actual projection, which gives you more control (the ability to set the camera anywhere, also easier to have moving objects). But at the same time, it's more complex, and even requires a matrix library. My plan was to make this first tutorial to give you guys some hint of what 3D was all about, and how you can actually make it quite simple. And then I could potentially continue, showing more of the fancy stuff you can do, showing more about actual matrices, rendering polygons, talking about about depth, importing meshes, and possibly even doing stuff like fancy shaders (god rays, texture mapping, etc) if I ever get to that point.

So that's what I want to ask, do you guys want to see more?
Follow the potato. Achieve enlightenment.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests