Page 1 of 2

Love2D 3D Tutorial #3 - Matrices

Posted: Thu May 15, 2014 11:52 pm
by Oysi
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. =)

Re: Love2D 3D Tutorial

Posted: Fri May 16, 2014 1:19 am
by LuaWeaver
...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.

Re: Love2D 3D Tutorial

Posted: Fri May 16, 2014 3:25 am
by CrackedP0t
My mind is now blown.
Thank you very much... I will use this knowledge. :D

Re: Love2D 3D Tutorial

Posted: Fri May 16, 2014 5:01 am
by Karai17
This was legitimately informative, thanks for the tutorial!

Re: Love2D 3D Tutorial

Posted: Fri May 16, 2014 6:51 am
by micha
That is a fantastic tutorial. Very clear and to the point. Thank you for sharing.

Re: Love2D 3D Tutorial

Posted: Fri May 16, 2014 3:09 pm
by HugoBDesigner
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:

Re: Love2D 3D Tutorial

Posted: Fri May 16, 2014 7:20 pm
by DaedalusYoung
Very cool indeed, and very well done. Are you planning to make more? Like, how to make a cube?

Re: Love2D 3D Tutorial

Posted: Fri May 16, 2014 8:32 pm
by Jasoco
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.

Re: Love2D 3D Tutorial

Posted: Fri May 16, 2014 10:47 pm
by DaedalusYoung
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.

Re: Love2D 3D Tutorial

Posted: Fri May 16, 2014 11:43 pm
by Oysi
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?