Comments (26)
That's me. I used HMM as a 'drop-in' replacement for GLM, and in order to do any basic translations I had to transpose HMM's matrices to GL. More advanced use of matrices (projection, view, rotation) was completely unusable, causing the transformed points to fall outside of GL's frustum and be culled away. I can provide example source.
from handmademath.
I think we might be inconsistent about row-major vs. column-major order right now (GLM is column-major.) I'm looking into it.
from handmademath.
I mean i dont transpose any of my matrices and im fine, but if there is a issue we should fix it and have it so matrices do not need to be transposed, no reason for opengl to do that extra work
from handmademath.
@StrangeZak What's your source for the perspective projection matrix? I don't have a linear algebra textbook handy and Google is being no help...
from handmademath.
One second let me look i dont remember where i got it, but i can you reassure you it works.
from handmademath.
Maybe these two videos:
https://www.youtube.com/watch?v=jeO_ytN_0kk
https://www.youtube.com/watch?v=dul0mui292Q
If you wanna check it that would be awesome.
from handmademath.
@JesseRMeyer HMM_Translate
is producing a row-major matrix instead of column-major (which OpenGL expects.) The rest of the functions seem to be producing column-major.
I hadn't run into this problem in my own project because I'm not yet using HMM_Translate
. I'm starting work on a patch.
@StrangeZak Is your project using HMM_Translate
at all? I'm surprised it would work for you...
(Also, this just highlights the need for #21!)
from handmademath.
I think i might just use HMM_LookAt for the time being maybe thats why mine works, yeah we really need a Unit Test obviously. How has no body else hit this with so many people using it
from handmademath.
There's like 25-30 people using this how is he the first to hit it. It makes no sense...
from handmademath.
I tried rendering again with the column/row fix, but it still doesn't work for me.
There's some relevent information in the pictures below.
http://imgur.com/a/ek2yM
from handmademath.
Hmm. Could you maybe try a simpler case? Not sure which matrix might be the problem now.
from handmademath.
That wireframe looks right for the most part, at least i think
from handmademath.
Change your model matrix to:
hmm_mat4 ModelMatrix = HMM_Mat4d(1.0f);
And see what happens? @JesseRMeyer
from handmademath.
The wireframe is constructed by RenderDoc. You're supposed to see what you're rendering show up inside the bounds.
HMM_Mat4d(1.0f); didn't seem to do anything different. I'm relying on that being being an intrinsic part of the Translate function anyway.
Here's a gif of me 'building' up the final matrix. I'm out of time looking into this today, so I can either upload my project's source or after the weekend I can provide a simpler usage case.
The view matrix causes the camera to spin and flatten the object, but it shouldn't do either! I can't quite tell what the Projection matrix is doing. The values by that point in the transformation are too dorked to make an interpretation AFAIK.
from handmademath.
For reference it's supposed to look like this: http://imgur.com/Tqs8Ayb
from handmademath.
Ill relook at this issue after my stream tomorrow maybe it will shed some light on this situation
from handmademath.
Didnt mean to close this....
from handmademath.
@JesseRMeyer There should be a new major version coming in the next few days where we will fix various bugs then we will try this again. Sorry for the hassle there might be a few bugs that i am not aware of
from handmademath.
@JesseRMeyer Merged in a fix today, would be great if you could see if it fixes it for you. If not we will try again in a few days as there is a few bugs to squash
from handmademath.
@JesseRMeyer We just merged a bunch more changes across the whole library (which is now thoroughly unit tested!) Give it another try and let us know how it goes. 😄
from handmademath.
Awesome work guys. I'll test this soon and will report back.
from handmademath.
You magnificent bastards! http://imgur.com/a/1rig0
This really did act as a drop in replacement! The only real difference so far is that HMM handles FOV slightly differently, so I had to change 45.0f to 90f for the perspective matrix. Very minor hurdle and obvious to track down. But you may want to make a mention of it for those wanting an absolutely easy transition. I'm also a little peeved that I have to capitalize all my vector components, but I'll get over that soon. :)
from handmademath.
@bvisness Any idea what hes talking about for the FOV thing ?
from handmademath.
@JesseRMeyer Glad everything is working now :)
from handmademath.
GLM probably requires you to put in half the desired FOV (45.0f for a 90.0f total FOV.) The function we're using just divides it in half before doing the math. No big deal, we're not doing anything wrong, just a difference in what the functions expect.
from handmademath.
@bvisness Awesome, i think we can finally close this issue 👍
from handmademath.
Related Issues (20)
- Ship a set of basic math functions as an easy CRT alternative HOT 2
- Support unary minus operator on vectors HOT 2
- Fully inline Handmade Math HOT 2
- CI is not working HOT 2
- Divide by zero when calling HMM_Slerp with two identity quaternions HOT 3
- Unnecessary Square Root HOT 4
- Rotate point by quaterion HOT 1
- Where's the function to inverse a matrix? HOT 2
- Request - document fundamental choices made in handmade math HOT 2
- Remove HMM_PREFIX HOT 1
- Make naming more consistent and concise HOT 1
- HMM 2.0 Design HOT 1
- Use _Generic in C? HOT 3
- Unroll our loops HOT 2
- Consistent results in calculations HOT 8
- Convert HandmadeMath to double HOT 1
- Vector to matrix multiply arguments have the wrong order HOT 1
- `HMM_LinearCombineV4M4` has incorrect name and naming of arguments HOT 2
- Audit use of pass-by-reference in C++ functions / operator overloads HOT 6
- Provide ASin, ATan, ATan2 functions HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from handmademath.