hello, I have a problem with the glsl
my shader is "ok" in the the "Shaderdesigner" but "jme" impossible that
it appears the same way
package jmetest.effects;
import com.jme.app.SimpleGame;
import com.jme.app.SimplePassGame;
import com.jme.image.Texture;
import com.jme.image.Texture2D;
import com.jme.math.FastMath;
import com.jme.math.Quaternion;
import com.jme.math.Vector2f;
import com.jme.math.Vector3f;
import com.jme.renderer.ColorRGBA;
import com.jme.renderer.pass.RenderPass;
import com.jme.scene.Node;
import com.jme.scene.shape.Quad;
import com.jme.scene.shape.Sphere;
import com.jme.scene.state.GLSLShaderObjectsState;
import com.jme.scene.state.TextureState;
import com.jme.util.TextureManager;
public class GLSLTest extends SimpleGame
{
Vector3f LightPosition = new Vector3f() ;
float MaterialThickness ;
Vector3f ExtinctionCoefficient = new Vector3f() ;
ColorRGBA LightColor = new ColorRGBA();
ColorRGBA BaseColor = new ColorRGBA();
ColorRGBA SpecColor = new ColorRGBA(); // speculaire
float SpecPower; // puisance de speculaire
float RimScalar;
private Quaternion rotQuat = new Quaternion();
private Vector3f axis = new Vector3f(1, 1, 0);
private float angle = 0;
Texture base_tex ;
Texture Normal ;
Texture Base_Height;
float u_invRad;
Node furryNode = new Node();
Vector2f cBumpSize = new Vector2f();
@Override
protected void simpleInitGame()
{
LightPosition.x = 0 ;
LightPosition.y = 0 ;
LightPosition.z = -10 ;
ExtinctionCoefficient.x = 4 ;
ExtinctionCoefficient.y = 2 ;
ExtinctionCoefficient.z = 3 ;
MaterialThickness = 0.0f ;
LightColor.b = 1;
LightColor.g = 1;
LightColor.b = 1;
LightColor.a = 1;
BaseColor.b = 0.925f;
BaseColor.g = 0.905f;
BaseColor.b = 0.884f;
BaseColor.a = 1;
SpecColor.b = 0.845f;
SpecColor.g = 0.830f;
SpecColor.b = 0.830f;
SpecColor.a = 1;
SpecPower = 0.5f;
RimScalar = 0.060f;
u_invRad = 0.2f ;
cBumpSize.x = 0.04200005f;
cBumpSize.y =-0.04999996f;
display.setTitle( "GLSL" );
display.getRenderer().setBackgroundColor(new ColorRGBA( 0.0f, 0.0f, 1.0f, 0.5f ));
Sphere s = buildSphere();
furryNode.attachChild(s) ;
rootNode.attachChild(furryNode);
rootNode.updateRenderState();
}
private Sphere buildSphere()
{
Sphere sphere = new Sphere("sphere1",32,32,4);
//sphere.setLocalScale(18f);
// Quad sphere = new Quad("waterQuad", 8, 8);
GLSLShaderObjectsState so = display.getRenderer()
.createGLSLShaderObjectsState();
// Check is GLSL is supported on current hardware.
if (!so.isSupported())
{
quit();
}
TextureState ts = display.getRenderer().createTextureState();
ts.setEnabled(true);
base_tex = TextureManager.loadTexture(
GLSLTest.class.getClassLoader().getResource(//uvfauteuil_Circle.tga
"com/jmex/effects/glsl/data/testsss.jpg"),Texture.MinificationFilter.Trilinear,
Texture.MagnificationFilter.Bilinear);
base_tex.setEnvironmentalMapMode(Texture.EnvironmentalMapMode.ObjectLinear);
base_tex.setWrap(Texture.WrapMode.Repeat);
Normal = TextureManager.loadTexture(
GLSLTest.class.getClassLoader().getResource(//uvfauteuil_Circle.tga
"com/jmex/effects/glsl/data/testsssnm.jpg"),Texture.MinificationFilter.Trilinear,
Texture.MagnificationFilter.Bilinear);
Normal.setEnvironmentalMapMode(Texture.EnvironmentalMapMode.ObjectLinear);
Normal.setWrap(Texture.WrapMode.Repeat);
Base_Height = TextureManager.loadTexture(
GLSLTest.class.getClassLoader().getResource(//uvfauteuil_Circle.tga
"com/jmex/effects/glsl/data/testssslm.jpg"),Texture.MinificationFilter.Trilinear,
Texture.MagnificationFilter.Bilinear);
Base_Height.setEnvironmentalMapMode(Texture.EnvironmentalMapMode.ObjectLinear);
Base_Height.setWrap(Texture.WrapMode.Repeat);
ts.setTexture(base_tex,0);
ts.setTexture(Normal,1);
ts.setTexture(Base_Height,2);
sphere.setRenderState(ts);
so.load(GLSLTest.class.getClassLoader().getResource("com/jmex/effects/glsl/data/sss.vert"),
GLSLTest.class.getClassLoader().getResource("com/jmex/effects/glsl/data/sss.frag"));
so.setUniform("LightPosition", LightPosition);
so.setUniform("MaterialThickness",MaterialThickness);
so.setUniform("ExtinctionCoefficient", ExtinctionCoefficient);
so.setUniform("LightColor", LightColor);
so.setUniform("BaseColor", BaseColor);
so.setUniform("SpecColor", SpecColor);
so.setUniform("SpecPower", SpecPower);
so.setUniform("RimScalar", RimScalar);
so.setUniform("base_tex", 0);
so.setUniform("Normal", 1);
so.setUniform("Base_Height", 2);
so.setUniform("u_invRad",u_invRad);
so.setUniform("cBumpSize",cBumpSize);
so.setEnabled(true);
sphere.updateRenderState();
sphere.updateGeometricState(0, true);
sphere.setRenderState(so);
sphere.updateRenderState();
return sphere;
}
protected void simpleUpdate() {
if (tpf < 1) {
angle = angle + (tpf * 25);
if (angle > 360) {
angle = 0;
}
}
rotQuat.fromAngleNormalAxis(angle * FastMath.DEG_TO_RAD, axis);
furryNode.setLocalRotation(rotQuat);
}
public static void main(String []args)
{
GLSLTest app = new GLSLTest();
// app.setDialogBehaviour(ALWAYS_SHOW_PROPS_DIALOG);
app.start();
}
}
what the problem ?
in Shaderdesigner :

in jme
