Modify USDZ file Shading texture - xcode

I use a .scn file in my iOS application to make a shoe appear in 3D.
To find its true texture, I configure it Shading on Constant from SceneKit Editor.
Today, I want to bring up this shoe from Safari AR Quick Look.
So I convert my .scn file to .usdz from XCode.
The Shading is on Physically Based. And we can observe a degradation of the texture which becomes very degraded!
From SceneKit Editor, I reconfigure the Shading of my .usdz on Constant, save the file and it doesn't work.
It is set up again on Physically Based when I open it again…
Have you encountered this problem?
Do you know a solution to force the writing of the .usdz file on Constant shading?
I create my 3D object from Realty Capture by inserting .jpg photos and export the Mesh as an .obj file with just the Diffuse .jpg file
Thank you for your help !

Related

How do I convert an .fbx file from blender to .dae file for Xcode SceneKit

I am trying to convert an .fbx file to a .dae (Collada) file. I have tried using an application for this called FbxConverterUI, however when I drag the Collada file into Xcode it doesn't load all of the animations, meshes and textures from the .fbx file. I use Blender to create the .fbx file. I did try to export it in Collada format from Blender however only a single animation loaded with multiple copies of that one, the animation was also different than how I keyframed it so I bumped into exporting it in .fbx which was loaded correctly when I imported it back into Blender to check that the .fbx format would work.
I lastly tried to export it in usdc and obj but I wasn't bothered with obj because it filled my desktop with like 100 files, the usdc didn't work either because there was not textures or colour and no animations, just a white mesh.
If you could explain how I could convert .fbx to Collada with all of the animations, textures and mesh stays the same that would be great. Or if there is another way to export it in Collada (from Blender) with it working properly. Any other methods that work which you suggest me do would be amazing.
Thanks.
In case you need some kind of guidance, this are my "prefered" export settings from Blender (v.3.0) when it comes to animated models - and I usually had success with it. I am using a separate DAE File for the Model, including the rig - and for the animations I create separate DAE files, containing only the animation, that can be applyed to the node containing the rigged model using SCNAnimationPlayer. (do not convert the those type of DAE files to SCN files using XCode - this may break the file in some cases)
There are many more settings to tweak. (in my example picture anything else is left default)
Keep in mind: This is for SceneKit. For other rendering engines, things may vary.

Issues adding texture to Reality Converter?

Anyone having issues with Reality Converter by Apple. Mainly, when I add an .obj file, it’s able to display the white object. However, when I go ahead and add a texture .png files into the Materials folder, nothing gets updated. I end up with a plain white 3d object (even after restarting/exporting).
The only way it works is if I upload a .gITF folder, where it will actually add in the textures/color.
Not sure if this is a glitch? Or if I’m doing something wrong?
In order to apply a texture to .obj file you need not only a texture file but also its inseparable companion .mtl file (Material Template Library) – a special material definitions file for .obj.

Importing PBR models into Xcode results in incorrect shader properties

I have been experimenting with different 3D model file formats in Xcode, primarily .obj and .dae.
However, after I export these files from Blender, they either don't have any lighting associated with them or all of the values (especially their metalness and roughness) are not what they were initially setup to be.
.obj export,
.dae export,
then the blender version.
Is the issue how I'm exporting the models from Blender, the models themselves, or something else?
obj
If you create a model in Blender (or in Maya), remember, every app has its own internal shaders that may differ from SceneKit's shaders. When you export any model as .obj you also get a corresponding uv-mapped .mtl texture file. There are no lights inside .obj, because this format does support only geometry (with smoothness, normals and UV IDs). And one more thing – .obj doesn't support animation.
dae
.dae format allows you export not only 3D geometry with animations but also its corresponding shaders (like Phong, Blinn or Lambert) with colours and textures (however, Blender or Maya's procedural textures are not supported). And all the lights that were in 3D scene will be also exported.
usdz
The best candidate for export is .usdz file. Not all 3D authoring tools have export usdz option, but Autodesk Maya 2022, thanks to USD plugin, has.
.usdz format has all the features that .dae format has, but in addition to that I can say it's native to RealityKit, SceneKit, Reality Composer and QuickLook, its hierarchical system was adapted for larger scenes and it supports Python USDZ schemas.

Blender MakeHuman to Three.js

I'm trying to integrate a animated 3D character in a Web navigator.
I use MakeHuman 1.02 to create a character which I import in Blender 2.74 in .mhx format.
I retarget to a BVH using the MakeWalk plugin for Blender. It's for the motion.
When I try to export the character in .json format (three.js), the following error appears :
MakeHuman is not a valid mesh object.
A mesh object is an object that we can modify properties or vertices, isn't it ?
I try others format like .dae format (collada) but it seems that the navigators doesn't find the skeleton and the textures of the character (even if they are in the same directory) necessary for the character's motion.
How to get the character like a mesh object ? Or somebody knows another process to success ?
Like Erica pointed out, you need to have a mesh selected to export it. The problem with this is it doesn't seem to work if you have multiple meshes. Only one will export. This is a problem when using MakeHuman because their clothes are separate meshes.
One way to fix this is to select all meshes and combine them into one (I believe that's CTRL + J). However, you'd have to somehow merge all your texture files into one big one and I have no idea how to do that.
What I do is to export the entire scene. Then it doesn't matter what is selected. All meshes get exported. You can load it using either the ColladaLoader, which I would recommend since you're retargeting to a BVH (worked great for me), or the new ObjectLoader.
If you have your own Scene object on the page that you want to use, you can still load the scene created by the exporter, traverse it to get the items you care about, and add those items to your scene that will display on the page.

How to import Blender 3D animation to iPhone OpenGL ES?

I am trying to do animations on iPhone using OpenGL ES. I am able to do the animation in Blender 3D software. I can export as a .obj file from Blender to OpenGL and it works on iPhone.
But I am not able to export my animation work from Blender 3D to OpenGL. Can anyone please help me to solve this?
If you have a look at this article by Jeff LaMarche, you'll find a blender script that will output a 3D model to a C header file. There's also a followup article that improves upon the aforementioned script.
After you've run the script, it's as simple as including the header in your source, and passing the array of vertices through your drawing function. Ideally you'd want a method of loading arbitrary model files at runtime, but for prototyping this method is the simplest to implement.
Seeing as you already have a method of importing models (obj) then the above may not apply. However, the advantage of using a blender script is that you can then modify the script to suit your own needs, perhaps also exporting bone information or model keyframes.
Well first off, I wouldn't recommend .obj for this purpose since the obj file format doesn't support animation, only static 3D models. So you'll need to export the animation data as a separate file that you load at the same time as the obj.
Which file format I would recommend depends on what exactly your animations are. I don't remember off the top of my head what file formats Blender supports, but as I recall it does not export Collada files with animation, which would be the most general recommendation. Other options would be md2 for character animations, or 3ds for simple "rigid objects moving around" animations. I think Blender's FBX exporter will work, although that file format may be too complicated for your needs.
That said, and assuming you only need simple rigid object movements, you could use .obj for the 3D model shapes and then write a simple Python script to export a file from Blender that has at the keyframes listed, with the frame, position, and rotation for each keyframe. Then load that data in your code and play back those keyframes on the 3D model.
This is an old question and since then some new iOS frameworks have been released such as GLKit. I recommend relying on them as much as possible when you can, since they take care of many inherent conversions like this, though I haven't researched the specifics. Also, while not on iOS, the new Scene Graph technology for OS X (which will likely arrive on iOS) in the future, take all this quite a bit further and a crafty individual could do some conversions with that tool and then take the output to iOS.
Also have a look at SIO2.
I haven't used recent versions of Blender, but my understanding is that it supports exporting mesh animation as a sequence of .obj files. If you can already display a single .obj in your app, then displaying several of them one after another will achieve what you want.
Now, note that this is not the most efficient form to export this type of animation, since each .obj file will have a lot of duplicated info. If your mesh stays fixed over time (i.e. only the vertices move with the polygon structure, uv coords, etc. all fixed) then you can just import the entire first .obj and from the rest just read the vertex array.
If you wanted to optimize this even more, you could compress the vertex arrays so that you only store the differences from the previous frame of the animation.
Edit: I see that Blender 2.59 has export to COLLADA. According to the Blender manual, you can export object transformations, and you can also export baked animation for rigged objects. The benefit for you in supporting the COLLADA format in your iPhone app is that you are free to switch between animation tools, since most of them export this format.

Resources