I have a terrain I want to apply materials to, but when I try to use TerrainLighting.j3md
I get an exception
SEVERE: Uncaught exception thrown in Thread[#48,jME3 Main,5,main]
com.jme3.renderer.RendererException: compile error in: ShaderSource[name=Common/MatDefs/Terrain/TerrainLighting.frag, defines, type=Fragment, language=GLSL150]
0(337) : error C1503: undefined variable “m_DiffuseMap_0_scale”
0(444) : error C1503: undefined variable “m_DiffuseMap_0_scale”at com.jme3.renderer.opengl.GLRenderer.updateShaderSourceData(GLRenderer.java:1581)
at com.jme3.renderer.opengl.GLRenderer.updateShaderData(GLRenderer.java:1608)
at com.jme3.renderer.opengl.GLRenderer.setShader(GLRenderer.java:1673)
at com.jme3.material.logic.MultiPassLightingLogic.render(MultiPassLightingLogic.java:168)
at com.jme3.material.Technique.render(Technique.java:167)
at com.jme3.material.Material.render(Material.java:1052)
at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:682)
at com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:273)
at com.jme3.renderer.queue.RenderQueue.renderQueue(RenderQueue.java:312)
at com.jme3.renderer.RenderManager.renderViewPortQueues(RenderManager.java:961)
at com.jme3.renderer.RenderManager.flushQueue(RenderManager.java:855)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1223)
at com.jme3.environment.EnvironmentCamera.render(EnvironmentCamera.java:181)
at com.jme3.app.state.AppStateManager.render(AppStateManager.java:387)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:274)
at com.jme3.system.lwjgl.LwjglWindow.runLoop(LwjglWindow.java:628)
at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:717)
Above this it appears to print the contents of the shader code in TerrainLighting.frag
. The Kotlin code I use to create the material is below.
terrainMaterial = Material(
assetManager,
"Common/MatDefs/Terrain/TerrainLighting.j3md"
)