Question

Texture Atlas? - Anyone tried creating one with FME?


Userlevel 4
Badge +26

Has anyone ever tried to create texture atlases in FME?

 

 

I'm thinking about trying to try this, however, I don't want to recreate the wheel or start a process which is just not worth it (performance-wise).

 

 

If anyone has had a go at this I would really appreciate any tips of comments

 

 

Thanks in advance!

 

 


6 replies

Userlevel 2
Badge +17

Hi @virtualcitymatt,

We have Enhancement Request (FMEENGINE-15322) for the ability to created texture atlases.

I have tried it a few times - to limited success. The basic steps are:

  • extract textures from model
  • mosaic textures into atlas - I just did a simple linear append, not really optimized.
  • apply atlas as texture on faces, using adjusted texture uv coordinates

The last step is tricky. The texture coordinates are stored as measures on the bounding polygon of the Face, which requires quite a bit of geometry decomposing to get to.

One alternative is to use the fme_appearance_texture_gen_info supplied by the AppearanceExtractor, and alter its parameter to fit the new atlas. The AppearanceSetter has an option to use this parameter when applying a new appearance.

The parameter of the fme_appearance_texture_gen_info are detailed on the doc page for the AppearanceExtractor, under Keep Input Traits as Attributes. I think you just need to adjust the U1, V1, dU2, dV2, dU3 and dV3 values to fit the textures new location in the atlas image. The UV coordinate are in the range 0-1, and refer to the proportionate location in the image.

Userlevel 2
Badge +17

One additional note - the Esri i3s writer automatically creates a texture atlas when writing. However, FME does not yet have a reader for this format.

Userlevel 4
Badge +26

Hi @virtualcitymatt,

We have Enhancement Request (FMEENGINE-15322) for the ability to created texture atlases.

I have tried it a few times - to limited success. The basic steps are:

  • extract textures from model
  • mosaic textures into atlas - I just did a simple linear append, not really optimized.
  • apply atlas as texture on faces, using adjusted texture uv coordinates

The last step is tricky. The texture coordinates are stored as measures on the bounding polygon of the Face, which requires quite a bit of geometry decomposing to get to.

One alternative is to use the fme_appearance_texture_gen_info supplied by the AppearanceExtractor, and alter its parameter to fit the new atlas. The AppearanceSetter has an option to use this parameter when applying a new appearance.

The parameter of the fme_appearance_texture_gen_info are detailed on the doc page for the AppearanceExtractor, under Keep Input Traits as Attributes. I think you just need to adjust the U1, V1, dU2, dV2, dU3 and dV3 values to fit the textures new location in the atlas image. The UV coordinate are in the range 0-1, and refer to the proportionate location in the image.

OK Cool thanks for the tips Dave - I'll give it a go and report back

Badge

Hi @virtualcitymatt,

We have Enhancement Request (FMEENGINE-15322) for the ability to created texture atlases.

I have tried it a few times - to limited success. The basic steps are:

  • extract textures from model
  • mosaic textures into atlas - I just did a simple linear append, not really optimized.
  • apply atlas as texture on faces, using adjusted texture uv coordinates

The last step is tricky. The texture coordinates are stored as measures on the bounding polygon of the Face, which requires quite a bit of geometry decomposing to get to.

One alternative is to use the fme_appearance_texture_gen_info supplied by the AppearanceExtractor, and alter its parameter to fit the new atlas. The AppearanceSetter has an option to use this parameter when applying a new appearance.

The parameter of the fme_appearance_texture_gen_info are detailed on the doc page for the AppearanceExtractor, under Keep Input Traits as Attributes. I think you just need to adjust the U1, V1, dU2, dV2, dU3 and dV3 values to fit the textures new location in the atlas image. The UV coordinate are in the range 0-1, and refer to the proportionate location in the image.

Nice! I gave it a 8 hours try last year but failed. The uv coordinates i extracted was skewed in some way i could not figure out. I figured it was above my head. When is FMEENGINE-15322 expected?

Badge +1

This would be super important feature especially for CityGML models, that have thousands of tiny textures, which downstream applications usually cannot handle.

Userlevel 4
Badge +26

This would be super important feature especially for CityGML models, that have thousands of tiny textures, which downstream applications usually cannot handle.

Yeah - This is essentially our use case. Each tiny face has a texture. We have another process which van generate texture atlases but I want to also be able to do it in FME. But if I ever get around to trying to do as Dave suggests I think it'll probably be pretty slow.

Reply