I'm not creating a mod per se; I'm creating a program that converts 1.8 item display values into 1.9 (see here). The item .json files list rotation as three angles from the x, y, z axes. In order to combine custom 1.8 values and the offset for 1.9, I need to convert them both into matrices. However, I don't know what conventions the game uses to create matrices out of the angles. I need to know in what order the game parses the angles (ZYX? ZXY?) to accurately create the necessary matrices so that I get the correct output. As well, if the conventions are different in 1.9, can I still simply multiply the matrices for an accurate result?

I currently assume Z->Y->X rotation order for both versions and multiply using BA^{-1} (BA^{T} in code) where A is the 1.8 rotation from the identity and B is the 1.9 rotation from the identity. This doesn't work for most angles.

You can use LWJGL Matrix4f class to create, rotate, translate and scale or whatever you need and export the matrix values to a file

It is highly recommended to understand how Matrix4f works. In your case witch order to do the transformations.

To clarify, I already know how to convert x, y, and z axis rotations into matrices and do the necessary operations to get the angles back. I need to know the order in which the game combines the rotations so that the rotation matrix is accurate to the actual rotation. I looked at the Matrix4f documentation, and other than a preset rotation method, it doesn't do anything more than what I already do with my program (I do rotations by multiplying two rotation matrices together). It still doesn't tell me in what order to perform the x,y,z rotations (which is very important to get right).

The order (in Forge 1.8, at least) is: translation - y rotation - x rotation - z rotation - scale(x,y,z).

So I would multiply the matrices in [Y][X][Z] order or [Z][X][Y] order? [Y][X][Z] isn't even working for simple angles. Here's what I'm using right now:

The initial values are custom 1.8 rotation values, and the offset values are those needed to rotate the 1.9 origin into the same orientation as the 1.8 origin.

I did just realize that my method of finding the final matrix is flawed. As far as I can tell now, I need to multiply the matrix R_{custom <- 1.8} by R_{1.8 <- 1.9}, which would be

multiply(initMatrix, offsetMatrix);

which is also not working. Is there a way to transform a rotation from one origin to a rotation from another (while keeping the final image the same)?

Is there a way to transform a rotation from one origin to a rotation from another (while keeping the final image the same)?

Yes you need to translate than rotate and translate by the same translation from before but make it negative. Here is an example.

And by the way you are really not supposed to use double arrays instead of a Matrix4f class. There are templates of Matrix4f class. Right now you are making this way to hard on yourself.

Yes you need to translate than rotate and translate by the same translation from before but make it negative. Here is an example.

And by the way you are really not supposed to use double arrays instead of a Matrix4f class. There are templates of Matrix4f class. Right now you are making this way to hard on yourself.

I may have to try that out, as it looks like there is a method to rotate around an arbitrary vector. All I would have to do is take the 1.8 values and rotate them around 1.8 axes expressed in 1.9's system. The rotation and translation are stored separately and I don't have to convert any actual points (the vertices themselves are stored in a UV format and are useless for display). I'll have to experiment with the correct order of rotations, though (evidently 1.8 rotation is done in Z -> X -> Y order).

How would I use lwjgl as a library, then (in deployment)? I would rather avoid having to download a third-party library just to use its matrix class. Also lwjgl seems a little overboard in terms of what I intend for my program to do. It's just a little matrix/vector transformation...

You may didn't understand what I am saying. It would be best to use LWJGL because you are making a program that interacts with another LWJGL program. But If you don't want to do that you can download free standalone Matrix classes, but I mean it is up to you how to implement matrix transformation.

You may didn't understand what I am saying. It would be best to use LWJGL because you are making a program that interacts with another LWJGL program. But If you don't want to do that you can download free standalone Matrix classes, but I mean it is up to you how to implement matrix transformation.

Actually, it doesn't interface with Minecraft at all; it's a converter for item model.json files. But I'm still having problems with the rotation. I can't figure out what's wrong here. This is still the exact same problem as with my custom "matrices".

import org.apache.commons.math3.geometry.euclidean.threed.*;
...
public static float[] convertRotation(float[] original, float[] offset) {
log.println("Original rotation values: " + Arrays.toString(original));
Rotation initRot = new Rotation(RotationOrder.ZYX, toRadians(original[0]), toRadians(original[1]), toRadians(original[2]));
Rotation offsetRot = new Rotation(RotationOrder.ZYX, toRadians(offset[0]), toRadians(offset[1]), toRadians(offset[2]));
//only converts properly for angles that add to the cardinals
Rotation finalRot = offsetRot.applyTo(initRot.revert());
double[] finalAngles = finalRot.getAngles(RotationOrder.ZYX);
float[] result = new float[] { (float) rint(toDegrees(finalAngles[0])), (float) rint(toDegrees(finalAngles[1])), (float) rint(toDegrees(finalAngles[2])) };
log.println("Final rotation values: " + Arrays.toString(result));
return result;
}

I'm not creating a mod per se; I'm creating a program that converts 1.8 item display values into 1.9 (see here). The item .json files list rotation as three angles from the x, y, z axes. In order to combine custom 1.8 values and the offset for 1.9, I need to convert them both into matrices. However, I don't know what conventions the game uses to create matrices out of the angles. I need to know in what order the game parses the angles (ZYX? ZXY?) to accurately create the necessary matrices so that I get the correct output. As well, if the conventions are different in 1.9, can I still simply multiply the matrices for an accurate result?

I currently assume Z->Y->X rotation order for both versions and multiply using BA

^{-1}(BA^{T}in code) where A is the 1.8 rotation from the identity and B is the 1.9 rotation from the identity.This doesn't work for most angles.Putting the CENDENT back in transcendent!You can use LWJGL Matrix4f class to create, rotate, translate and scale or whatever you need and export the matrix values to a file

It is highly recommended to understand how Matrix4f works. In your case witch order to do the transformations.

Not doing mc modding that much anymore because I am making a full blown game that does not have limitations that mc has. (rip Magiology for now)

I may come back if MC fixes it's rendering pipeline.

To clarify, I already know how to convert x, y, and z axis rotations into matrices and do the necessary operations to get the angles back. I need to know the order in which the game combines the rotations so that the rotation matrix is accurate to the actual rotation. I looked at the Matrix4f documentation, and other than a preset rotation method, it doesn't do anything more than what I already do with my program (I do rotations by multiplying two rotation matrices together). It still doesn't tell me in what order to perform the x,y,z rotations (which is very important to get right).

Putting the CENDENT back in transcendent!I am 90% sure that it is in x y z order

Not doing mc modding that much anymore because I am making a full blown game that does not have limitations that mc has. (rip Magiology for now)

I may come back if MC fixes it's rendering pipeline.

The order (in Forge 1.8, at least) is: translation - y rotation - x rotation - z rotation - scale(x,y,z).

But translation order doesn't matter as long as there is no rotations or scales in between the translations what I am guessing that kverti is doing

Not doing mc modding that much anymore because I am making a full blown game that does not have limitations that mc has. (rip Magiology for now)

I may come back if MC fixes it's rendering pipeline.

So I would multiply the matrices in [Y][X][Z] order or [Z][X][Y] order? [Y][X][Z] isn't even working for simple angles. Here's what I'm using right now:

Putting the CENDENT back in transcendent!I don't see a rotation matrix. Are you applying the rotation in the initMatrix?

I may come back if MC fixes it's rendering pipeline.

I'm creating the matrices for the individual axes separately, and then multiplying the matrices in this order:

The initial values are custom 1.8 rotation values, and the offset values are those needed to rotate the 1.9 origin into the same orientation as the 1.8 origin.

I did just realize that my method of finding the final matrix is flawed. As far as I can tell now, I need to multiply the matrix R

which is also not working. Is there a way to transform a rotation from one origin to a rotation from another (while keeping the final image the same)?_{custom <- 1.8}by R_{1.8 <- 1.9}, which would bePutting the CENDENT back in transcendent!Yes you need to translate than rotate and translate by the same translation from before but make it negative. Here is an example.

And by the way you are really not supposed to use double arrays instead of a Matrix4f class. There are templates of Matrix4f class. Right now you are making this way to hard on yourself.

I may come back if MC fixes it's rendering pipeline.

I may have to try that out, as it looks like there is a method to rotate around an arbitrary vector. All I would have to do is take the 1.8 values and rotate them around 1.8 axes expressed in 1.9's system. The rotation and translation are stored separately and I don't have to convert any actual points (the vertices themselves are stored in a UV format and are useless for display). I'll have to experiment with the correct order of rotations, though (evidently 1.8 rotation is done in Z -> X -> Y order).

How would I use lwjgl as a library, then (in deployment)? I would rather avoid having to download a third-party library just to use its matrix class. Also lwjgl seems a little overboard in terms of what I intend for my program to do. It's just a little matrix/vector transformation...

Putting the CENDENT back in transcendent!You may didn't understand what I am saying. It would be best to use LWJGL because you are making a program that interacts with another LWJGL program. But If you don't want to do that you can download free standalone Matrix classes, but I mean it is up to you how to implement matrix transformation.

I may come back if MC fixes it's rendering pipeline.

Actually, it doesn't interface with Minecraft at all; it's a converter for item model.json files. But I'm still having problems with the rotation. I can't figure out what's wrong here. This is still the exact same problem as with my custom "matrices".

Putting the CENDENT back in transcendent!Huh I really do not see that's the issue

I may come back if MC fixes it's rendering pipeline.

Note that when converting to 1.9, the scale of the item is HUGE. You will also have to adjust size.

User: Hey! I can read this!