[WIP] BasicShadow Thingy! Added test app for visually adjusting settings

@jmaasing said:
I gave it a spin but on my Linux + GeForce GT520 I get



I'm totally lost when it comes to shaders so I don't even know how to start fixing this :)

Try setting language to GLSL120 in the Material Definition files. If this is the problem, I'll update the posted code.

It looks like this in the mat defs:
[java]Technique {
VertexShader GLSL100: Shaders/BasicShadowPost.vert
FragmentShader GLSL100: Shaders/BasicShadowPost.frag[/java]

Switch it to:
[java]Technique {
VertexShader GLSL120: Shaders/BasicShadowPost.vert
FragmentShader GLSL120: Shaders/BasicShadowPost.frag[/java]

This should fix the issue (I think)

I’ll also look at what I’m doing that requires GLSL120… It shouldn’t need GLSL120

Yeah, without knowing I guess it might be something like that so I already tried like you said. This is the result:



GLSL110

com.jme3.renderer.RendererException: Shader link failure, shader:Shader[numSources=2, numUniforms=2, shaderSources=[ShaderSource[name=Shaders/BasicShadowPre.vert, defines, type=Vertex, language=GLSL110], ShaderSource[name=Shaders/BasicShadowPre.frag, defines, type=Fragment, language=GLSL110]]] info:Vertex info
0(7) : error C5052: gl_FragColor is not accessible in this profile



GLSL120
com.jme3.renderer.RendererException: Shader link failure, shader:Shader[numSources=2, numUniforms=2, shaderSources=[ShaderSource[name=Shaders/BasicShadowPre.vert, defines, type=Vertex, language=GLSL120], ShaderSource[name=Shaders/BasicShadowPre.frag, defines, type=Fragment, language=GLSL120]]] info:Vertex info
0(7) : error C5052: gl_FragColor is not accessible in this profile


GLSL140
com.jme3.renderer.RendererException: Shader link failure, shader:Shader[numSources=2, numUniforms=2, shaderSources=[ShaderSource[name=Shaders/BasicShadowPre.vert, defines, type=Vertex, language=GLSL140], ShaderSource[name=Shaders/BasicShadowPre.frag, defines, type=Fragment, language=GLSL140]]] info:Vertex info
0(2) : warning C7555: 'varying' is deprecated, use 'in/out' instead
0(7) : warning C7533: global variable gl_FragColor is deprecated after version 120
0(7) : error C5052: gl_FragColor is not accessible in this profile


On a related note, at one time I forgot to remove the pssm processor like this:
[java] ...setting up pssm
viewPort.addProcessor(pssmShadowRenderer);

// heh... BS... assetManager, textureSize, shadowStrength, noiseBias, edgeSize
BasicShadow bs = new BasicShadow(assetManager, 1024, 0.25f, 0.0025f, 7.0f);
bs.setDirection(this.lightDirection);
viewPort.addProcessor(bs);
[/java]

it's obviously isn't going to look that hot with two shadow processors but with that I didn't get any shader link errors. Wonder what that is about :)

btw off-topic loving the fog filter, it suits my needs perfectly :)
1 Like

@jmaasing

Sorry… got tied up with work. Here is the reason. In the mat def for BasicShadowPre.j3md, remove



[java]RenderState {

FaceCull Front

DepthTest On

DepthWrite On

PolyOffset 0 0

ColorWrite Off <<< THIS!!!

}[/java]

@t0neg0d said:
@jmaasing
Sorry... got tied up with work. Here is the reason. In the mat def for BasicShadowPre.j3md, remove

[java]RenderState {
FaceCull Front
DepthTest On
DepthWrite On
PolyOffset 0 0
ColorWrite Off &lt;&lt;&lt; THIS!!!
}[/java]

No that's not it (at least not the main problem), the solution was that it really helps if you put the fragment shader in the .frag file and the vertex shader in the .vert file :) Sorry to bother you with my stupidity
@jmaasing said:
No that's not it (at least not the main problem), the solution was that it really helps if you put the fragment shader in the .frag file and the vertex shader in the .vert file :) Sorry to bother you with my stupidity


This is SOOOO something I would do!
@t0neg0d said:
@jmaasing
Sorry... got tied up with work. Here is the reason. In the mat def for BasicShadowPre.j3md, remove

[java]RenderState {
FaceCull Front
DepthTest On
DepthWrite On
PolyOffset 0 0
ColorWrite Off &lt;&lt;&lt; THIS!!!
}[/java]

uh....don't do this really...
This is to avoid to completely render the objects and just render depth (needed for the shadow maps).
Removing this line just make it slower and you have a complete render wasted....