Problem with Particle-Material

Hi,



I updated my local Version of jME3 today and now I get an error with the Particle-Material:



http://marblemania.net/particleError.txt

I hope this works now. I couldn’t find a Site that could display the Error-Message, so I uploaded it to my own Server.





I create the Particles like this:

[java]

ParticleEmitter emit = new ParticleEmitter(texture+“Trail”, Type.Triangle, 50);

emit.setGravity(0);

emit.setVariation(1);

emit.setLowLife(1);

emit.setHighLife(1);

emit.setStartVel(new Vector3f(0, .5f, 0));

emit.setImagesX(15);

emit.setStartSize(2f);

Material mat = new Material(Game.getGame().getAssetManager(), “Common/MatDefs/Misc/Particle.j3md”);

mat.setTexture(“m_Texture”, Game.getGame().getAssetManager().loadTexture(texture));

emit.setMaterial(mat);

[/java]

(texture is just a string with a filename)



The weird thing is, that the Test-classes from jME3 are working, but mine doesn’t, although it’s almost the same.

And here a couple of Screenshots.

What it’s supposed to look like:





and what it looks like now:







Am I doing something wrong or is there something wrong with jME3?

Unfortunately I can’t open the particleError.txt file, all I see is this:

㜲ㄮ⸰〲〱㈠㨳ㄳ㌺‴潣⹭浪㍥爮湥敤敲⹲睬杪⹬睌杪剬湥敤敲⁲灵慤整桓

Is it supposed to be a text file or what?



So from what I get in the screenshots, the particle size essentially doubled?

27.10.2010 23:31:34 com.jme3.renderer.lwjgl.LwjglRenderer updateShaderSourceData

WARNUNG: Common/MatDefs/Misc/Particle.frag compile error: ERROR: 0:4: ‘’ : #version must occur before any other statement in the program



27.10.2010 23:31:34 com.jme3.renderer.lwjgl.LwjglRenderer updateShaderSourceData

WARNUNG: #define USE_TEXTURE 1

// TODO: Fix this so normal particles don’t need it.

// Only needed for certain GPUs.

#version 120



#ifdef USE_TEXTURE

uniform sampler2D m_Texture;

varying vec4 texCoord;

#endif



varying vec4 color;



void main(){

if (color.a <= 0.01)

discard;



#ifdef USE_TEXTURE

#ifdef POINT_SPRITE

vec2 uv = mix(texCoord.xy, texCoord.zw, gl_PointCoord.xy);

#else

vec2 uv = texCoord.xy;

#endif

gl_FragColor = texture2D(m_Texture, uv) * color;

#else

gl_FragColor = color;

#endif

}





27.10.2010 23:31:34 com.jme3.renderer.lwjgl.LwjglRenderer updateUniformLocation

WARNUNG: Uniform m_VertexColor is not declared in shader.

How hard can it be to send a simple Text?:smiley:

Anyways, I made a Screenshot of the Error-Message:

ld-host.de



Yep, it kinda doubled and the Flames don’t have a color anymore. They are just white.



I just realised that you can’t open the Big version of the Pictures above, so here are the two Links:

ld-host.de

ld-host.de





EDIT:

@norman: I don’t get it. If I copy the Error-Message from your post it works, but if I copy my error-message it doesn’t. I tried different Encodings etc, but it still won’t work.

I removed one “empty” line. Apparently it contained some special characters, dont know :slight_smile:

Intresting :smiley:



I just did another update of my jME3 and now the test-classes also don’t work anymore.

It crashes with the same Error-Message + this Exception:



[java]SCHWERWIEGEND: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]

java.lang.IllegalStateException: Cannot render mesh without shader bound

at com.jme3.renderer.lwjgl.LwjglRenderer.setVertexAttrib(LwjglRenderer.java:1808)

at com.jme3.renderer.lwjgl.LwjglRenderer.setVertexAttrib(LwjglRenderer.java:1813)

at com.jme3.renderer.lwjgl.LwjglRenderer.renderMeshDefault(LwjglRenderer.java:2012)

at com.jme3.renderer.lwjgl.LwjglRenderer.renderMesh(LwjglRenderer.java:2042)

at com.jme3.material.Material.render(Material.java:676)

at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:390)

at com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:132)

at com.jme3.renderer.queue.RenderQueue.renderQueue(RenderQueue.java:185)

at com.jme3.renderer.RenderManager.renderViewPortQueues(RenderManager.java:543)

at com.jme3.renderer.RenderManager.flushQueue(RenderManager.java:505)

at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:667)

at com.jme3.renderer.RenderManager.render(RenderManager.java:687)

at com.jme3.app.SimpleApplication.update(SimpleApplication.java:216)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:144)

at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:133)

at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:198)

at java.lang.Thread.run(Thread.java:680)[/java]

@Momoko_fan I already noticed this issue, defines are injected to the shader (omg!) at the beginning of the file. So if we use defines and a shader with a version statement it fails because the version statement must be the first thing in the shader.

maybe we should check for this particular statement before wrting the defines to the shader.

I think we should not specify the #version statement in the shader, we specify it in the material like “VertexShader GLSL120 : …” then it can be appended on top of the defines instead of below.

Ok I added an issue (issue 232) in the tracker about that and I removed the #version120 in the particle shader



@Creativ could you test, if it works please?

Works again :slight_smile:

Thanks for the quick Fix.