kcoley / gltf2usd

command-line utility for converting glTF 2.0 models to USD
MIT License
264 stars 38 forks source link

Support of KHR_texture_transform #104

Closed ghost closed 5 years ago

ghost commented 5 years ago

Do you have any idea when you would support KHR_texture_transform and how to do so with USD?

kcoley commented 5 years ago

Hi @sayduck-daniel. (Sorry for the delay, I’ve currently traveling). I can add support for it next week when I return from traveling. I would expect it to map to the USDUVTexture spec: https://graphics.pixar.com/usd/docs/UsdPreviewSurface-Proposal.html

ghost commented 5 years ago

Hi @kcoley, no worries. Let me know you need something from me.

In this zip you can find 2 cubes with the same texture:

ghost commented 5 years ago

Hi @kcoley, any news on this matter?

kcoley commented 5 years ago

@sayduck-daniel thanks for checking in on this. I just double checked the USD spec on this, and it looks like USD actually doesn't have support for texture transform, unlike what I originally thought. The scale and bias parameters modify the texture values, but do not offset or scale the texture coordinates.

I could get the tool to "bake" the texture transform into a new modified texture to get it to work, though this would yield a bigger usdz file size. This would essentially remove the texture transform properties.

ghost commented 5 years ago

@kcoley that is what I taught as well, baking is the best way to support this extension and it should be done before conversion. To be frank, when I read your USD Preview Surface I understood tiled textures could be supported, I must have misunderstood it.

Regarding the bigger size, it is a risk the modeller is aware of. In any case, we let him know through our interface when he asks for a USDZ export.

Do you think this is something you could add to gltf2usd? Do you see a timeline for this feature request?

kcoley commented 5 years ago

@sayduck-daniel yeah I think it's something that can be added to the tool. I hope to get it in by end of this week. I am trying to figure out how to implement this in the Pillow API.

kcoley commented 5 years ago

@sayduck-daniel almost have something working, though going through some edge cases. Might take one more day or two before I merge.

ghost commented 5 years ago

👍 awesome, let me know, we have everything in place to test some models in our side.

kcoley commented 5 years ago

@sayduck-daniel just added support for texture transform generation. A new texture gets generated if the extension is used, which may slow down the export a bit. Feel free to open an issue if you hit any problems.