Results 1 to 4 of 4

Thread: Particle depth test

  1. #1
    Member Contributor
    Join Date
    Feb 2001
    Location
    Hungary
    Posts
    60

    Particle depth test

    I have 'glowing' particles (around 300 pieces) that fly around some 3d objects.
    - If I enable depth test and use quads, I always have to calculate the distance between the camera and all of the particles (to know the drawing order) and between the camera and the objects (difficult geometry) and I have to make calculations to make the particles face the viewer. This eats up a lot of CPU time...
    - If i use point sprites, I have only a limited particle size and I have to calculate the distance and so on...
    - If I disable depth test, I won't be able to see the particle disappearing behind an object and reappearing in front of it.

    A saw a lot of examples concerning this problem, but they always showed glut examples and only a particle emitter (nothing else in the scene), but no depth testing.

    My question is:
    What is the technique I have to use for particles (not gl_points, but trangle strips or quads) to make them move around in 3D space?

    thx

    ps: I don't use glut

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: Particle depth test

    Disable depth writes, but keep depth test enabled. Check out glDepthMask.

  3. #3
    Member Contributor
    Join Date
    Feb 2001
    Location
    Hungary
    Posts
    60

    Re: Particle depth test

    That solved my problem. Thank you.
    I've never seen anyone mentioning that thing concerning particles...

  4. #4
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Particle depth test

    You did not search that much, because it is well known that with additive transparency you don't have to sort particles.
    Quite often games use additive instead of classic blending to avoid sorting, even for smoke and dust. It does not look so good though.

Similar Threads

  1. Perform stencil test only if depth test fails
    By Ray1184 in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 09-23-2015, 01:21 AM
  2. Framebuffer depth test with depth and stencil buffer
    By moldyviolinist in forum OpenGL: Basic Coding
    Replies: 10
    Last Post: 07-29-2013, 08:21 PM
  3. Does Depth Buffer Allow Writing Into When Disabling Depth Test
    By wilburn in forum OpenGL: Basic Coding
    Replies: 16
    Last Post: 12-23-2006, 01:23 AM
  4. Particle System: Depth and Blend
    By Rodrix in forum OpenGL: Basic Coding
    Replies: 10
    Last Post: 10-06-2006, 10:31 AM
  5. Can Alpha Test work the same way as Depth Test?
    By Rong Yao in forum OpenGL: Basic Coding
    Replies: 12
    Last Post: 05-13-2004, 02:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean