MultiPass & Rendering Order

Hi!

I have tried to use multipass rendering to render two BranchGroups: A & B, so that group B is rendered on top of A, but with no luck… :-
Is it possible to achieve? Should I know something specific about usage of MultiPassView etc…?

My problem is that I actually can achive the order but strangly only when I set to render B in PARALLEL_PROJECTION.
If I set A to render in parallel - then A would be rendered on top…

And finaly, when I set both to perspective - they are rendered just as there are no multipass (or probably I’m putting different meaning to multipass ???). For example if I have cube and sphere in the same location - I can see how they overlap as in normal rendering… (See the picture), though they are in different rendering passes. Is it correct behaviour?

Bohdan.

Please post your code, so that we can track the problem. It seems that you have done everything correctly.

Hey I had this “problem” but you know it’s not a bug, it’s features ^^

Actually I think it’s because of the Z-Buffer which isn’t cleared between different passes but… I may be wrong.

Now I also seem to have a strange problem with the MultiPassView. It seems to ignore the rendering order, which I simply can’t understand, since the passes are rendered step by step.

Please have a look at the (redesigned) HUD3DTest and you’ll see the problem.

Does anyone have a clue?

Marvin

Did you look at the rendering code yet ?

Have you checked the Z-buffer thingy? I suspect the multi pass rendering is correct. Is there possibly a flag to clear the depth-buffer after finishing a pass (or before starting the next)?

[quote="<MagicSpark.org [ BlueSky ]>,post:5,topic:27917"]
Did you look at the rendering code yet ?
[/quote]
Not yet. I was really tired yesterday evening. I’ll hopefully do it the next hours.

Unfortunately I haven’t used the z-buffer things before. I’ll have to search through the code and collect information on it. Any hints?

Well Z-buffer is easy : it’s used to check that polygons are rendered in the correct (perspective order). It must be cleared (or ignored) if you want to render object each on top on each other by rendering order, not Z order.

[quote="<MagicSpark.org [ BlueSky ]>,post:8,topic:27917"]
Well Z-buffer is easy : it’s used to check that polygons are rendered in the correct (perspective order). It must be cleared (or ignored) if you want to render object each on top on each other by rendering order, not Z order.
[/quote]
Yes, thnks, I do know the principle of z-buffering ;). The thing is that I don’t know how ot is implemented in Xith.

search for glEnable([GL.]GL_DEPTH_TEST) and glClear([GL.]GL_DEPTH_BUFFER_BIT)

Thanks.


public void renderOnce()
    {
        int i = 0;
        for (RenderPass pass: listRenderPasses)
        {
            renderOnce(pass, (i == 0), (i == listRenderPasses.size() - 1));
            i++;
        }
    }


/**
     * This renders just the given pass, overriding the clearBuffer and
     * swapBuffer states.
     * 
     * @param pass the pass to render
     * @param forceClearBuffer
     * @param forceSwapBuffers
     */
    protected void renderOnce(RenderPass pass, boolean forceClearBuffer, boolean forceSwapBuffers)

should it be


renderOnce(pass, true, (i == listRenderPasses.size() - 1));

?

[quote="<MagicSpark.org [ BlueSky ]>,post:12,topic:27917"]
should it be


renderOnce(pass, true, (i == listRenderPasses.size() - 1));

?
[/quote]
Hmm… no. With these values the HUD3DTest end in an unrendered main scene. But thank you very much for helping me to find the clue. Please keep on searching :).

No, I don’t think so. It might be a desired behaviour to have correct z-buffering drawing while multi pass rendering. There should be a flag to control this behaviour.

On a sidenote, it should be possible to specify a texture as target of the rendering (using FBOs) except for the last pass, so you could refer to the pixels of a preceding render pass.

hmm… if that didn’t hit the performance. I guess one shouldn’t be able to grab directly into the frame buffer (too fragile).

That’s what FBOs are for. It’s a nice thing and not too difficult to implement (if it is supported by the driver). Maybe I’ll find the time and prototype this.

I think the place is right. The problem is, that the forceClearBuffer flag clears the color buffer, too. I think the implementation of renderOnce has to be extended to allow for depth buffer clearing only.

OK. Than it’s good :).

I’ll check that.

Where do you guys put the tests and demos? The cvs repository did not contain anything like that. All demos seem to be deleted some months ago. ???

You probably checked out xith3d CVS. All tests and demos now resist in xith-tk.

Marvin

Ah, thanks ::slight_smile: