Why is my .dae file not applying materials correctly in Xcode? - xcode

I worked with a freelancer to create a few 3D models and I'm now trying to apply materials to them in Xcode, but some of the models are behaving weirdly. When I import the .dae file, instead of the default gray color models usually have, they are part green, part black, and part transparent. When I try to apply a material, the material only applies to the green parts, and any color seems to blend with the green.
The freelancer is at a loss because he says there shouldn't be anything different about the models that are working and the ones that aren't.
I've attached a screenshot of one of the broken models and one of the working ones, both with the same material applied.
Any help would be much appreciated!
I tried playing around with different material settings and searching for materials that were secretly applied to broken model, but to no avail.

I fixed this issue by removing a Colors item that was in Geometry Sources. I'm still not sure exactly what it is (I'm a SceneKit noob), but removing it did the trick.

This answer is just to illustrate the issue you might have with the texture coordinates. If you use one single color and not textures, you'll be good. But if you plan to add some texturing, you might want to unwrap your model in a different way. the following images should illustrate that.
This model shows texture coordinates that looks like a perspective projection and you loose a lot of space. It cannot be textured in a good manner. it should be unwrapped differently (illustration from Blender).
This model here is perfectly unwrapped with non overlapping textures and alomst every free space on the image texture is used for anything (illustration from Blender).
hope I could help in some manner.

Related

ThreeJS - delineate between meshes

I am displaying a number of different models simultaneously in three.
Some models have the same texture, and it can make it hard to tell where one starts and another ends.
As an example, first image is from my three viewer, second image is from Blender:
It is not obvious in three where the two objects intersect.
I've so far attempted to alter lighting and material settings but have been without success on that front.
I also tried an outline post processing effect but due to what I think is a disorderly output from Sketchup (where the models were made) the outline effect is chaotic:
I am trying to find a good way to clearly delineate between models.
Raycaster from mouse position. De-emphasize the other models' opacity or something. Or if you're serious, you could try the clipping stencil. There's some really good examples for mesh BVH that demonstrates this. https://gkjohnson.github.io/three-mesh-bvh/example/bundle/clippedEdges.html

A-Frame / THREE.js, no textures simplified gltf[glb] models

After simplifying glb successfully with the answer in this post.
The textures in are not being applied to the model any more (it appears completely black and unreflective(no material)
How would I programmatically get the textures to work with this new simplified geometry?
I think its something to do with the uv's but im not to sure how to have it work according to simplified geometry, if even possible.
THREE.SimplifyModifier currently does not preserve UVs in the geometry, which you'll need for textures to work. See: https://github.com/mrdoob/three.js/issues/14058. There is a workaround suggested in that issue (via changes to SimplifyModifier) but as discussed there, some artifacts will likely be visible in the result. If you can do the simplification in Blender or another modeling tool, you may have more control over the process and can get better results.

substance painter export gltf in webgl(three.js) is totally black

When I import my model (.fbx) to draw a texture in the substance painter and export it to the .gltf format, I find that the metal I paint is gone and replaced by the shiny black, and then when I put the exported model in the three.js/examples/webgl_load_gltf.html case, I found that my model was dark and needed to be added a directLight can only see a point, the effect is not very good, but the case of importing the painter painter does not have any problems.
It looks as good as the model in the original example.
I would like to know what causes this two problems.
The problem is that your demo has only a single instance of HemisphereLight. The materials of your meshes are instances of MeshStandardMaterial with metalness values of 1.0. Since hemisphere lights are sources of indirect diffuse light, they are not reflected by pure metals. More information about this topic in: https://github.com/mrdoob/three.js/issues/9228
You should use a different light setting e.g. add a directional light. Or try to fix the material settings in your model.
DUDE I JUST WENT THROUGH THIS, it was a nightmare. I had a very shiny gold car with windows and all types of shit going on. Looked great as a USDZ! Then tried to export GLTF. Black.
Turned off all channels except normal and base color, looked fine.
Then went and turned on metallic and again black.
Then i realized "Oh, I didn't bake my mesh maps" like an idiot. Boom, metallic, roughness and opacity all suddenly worked.
Always ALWAYS bake your mesh maps. Substance is pointless without it.
I know this is 2 years old but apparently all the early adopters of Substance figured this out long ago, so this is for you, random person just learning this stuff. AR is only going to become more in demand, thank god I know how to make it cross-platform now.

How can I dull the reflection effect of an environment map (ie. make it blurred / matte)?

I'm currently rendering a skybox to a THREE.CubeCamera target and am then using that target as the environment map on a material. The idea being that I want to have the colour of a cube affected by the colour of the sky around it, though not fully reflecting it (like how a white matte cube would look in the real world).
For example, here is what I have so far applying the environment map to a THREE.LambertMaterial or THREE.PhongMaterial with reflectivity set to 0.7 (same results):
Notice in the first image that the horizon line is clearly visible (this is at sunset when it's most obvious) and that the material is very reflective. The second image shows the same visible horizon line, which moves with the camera as you orbit. The third image shows the box at midday with blue sky above it (notice how the blue is reflected very strongly).
The effect I'm trying to aim for is a duller, perhaps blurred representation of what we can already see working here. I want the sky to affect the cube but I don't want to fully reflect it, instead I want each side of the cube to have a much more subtle effect without a visible horizon line.
I've experimented with the reflection property of the materials without much luck. Yes, it reduces the reflection effect but it also removes most of the colouring taken from the skybox. I've also tried the shininess property of THREE.PhongMaterial but that didn't seem to do much, if anything.
I understand that environment maps are meant to be reflections, however my hope is that there is a way to achieve what I'm after. I want a reflection of the sky, I just need it to be much less precise and instead more blurred / matte.
What could I do to achieve this?
I achieve this writing my own custom shader based on physically based rendering shading model.
I use cook-torrance model that consider roughness of the material for specular contribution. It's not an easy argument that I can talk in this answer, you can find great references here http://graphicrants.blogspot.it/ at the specular BRDF article.
In this question you can find how I achieve the blurry reflection depending on material roughness.
Hope it can help.
I solved this by passing a different set of textures that were blurred to be the cubemap for the object.

mesh looks incorrect (threejs r68)

I'm using threejs (R68) on the model online view project which converts some uploaded models to threejs files.
We found some models look incorrect as below.
Some models can be viewed at
http://www.threedbook.com/detail/23981
Especially when move the models(rotate or pan), the mesh color and shade look changing all the time.
Strange thing is that model will look normal if it's zoomed in enough size.
Would anyone point me which causes the rendering problem? or any issue when I convert the models to threejs file?
Thanks a lot!
The modelling of the object is incorrect. You have overlapping polygons over the same area and very close to each other. When rendering, that would cause the appearance to change (specially if you are zoomed out since you dont have enough rendering resolution); ie. many polygons are squashed on top of each other and the renderer doesn't know which one to render first. When you zoom in, everything is ok because now you have the resolution.
I find the similar issue at Flickering planes
I make the near to 1, it works for most models.

Resources