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");
        TerrainQuad t=(TerrainQuad) node;
        Texture tex1 = assetManager.loadTexture("Scenes/terrain/textures/");
        t.getMaterial().setTexture("DiffuseMap", tex1);

Ask for help!

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.


When brushing a Terrain, modify AlphaMap instead of DiffuseMap. The texture of each tile of the hightmap is decided by 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