drwave / usd-sketchup

Source & macOS binary of USD exporter for SketchUp
Other
63 stars 5 forks source link

some materials are not found #16

Closed drwave closed 6 years ago

drwave commented 6 years ago

For some sketchup models, I'm currently not finding the texture material. This seems related to if the model is a component. Here are two files, one of which is a component, and we don't find the texture, but if we make the model not a component, we do find the texture.

FloorTile_NoComponent.zip FloorTile.zip

wave-electron commented 6 years ago

I noticed yesterday with a complex model downloaded from 3Dwarehouse, it was not previewing in Ios12 after conversion using the SketchUp plugin or the gltf2usd command line tool. If the model was viewed in Xcode for both conversions, the complex material assignment looked good. I counted around individual 30 jpg materials in the usdz file. I have found if you have more than 1 material assigned to mesh it won’t preview in ios12.... so it could have been that.

drwave commented 6 years ago

Interesting. I think this is a different issue, though.

I'm literally not finding the material in going through the scene graph, so I'm not even making the assignment.

Would love to get a list of any models you find that in 3DWarehouse (or elsewhere) that look better/more accurate with your glTF export pipeline than just exporting directly with this plug-in. You've already caused me to fix a bunch of bugs I didn't realize I had, so would love to squash more before the deluge comes in the next few weeks...

wave-electron commented 6 years ago

Ok. Will do. I’ll try and get interesting assortment of models with both components & groups. I noticed yesterday that your usd conversions for a large model was roughly 1 MB or around 10% reduction now over the gltf2usd tool! So your moving in the right direction it would seem :)

wave-electron commented 6 years ago

@drwave Ok, I found some other strange issue with materials. How are you handling whitespaces in image file naming? say a name like "untitled drawing (3).jpg" I noticed a material not applying the correct texture on a train door. It also had the image assign on two doors, one was ok, one had the wrong texture in its place. The GLTF tool handled it correctly. Another problem I noticed, after reposition and scaling a texture inside SketchUp before exporting, your plugin does something very weird to the texture.... GLTF handled it correctly. I also noticed its completely ignoring just lines (train power lines below)... which is fair enough, but the GLTF tool did at least try render them, but not perfectly.

SketchUp plugin conversion compared to GLTF this time was roughly 20% larger.

train-files-for-debugging.zip

img_1657 img_1656

drwave commented 6 years ago

Hmm. I'm looking at these USD files on macOS, and will try it on iOS 12 in a bit, but at first blush, my export looks good:

train

You might download the latest plug-in - I just updated the binary. Also, I by default now only export the "front face" and mark it as double-sided, so I think for most models you won't notice anything visually different (but if you do you can uncheck the box on options), but you should get a size savings.

Give that a try - looks like the .usdz I generate is 3.4MB, which is smaller than you're seeing from glTF, right?

Comeng.usdz.zip

wave-electron commented 6 years ago

I exploded the model, and it fixes the door problem and grass.

drwave commented 6 years ago

You shouldn’t have to - I didn’t in the one I just tried.

I think this is related to the issue I fixed today where component definitions and instances can have a material associated with them, and I was missing that previously.

There are still some places I’m not finding the materials, though. Hoping to get the SketchUp folks to finally take a look at this code, but I fear they’re all heads down for Basecamp, so nobody there will look for a few weeks...

On Sep 15, 2018, at 7:50 PM, Ashley Joyce notifications@github.com wrote:

I exploded the model, and it fixes the door problem and grass.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/drwave/usd-sketchup/issues/16#issuecomment-421677911, or mute the thread https://github.com/notifications/unsubscribe-auth/ABmgOql5jtAUnX-lZa5NgUA3S5hDyEQCks5ubbyOgaJpZM4WqmWk.

wave-electron commented 6 years ago

The model had components, so maybe its related to your earlier discovery?

drwave commented 6 years ago

Yes, I expect so.

wave-electron commented 6 years ago

Ok. I will download the latest & retry.

wave-electron commented 6 years ago

Ok. I try the latest plugin with same train model....I've still got issues with materials being wrong - error on the door material - gravel instead of the red jpg. Error on the grass area again - Its actually similar to the image I posted above.

What are your export settings? Mine have the first 4 settings Checked.

wave-electron commented 6 years ago

BTW, I didn't explode at all.

wave-electron commented 6 years ago

Sorry... let me just double check the SketchUP updated properly. Will try again.

drwave commented 6 years ago

Export Double Sided should be checked. I do "single file" when I'm debugging this stuff so I can more easily look at it. Again, I'm trying this on macOS, not iOS, so we definitely could be seeing different things with the same resulting file. What happens when you try and image the Comeng.usdz I uploaded earlier in this thread?

options
wave-electron commented 6 years ago

Again, I'm trying this on macOS, not iOS, so we definitely could be seeing different things with the same resulting file.

Definitely, viewing the file on macOS is far better than iOS... for some reason. I'm running into all sorts of limitation in iOS. In relation to animations, I'm unable to get more than 1 bone animation working in the same scene... but the multiple character animations run fine on macOS.

I will try out your Comeng.usdz now.

drwave commented 6 years ago

Honestly, I think it's very early days (in a good way) in iOS for this stuff. I expect it will get a lot better in the next iteration now that so many folks will be pounding on it.

The bar, to start with, though, is pretty low - I think what they're really promising day 1 is well authored single assets, which is already pretty darn neat. It just shows all the head room once they really get this bulletproof.

wave-electron commented 6 years ago

Yep, so your file Comeng.usdz.zip img_1659 Is displaying like this in iOS 12 GM version. Texture on door is ok, but the grass is not correct. But if you explode it... that corrects itself.

wave-electron commented 6 years ago

Honestly, I think it's very early days (in a good way) in iOS for this stuff. I expect it will get a lot better in the next iteration now that so many folks will be pounding on it.

Yeah agree, I've notice a few more players popping up... here's another one from the past week online usdz creation tool from Vectary

drwave commented 6 years ago

I believe I've figured out the issue re: missing some materials.

The problem is when you have a component that is defined without any material, but then the material is assigned to the instance. Currently, I'm noting that there's a material, but since the faces (with their materials - or lack there of) have already been written out as part of the component definition, the material assigned to the instance is not used.

I think the solution is to define a material and bind it to the instance - I believe that's a good USD thing to do and will work, the issue is just what scope to define the material in....

I also have no idea in SketchUp how you do this sort of thing from the UI, and if/why it's a desirable thing to do, but as an exporter, that's not my problem - since it's possible, we need to handle it correctly.

BTW, the way I debugged this finally was to use the skp_to_xml example plug-in and looked at it's output. Here's a small example .skp file and the XML, and you can see if you look at the component in sketchup and then in it's XML export, the material is bound to the instance and you can see that the component its based on does not have any material assigned to it.

BoundToInstanceExample.zip

drwave commented 6 years ago

As far as the USD export is concerned, I believe this is fixed. It's true that there are issues on the ARKit rendering side, but the info is in the USD file and I believe it's correct, so closing.