How to create a shader containing the original texture of the Cesium World Terrain?

Question.
How can I get the texture of Cesium World Terrain for my original shader?
If not, can I add texture to the terrain without affecting its original texture?

Hello @nnn,

Just so you’re aware, the satellite imagery that Cesium World Terrain uses likely won’t work on meshes that aren’t 3D Tilesets. 3D Tilesets have texture coordinates embedded in each tile that account for different LODs, and the imagery will not update correctly if the mesh is not of type Cesium3DTileset.

If you are looking to customize a 3D Tileset’s material, you can start by editing the Cesium default shader. This shader is currently found under Packages/com.cesium.unity[or Cesium for Unity]/Runtime/Resources/CesiumDefaultTilesetShader.shadergraph. Make a copy of that shader and move it to your main Assets folder. (It’s also recommended to rename it to avoid confusion.)

Double-clicking on your duplicate shader will open the shadergraph.

Generally, you will want to insert any custom shader nodes right before you connect them to the output Fragment shader, after all the existing Cesium nodes.

Let me know if you have further questions! We hope to make a tutorial on material editing soon.

-Alex

Thank you for answer.
I used the Cesium default shader and it worked. But every time I change the effect, the terrain will not refresh, or only refresh once. I have to run the whole program to see the effect, but it takes time and is not easy to develop. Do you have a solution?
Thanks.

Hi @nnn,

I think I’m seeing this issue too, and it’s not intended behavior. I created an issue to track this here: Changing material parameters does not update material for all tiles · Issue #180 · CesiumGS/cesium-unity · GitHub

Thank you for reporting this!

-Alex