Hi, @ficik ! Sorry for long reply. I was busy with some shaders writing:
http://hub.jmonkeyengine.org/groups/graphics/forum/topic/glsl-glass-shader-advice-is-needed/
http://hub.jmonkeyengine.org/groups/graphics/forum/topic/glsl-matcap-shader-advice-needed/
Also, I have put @theucher 's dissolve shader to the library.
Now, I’m ready to put your shader to my repository. But firstly, I have to make a usage example. So, I will try to make a simple example scene.
@ficik , I have added your shader to the shader library! Thanks to you again! It works perfectly.
http://code.google.com/p/jme-glsl-shaders/
There are 7 cool shaders in the repository. I think about JNP plugin and put it into the JMP-Contributions. I hope it will be helpful for other people.
Oh my f*** god. Nerdgasm!
Nice work, ficik…
@ficik said:
I just wrote my very first shader.. uff. It's force field which can display up to 8 hits.
demo:
I tried your shader but i get this error
i am not that familiar with shaders, so can you tell me where to get an update
i use tha latest version(07)
Fragment info
0(33) : warning C7011: implicit cast from "int" to "float"
0(27) : error C6013: Only arrays of texcoords may be indexed in this profile, and only with a loop index variable
thx
Somewhere in the shader you have to replace a “0” with “0.0” or a “1” with “1.0”. Guess the author had a nvidia card, their driver compiles anything ^^
You have loops with non-const number of iterations. GLSL 1.0 implementations don’t like that.
@mifth said:
@rompelstilchen , can you paste entire log (with lines of shader code). I'll try to fix it.
hello
did you modify the code ?
sheers
@rompelstilchen no, I have been waiting for your ENTIRE LOG. There should be a very big log with shader lines.
I need more with shader lines above the log. And you should install nightly updates, as shader debugger was implemented recently.
yes i have a question about that, if you please…
i have a svn checkout of jme but i don’t know what to copy and where once i have built it
i mean i am not sure what compiled libs ands stufs need to be copied to c:ProgramFilesjme… directory(windows)
here’s the log
Fragment info
0(33) : warning C7011: implicit cast from "int" to "float"
0(27) : error C6013: Only arrays of texcoords may be indexed in this profile, and only with a loop index variable
i need much more log. Can you give me 500-700 lines of your log?
@mifth: If you’re expecting the shader dump, you won’t see it in this case because this is a linker error and not a compile error.
The issue is (as I have stated in the previous page), is that you cannot have complex control flow in a shader that claims to support GLSL 1.0.
This:
[java]uniform int m_SomeVariable;
// …
for (int i = 0; i < m_SomeVariable; i++) {
// …
}
[/java]
Is not acceptable in GLSL 1.0, m_SomeVariable is not constant and so the number of times the logic inside the loop has to execute is not known at compile time.
On the other hand replacing the uniform value with a constant, like so:
[java]const int m_SomeVariable = 123;[/java]
Is acceptable.
Another approach is to use defines to expose a constant in the shader. This way you can still set a value in the Material as before, but the value you have set becomes a compile time constant in the shader exposed through a “#define” statement at the top of the shader.
I have an exception with nightly build:
LOG:
Jun 20, 2012 8:37:34 PM com.jme3.renderer.lwjgl.LwjglRenderer initialize
INFO: Caps: [FrameBuffer, FrameBufferMRT, FrameBufferMultisample, TextureMultisample, OpenGL20, OpenGL21, OpenGL30, OpenGL31, OpenGL32, ARBprogram, GLSL100, GLSL110, GLSL120, GLSL130, GLSL140, GLSL150, VertexTextureFetch, TextureArray, TextureBuffer, FloatTexture, FloatColorBuffer, FloatDepthBuffer, PackedFloatTexture, SharedExponentTexture, PackedFloatColorBuffer, TextureCompressionLATC, NonPowerOfTwoTextures, MeshInstancing, VertexBufferArray, PackedDepthStencilBuffer]
Jun 20, 2012 8:37:34 PM com.jme3.asset.DesktopAssetManager
INFO: DesktopAssetManager created.
Jun 20, 2012 8:37:34 PM com.jme3.renderer.Camera
INFO: Camera created (W: 640, H: 480)
Jun 20, 2012 8:37:34 PM com.jme3.renderer.Camera
INFO: Camera created (W: 640, H: 480)
Jun 20, 2012 8:37:34 PM com.jme3.input.lwjgl.LwjglMouseInput initialize
INFO: Mouse created.
Jun 20, 2012 8:37:34 PM com.jme3.input.lwjgl.LwjglKeyInput initialize
INFO: Keyboard created.
Jun 20, 2012 8:37:34 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
INFO: AudioRenderer supports 64 channels
Jun 20, 2012 8:37:34 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
INFO: Audio effect extension version: 1.0
Jun 20, 2012 8:37:34 PM com.jme3.audio.lwjgl.LwjglAudioRenderer initInThread
INFO: Audio max auxilary sends: 4
Jun 20, 2012 8:37:34 PM com.jme3.material.MaterialDef
INFO: Loaded material definition: Unshaded
Jun 20, 2012 8:37:35 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (null)
Jun 20, 2012 8:37:35 PM com.jme3.scene.Node detachAllChildren
INFO: Gui Node (Node): All children removed.
Jun 20, 2012 8:37:35 PM com.jme3.scene.Node attachChild
INFO: Child (BitmapFont) attached to this node (null)
Jun 20, 2012 8:37:35 PM com.jme3.scene.Node attachChild
INFO: Child (null) attached to this node (Gui Node)
Jun 20, 2012 8:37:35 PM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.IllegalArgumentException: Material parameter is not defined: m_Color
at com.jme3.material.Material.checkSetParam(Material.java:442)
at com.jme3.material.Material.setParam(Material.java:458)
at com.jme3.material.Material.setColor(Material.java:615)
at ForceShield.Shield.simpleInitApp(Shield.java:41)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:225)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:129)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:205)
at java.lang.Thread.run(Thread.java:662)
Jun 20, 2012 8:37:35 PM com.jme3.renderer.lwjgl.LwjglRenderer cleanup
INFO: Deleting objects and invalidating state
Jun 20, 2012 8:37:35 PM com.jme3.input.lwjgl.LwjglMouseInput destroy
INFO: Mouse destroyed.
Jun 20, 2012 8:37:35 PM com.jme3.input.lwjgl.LwjglKeyInput destroy
INFO: Keyboard destroyed.
Jun 20, 2012 8:37:35 PM com.jme3.system.lwjgl.LwjglAbstractDisplay deinitInThread
INFO: Display destroyed.
BUILD SUCCESSFUL (total time: 22 seconds)
LINE: at ForceShield.Shield.simpleInitApp(Shield.java:41)
[java]
mat1.setColor("m_Color", ColorRGBA.randomColor());
[/java]
@mifth said:
I have an exception with nightly build:
java.lang.IllegalArgumentException: Material parameter is not defined: m_Color
LINE: at ForceShield.Shield.simpleInitApp(Shield.java:41)
[java]
mat1.setColor("m_Color", ColorRGBA.randomColor());
[/java]
Use "Color", not "m_Color"
This looks really good!
Cant wait to add it to my game
Would be really cool because it would protect against astroids and radiation and onces the shield runs out of energy
then red stuff starts to flash and beep and the controls will no longer react…
Man, this is a really great thing you’ve made! Good job!
@mifth @Addez
i think a good idea, would be to mix this effect with a noise texture
only my opinion…
can’t wait to add it too
@Addez , @rompelstilchen sorry for VERY VERY VERY long delay. I fixed the shader!
Just grab fragment and vertex shaders here:
http://code.google.com/p/jmonkeyplatform-contributions/source/detail?r=476