How to create detail texture?

Hi,

I’m implementing export to 3D Tiles from our terrain generating cloud service Remoscape. We are using a grayscale multi-texture as a detail texture with a separate dense UV-map on layer 1 in other exports, but I can’t seem to convert this properly to gltf.

I have tried setting the detail texture as metallicRoughnessTexture pointing to texCoord 1 where the separate UV-map is, but nothing is visible. I realize that I would have to convert the detail texture and probably put its content as roughness in the G channel, but even before then I expected to see something when uploaded to ION, but it seems to be completely ignored.

See this closeup for how I expect the combination to look like and the result in ION to the right:
image
image

Can someone recommend a way to accomplish this in the best way, if at all possible? I would like to avoid custom shaders if possible to make the export as general as possible.

Thanks,
Andreas

Hi @AndreasRemograph

How does the glTF look in other viewers like https://gltf-viewer.donmccurdy.com/ and https://sandbox.babylonjs.com/?

Does the glTF validate with glTF Validator?

If those check out there could be a bug in CesiumJS. Would you be able to share the glTF for us to look at?

Thanks Sean!

I’m actually converting each tile directly to .b3dm in my 3D Tiles export, using tinygltf with some added code. I tried creating a separate .glb file as well, but the tools you provided don’t seem to like my external images referred to by uri only. A zipped folder with glb with external images is attached here:

terrain_glb.zip (226.8 KB)

I have tried 3d-tiles-validator on the complete asset, but all it’s complaining about is that “The batch table binary must be aligned to 8 bytes”, which has never seemed to matter anyway.

My ion asset is 1704606, perhaps you can see something there? I think I can see some different metallic behavior of the terrain, but no roughness. I’m probably misunderstanding the use of metallic and roughness.

I’m not at all convinced that this is a way of accomplishing a detail texture providing higher detail and fidelity when approaching the ground. I have thought about normalTexture, but it’s not as simple as using a regular texture.Do you have other suggestions?

I created a version that’s a bit easier to inspect.

terrain_gltf.zip (226.9 KB)

The main problem is that the model doesn’t have normals and CesiumJS doesn’t generate normals automatically, so it’s rendered as an unlit material.

If you add normals to the glTF you should see it shade properly, or at least consistently with other viewers.

We’re tracking this issue here: Generate normals automatically for glTF 2.0 models · Issue #6506 · CesiumGS/cesium · GitHub

Ok, thanks! I just put together a bad example without normals, my bad. So I added normals and now I can certainly see a difference. I also erased red and green channel in detail.jpg to only use roughness. But it’s only visible as a “specular” roughness, see below:
image

So I should have read up on the metal-roughness technique and I’m probably wrong in that I can use this for what I want. Isn’t there any other more general way of accomplishing “regular” generic multi-texturing, something like glTexEnv with GL_ADD or GL_MODULATE?

Yeah I’m not sure if glTF does exactly what you want. You could try using the occlusion texture instead of metallic-roughness but that limits you to grayscale detail textures.

Yes, occlusion texture actually works the way I want, we use only grayscale detail texture anyway. Thank you so much!