Custom material and glow color

Hi

I have made my own material:

[java]Material MyMaterial : Common/MatDefs/Light/Lighting.j3md {
MaterialParameters {
DiffuseMap : Flip Tex/Props/D_Extra1_1.dds

    // Texture of the glowing parts of the material
    Texture2D GlowMap
    // The glow color of the object
    Color GlowColor
}
Technique Glow {

    LightMode SinglePass

    VertexShader GLSL100:   Common/MatDefs/Misc/SimpleTextured.vert
    FragmentShader GLSL100: Common/MatDefs/Light/Glow.frag

    WorldParameters {
        WorldViewProjectionMatrix
    }

    Defines {
        HAS_GLOWMAP : GlowMap
        HAS_GLOWCOLOR : GlowColor
    }
}
AdditionalRenderState {
    FaceCull Back
}

}
[/java]

When I execute my program I get the following error:

[java]com.jme3.asset.AssetLoadException: An exception has occured while loading asset: Models/Extra/M_Extra1_1.j3m
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:290)
at com.jme3.asset.DesktopAssetManager.loadMaterial(DesktopAssetManager.java:350)
at com.jme3.scene.Geometry.read(Geometry.java:510)
at com.jme3.export.binary.BinaryImporter.readObject(BinaryImporter.java:340)
at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:242)
at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:125)
at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:109)
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:288)
at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:374)
at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:378)
at fa.level.TutorialLevel.addJ30Object(TutorialLevel.java:143)
at fa.level.TutorialLevel.createSecondFloor(TutorialLevel.java:122)
at skeletonadapter.RePest.simpleInitApp(RePest.java:224)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:226)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.io.IOException: Value parameter statement syntax incorrect
at com.jme3.material.plugins.J3MLoader.readValueParam(J3MLoader.java:270)
at com.jme3.material.plugins.J3MLoader.readExtendingMaterialParams(J3MLoader.java:296)
at com.jme3.material.plugins.J3MLoader.loadFromRoot(J3MLoader.java:531)
at com.jme3.material.plugins.J3MLoader.load(J3MLoader.java:555)
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:288)
… 16 more[/java]

I was wondering what is wrong with my material. It used to work when no additional paramaters were added for the glow effect.

I don’t think you should define same parameters again if you already inherit from base material. Seems that extending material only expect specific declarations, like your DiffuseMap. Lighting.j3md already defines Glow parameters, so no need to redefine them.

This is the way the documentation specifies it: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:bloom_and_glow

You say that my object should be able to glow as:

[java]Material MyMaterial : Common/MatDefs/Light/Lighting.j3md {
MaterialParameters {
DiffuseMap : Flip Tex/Props/D_Extra1_1.dds
}

AdditionalRenderState {
}

}[/java]

Because I try this (when going over the object with my mouse and it is not working)

Documentation says
GlowMap : Models/HoverTank/tank_glow_map_highres.png
not
Texture2D GlowMap

When you extend material, you are defining, not declaring, parameter values.

Solved. My problem was not even related to the material or object.