Solved

I want to create textured models to cesium 3d tiles from obj files


Badge

Hi,

I have several obj files for a city. I succeeded to convert these obj files into cesium 3D tiles. At the result of tiles, texture of models created darknessly. To solve this situation, I used AppearanceSetter, then set Shininess value. However, textures of models got lost. How do I set shininess value of my building with textures?

 

I want to share created models by using AppearanceSetter:appeareancesetterI want to share without AppearanceSetter:

without_appeareancesetterIts my workflow:

Ekran AlıntısıThanks for your interest.

icon

Best answer by kailinatsafe 21 July 2022, 23:52

View original

15 replies

Userlevel 2
Badge +13

Hello @talha​ , thanks for including those screenshots! Sometimes missing vertex normals can cause a texture to look darker than they are. It might be worth adding a GeometryValidator with 'Issues To Detect' = 'Missing Vertex Normals'. If you have 'Attempt Repair' = 'Yes', I think this may actually create the vertex normals for you. Alternatively, I think there is a time setting/parameter in cesium viewer, so if you're looking at data far away from your location, you may just have to adjust the time to daytime (it may be night time). Let me know if either of these suggestions work, Kailin.

Badge

Hi @kailinatsafe​ ,

Thanks for your interest. I tried these ways you suggested, but they didn't solve this dark color problem. I tried to convert by using obj23dtiles package, it created brightness color perfectly. I investigated that it had used an occlusion value during converting. I want to share this in following:

__useOcclusionWhen I converted with FME, I got a result like following:

FMEWhen I converted with obj23dtiles package, I got a result like following:

obj23dtilesAs you can see, there is a difference between two images about brightness/dark color. How can I set this occlusion value with FME and solve this problem?

I really appreciate your interest. Thanks @kailinatsafe​ !

Badge +22

I don't have answer for you, but we had the same issue https://community.safe.com/s/question/0D54Q00008e3MVQSA2/3dtiles-texture-illumination

 

I suspect that it's because our obj mtl file had illum 2 in all the textures which is ignored by FME when reading the obj files and therefore not accounted for in the GLTF.

 

Illum 2

This is a diffuse and specular illumination model using Lambertian

shading and Blinn's interpretation of Phong's specular illumination

model (BLIN77). The color includes an ambient constant term, and a

diffuse and specular shading term for each light source. The formula

is:

color = KaIa

+ Kd { SUM j=1..ls, (N*Lj)Ij }

+ Ks { SUM j=1..ls, ((H*Hj)^Ns)Ij }

 

We also ended up using a different obj to 3DTiles converter. In our case the modelTiler from cesium.

Userlevel 2
Badge +13

I don't have answer for you, but we had the same issue https://community.safe.com/s/question/0D54Q00008e3MVQSA2/3dtiles-texture-illumination

 

I suspect that it's because our obj mtl file had illum 2 in all the textures which is ignored by FME when reading the obj files and therefore not accounted for in the GLTF.

 

Illum 2

This is a diffuse and specular illumination model using Lambertian

shading and Blinn's interpretation of Phong's specular illumination

model (BLIN77). The color includes an ambient constant term, and a

diffuse and specular shading term for each light source. The formula

is:

color = KaIa

+ Kd { SUM j=1..ls, (N*Lj)Ij }

+ Ks { SUM j=1..ls, ((H*Hj)^Ns)Ij }

 

We also ended up using a different obj to 3DTiles converter. In our case the modelTiler from cesium.

Hello @jdh​ and @talha​ , thank you for sharing this! Sorry @jdh​ you are also encountering this! Would either of you be able to share your texture file or OBJ? If I am able to reproduce the behaviour, I can potentially file an ehancement request with development. Best, Kailin

Badge

I am really grateful for your interest @kailinatsafe​ .

I am sharing with you all the files that I used to create a single building.

I want you to keep me apprised of any developments whatsoever.

Thank you.

Userlevel 2
Badge +13

I am really grateful for your interest @kailinatsafe​ .

I am sharing with you all the files that I used to create a single building.

I want you to keep me apprised of any developments whatsoever.

Thank you.

Hi there @talha​ , thank you so much for sharing your OBJ file. I did some investigation and I was not able to visually see a difference between FME Data Inspector and CesiumION. From there, I decided to see if FME loses or drops any illumination information while roundtripping OBJ, to my surprise, FME actually added some values that were not present in the material file before (which is great)! I've appended this information to FMEENGINE-15899.

 

I have a feeling the bug you're encountering may be in the Cesium 3D Tiles Writer. Would you be able to share your workspace with the 3D Tile writer present? Also, I've been using FME 2022.0 Official, are you also using FME 2022.0? Happy to help, Kailin

Badge

Hi @kailinatsafe​ .

Thanks for your all interest. Firstly, I have so excited I read these improvements. I really appreciate you. Also, I'm also using FME 2022.0 such as you. Secondly, I'm sharing my workflow as an attachment. I want to keep me apprised of any developments again.

Thank you.

Userlevel 2
Badge +13

Hi @kailinatsafe​ .

Thanks for your all interest. Firstly, I have so excited I read these improvements. I really appreciate you. Also, I'm also using FME 2022.0 such as you. Secondly, I'm sharing my workflow as an attachment. I want to keep me apprised of any developments again.

Thank you.

Hello @talha​, I super appreciate this! Thank you so much for sharing, if you're able to pass along the CSV dataset as well? If you're unable to publically share the CSV, let me know. Best, Kailin.

Badge

Hi @kailinatsafe​ .

I really appreciate you, and am so excited to reach a result. I am sharing again with you all the files (with CSV) that I used to create a single building. By the way, I want to explain that this CSV file includes correct latitude, longitude and height informations in order to locate a building right on the sphere. Thanks for everything @kailinatsafe​ .

Userlevel 2
Badge +13

Hi @kailinatsafe​ .

I really appreciate you, and am so excited to reach a result. I am sharing again with you all the files (with CSV) that I used to create a single building. By the way, I want to explain that this CSV file includes correct latitude, longitude and height informations in order to locate a building right on the sphere. Thanks for everything @kailinatsafe​ .

Hello @talha​ , thanks for sharing everything. I was able to see the lighting difference you noted between FME and CesiumION. Can you take a look at this potential solution, and let me know if it works for you? obj_csv2_pngraster2cesium3dtiles_ko.fmw

 

I found an FME Hub transformer that applies gamma correction to RGB images (RGBGammaCorrector). I've created a user parameter for you to test with, so you can find the most appropriate correction value (for reference, it seems the lower the value, the lighter the model). You'll notice I placed the RGBGammaCorrector in the transparency bookmark, this way are able to edit the texture itself before its re-added to the model. Please let me know if this gives you a more ideal output.

 

Also, when I uploaded your tileset to CesiumION, the building was really elevated (floating). To resolve this, I changed Z Offset = 0 in the Offsetter_2. Now the building is on the ground.

 

Happy to help, Kailin.

Badge

Hi @kailinatsafe​. Thanks for everything and your all interest.

I have tried your workspace with different gamma correction values, and got different results. I'll share all results to you in following.

1- When the gamma correct value was 0.2:

gama02created buildings that gamma correct value was 0.2:

gama02buildingsI saw that created buildings were covered with a light gray color.

2- When the gamma correct value was 0.5:

gama05created buildings that gamma correct value was 0.5:

gama05buildings3- When the gamma correct value was 0.8:

gama08created buildings that gamma correct value was 0.8:

gama08buildingsI think these buildings are still created darknessly according to obj23dtiles npm package, as you can notice.

After you had found (RGBGammaCorrector) transformer, I also found an FME Hub transformer that adjusts the brightness and contrast of RGB rasters. It's RGBBrightnessContrastAdjuster. However, it got lost textures of buildings like using AppearanceSetter. I want to share with you result of creating buildings by using this transformer. I placed the RGBBrightnessContrastAdjuster in place of RGBGammaCorrector in workspace.

brightnessAlso, I realized that roofs of buildings was created more darkness than all walls, but I don't know reason of this.

@kailinatsafe​ I really appreciate that you are very interested. I'm waiting your replying. Thank you @kailinatsafe​ .

 

Userlevel 2
Badge +13

Hi @kailinatsafe​. Thanks for everything and your all interest.

I have tried your workspace with different gamma correction values, and got different results. I'll share all results to you in following.

1- When the gamma correct value was 0.2:

gama02created buildings that gamma correct value was 0.2:

gama02buildingsI saw that created buildings were covered with a light gray color.

2- When the gamma correct value was 0.5:

gama05created buildings that gamma correct value was 0.5:

gama05buildings3- When the gamma correct value was 0.8:

gama08created buildings that gamma correct value was 0.8:

gama08buildingsI think these buildings are still created darknessly according to obj23dtiles npm package, as you can notice.

After you had found (RGBGammaCorrector) transformer, I also found an FME Hub transformer that adjusts the brightness and contrast of RGB rasters. It's RGBBrightnessContrastAdjuster. However, it got lost textures of buildings like using AppearanceSetter. I want to share with you result of creating buildings by using this transformer. I placed the RGBBrightnessContrastAdjuster in place of RGBGammaCorrector in workspace.

brightnessAlso, I realized that roofs of buildings was created more darkness than all walls, but I don't know reason of this.

@kailinatsafe​ I really appreciate that you are very interested. I'm waiting your replying. Thank you @kailinatsafe​ .

 

Hey @talha​, thanks for taking a look at the workspace! You're correct, this still does appear to be darker - rats!

 

I think I might have to leave this with development for a bit, I'm slowly running out of ideas! For now, I've appended key parts of our discussion to FMEENGINE-15899. I will update this thread when I can.

 

I also took a look at the latest workspace you shared, I think that result is expected with the values you entered (1, 1). RGBBrightnessContrastAdjuster - "Positive values mean brighter/more contrast, negative values mean less bright/less contrast". If we run with lower values, such as 0.3 & 0.3, we can see the texture, but it looks saturated:

 

RGBBrightnessContrastAdjuster 

Thank you again for sharing everything, and sorry I don't have an immediate solution for you! Happy to help, Kailin

Badge

Hello @kailinatsafe​ .

I don't know what is the FMEENGINE-15899, and wonder it. I have efforted to investigate it, but didn't find anything.

You have so helped so far. It's so exciting experienced with you. I really look forward you will update.

Thanks for your all affort and interest @kailinatsafe​ .

Userlevel 2
Badge +13

Hello @kailinatsafe​ .

I don't know what is the FMEENGINE-15899, and wonder it. I have efforted to investigate it, but didn't find anything.

You have so helped so far. It's so exciting experienced with you. I really look forward you will update.

Thanks for your all affort and interest @kailinatsafe​ .

Hello @talha​ , no worries at all, more than happy to help (and this was fairly interesting!). FMEENGINE-15899 is a ticket related to adding illumination model support for the Cesium 3D Tiles writer. Unfortuantely, no timeline has been adopted yet, but I will update this thread as I can. Best, Kailin.

Badge

Thanks for all informations @kailinatsafe​ . I am going to wait all improvements.

Reply