What is the best settings for ARKit 3D models - ios

I am exporting 3D models from Cinema4D with .dae file format, and drag them into art.scnassets. Every time I compile the project the 3D object are too big or not in the right position. What is the best setting for models which we want to use in iOS ARKit ? I have search many topics and still not a final solution.
Edited :

I have found that if your object is for instance 50cm in cinema, you need to export it as .dae (1.4, important!) and then select 0.001 meters as scale.
Also, make sure that you position the object at 0, 0, 0 (even if you want it positioned somewhere else in the end, centering it will make editing & repositioning in Xcode easier).
After importing, inside Xcode, click on the .dae file. Select the object in the scene, open the right inspector menu and navigate to the identity inspector.
Then press is movable. This will convert the file to .scn which is better for editing. (is movable should still be unchecked after conversion, if not uncheck, or leave as is)
Then, open the new .scn file and click on your object. You'll see its scale on the right in the identity inspector. If it's still not right, you can change the scale of the bounding box there and also position the object in the scene.

Related

How to scale 3D object in Xcode using Inspector?

I'm trying to scale my 3D object which I've exported from Blender in .dae format (In Xcode -> Inspector). When I've changed the value of the scale parameter, Bounding Box didn't change.
Here is what I've in Xcode.
Before scale changing:
After scale changing:
And there is no effect in the simulator too.
What I am doing wrong? When I've exported my model from Blender, I've set these properties, maybe the issue is with my export:
I need to be able to resize the object in Xcode to make it bigger or smaller on the actual screen. How to change Bounding Box value here?
After combining a few good answers, I've found a solution:
Blender
First of all, I need to group all my objects inside the mouth in one. In Blender, I've selected all objects which I want to group in Outliner (press Shift and select) and I've pressed Ctrl+J.
Then, I need to check the 3D manipulator position. Go to Editor Mode, select all vertexes with A, press shift+S and select “cursor to selected”.
Switch to Object mode, press SHIFT+CTRL+ALT+C and select Origin to 3D cursor.
Xcode
In Scene Graf press + and add (It will add an empty node)
Put your objects inside a new node.
When you'll change the scale of your objects, the parent's node Bounding Box will change and you'll see it properly in the simulator.

ARKit - Adding texture to object in Scene Editor

This would be working perfectly if it weren't for one aspect of what is going on. When I add the texture to the object (drag and drop it onto the object from the menu in the bottom right) it adds it exactly where I want, but it also adds it around the object large (too large for the object) and all blurred, and I want it to just stay white:
Before:
After:
I want it to stay in the middle where it is, and have the surrounding area be the original color of the shirt.
UPDATE
I created a static physics body, and that allowed me to get to the materials of the Plane object. But I can't remove the coloring around the image.
UPDATE
Also, I exported the texture from Blender with Save Image As from Blender UV/Image Editor, I'm not sure if that is the correct way to export a texture to be used correctly in xcode.
UPDATE
I used the .obj file instead and got this far, but when it renders in the app there is no image, only they gray tshirt.
To export a .dae including textures from Blender, make sure to select UV Textures and the Copy checkbox unter Texture Options, in the Export options, during export. Then, in xcode, your texture will be available as a material under the Materials tab, and you just have to drag the image that you were using with the texture, onto the material (make sure you have the correct material selected) in the Scene Editor in Xcode.

Importing a .dae file to Xcode, shows Z-axis facing top

I have a .dae file, which I'm trying to import into Xcode. Once I import, the object's Z-axis points upwards and Y-axis points downwards. Which actually should be vice versa. How to fix this issue?
The below image shows, how z-axis is facing top.
Change the camera view to see the file on the perspective you want. See the image below.
Hope this helps.
This just a compatibility issue. Model exported by modeling software usually has size or position issue.
You can set it in scene editor.
Scene Editor
And the image below shows the way to change camera view.
Camera View

How to import a dae to SceneKit for ARKit

If I run Xcode's ARKit project template, I can move around the default ship as expected.
I have tried importing some dae models that I have exported from Blender, switching the ship to the new item but keeping the code the same. They always show in view but position in front the camera. If I try to move around the model it sticks infront of the camera and doesn't stay in the same virtual space.
I have also tried importing a dae from another tutorial and that works as expected.
Does anything need setting when exporting a 3d model as a Collada dae file to make sure it will anchor to a position in ARKit?
When importing 3D-models for ARKit make sure to check:
the scale of your file. One unit equals 1 meter
The model should be centered in the coordinate origin to make it easy to position the model
Try to import the file in the SceneKit editor in Xcode and check if it gets imported correctly.

Xcode SpriteKit Designer Clear Background Red X

I'm not sure what the issue is, but I'm trying to design a level in Apple's Sprite Kit editor, and I'm running into a problem with SKSpriteNodes that have a transparent background. Sometimes the background doesn't appear as clear. Instead, SpriteKit seems to load a Red X as a background image.
Naturally, I can't have this. Also, it's a problem because I really should be doing all of the level design in the editor instead of manually adding sprites in my Scene code.
Has anyone come across this problem? Could it be a bug in SpriteKit Designer? (There are a number of issues I've had with it since starting to use the tool).
Here is a photo of what it looks like:
I found a kinda hacky way to solve it. Basically, as uchuugaka said, the Red X appears when Sprite Kit fails to load a texture. If you want a clear background, you have to load a clear png file as the background of the sprite. There is no "No Texture" option currently available in the Sprite Kit designer.
Take these steps.
1.) Open any .png file with some transparency in it.
2.) Copy an arbitrary rectangular section of pixels.
3.) Create a new file with said arbitrary pixels.
4.) Save this file as your "clear.png" and import it into your project.
5.) Click on the sprite node with the Big Red X so you can see its setting. Take a screenshot of its position, size, etc. using preview. These settings will get erased when you swap the texture over to clear.png
6.) Swap the texture to clear.png
7.) Re-enter the sprite settings from your screenshot.
8.) Because SpriteKit Editor is currently horribly terribly flawed (see post above), you will need to reset your sprite's physics properites. Set the physics body to none. Then set it to bounding box or circle or alpha mask or whatever you had earlier.
9.) I hope you remembered your collision mask, category mask, and other physics body properties because they just got reset to the default. Re-enter what you had earlier or you will get a very unexpected result.

Resources