Modify j3o material meet trouble

Hello everyone, I loaded by j3o file into the program, to get the material of it and then edit textures, but no response Pictures did not update

Node node=(Node) assetManager.loadModel("Scenes/terrain/t1.j3o");
        rootNode.attachChild(node);
        
        TerrainQuad t=(TerrainQuad) node;
        t.getMaterial().clearParam("DiffuseMap");
        
        Texture tex1 = assetManager.loadTexture("Scenes/terrain/textures/map_road_001.dds");
        tex1.setWrap(WrapMode.Repeat);
        t.getMaterial().setTexture("DiffuseMap", tex1);
        System.out.println(t.getMaterial().getParam("DiffuseMap").getValue());

Ask for help!

http://wiki.jmonkeyengine.org/doku.php/jme3:beginner:hello_terrain

Hi Xujiang
Please take a look at this video made by @normen
In this video he loads a model and gets it’s material and change it’s texture .
He uses JME GUI material editor . (not in code) . I hope It can help you. :grinning:
You do not need to watch the hole video . you may look it from minute [5:00 to 10:00] from video .

Hi, i know you. You are making a Terrain Editor and want to paint something on a terrain.

我认识你。

Find into the shader your terrain use, and look for the right material parameter you need.

地形贴图跟材质有关,材质和染色器有关。你想替换地形贴图的话,得确定找对了染色器中的参数。

It seems that your terrian use “Common/MatDefs/Terrain/TerrainLighting.j3md”, it has 12 diffuse maps and 3 alpha maps.

看起来你使用的是"Common/MatDefs/Terrain/TerrainLighting.j3md"这个材质,它有12个DiffuseMap,还3个AlphaMap。

When brushing a Terrain, modify AlphaMap instead of DiffuseMap. The texture of each tile of the hightmap is decided by AlphaMap。

如果你是在刷地形的话,最好是修改AlphaMap,而不是DiffuseMap。因为高地图地形上的每个Tile贴什么图是由AlphaMap的通道决定的。

The shader’s parameters :

MaterialParameters {

    // use tri-planar mapping
    Boolean useTriPlanarMapping

    // Use ward specular instead of phong
    Boolean WardIso

    // Are we rendering TerrainGrid
    Boolean isTerrainGrid

    // Ambient color
    Color Ambient

    // Diffuse color
    Color Diffuse

    // Specular color
    Color Specular

    // Specular power/shininess
    Float Shininess : 0

    // Texture map #0
    Texture2D DiffuseMap
    Float DiffuseMap_0_scale
    Texture2D NormalMap

    // Texture map #1
    Texture2D DiffuseMap_1
    Float DiffuseMap_1_scale
    Texture2D NormalMap_1

    // Texture map #2
    Texture2D DiffuseMap_2
    Float DiffuseMap_2_scale
    Texture2D NormalMap_2

    // Texture map #3
    Texture2D DiffuseMap_3
    Float DiffuseMap_3_scale
    Texture2D NormalMap_3

    // Texture map #4
    Texture2D DiffuseMap_4
    Float DiffuseMap_4_scale
    Texture2D NormalMap_4

    // Texture map #5
    Texture2D DiffuseMap_5
    Float DiffuseMap_5_scale
    Texture2D NormalMap_5

    // Texture map #6
    Texture2D DiffuseMap_6
    Float DiffuseMap_6_scale
    Texture2D NormalMap_6

    // Texture map #7
    Texture2D DiffuseMap_7
    Float DiffuseMap_7_scale
    Texture2D NormalMap_7

    // Texture map #8
    Texture2D DiffuseMap_8
    Float DiffuseMap_8_scale
    Texture2D NormalMap_8

    // Texture map #9
    Texture2D DiffuseMap_9
    Float DiffuseMap_9_scale
    Texture2D NormalMap_9

    // Texture map #10
    Texture2D DiffuseMap_10
    Float DiffuseMap_10_scale
    Texture2D NormalMap_10

    // Texture map #11
    Texture2D DiffuseMap_11
    Float DiffuseMap_11_scale
    Texture2D NormalMap_11


    // Specular/gloss map
    Texture2D SpecularMap


    // Texture that specifies alpha values
    Texture2D AlphaMap
    Texture2D AlphaMap_1
    Texture2D AlphaMap_2

    // Texture of the glowing parts of the material
    Texture2D GlowMap

    // The glow color of the object
    Color GlowColor
}