Batchnode is broken

Hey, currently the Batchnode seem to be broken
any of the provded examples just crash with Scenegraph it not properly updated.

It seesm that refreshFlags=8 → RF_CHILD_LIGHTLIST

I did not manage to track down the reason for this however.

erf got it too.
@Momoko_Fan probably the scene graph optimization that went wrong.

fixed

@nehon
Still kinda open,sorry :confused:

Enable assertions run TestBatchNodeCluster

java.lang.AssertionError
	at com.jme3.scene.Node.updateWorldBound(Node.java:152)
	at com.jme3.scene.Node.updateGeometricState(Node.java:266)
	at com.jme3.scene.Node.updateGeometricState(Node.java:261)
	at com.jme3.app.SimpleApplication.update(SimpleApplication.java:252)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:152)
	at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:192)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:231)
	at java.lang.Thread.run(Thread.java:745)

Ha…
@Momoko_Fan i guess we have the answer to this question
Fixed issue when BatchNode's light list flag was not cleared · jMonkeyEngine/jmonkeyengine@1616b08 · GitHub

That said…the assertion is kind of dumb here…
It assumes that at this point the update is done, but it might not (this is the typical case where it’s not).
And anyway, you’ll have a crash later if it’s not updated properly…
So IMO we could just remove the assertion…

No, don’t remove the assertion. Why is it not finished there? Why does it have RF_CHILDLIST still set after updateGeometricState()? That’s an error.

The proble is with RF_BOUND not RF_CHILDLIST.
We do because the bound of the batches are updated later.
Actually I could invert the call to super.updateGeometricState() and the batch update bound.

Mhhh…I don’t have the assertion fail…

I just tested again, I can reproduce it with a completly new checkout.

I have only a few small modification in the gradle files, to upload to my artifactory and create eclipse project files. But no change to any source code at all.

Mar 06, 2015 8:11:03 AM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.1.0 (snapshot-github)
 * Branch: master
 * Git Hash: 8818c01
 * Build Date: 2015-03-06
Mar 06, 2015 8:11:04 AM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFO: LWJGL 2.9.3 context running on thread LWJGL Renderer Thread
 * Graphics Adapter: null
 * Driver Version: null
 * Scaling Factor: 1
Mar 06, 2015 8:11:04 AM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFO: OpenGL Renderer Information
 * Vendor: X.Org
 * Renderer: Gallium 0.4 on AMD PITCAIRN
 * OpenGL Version: 3.0 Mesa 10.4.5
 * GLSL Version: 1.30
Mar 06, 2015 8:11:04 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio Device: OpenAL Soft
Mar 06, 2015 8:11:04 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio Vendor: OpenAL Community
Mar 06, 2015 8:11:04 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio Renderer: OpenAL Soft
Mar 06, 2015 8:11:04 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio Version: 1.1 ALSOFT 1.15.1
Mar 06, 2015 8:11:04 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: ALC extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context ALC_SOFT_loopback
Mar 06, 2015 8:11:04 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: AL extensions: AL_EXT_ALAW AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_LOKI_quadriphonic AL_SOFT_buffer_samples AL_SOFT_buffer_sub_data AL_SOFTX_deferred_updates AL_SOFT_direct_channels AL_SOFT_loop_points AL_SOFT_source_latency
Mar 06, 2015 8:11:04 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: AudioRenderer supports 64 channels
Mar 06, 2015 8:11:04 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
WARNING: Pausing audio device not supported.
Mar 06, 2015 8:11:04 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio effect extension version: 1.0
Mar 06, 2015 8:11:04 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFO: Audio max auxilary sends: 4
Mar 06, 2015 8:11:04 AM com.jme3.app.Application handleError
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.AssertionError
	at com.jme3.scene.Node.updateWorldBound(Node.java:152)
	at com.jme3.scene.Node.updateGeometricState(Node.java:266)
	at com.jme3.scene.Node.updateGeometricState(Node.java:261)
	at com.jme3.app.SimpleApplication.update(SimpleApplication.java:252)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:152)
	at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:192)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:231)
	at java.lang.Thread.run(Thread.java:745)

do you get it as soon as it starts?

Yes, directly before any frame manages to render.
If i disable assertions, everything behaves as expected btw.

@nehon I made a PR to enable assertion when you run Examples,… from command line and from netbeans.
When it’ll be merged, you should to have the AssertionError (I have it).

PS: to disable javadoc, add into $HOME/.gradle/gradle.properties

buildJavaDoc = false

well…i don’t get it, when I run the example, i have a comment in the log that assertion is enabled…idk why it would be different…

Well I just made a video showing the problem in its full glory.

Around the first 6 minutes are just downloading and building it, so you can verify how i did that, and try to reproduce.

@nehon bump XD :smile:
Do you get the error if you replicate what i did in the video?

Sorry I wasn’t around yesterday, and won’t have time today neither. i’ll look into it maybe this evening or tomorrow

OK so now I have the assertion.
If I invert the code, I got another assertion for world light list.
I guess there is no way around reimplementing the method.

1 Like

I found the issue.
It was an unneeded call to updateGeometricState when batching.

1 Like

Nice thank you :slight_smile: