Skip to main content
26 events
when toggle format what by license comment
S Nov 9, 2021 at 4:43 vote accept CaptainLupa
S Nov 9, 2021 at 4:43 vote accept CaptainLupa
S Nov 9, 2021 at 4:43
Nov 9, 2021 at 4:19 vote accept CaptainLupa
S Nov 9, 2021 at 4:43
Nov 9, 2021 at 4:18 answer added CaptainLupa timeline score: 1
Nov 9, 2021 at 3:01 comment added CaptainLupa Ok the problem I'm having now is that the Camera is being translated as expected where it moves relative to the direction it is facing, but rotates around the origin, despite doing rotation before translation on an identity Matrix. And I'm using the same rotation function for my 3d objects and they rotate locally just fine.
Nov 8, 2021 at 23:19 comment added CaptainLupa Alright I seem to have gotten most things working, thank you so much for your help. Also sorry I dissapeared for two days I didn't get any notifications any new comments had been added.
Nov 5, 2021 at 20:27 comment added DMGregory "like its getting squished by the aspect ratio of the window or something". Yep, that'd do it. You need to output your projected vertex positions in "normalized device coordinates" which range from (-1, -1) in one corner to (1, 1) in the opposite corner. If your window is twice as wide as it is tall, then a 1x1 square in NDC becomes a 2x1 rectangle in window pixels. And a tilted square becomes a skewed diamond. Your projection matrix needs to compensate for the aspect ratio of the window to fix this.
Nov 5, 2021 at 19:51 history edited CaptainLupa CC BY-SA 4.0
added 1357 characters in body
Nov 5, 2021 at 14:01 comment added CaptainLupa I haven't set up a view or projection matrix as of yet, its just the modelMatrix multiplied with the vertex positions. Would that be the problem? like its getting squished by the aspect ratio of the window or something.
Nov 5, 2021 at 12:30 comment added DMGregory Can you show us how you've set up your camera's viewport/projection matrix? It's possible the distortion is arising from the projection, and the rotation is just making it more noticeable.
Nov 5, 2021 at 11:21 answer added PentaKon timeline score: 0
Nov 4, 2021 at 22:52 history edited CaptainLupa CC BY-SA 4.0
added 771 characters in body
Nov 4, 2021 at 21:23 history edited CaptainLupa CC BY-SA 4.0
deleted 109 characters in body
Nov 4, 2021 at 21:18 comment added CaptainLupa i tried moving the rectangle back to the origin, rotating that around the Z axis, and then back to the current position but that didn't work either.
Nov 4, 2021 at 21:16 comment added CaptainLupa bruh im boutta cry i dont get this at all
Nov 4, 2021 at 20:50 comment added DMGregory "I tried storing the rotation as being around the rectangles current position like this" - no, that is not what that code does. It uses the line between the origin and the object's position as the axis of rotation. So if your object isn't positioned exactly along the z axis, you end up with a rotation around some diagonal axis, rather than a rotation in the image plane. That rotates your object into depth, so that a perspective camera will see one end of it as being shorter (further away) than the other.
Nov 4, 2021 at 20:46 history edited CaptainLupa CC BY-SA 4.0
added 344 characters in body
Nov 4, 2021 at 19:49 comment added CaptainLupa Would I need a view matrix to do that? Because as of right now all I have is the raw vertices and the model matrix.
Nov 4, 2021 at 19:46 comment added CaptainLupa How would I go about rotating around the center of the rectangle? I was thinking that if I give each object an orientation it would be rotated around itself, but from what you're saying that doesn't seem to be the case. I tried switching the order of the translation and rotation operations but all I got was each vertex moving around in a random pattern independent of eachother like the menu text in Persona 5.
Nov 4, 2021 at 19:22 comment added PentaKon The way the resulting picture looks, it seems the problem might appear because you apply the translation step before the rotation. If you think about how the operations work, if you translate first then rotate by the coordinate system's Z axis (i.e. not the rectangle's center since it is now translated away from the origin \$O = (0,0)\$) then it will rotate the whole rectangle around the origin \$O\$. It might be possible that this is what you want but I think in your case it's not what you are trying to achieve.
Nov 4, 2021 at 18:54 history edited CaptainLupa CC BY-SA 4.0
vertex shader
Nov 4, 2021 at 18:33 history edited CaptainLupa CC BY-SA 4.0
added 161 characters in body
Nov 4, 2021 at 18:19 comment added CaptainLupa Just tried that, same result.
Nov 4, 2021 at 18:13 comment added DMGregory Have you tried applying your scale before the rotation?
S Nov 4, 2021 at 18:09 review First questions
Nov 5, 2021 at 16:05
S Nov 4, 2021 at 18:09 history asked CaptainLupa CC BY-SA 4.0