Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Point distance attenuation problem?

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2010
    Posts
    1

    Point distance attenuation problem?

    Hello everyone here~

    I am working with CGFX Shader. In my project, I used 3D points dataset. I've implemented CGGX Shader on 3d points to have the Point Size Attenuation effect. In my CGFX shader I found: 'PointDistanceAttenuation = float3(1.0, 0, 0);' in 'Renderstates of Vertex Pipeline'

    I've tried with PointDistanceAttenuation = float3(0,1.0,0) to have a linear point size attenuation, but it doesn't work, all the points look like in a same size.

    Actually, the 3D points which are far away should look smaller than those closer to the viewer.

    Anybody knows:
    --How to active PointDistanceAttenuation property in CGFX shader?
    --or before activation of PointDistanceAttenuation I have to enable other states?
    --PointDistanceAttnuation is used to set PointSize? or Point lighting?


    Thx in advance~

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    2,882

    Re: Point distance attenuation problem?

    Quote Originally Posted by Dormouse
    I am working with CGFX Shader. In my project, I used 3D points dataset. I've implemented CGGX Shader on 3d points to have the Point Size Attenuation effect. In my CGFX shader I found: 'PointDistanceAttenuation = float3(1.0, 0, 0);' in 'Renderstates of Vertex Pipeline'

    I've tried with PointDistanceAttenuation = float3(0,1.0,0) to have a linear point size attenuation, but it doesn't work, all the points look like in a same size.
    Well, I'm no point sprite guru, but I'm guessing that PointDistanceAttenuation is POINT_DISTANCE_ATTENUATION in ARB_point_parameters. This is the old pre-shaders way of controlling point spites.

    You're using CgFX. So you're writing your own shaders. Just set the point size yourself! glEnable( GL_VERTEX_PROGRAM_POINT_SIZE ) -- aka GL_PROGRAM_POINT_SIZE in GL3.2 -- and then set gl_PointSize in the vertex shader. You'll need to map gl_PointSize (GLSL) to Cg language though.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •