-
Notifications
You must be signed in to change notification settings - Fork 115
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
EXR Metadata Rotation Bug #722
Comments
Corrected. Check if rotation axes are correct now. |
Thanks, I'll wait for the next Travis CI Build then right? |
Unfortunately I have discovered another thing...
Thanks so much! |
PS. |
... Probably it would also be great to export the metadata with a bit more precision. EXR meta: |
I have already increased accuracy of coordinates in this commit 3fd4372 |
Nice! Unfortunately this won't fix the rotation problem. This is more than precision problem... PS. |
The problem is probably in the sequence of rotations. How they are defined in Houdini? |
You have to remember that in Mandelbulber axes are swapped. y is depth and z is vertical. The reason of this is to be complain with fractal coordinates (like in M-Set). XY plane is defined like for flat fractal, and z is extension for third dimension. Default view is from side of the 3D fractal. Rotation matrix is defined in following way:
|
But I am not converting the coordinate system. Sorry, that was complicated description :-P |
How you convert degrees to radians? Can you show me it in your code?
wt., 15 paź 2019, 11:48 użytkownik Adrian Meyer <notifications@github.com>
napisał:
… But I am not converting the coordinate system.
I just take the values raw as they are (despite the rotation corrections I
mentioned).
So more precisely I use the raw position values from the EXR word position
image layer and directly convert each pixel into s 3D Point.
Also I directly import the raw Camera position values from Metadata.
Now the fractal Pointcloud scene has an unchanged orientation as in
Mandelbulber.
So Y stays Y, Z stays Z etc.
Just the scene does not line up with Houdini’s default orientation, but
that does not matter.
But to achieve that also for the camera orientation Y stays Y, Z stays Z
and X stays X I had to play around and found that I had to do the rotation
corrections mentioned above.
Now the scenes in Houdini and Mandelbulber line up identical.
Despite that little rotation mismatch that remains somehow.
Sorry, that was complicated description :-P
Hope you know what I mean.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#722?email_source=notifications&email_token=ACZHWXTCTTMQQFCX72H3XP3QOWGXHA5CNFSM4I7YDAKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBIEP2Y#issuecomment-542132203>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACZHWXUEVEILWJ54LKYMPXDQOWGXHANCNFSM4I7YDAKA>
.
|
I don’t convert degrees to radians at all. |
Hey, Also I noticed that I can add Yaw/Pitch/Rotation to Keyframes. |
In this file there is a code for rotation matrices: Here is some theory what is rotation matrix: https://en.wikipedia.org/wiki/Rotation_matrix viewAngle.x, viewAngle.y, viewAngle.z are components of rotation stored in vector structure. main_camera_top is a vector which is perpendicular to the front of the camera (to the line between camera and target) and directed towards top of the camera. E.g. if you change roll angle of the camera, this vector rotates. Here is preparation of rotation matrix:
Here us usage of rotation matrix
viewVector is a direction of ray starting from the camera. In the center of the screen is {0, 1, 0} (towards y direction which is depth - default view is from side of 3D fractal)
|
@buddhi1980 can we close this? |
It is still open topic |
Yes still open... |
Hey guys, I spend some time to try and resolve this issue. Thanks!! Here the VEX code used: Values:
|
@ adrian
out of interest:
- is the 2.25 y fudge factor consistent with other frames/camera angles
- what happens when you repeat the exercise with target (0,0,0), no
camera rotations, and looking straight down the y axis camera at (0,
-something, 0)
@ sebastian, krzysztof - can we have camera top coordinates added to
metadata
…On Mon, Mar 16, 2020 at 4:36 AM Adrian Meyer ***@***.***> wrote:
Hey guys,
back working on the mandelbulber / houdini / nuke project.
I spend some time to try and resolve this issue.
I got closer, but not fully there. I hope we can fix it together.
I made a little video where I explain what I did, guess thats much easier
to understand.
https://vimeo.com/397787998/299692b8c3
(sry something went a bit wrong with recording, some wird artefacts)
Hope you find the time to check it out.
Thanks!!
Here the VEX code used:
Values:
from = {0.536337, -0.678756, 6.65716}
to = {-0.0423664, -1.13841,6.52942}
top = {0.0755473, 0.177564, -0.981205}
trans_order = 0 // XFORM_SRT
rot_order = 0 // XFORM_XYZ
// mandelbulber cam data
vector from = chv("from"); //exr meta camera (pos)
vector to = chv("to"); //exr meta target
vector top = chv("top"); //camera_top (from .fract file flightanimation)
// calculate vectors
vector forward = normalize(from - to);
vector right = cross(normalize(top), forward);
vector up = cross(forward, right);
// prepare xform matrix
vector4 right_c = set(right.x, right.y, right.z, 0);
vector4 up_c = set(up.x, up.y, up.z, 0);
vector4 forward_c = set(forward.x, forward.y, forward.z, 0);
vector4 from_c = set(from.x, from.y, from.z, 1);
// set xform matrix
matrix m = set(right_c, up_c, forward_c, from_c);
printf("\n%s", m);
// extract rotation angles from matrix
int trans_order = chi("trans_order"); // XFORM_SRT
int rot_order = chi("rot_order"); // XFORM_XYZ
vector pivot = {0,0,0};
vector pivot_rotate = pivot;
vector t,r,s,shears;
// cracktransform returns rotation angles in degrees
cracktransform(trans_order, rot_order, pivot, pivot_rotate, m, t, r, s, shears);
// export rotation angles
***@***.***_angles = r;
printf("\n%s", ***@***.***_angles);
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#722 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADBNSHG5XIOPBUGLLWTCHKLRHTYZFANCNFSM4I7YDAKA>
.
|
@adrian I have now watched all of your video, so the fudge factor /
eyeballing changes probably varies on positions.
I have no idea why the metadata rotations are different to the
calculated ones
I now realize that the camera-top relationship to target & camera, is
not at all what i had assumed :)
So I cannot help, other than saying that a standard menger sponge is often
good to test things with. As the geometry is all right angles and has known
dimensions.
…On Tue, Mar 17, 2020 at 4:39 PM carbuncle grim ***@***.***> wrote:
@ adrian
out of interest:
- is the 2.25 y fudge factor consistent with other frames/camera angles
- what happens when you repeat the exercise with target (0,0,0), no
camera rotations, and looking straight down the y axis camera at (0,
-something, 0)
@ sebastian, krzysztof - can we have camera top coordinates added to
metadata
On Mon, Mar 16, 2020 at 4:36 AM Adrian Meyer ***@***.***>
wrote:
> Hey guys,
> back working on the mandelbulber / houdini / nuke project.
>
> I spend some time to try and resolve this issue.
> I got closer, but not fully there. I hope we can fix it together.
> I made a little video where I explain what I did, guess thats much easier
> to understand.
> https://vimeo.com/397787998/299692b8c3
> (sry something went a bit wrong with recording, some wird artefacts)
> Hope you find the time to check it out.
>
> Thanks!!
>
> Here the VEX code used:
>
> Values:
>
> from = {0.536337, -0.678756, 6.65716}
> to = {-0.0423664, -1.13841,6.52942}
> top = {0.0755473, 0.177564, -0.981205}
> trans_order = 0 // XFORM_SRT
> rot_order = 0 // XFORM_XYZ
>
> // mandelbulber cam data
> vector from = chv("from"); //exr meta camera (pos)
> vector to = chv("to"); //exr meta target
> vector top = chv("top"); //camera_top (from .fract file flightanimation)
>
> // calculate vectors
> vector forward = normalize(from - to);
> vector right = cross(normalize(top), forward);
> vector up = cross(forward, right);
>
> // prepare xform matrix
> vector4 right_c = set(right.x, right.y, right.z, 0);
> vector4 up_c = set(up.x, up.y, up.z, 0);
> vector4 forward_c = set(forward.x, forward.y, forward.z, 0);
> vector4 from_c = set(from.x, from.y, from.z, 1);
>
> // set xform matrix
> matrix m = set(right_c, up_c, forward_c, from_c);
> printf("\n%s", m);
>
> // extract rotation angles from matrix
> int trans_order = chi("trans_order"); // XFORM_SRT
> int rot_order = chi("rot_order"); // XFORM_XYZ
> vector pivot = {0,0,0};
> vector pivot_rotate = pivot;
> vector t,r,s,shears;
> // cracktransform returns rotation angles in degrees
> cracktransform(trans_order, rot_order, pivot, pivot_rotate, m, t, r, s, shears);
>
> // export rotation angles
> ***@***.***_angles = r;
> printf("\n%s", ***@***.***_angles);
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#722 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ADBNSHG5XIOPBUGLLWTCHKLRHTYZFANCNFSM4I7YDAKA>
> .
>
|
hey guys, anyways, just got rid of that now and also tested with simpler scenes such as Menger Sponge. now I again tested all of this manually by grabbing the values from Mandelbulber Flight Anim Keyframe Spreadsheet. So that I can automate that, would be awesome again if you could include "camera_top" in EXR Metadata! for the actual rotation values you calculate and export to EXR Metadata, somehow this does not work properly. Also tried to directly grab the values from Mandelbulbers Navigation Panel "Yaw, Pitch, Roll", they seem to be the same values initially with the exr Metadata (makes sense). so I actually have the feeling that your Mandelbulber Rotation values are incorrect. Though, as I mentioned you recently did some modification on the Rotation Metadata based on my suggestion:
but somehow something weird happened there and trhe results are very wrong. So I would suggest, (unless you find that your rotation values are actually completely incorrect and do a complete fix for this) that you revert the rotation metadata to the point before the corrections (i.e. values like they appear in Mandelbulber Navigation Tab). but that just for cleanliness, as I mentioned, as soon as I have camera_top in EXR metadata I can get it properly working now. Thanks a lot! |
BTW. Might be even nicer. But to test it out, it would be great if you could first export all of that, and than I can try what works best. Afterwards you could strip it down again. thx |
In next days I will add top vector to the metadata. From Camera, Target and Top vector you can calculate rotation matrix:
where uu, vv, ww are rows or rotation matrix |
Example of this calculation of rotation matrix is used in my shader in ShaderToy: https://www.shadertoy.com/view/WlSSWW |
alright thanks. let me know |
In last commit I have added camera top vector to the image metadata |
thx, will try it out once the CI build is ready |
works! PS. |
Can I close this issue? |
yep! |
Hi,
working on using the new additional passes and the metadata.
Found out that there is a bug in the rotation Metadata written into the EXRs.
To get it right I had to do the following:
rotate_x = 90 - float(metadata("camera_rotation.y"))
rotate_y = float(metadata("camera_rotation.z"))
rotate_z = float(metadata("camera_rotation.x"))
Might be cleaner if you would do this directly and write the correct values into the exr, so not everybody has to figure this out by itself.
Position Metadata is correct!
Let me know when this is done so I will undo the correction in my code.
Thanks
The text was updated successfully, but these errors were encountered: