Horde3D
http://horde3d.org/forums/

Particle system corrupts with Opengl draw functions
http://horde3d.org/forums/viewtopic.php?f=1&t=1876
Page 1 of 1

Author:  lbr0307 [ 12.04.2013, 18:11 ]
Post subject:  Particle system corrupts with Opengl draw functions

I've been working on building a room with fire using Hord3D. I try to use the Opengl draw functions to visualize my pathfinding algorithm.
But I got this:
Attachment:
File comment: It seems like the fire is "culled" by the Opengl Quads an Lines.
2.JPG
2.JPG [ 55.07 KiB | Viewed 12085 times ]

I am thinking about to modify the particle shader. Anyway, is the rendering order to do with this problem? :?

I have modified my particle.shader like this:
Code:
context TRANSLUCENT
{
   VertexShader = compile GLSL VS_TRANSLUCENT;
   PixelShader = compile GLSL FS_TRANSLUCENT;
   
   ZWriteEnable = true;
   BlendMode = Replace;
}

The particle system became like this:
Attachment:
3.JPG
3.JPG [ 61.26 KiB | Viewed 12085 times ]

This change solves the "cover(culling)" problem, but the particle system became kind of "ugly", maybe something wrong with the texture?

Attachments:
File comment: The moving fire is covered by my Opengl grids.
1.JPG
1.JPG [ 66.83 KiB | Viewed 12085 times ]

Author:  mikel [ 12.04.2013, 19:23 ]
Post subject:  Re: Particle system corrupts with Opengl draw functions

Particles must be rendered last, and without writing to zbuffer.

I just played with this a bit, and here some hackish C# code:

Code:
        public override void Render(float time)
        {
            Camera.Update();

            // hide only particles
            h3d.setNodeFlags(particles.Node, (int)h3d.H3DNodeFlags.Inactive, true);
            h3d.render(Camera.Node);
            h3d.setNodeFlags(particles.Node, 0, true); // back to visible


            // draw GL stuff
// remember push all attribs (states) first, draw, then pop attribs


            // hide everything
            h3d.setNodeFlags(h3d.H3DRootNode, (int)h3d.H3DNodeFlags.Inactive, true);
            // set only particles visible
            h3d.setNodeFlags(particles.Node, 0, true);
            h3d.render(Camera.Node);

            h3d.setNodeFlags(h3d.H3DRootNode, 0, true); // all visible
        }



Then I had to modify forward.pipeline.xml,
Code:
         <ClearTarget depthBuf="true" colBuf0="false" />

I changed colBuf0="true" to false so second h3d.render() doesnt clear screen.
With my scene this works because I have skybox, so clearing isnt necassary anyway.

Author:  lbr0307 [ 13.04.2013, 13:57 ]
Post subject:  Re: Particle system corrupts with Opengl draw functions

Thanks! It works for me. I think it is the simplest solution.

Then I can move on!

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/