PDA

View Full Version : Updated Geometry Shader Example



rombust
07-07-2011, 10:15 AM
Found in ClanLib 2.2 and 2.3 SVN (Examples/3D/GeometryShader)

http://esoteric.clanlib.org/~rombust/ReleaseImages/borg4.png

rombust
07-07-2011, 06:24 PM
I have made a silly mistake in the example.

I tried Z sorting the particles so the blending works for translucent particles.

Except, I failed big time!

I rendered the scene once, only writing to the depth buffer
The rendered the actual scene.

That has exactly the same effect as only rendering the scene once and the particle texture has either 0.0 alpha or 1.0 alpha.

Thus, you can get twice the framerate by only having a single pass and changing the texture graphic.

The challenge would be to correctly render the scene with the correct Z order without qsorting the points.

One method could be:
Pass 1: Use additive blending, render to a framebuffer using a floating point RGBAX texture (except it does not exist!) where X is an integer count of fragments written.
Pass 2: Draw the floating point RGBAX texture, dividing RGBA by X

humm, not sure that would work either.

Anyway, perhaps it's a pointless excercise anyway.

Maybe particle fragments should never blend (i.e. Alpha < 0.1 discard, Else set alpha to 1.0 in the fragment shader)

Feel free to play!

rombust
07-08-2011, 07:35 AM
Okay, i have cleaned the example, it now only does one render pass.

Also the texture image uses "alpha_ball2.png".

The example is now complete :)

http://esoteric.clanlib.org/~rombust/ReleaseImages/borg6.png

flowmelody
11-21-2011, 11:58 AM
Great ! Thanks a lot

lampcord
02-09-2012, 08:17 PM
Holy crap, 1,000,000 particles and 66 FPS????

What kind of PC are you using?