Again, can i get some explanation on projection matrices from 3d coordinates onto a 2d screen esp. With the camera not the origin and orbit around a center? Its direction can assume facing character all the time... like third persons game.
I dont get all those r+l=0 shiz
>crackhead mathematics epiphany: the thread
lay down the drugs for a fuckin second, loser
Didnt even buy vitamins, you can lay down your sugar pills now
thread closed
holy shit he actually cucked and is learning matrices? lmao
You havent wrote anything more than your kike slurs so i am not learning anything yet, nagger
Try using ms paint maybe than phoneposting like ahmeds
learn past participles first
Study these
https://learnopengl.com/Getting-started/Transformations
http://www.songho.ca/opengl/gl_transform.html
https://learnopengl.com/Getting-started/Coordinate-Systems
https://learnopengl.com/Getting-started/Camera
don't bother, OP is clinically insane and unable to perform basic cognitive tasks
These looks alright and generally i understand how to use them but i wanna understand how matrices are the way they are.
Also these links dont specifically use orbitting camera as example. Which in my opinion is more specific.
And you are israeli
Lel
Orbiting camera doesn't matter. Every time you render a frame you just take the camera's current orientation and position as a given. The reposting of the camera due to any movement happens "in between" frames.
I mean any reposition or change in orientation of the camera happens in between.
Each frame is just a frozen snapshot in time that is rendered, and then thrown away and re-rendered each time.
1/2
>but i wanna understand how matrices are the way they are
Read
https://gamedev.stackexchange.com/questions/68522/what-does-a-matrix-represent
It shows each matrix multiplication.
If you want to really understand matrices, you'd need to learn some linear algebra.
I've made a 3rd person camera, and the trick is understanding transforms. If you want something to move relative to something else you need to concatenate transforms (if your transforms are stored as matrices, this means that you multiply the matrices). To visualize this, think of the moon orbiting the Earth orbiting our sun.
The way I did things for a 3rd person camera is by having the camera transformed relative to a "target",
camera_world_space = camera_relative_target * target_world_space.
Then I built camera_relative_target using polar coordinates so I could zoom and orbit with the keyboard keys.
anyone can learn, I'll give it a try
2/2
Personally, I like to concatenate transforms storing translation and scaling as vectors and rotation as a unit quaternion. Then when sending things to the shader I convert these things into a 4x4 matrix. Here is some old code (before I took the C pill and used C++) you can take, also read the book in the comments if possible.
#include <glm/glm.hpp>
#include <glm/gtc/quaternion.hpp>
#include <glm/gtx/quaternion.hpp>
#include <glm/gtx/transform.hpp>
// Mathematics for 3D Game Programming and Computer Graphics 3rd Ed by Eric Lengyel
// transformation component stored as two 3 dim vectors and a quaternion
// the order of transformation is "scale then rotate then translate"
struct Transform
{
glm::vec3 t = glm::vec3(0.0, 0.0, 0.0); // translate
glm::quat q = glm::quat(1.0, 0.0, 0.0, 0.0); // rotate
glm::vec3 s = glm::vec3(1.0, 1.0, 1.0); // scale
Transform() {}
Transform(const glm::vec3& _t, const glm::quat& _q, const glm::vec3& _s)
: t(_t), q(glm::normalize(_q)), s(_s) {}
// concatenation rules : q = q2q1, s = s2s1, t = t2 + q2(s2t1)q2^(-1)
Transform operator * (const Transform& trans)
{
Transform result;
result.q = glm::normalize(q * trans.q);
result.s = s * trans.s;
result.t = t + q * (s * trans.t) * glm::inverse(q);
return result;
}
glm::mat4 mat4() { return glm::translate(t) * glm::toMat4(q) * glm::scale(s); }
static Transform interpolate(const Transform& trans1, const Transform& trans2, float L)
{
Transform result;
result.s = glm::mix(trans1.s, trans2.s, L);
result.t = glm::mix(trans1.t, trans2.t, L);
result.q = glm::slerp(trans1.q, trans2.q, L);
return result;
}
};
>polar coordinates
Meant to type spherical coordinates
I guess, but quaternions aren't very complex algebraically. My understanding is to go with an axis-angle representation if you don't need to worry about interpolation. I have quaternions because I have decoupled render logic from physics logic and because I want smooth animations.
Ah, he's been posting daily then? Makes sense why everyone is pissed.
yeah everyday, it's questions that he could learn himself by just doing learnopengl.com and https://gamemath.com/
Just a note for the future OP: when people start telling you about Quaternions, ignore them and read up on Rodrigues Rotation Formula. It's a much simpler way to rotate vectors, no matrices or quats involved.
....generally i just orbit the points around center and not really rotate anything else.
not the schizo op that refuses to read a math book, I neverd about this before and it helps me thanks
Is this a troll? You seem to post basically the same question almost every day and ignore everyone who tries to help. Just read a fucking book.
No i m just ignoring you. And i didnt just now so you might need to read a book and post something useful. Like use mspaint too.
...but it looks simpler for me to remember. At least visually. This matrix thing looks wild.
You are not using it either
I'm saying that whether or not your object is rotating or your camera is rotating is irrelevant for the rendering process. You're essentially taking a some number of still photographs of your 3d world every second.
...i m pretty sure it s important because then i only need to just solve its projection and nothing else... nor "lookaround" function
What?
Honestly I think you're confused by something very basic here but I don't know what. You should read an intro graphics programming/math book and work through all of the examples. Otherwise you'll just keep making these threads day after day and piss off anons more and more.
>from 3d coordinates onto a 2d screen
translate, rotate, scale
Friendly reminder linear algebra is taught in high school outside of America before calculus. This is literally early high school math and if you don't understand it you should feel bad.
He should feel bad for refusing to learn, not for not being taught something during school. This is always such a dumb take
>if your shitty American school isn't as good as my non American school was then you're a dumbass who should self loathe
stfu, it's never too late to learn anything unless you're being wilfully retarded like OP is with these threads
in the schizo thread
thread closed
The camera is always at the origin by definition when you are projecting to the screen. Because camera space is defined relative to the camera.
Basically
> Project 3d models into world space
> Project 3d world space to 3d camera space
> Project camera space to 2d
> Draw 2d to screen