Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Xith regression #4  (Read 3752 times)
0 Members and 1 Guest are viewing this topic.
Offline hawkwind

Junior Member




Java games rock!


« Posted 2006-11-08 02:42:56 »

In this case I am trying to remove a light from the scenegraph, surprisingly this ends up as an addLight down the stack trace causing me to use more lights than I should.

==>remove from bg org.xith3d.scenegraph.PointLight@188655e
Exception in thread "Thread-10" java.lang.ArrayIndexOutOfBoundsException: 8
   at org.xith3d.render.shader.LightingShader.addLight(LightingShader.java:90)
   at org.xith3d.render.prerender.AtomsCollector.collectGroupAtoms(AtomsCollector.java:258)
   at org.xith3d.render.prerender.AtomsCollector.collectNodeAtoms(AtomsCollector.java:402)
   at org.xith3d.render.prerender.AtomsCollector.collectAtoms(AtomsCollector.java:451)
   at org.xith3d.render.ScenegraphModificationsManager.onChildRemovedFromGroup(ScenegraphModificationsManager.java:259)
   at org.xith3d.scenegraph.GroupNode.removeChild(GroupNode.java:246)
   at hawk.manager.LightManager.enableSet(LightManager.java:344)
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #1 - Posted 2006-11-08 12:55:48 »

In this case I am trying to remove a light from the scenegraph, surprisingly this ends up as an addLight down the stack trace causing me to use more lights than I should.

==>remove from bg org.xith3d.scenegraph.PointLight@188655e
Exception in thread "Thread-10" java.lang.ArrayIndexOutOfBoundsException: 8
   at org.xith3d.render.shader.LightingShader.addLight(LightingShader.java:90)
   at org.xith3d.render.prerender.AtomsCollector.collectGroupAtoms(AtomsCollector.java:258)
   at org.xith3d.render.prerender.AtomsCollector.collectNodeAtoms(AtomsCollector.java:402)
   at org.xith3d.render.prerender.AtomsCollector.collectAtoms(AtomsCollector.java:451)
   at org.xith3d.render.ScenegraphModificationsManager.onChildRemovedFromGroup(ScenegraphModificationsManager.java:259)
   at org.xith3d.scenegraph.GroupNode.removeChild(GroupNode.java:246)
   at hawk.manager.LightManager.enableSet(LightManager.java:344)

Well, every time you add or remove a Light, something called "shaderstate" needs to be rebuilt for all affected Groups and Shapes. This means to readd all remaining Lights to the newly created shaderstates.
I'll check the ArrayIndexOutOfBoundsException.

Marvin
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #2 - Posted 2006-11-08 16:52:20 »

Well, every time you add or remove a Light, something called "shaderstate" needs to be rebuilt for all affected Groups and Shapes. This means to readd all remaining Lights to the newly created shaderstates.
I'll check the ArrayIndexOutOfBoundsException.
Is that optimizable ?

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline hawkwind

Junior Member




Java games rock!


« Reply #3 - Posted 2006-11-08 17:03:27 »

The trouble is I have many lights but only 8 or less enabled at a time.  The current processing is enabling more lights than Xith/Opengl support simultaneously.  There is no reason why I cannot have 200 lights in a scenegraph if 8 or less are enabled
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #4 - Posted 2006-11-08 17:31:35 »

Yeah I don't know how it should be handled, when more than eight light are enabled at the same time... maybe throw a self-explanative exception ?

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline hawkwind

Junior Member




Java games rock!


« Reply #5 - Posted 2006-11-08 18:05:59 »

I think it is more that the internals are enabling lights that I am not...if a light is not enabled then it shouldn't BE enabled internally
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #6 - Posted 2006-11-08 19:49:52 »

Well, every time you add or remove a Light, something called "shaderstate" needs to be rebuilt for all affected Groups and Shapes. This means to readd all remaining Lights to the newly created shaderstates.
I'll check the ArrayIndexOutOfBoundsException.
Is that optimizable ?

Certainly. But not too easily. It certainly is a lower priorized task, isn't it?

The trouble is I have many lights but only 8 or less enabled at a time.  The current processing is enabling more lights than Xith/Opengl support simultaneously.  There is no reason why I cannot have 200 lights in a scenegraph if 8 or less are enabled

I guess you're talking about added/removed Lights. But you should maybe consider enabling/disabling them. Then the shaderstates don't need to be rebuilt.

Yeah I don't know how it should be handled, when more than eight light are enabled at the same time... maybe throw a self-explanative exception ?

Indeed.

Marvin
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #7 - Posted 2006-11-09 02:58:09 »

In this case I am trying to remove a light from the scenegraph, surprisingly this ends up as an addLight down the stack trace causing me to use more lights than I should.

==>remove from bg org.xith3d.scenegraph.PointLight@188655e
Exception in thread "Thread-10" java.lang.ArrayIndexOutOfBoundsException: 8
   at org.xith3d.render.shader.LightingShader.addLight(LightingShader.java:90)
   at org.xith3d.render.prerender.AtomsCollector.collectGroupAtoms(AtomsCollector.java:258)
   at org.xith3d.render.prerender.AtomsCollector.collectNodeAtoms(AtomsCollector.java:402)
   at org.xith3d.render.prerender.AtomsCollector.collectAtoms(AtomsCollector.java:451)
   at org.xith3d.render.ScenegraphModificationsManager.onChildRemovedFromGroup(ScenegraphModificationsManager.java:259)
   at org.xith3d.scenegraph.GroupNode.removeChild(GroupNode.java:246)
   at hawk.manager.LightManager.enableSet(LightManager.java:344)

Fixed Smiley.

Marvin
Offline Amos Wenger

Senior Member




Everything's possible, but not everything's fun...


« Reply #8 - Posted 2006-11-09 18:45:14 »

Well, every time you add or remove a Light, something called "shaderstate" needs to be rebuilt for all affected Groups and Shapes. This means to readd all remaining Lights to the newly created shaderstates.
I'll check the ArrayIndexOutOfBoundsException.
Is that optimizable ?

Certainly. But not too easily. It certainly is a lower priorized task, isn't it?

The trouble is I have many lights but only 8 or less enabled at a time.  The current processing is enabling more lights than Xith/Opengl support simultaneously.  There is no reason why I cannot have 200 lights in a scenegraph if 8 or less are enabled

I guess you're talking about added/removed Lights. But you should maybe consider enabling/disabling them. Then the shaderstates don't need to be rebuilt.
OK so that's really not a big performance problem, just adds all your lights at the beginning of the scene and enable/disable them... maybe a transparent pool of lights could be used ?

"Once you start working on something, don't be afraid of failure and don't abandon it. People who work sincerely are the happiest"
Offline hawkwind

Junior Member




Java games rock!


« Reply #9 - Posted 2006-11-21 01:13:50 »

Its back.....When using latest SVN pull as of last night

Exception in thread "Thread-10" java.lang.ArrayIndexOutOfBoundsException: 8
   at org.xith3d.render.shader.LightingShader.addLight(LightingShader.java:96)
   at org.xith3d.render.prerender.AtomsCollector.collectGroupAtoms(AtomsCollector.java:248)
   at org.xith3d.render.prerender.AtomsCollector.collectNodeAtoms(AtomsCollector.java:398)
   at org.xith3d.render.prerender.AtomsCollector.collectAtoms(AtomsCollector.java:447)
   at org.xith3d.render.ScenegraphModificationsManager.onChildRemovedFromGroup(ScenegraphModificationsManager.java:244)
   at org.xith3d.scenegraph.GroupNode.removeChild(GroupNode.java:260)
   at hawk.manager.LightManager.enableSet(LightManager.java:344)
   at hawk.jcd.Xith3DFrame.runx(Xith3DFrame.java:746)
   at hawk.jcd.Xith3DFrame.loopIteration(Xith3DFrame.java:616)
   at org.xith3d.render.loop.RenderLoop.run(RenderLoop.java:882)
   at java.lang.Thread.run(Unknown Source)
   

Just to set my situation....I have N rooms, each with one or more lights,  potentialy giving 30-50 lights, less than 8 of which are in the scenegraph at any time..  Based on user interaction I add or remove  lights from the scenegraph.   In the stack trace above I am removing a light from the scene, from within the RenderLoop.  I cannot imagine why the light I am removing is being added...any thoughts appreciated
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #10 - Posted 2006-11-21 01:34:27 »

Its back.....When using latest SVN pull as of last night

God dammed... Smiley

...I cannot imagine why the light I am removing is being added...any thoughts appreciated

As I said before, when a Light or Fog is removed, the shader state needs to be rebuilt. This is done by readding the Lights and Fogs. This is why Lights are added, when a Light actually is removed.

I've applied a fix, that should solve the problem. Please do revert, if it doesn't.

Marvin
Offline hawkwind

Junior Member




Java games rock!


« Reply #11 - Posted 2006-11-21 01:38:49 »

I looked briefly at the atom stuff and the test for lighting is checking for renderable not enabled.  This is the stuff that always confuses me...is a not-enabled light renderable???  Seems like no to me but there are two separate states that describe whether a light is visible or not....YUCK!!  I will try and set light as not-renederable when i set them not enabled.
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #12 - Posted 2006-11-21 01:51:12 »

I looked briefly at the atom stuff and the test for lighting is checking for renderable not enabled.  This is the stuff that always confuses me...is a not-enabled light renderable???  Seems like no to me but there are two separate states that describe whether a light is visible or not....YUCK!!  I will try and set light as not-renederable when i set them not enabled.

This won't do the trick! I've added a comment to AtomsCollector and committed. I'll quote it here:
Quote
* check here for isRenderable(), since ScenegraphModificationManager sets
* a Light or Fog temporarily to non renderable before the atoms are recollected.
* This is done, because the Atoms must be recollected before the Light or Fog
* is actually removed from the scenegraph, to enable the collector to remove the
* atom.

And a not-enabled Light is still renderable.

I hope this answers your question.

Marvin
Offline hawkwind

Junior Member




Java games rock!


« Reply #13 - Posted 2006-11-21 22:43:20 »

Yee Heee found it.!!!!

..at least for my situation.  The code is adding my lights multiple times to the array that throws the exception.  Since I don't have dev rights could someone mod the code to determine if a Light is already in the array before attempting to add it and up the Light count.


  at org.xith3d.render.shader.LightingShader.addLight(LightingShader.java:96)
   at org.xith3d.render.prerender.AtomsCollector.collectGroupAtoms(AtomsCollector.java:248)
   at org.xith3d.render.prerender.AtomsCollector.collectNodeAtoms(AtomsCollector.java:398)
   at org.xith3d.render.prerender.AtomsCollector.collectAtoms(AtomsCollector.java:447)
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #14 - Posted 2006-11-21 22:46:29 »

Yee Heee found it.!!!!

..at least for my situation.  The code is adding my lights multiple times to the array that throws the exception.  Since I don't have dev rights could someone mod the code to determine if a Light is already in the array before attempting to add it and up the Light count.


  at org.xith3d.render.shader.LightingShader.addLight(LightingShader.java:96)
   at org.xith3d.render.prerender.AtomsCollector.collectGroupAtoms(AtomsCollector.java:248)
   at org.xith3d.render.prerender.AtomsCollector.collectNodeAtoms(AtomsCollector.java:398)
   at org.xith3d.render.prerender.AtomsCollector.collectAtoms(AtomsCollector.java:447)

Well, that was exactly, what I fixed yesterday Huh Don't know, if you checked out after I posted it here.

Marvin
Offline hawkwind

Junior Member




Java games rock!


« Reply #15 - Posted 2006-11-21 23:53:44 »

cool Tongue
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (25 views)
2014-07-29 18:09:19

Riven (15 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (33 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (43 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!