Yuri Vl. Gushchin
Senior Member   
Speak Java!
|
 |
«
Posted
2003-12-07 11:26:27 » |
|
Background Color support just committed to CVS HEAD.
Background color now rendering with no extra performance cost by changing canvas clear color before clearing frame buffer.
Additional atom (BackgroundColorAtom) added, additional rendering setup pass introduced (no performance impact if no background color set, no background existing or packground color set to null).
Appropriate examples added as Xith3DBackgroundColorTest.java and Xith3DBackgroundColorTest.bat.
Yuri
|
Yuri Vl. Gushchin JProof Group
|
|
|
Java Cool Dude
|
 |
«
Reply #1 - Posted
2003-12-07 14:42:18 » |
|
Two thumbs up 
|
|
|
|
|
Java Cool Dude
|
 |
«
Reply #2 - Posted
2003-12-07 16:18:14 » |
|
Hey man just checked the xith3d.jar file in the cvs and it dates all the way back to 10/11/03. The size is also 484k whereas the nightly build commited by William weighs no less than 650k 
|
|
|
|
|
Games published by our own members! Check 'em out!
|
|
abies
|
 |
«
Reply #3 - Posted
2003-12-07 16:24:39 » |
|
I would suggest deleting xith3d.jar from cvs. Support libraries - ok, but main library should be not included inside CVS IMHO.
|
Artur Biesiadowski
|
|
|
Jens
|
 |
«
Reply #4 - Posted
2003-12-07 16:25:04 » |
|
You have to run the ant build script to update xith3d.jar.
|
|
|
|
Java Cool Dude
|
 |
«
Reply #5 - Posted
2003-12-07 16:36:02 » |
|
NVM built it all up using netbeans build all command  Works like a charm now.
|
|
|
|
|
Java Cool Dude
|
 |
«
Reply #6 - Posted
2003-12-07 17:05:52 » |
|
Me again, I managed to compile the source using the provided ant build, but when I try to run some of my demos, it takes about 2-3 seconds before a null pointer exception surfaces: 1 2 3 4 5 6 7 8 9 10
| java.lang.NullPointerException at com.xith3d.render.RenderBin.addAtom(RenderBin.java:87) at com.xith3d.render.Renderer.addRenderSetupAtom(Renderer.java:167) at com.xith3d.scenegraph.View.renderNode(View.java:902) at com.xith3d.scenegraph.View.renderNode(View.java:1015) at com.xith3d.scenegraph.View.getRenderFrame(View.java:824) at com.xith3d.scenegraph.View.renderOnce(View.java:717) at com.xith3d.scenegraph.View.renderOnce(View.java:655) at Xith3DParticles.ParticlesTest.run(ParticlesTest.java:353) at java.lang.Thread.run(Thread.java:534) |
Also enabling background color gives the performance a firm kick in the nuts (we're talking about 20-30% performance loss on a 2.1 Ghz Athlon, Radeon 9500 Pro machine). Oh well 
|
|
|
|
|
William Denniss
|
 |
«
Reply #7 - Posted
2003-12-07 21:15:40 » |
|
I would suggest deleting xith3d.jar from cvs. Support libraries - ok, but main library should be not included inside CVS IMHO. 100% agree with you there  Since we're on the topic I think that the reference/xith_utilities.zip isn't needed anymore since it's now in the main trunk. Same goes for third-party/xith_utilities.jar. Would anyone object to the removal of those three files from CVS? Will.
|
|
|
|
Java Cool Dude
|
 |
«
Reply #8 - Posted
2003-12-08 00:27:33 » |
|
Fixed my null exception by modifying the RenderBin. 1 2 3 4 5 6 7 8 9
| public void addAtom( RenderAtom atom ) { if (curSize == buckets.length) { RenderBucket[] newBuckets = new RenderBucket[buckets.length + EXT_SIZE]; System.arraycopy(buckets, 0, newBuckets, 0, buckets.length); buckets = newBuckets; } if(curSize<buckets.length-1) buckets[curSize++].setAtom(atom); } |
Still, now running my particles system containing 50 billboarded, alpha blend squares, shows a huge performance drop: Without BackGround color FPS ~1900FPS With BackGround color FPS ~1000FPS!!! :sad panda:
|
|
|
|
|
DavidYazel
Junior Member  
Java games rock!
|
 |
«
Reply #9 - Posted
2003-12-08 02:58:31 » |
|
Thats weird JCD, the first part of that code should obviate the need for the second part. How could curSize ever be >= to the array size if the preceeding clause increases it in just that condition?
|
David Yazel Xith3D Project Founder http://xith3d.dev.java.netIt may look complicated, but in the end it is just a bunch of triangles
|
|
|
Games published by our own members! Check 'em out!
|
|
Java Cool Dude
|
 |
«
Reply #10 - Posted
2003-12-08 03:30:59 » |
|
Thats weird JCD, the first part of that code should obviate the need for the second part. How could curSize ever be >= to the array size if the preceeding clause increases it in just that condition? No clue and yet it's the only fix that I could put together... 
|
|
|
|
|
Java Cool Dude
|
 |
«
Reply #11 - Posted
2003-12-08 05:22:16 » |
|
An example showing performance cut in half after adding a background color. 1 2 3 4 5 6
| public BranchGroup scene(){ BranchGroup scene = new BranchGroup(); Background backGround = new Background(new Color3f(0,1,0)); scene.addChild(backGround); return scene; } |
Trying commenting out the "addChild" part and get blown away by the frame rate increase...
|
|
|
|
|
Yuri Vl. Gushchin
Senior Member   
Speak Java!
|
 |
«
Reply #12 - Posted
2003-12-08 05:53:20 » |
|
Hi,
Sorry, it was a bug in Renderer.java - I forget to clear Render Setup pass bin between passes. This caused overflow of render bin after some time (3000 frames) and slowdown increasing over time.
Just committed a fix. Try now.
Fix provided by JCD replaced by one line in Renderer.java, so just use latest CVS HEAD version.
I tried JCD's test with and without Background node and got exactly the same performance [after applying fix].
Yuri
|
Yuri Vl. Gushchin JProof Group
|
|
|
|
|
Ramses
Senior Newbie 
Java games rock!
|
 |
«
Reply #14 - Posted
2003-12-18 22:13:57 » |
|
I'm trying to set the background to an image using the code below, but I'm getting the standard greyish background color instead. Am I doing something wrong? 1 2 3 4 5 6 7 8
| try { BufferedImage im = ImageUtility.readImage("gfx\\bg.png"); ImageComponent2D ic2D = new ImageComponent2D(ImageComponent.FORMAT_RGBA, 800, 600, im); Background backGround = new Background(ic2D); scene.addChild(backGround); } catch (Exception e) { e.printStackTrace();} |
|
|
|
|
|
Yuri Vl. Gushchin
Senior Member   
Speak Java!
|
 |
«
Reply #15 - Posted
2003-12-19 06:05:14 » |
|
Images are not supported as backgrounds for a moment. What you can do is to use textured rectangle/grid of rectangles instead of BG. I am trying to find good accelerated way to draw BG image [I mean the way other than textured rect].
Yuri
|
Yuri Vl. Gushchin JProof Group
|
|
|
|