Cant make my matrix and shader work correct

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
D0N7H4V3
Prole
Posts: 6
Joined: Thu Jan 23, 2020 1:43 pm

Cant make my matrix and shader work correct

Post by D0N7H4V3 »

Hi, i wanna make 3d engine for game, but im little bit dumb in to matrixes, have many little bit issues with that.

Its hard to explain what issue i got, cuz now my brain stopped work. But i need to some meduim-pro in matrixes, shaders, and also math to check my main.lua file to give me some hints, councils and more.
Its little bit mess in my code and game.love file doesnt run (i dont know why) so please unzip it and check my code.
It really hard to think after i came from my work. Sorry.
I hope for your help!
Attachments
matrix_pain.love
(1.27 MiB) Downloaded 97 times
D0N7H4V3
Prole
Posts: 6
Joined: Thu Jan 23, 2020 1:43 pm

Re: Cant make my matrix and shader work correct

Post by D0N7H4V3 »

Oh, also i want to understand matrixes by myself or with someone help, and i didnt want to use other libs, i want to create all by myself to get more understand in it
RNavega
Citizen
Posts: 86
Joined: Sun Aug 16, 2020 1:28 pm

Re: Cant make my matrix and shader work correct

Post by RNavega »

Hi. You want to write a 3D engine from scratch. I myself only know the basics of linear algebra (just enough to do what I want), and I can tell you it's very very complicated. Something that needs to be taken in steps, like getting a single point to transform by a matrix with predictable results (doing it in Blender, then seeing if you can get the same result using your own code). It's a slow process.

This great article explains why you should just go write your game already, without creating an engine: Write Games, Not Engines

You're going to have to deal with algebra anyway as you code your game, solving problems like "how to make this thing point in this direction", or "how to get the front direction vector of wherever this thing is facing", and solving intersection equations etc.

If your ultimate goal is to make a 3D game, my suggestion: change your view that using a lib is "cheating" (I used to think this) or not educational. It can be totally educational if you actually go and read and understand its code, and especially educational if you modify or extend it with new features.

Groverburger's 3D framework is small and elegant, it's a great opportunity for this:
https://love2d.org/forums/viewtopic.php?f=5&t=86350

What it does is handle matrices on the Lua side as array-like tables, and then you send those matrices to a vertex shader so they're used to transform your mesh vertices and put them in 3D space (example 1, example 2).

If I were in your position I would be making several demos with it, trying to get familiar with it. Go and make your 3D game with the assurance that you will learn about matrices and vectors as you're coding it, because these things are used in gameplay code as well.
D0N7H4V3
Prole
Posts: 6
Joined: Thu Jan 23, 2020 1:43 pm

Re: Cant make my matrix and shader work correct

Post by D0N7H4V3 »

RNavega

I am very grateful for such a large and detailed answer. I will definitely familiarize myself with the material and will learn and have fun doing my projects. Thank you.
ps. since my knowledge of English is not at an ideal level, I cannot thank you properly, but I will continue to study and I am grateful for your advice from the bottom of my heart
RNavega
Citizen
Posts: 86
Joined: Sun Aug 16, 2020 1:28 pm

Re: Cant make my matrix and shader work correct

Post by RNavega »

No problem, have fun with it. Post your progress later if you feel like it.
D0N7H4V3
Prole
Posts: 6
Joined: Thu Jan 23, 2020 1:43 pm

Re: Cant make my matrix and shader work correct

Post by D0N7H4V3 »

Hmm. What about "i can't make 3d render" instead of "3d engine"
Acutally i want to create simple 3d game, but i need to create 3d first. so matrices is my problem. I was dumb when i writed that thread.
(as i said i was tired)
RNavega
Citizen
Posts: 86
Joined: Sun Aug 16, 2020 1:28 pm

Re: Cant make my matrix and shader work correct

Post by RNavega »

Sure, I hope someone can review your code for you (I personally don't have time right now).
If you get tired of waiting, be aware that you can try that framework to get a 3D scene going, and then continue from there.
Post Reply

Who is online

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