Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (497)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2]
  ignore  |  Print  
  MultiPass & Rendering Order  (Read 6402 times)
0 Members and 1 Guest are viewing this topic.
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #30 - Posted 2006-09-16 15:10:13 »

I thought about porting this, but haven't analysed it's source yet.

Looks really really great. Would be fine, if we had it in xith... Wink
Offline cylab

JGO Ninja


Medals: 49



« Reply #31 - Posted 2006-09-16 15:12:36 »

Quote
Please register at xith-tk and I'll give you Developer access as soon as possible.
just registered...

Mathias - I Know What [you] Did Last Summer!
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #32 - Posted 2006-09-17 17:32:42 »

I took a quick look in the source. To configure the CanvasPeer to draw the render passes on top of each other, you have to call

1  
2  
3  
4  
// clear the buffer...
canvasPeer.setDisableClearBuffer(false);
// ...but specify, that depth-buffer clearing is not necessary
canvasPeer.setFullOverpaint(true);


The MultiPassView however only calls the first in it's prepareRenderOnce() method:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
// MultiPassView:195 ...
prepareRenderOnce(RenderPass pass, boolean forceClearBuffer, boolean forceSwapBuffers, Canvas3D canvas3D)
{
        // (...)
       if (canvas3D.get3DPeer() instanceof com.xith3d.render.jsr231.CanvasPeerImpl)
        {
            com.xith3d.render.jsr231.CanvasPeerImpl canvasPeerImpl = (com.xith3d.render.jsr231.CanvasPeerImpl)(canvas3D.get3DPeer());
            // set clear buffer state
           canvasPeerImpl.setDisableClearBuffer(!forceClearBuffer);
            // set force swap state
           canvasPeerImpl.setForceNoSwap(!forceSwapBuffers);
        }
        else if (canvas3D.get3DPeer() instanceof com.xith3d.render.lwjgl.CanvasPeerImpl)
        {
            com.xith3d.render.lwjgl.CanvasPeerImpl canvasPeerImpl = (com.xith3d.render.lwjgl.CanvasPeerImpl)(canvas3D.get3DPeer());
            // set clear buffer state
           canvasPeerImpl.setDisableClearBuffer(forceClearBuffer);
            // set force swap state
           //canvasPeerImpl.setForceNoSwap(!forceSwapBuffers);
       }
}


which results in either no clearing at all or full clearing including the color buffer.

So to solve this, a new property - named "layered" for example - should be added to MultiPassView. If this is set to true, the two canvasPeer-properties should be set like the code at the top of this post for all render passes but the first one.

I'll try this tomorrow, maybe Wink

I tried this out. But with no success. for all passes the following code is executed:
1  
2  
3  
canvas3D.get3DPeer().setDisableClearBuffer([b]!isFirstPass[/b]);
canvas3D.get3DPeer().setFullOverpaint([b]!isFirstPass[/b]);
canvas3D.get3DPeer().setForceNoSwap([b]!isLastPass[/b]);


Did I misunderstand anything?

I uploaded the new version. Please refer to this for further discussion.

btw. If you're not utilizing the layered mode, you can even not-use the MultiPassView or put everything in one RenderPass.

Marvin


EDIT: Yeehaa! 500 Posts! Grin Grin Grin
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline cylab

JGO Ninja


Medals: 49



« Reply #33 - Posted 2006-09-17 21:37:33 »

Quote
I uploaded the new version. Please refer to this for further discussion.
Sad
I was just waiting for cvs-access to check my changes in...

Mathias - I Know What [you] Did Last Summer!
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #34 - Posted 2006-09-17 22:41:37 »

Quote
I uploaded the new version. Please refer to this for further discussion.
Sad
I was just waiting for cvs-access to check my changes in...

Sorry, but I made further changes of cleanup and your changes were just a matter of about three lines of code. So I just made it for quick.

But it doesn't work anyway. So please check, what I made wrong and check it in.

Marvin
Offline cylab

JGO Ninja


Medals: 49



« Reply #35 - Posted 2006-09-18 08:36:17 »

Sorry, but I made further changes of cleanup and your changes were just a matter of about three lines of code. So I just made it for quick.
Nevermind... I'll merge it as soon as Amos gets back from whatever is keeping him away and gives me cvs access Wink

I have also made a fix for texture-loading in the MD2Test, so...

I tried this out. But with no success. for all passes the following code is executed:
1  
2  
3  
canvas3D.get3DPeer().setDisableClearBuffer([b]!isFirstPass[/b]);
canvas3D.get3DPeer().setFullOverpaint([b]!isFirstPass[/b]);
canvas3D.get3DPeer().setForceNoSwap([b]!isLastPass[/b]);


Did I misunderstand anything?

In layered mode you have to enable the buffer clearing for every pass:
1  
2  
canvas3D.get3DPeer().setDisableClearBuffer(false);
canvas3D.get3DPeer().setFullOverpaint(!isFirstPass);


If you test this, don't commit; in my changes I have already refactored the different renderOnce()-Methods to contain an additional parameter and the MultiPassView to contain the layered property along with getters and setters.

btw. If you're not utilizing the layered mode, you can even not-use the MultiPassView or put everything in one RenderPass.
What do you mean? Why?

Mathias

Mathias - I Know What [you] Did Last Summer!
Offline Amos Wenger

Senior Member




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


« Reply #36 - Posted 2006-09-18 16:26:15 »

Quote
Please register at xith-tk and I'll give you Developer access as soon as possible.
just registered...
access just granted....  Wink

"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 Amos Wenger

Senior Member




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


« Reply #37 - Posted 2006-09-18 16:27:59 »

Sorry, but I made further changes of cleanup and your changes were just a matter of about three lines of code. So I just made it for quick.
Nevermind... I'll merge it as soon as Amos gets back from whatever is keeping him away and gives me cvs access Wink
It's called Lycée.



 Grin

"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 cylab

JGO Ninja


Medals: 49



« Reply #38 - Posted 2006-09-18 16:50:53 »

access just granted....  Wink
Thanks!

It's called Lycée.
I was just about to ask you about a photo of her, but then I noticed google only found pictures of crappy schools  Grin

Anyway - school on sunday ?  Tongue

Mathias - I Know What [you] Did Last Summer!
Offline Amos Wenger

Senior Member




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


« Reply #39 - Posted 2006-09-18 16:58:07 »

It's called Lycée.
I was just about to ask you about a photo of her, but then I noticed google only found pictures of crappy schools  Grin
Aow  Grin funny.

Anyway - school on sunday ?  Tongue
Oh no, no school on sunday, but err.. no computer either (parents, grrr...).

"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 cylab

JGO Ninja


Medals: 49



« Reply #40 - Posted 2006-09-18 17:04:22 »

Quote
Oh no, no school on sunday, but err.. no computer either (parents, grrr...).
LOL... but then... I have a wife Roll Eyes Lips Sealed

Mathias - I Know What [you] Did Last Summer!
Offline Amos Wenger

Senior Member




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


« Reply #41 - Posted 2006-09-18 17:12:10 »

Quote
Oh no, no school on sunday, but err.. no computer either (parents, grrr...).
LOL... but then... I have a wife Roll Eyes Lips Sealed
Grin Grin

"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 Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #42 - Posted 2006-09-18 18:05:21 »

In layered mode you have to enable the buffer clearing for every pass:
1  
2  
canvas3D.get3DPeer().setDisableClearBuffer(false);
canvas3D.get3DPeer().setFullOverpaint(!isFirstPass);


Ah, cool that did the trick Smiley

If you test this, don't commit; in my changes I have already refactored the different renderOnce()-Methods to contain an additional parameter and the MultiPassView to contain the layered property along with getters and setters.

When I sayed, that I have uploaded the changes in this posting, I was talking about some cleanup and the layered flag. So the only thing that needs to be changes is like #239 in MultiPassView to always pass "false" to the method and it's done.

The layered flag shouldn't be passed to every call of renderOnce, but should be a flag of the View class, as it is now. And you would break compatiplity if you just add an additional parameter to any renderOnce method. So I would suggest to only modify this line #239 in MultiPassView and leave the rest as is. Is this OK?

btw. If you're not utilizing the layered mode, you can even not-use the MultiPassView or put everything in one RenderPass.
What do you mean? Why?

Well, if the only effort of the multipass view in non layered mode is to render one block of nodes after another, you can simply put them in an OrderedGroup. So when I have integrated the MultiPass feature directly into the internal rendering code, which is much faster, you'll need a layered flag. But so far, it is not needed, I think. Or am I wrong?

Marvin
Offline cylab

JGO Ninja


Medals: 49



« Reply #43 - Posted 2006-09-18 19:01:03 »

I have just committed the changes...  before reading this post Wink check it out.

I changed your last version, so it should meet your expectations Smiley One thing I noticed is, that you included the buffer swapping into the if(isLayered) constraint, which I suspect was wrong. As I understand it, the should disable buffer swapping until all passes are rendered, so it is needed in any case.

I have also changed the MultipassTest a little, so you can switch layered mode on and off pressing L.

Quote
Well, if the only effort of the multipass view in non layered mode is to render one block of nodes after another, you can simply put them in an OrderedGroup. So when I have integrated the MultiPass feature directly into the internal rendering code, which is much faster, you'll need a layered flag. But so far, it is not needed, I think. Or am I wrong?

Don't know. I am just not comfortable in changing others code without leaving a way to get the old behaviour back. There might be use cases like e.g. stencil shadows to leave the depth buffer intact... but I haven't thought this through.

Mathias - I Know What [you] Did Last Summer!
Offline Marvin Fröhlich

Senior Member




May the 4th, be with you...


« Reply #44 - Posted 2006-09-18 20:07:11 »

I have just committed the changes...  before reading this post Wink check it out.

I changed your last version, so it should meet your expectations Smiley One thing I noticed is, that you included the buffer swapping into the if(isLayered) constraint, which I suspect was wrong. As I understand it, the should disable buffer swapping until all passes are rendered, so it is needed in any case.

I have also changed the MultipassTest a little, so you can switch layered mode on and off pressing L.

Cool. Thanks. Smiley
Pages: 1 [2]
  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.

BurntPizza (22 views)
2014-09-19 03:14:18

Dwinin (35 views)
2014-09-12 09:08:26

Norakomi (64 views)
2014-09-10 13:57:51

TehJavaDev (90 views)
2014-09-10 06:39:09

Tekkerue (44 views)
2014-09-09 02:24:56

mitcheeb (65 views)
2014-09-08 06:06:29

BurntPizza (48 views)
2014-09-07 01:13:42

Longarmx (35 views)
2014-09-07 01:12:14

Longarmx (40 views)
2014-09-07 01:11:22

Longarmx (37 views)
2014-09-07 01:10:19
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

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

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

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!