Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jump space transformation matrix is relative to origin. #13

Open
phiresky opened this issue Oct 24, 2014 · 15 comments
Open

jump space transformation matrix is relative to origin. #13

phiresky opened this issue Oct 24, 2014 · 15 comments

Comments

@phiresky
Copy link
Collaborator

Maybe create a proxy function to allow rotation around center of the jump field.

@cnlohr
Copy link
Owner

cnlohr commented Oct 24, 2014

It was unbelievably frustrating to get the jump fields to rotate correctly, to boot (needing a field offset, etc.) But, now that they are working, it is necessary to do it in the C/C++ side of things, so I think a utility function to create the jumps would be super helpful.

@phiresky
Copy link
Collaborator Author

Why was it so complicated? Shouldn't the transformation just be single multiplication of the ray with a matrix?

@cnlohr
Copy link
Owner

cnlohr commented Oct 24, 2014

The problem with transformations is that upon entrance of a specific cell, you have to do a transformation. Figuring out the actual offset/position of where that cell should be put out is a pain because it would nominally be different for each cell provided you're not only doing a translation instead of a translation + rotation.

New thought: I wonder how arbitrary the matrix can be and still work - could we have portals that give an isometric view? (how weird would that be?)

@cnlohr
Copy link
Owner

cnlohr commented Oct 24, 2014

To be fair, I think as long as it's built on top of the existing system, it should be relatively easy.

@phiresky
Copy link
Collaborator Author

I don't fully understand yet how it works and why it's hard, I just noticed when passing a 3x3 rotation matrix into JumpSpace() it rotates the whole world around (http://youtu.be/nEpnNfgPB6w).

New thought: I wonder how arbitrary the matrix can be and still work - could we have portals that give an isometric view? (how weird would that be?)
I think that should be possible, considering that basically all graphics manipulation is usually already done in matrices. Would be pretty weird.

I think the matrix has to be extended to 4x4 to allow for every kind of transformation.

@cnlohr
Copy link
Owner

cnlohr commented Oct 27, 2014

That is acceptable. It appears we are truncating the existing 4-wide floats for the Rotxyz, move. Also, there is little need to keep that packed... We should be fine extending the matrix.

It would need to be changed both places in Pass1.frag and Pass1Physics.frag. I have no idea how one could use the bizarre matrix transformations, but I am confident kooky uses could be found.

Also, animating the transform. Brilliant!

@phiresky
Copy link
Collaborator Author

@cnlohr
Copy link
Owner

cnlohr commented Oct 28, 2014

O.O Ok... I now understand why we need to be able to have arbitrary matricies instead of jump + rotation.

@cnlohr
Copy link
Owner

cnlohr commented Oct 28, 2014

Also, what happens when you walk through?

@phiresky
Copy link
Collaborator Author

I do sometime in the video.. nothing spectacular, looks kinda wrong. Also I had to remove the part where you also apply the matrix to the current ray location for this to work, otherwise it's exits at some other world location.

@cnlohr
Copy link
Owner

cnlohr commented Oct 28, 2014

I think you are going to have to use more words to explain the thing that people have never had to explain to one another before. If you are talking about handling if the ray is already in the jumpspace correctly (first texture lookup) that is relatively important -- at least it was. Maybe it's OBE?

@phiresky
Copy link
Collaborator Author

:D
I had to change this line: https://github.com/cnlohr/noeuclid/blob/master/Shaders/Pass1.frag#L222 to
ptr = ptr + offset;. And I know that can't be a permanent change, because without rotating the position vector too the output plane of rays is parallel to the input plane, and thus when only the output directon is rotated there is distortion.

By the way I moved it into an extra function because you used the same code twice.

@cnlohr
Copy link
Owner

cnlohr commented Oct 28, 2014

I just realized, I've been updating your branch most of the time, as per why I didn't see anything new.

Re the matricies: To be fair, I could believe anything that messes with the frustum matrix values (that bottom row) would not be displayable upon a jump. That doesn't mean I wouldn't want to totally mess with it anyway. I guess there are situations where a game designer would want to have something that is displayed that one could not actually jump to. I.e. switching to an orthographic view. Upon a jump, the view would reset.

Second though: Right now we are mixing the quaternions after a jump. I wonder if we could probe more stuff to get 'view' back from the shader, then mix the matricies?

Third thought: That is an awful idea. If you would have to turn around, or upside down, everything would break on the process from "here" to "there."

P.S. I agree with the not a permanent solution. There is a lot of difficulty with handling rotation through jumps, but we have to be careful to maintain it. I am not entirely sure how to fix it at the moment.

@cnlohr
Copy link
Owner

cnlohr commented Oct 28, 2014

P.P.S. The current repo still seems to fully work. Impressive. If I were you, I'd have broken things by now considering how seriously you've rearchitected everything.

@phiresky
Copy link
Collaborator Author

I deleted my copy of the repo for now.

Yes I'm also not sure how to fix the Rotation, but I'm sure it's possible.

The current repo still seems to fully work. Impressive.

Well I am pushing to your master, so I can't really break everything can I ;).
Also, there are some bugs with the rooms (like door opening/closing) and when skipping levels. Also the automatic file reload doesn't reinit the levels immediately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants