Hi,
my 3D-Models are rendered on a wrong position in the ARM64 - Bit App.
In the Emulator, all looks great, but on the devices (iphone6/ipad mini2)
the Models are not on the right position. Some idea?
If I uncheck ARM64, than it works on the device, but I mean, I can’t upload it to the store.
Hope anyone could help.
Regards
Ronny
do you have a repo project (a small one will do). It might be a 32bit>64bit float issue… But someone will need to debug it.
Hi,
this is difficult. I unchecked the checkbox “Perform all 32-bit float operations as 64…”, but it also
doesn’t work.
It works in the simulator, but not on the real device.
It also works on device, if I deploy in debug mode with debug enabled.
The ARMv7 Version works just fine, but the ARM64 Version desn’t work.
You can simple reproduce this by rotating a 3D-Model.
This is a short bit of the code which doesn’t work.
void DrawGrid (Matrix world, Matrix view, Matrix projection) {
GraphicsDevice.RasterizerState = RasterizerState.CullNone;
GraphicsDevice.BlendState = BlendState.AlphaBlend;
GraphicsDevice.DepthStencilState = DepthStencilState.Default;
var last = default ( string );
for (var i = -5; i <= 5; i++) {
var n = Helper.MapRange (i, 5, -5, graphF.GetMinY (), graphF.GetMaxY ());
if (!float.IsNaN (n) && !float.IsInfinity (n)) {
if (last != null && last.Replace ("-", "").Length > 2) {
last = null;
continue;
}
var s = ((int)n).ToString ();
if (s != last) {
var pos = n < 0 ? -110 : 0;
foreach (var c in s) {
texts [c].Draw (
world
* Matrix.CreateTranslation (pos, 0, 0)
* Matrix.CreateRotationX (currentRotY / 100f)
* Matrix.CreateRotationY (rotX)
* Matrix.CreateScale (.0025f)
* Matrix.CreateTranslation (5.9f, 0, i),
view, projection, /* CAPTION_COLOR*/ new Vector3(1,0,0), CaptionAlpha);
pos += 110;
}
last = s;
}
}
}
}
// texts is an Array of 3D-Models
// rotX and currentRotY are rotation-variables which are set with touch gestures.
// on the 64-bit version, the models on different positions, normally they should be
// on a straight line, but they all skew
Thank you
I unfortunately do not have a 64-bit iOS device to debug this on. It is annoying that it only happens on device.
I wonder if this is related to float vs nfloat ? nfloat was introduced into the 64bit bit Unified API on Xamarin.iOS to handle 32bit/64bit stuff…
I solved the problem. It was a problem on 64 bit with the Matrix-Multiplication.
I changed the order of the factors like this
from:
…draw(world*Matrix.Translation(…)*Matrix.CreateRotationX(…))
to:
…draw(Matrix.Translation(…)*Matrix.CreateRotationX(…)*world)
this solved my problem, but I don’t know why this is needed on 64bit.
Regards
Ronny