Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Slug Production : Per Pixel Lighting demos released

  1. #1
    Member Regular Contributor
    Join Date
    Jul 2000
    Location
    Arlon, Belgium
    Posts
    486

    Slug Production : Per Pixel Lighting demos released

    Slug Production has released 8 demos using Per Pixel Lighting.
    Every demo has been released with the source code.

    There are 2 sections for lighting a scene.

    1. Section : Per Pixel Lighting using a 2D Texture
    Here're the 4 differents demos for the Per Pixel Lighting

    - ARB Vertex Program
    - Dynamic LightMapping
    - NVIDIA Vertex Program
    - NVIDIA Vertex Program with Register Combiners

    2. Section : Per Pixel Lighting using a 3D Texture
    Here're the 4 differents demos for the Per Pixel Lighting

    - ARB Vertex Program
    - Dynamic LightMapping
    - NVIDIA Vertex Program
    - NVIDIA Vertex Program with Register Combiners

    LEYDER Dylan
    Slug Production - http://www.slug-production.be.tf/

  2. #2
    Junior Member Regular Contributor
    Join Date
    Jan 2003
    Posts
    146

    Re: Slug Production : Per Pixel Lighting demos released

    Just wanted to say your demos are looking better.

    Just a question. I see that you are rendering the lightmap first, then the floor
    texture. You do this in both your 2D and 3D lightmapping demos. The problem with
    this for me is that when you turn off the lightmap, you're blending the floor texture
    with the background color again, like last time. Set your background color to all
    green and you will see what I mean.

    Is there any reason why you can't switch those two passes, and draw the floor
    texture first, then draw the lightmap? And still get the same effect?
    This makes more sense to me.

  3. #3
    Member Regular Contributor
    Join Date
    Jul 2000
    Location
    Arlon, Belgium
    Posts
    486

    Re: Slug Production : Per Pixel Lighting demos released

    Just a question. I see that you are rendering the lightmap first, then the floor
    texture. You do this in both your 2D and 3D lightmapping demos. The problem with
    this for me is that when you turn off the lightmap, you're blending the floor texture
    with the background color again, like last time. Set your background color to all
    green and you will see what I mean.
    Yes I tryed and it's ugly man

    In my engine, I use the PPL as this :

    Code :
     // 1 Pass :
    	if (Per_Pixel_Lighting)
    		T3D_Render_Engine->Map_Display_Per_Pixel_Lightning(true);
     
    // 2 Pass :
    T3D_Render_Engine->Map_Display(false);
    And I've got no trouble with that.


    Is there any reason why you can't switch those two passes, and draw the floor
    texture first, then draw the lightmap? And still get the same effect?
    This makes more sense to me.
    I've not tryed but I think that's it's possible.

  4. #4
    Junior Member Regular Contributor
    Join Date
    Jan 2003
    Posts
    146

    Re: Slug Production : Per Pixel Lighting demos released

    Another question. What's the purpose of the ARB Vertex Program in your 2D and 3D demos?

    They look the same as the dynamic lightmapping demos. I don't use vertex programs,
    and don't know much about them, but to me it doesn't look like they serve any purpose.

  5. #5
    Member Regular Contributor
    Join Date
    Jul 2000
    Location
    Arlon, Belgium
    Posts
    486

    Re: Slug Production : Per Pixel Lighting demos released

    First :

    They are not mainly there to speed up. and on NVIDIA cards they won't by default mean a possible speedup, as they all have the fixed function wich can, or can not, depending on situation, outperform the vs..

    Second : 90% of the time, the T&L part is NOT the bottleneck of your rendering. It's 90% of the time the fillrate, or sending data over the busses.

    Third : They are made to replace the fixed function by something flexible. You can do there in what ever you want. Thats their feature. They extend the capabilities of openGL.

    You can read this :

    PDF :

    http://developer.nvidia.com/docs/IO/...texProgram.pdf

    Power Point Presentation :

    http://developer.nvidia.com/docs/IO/...texProgram.ppt


    [This message has been edited by Leyder Dylan (edited 10-16-2003).]

  6. #6
    Intern Contributor
    Join Date
    Feb 2003
    Location
    Brazil
    Posts
    94

    Re: Slug Production : Per Pixel Lighting demos released

    Thanx for the code of the DL...but how do i configure the 2 tex units matrix to call only glDrawElement()?
    Im doing

    //binding shader..
    static float op1[] = {1,0,0,0};
    static float op2[] = {0,1,0,0};
    static float op3[] = {0,0,1,0};

    glActiveTexture(GL_TEXTURE0_ARB);
    glEnable(GL_TEXTURE_2D);
    glBindTexture(GL_TEXTURE_2D, tex_light2d);

    glEnable(GL_TEXTURE_GEN_S);
    glTexGenfv(GL_S, GL_OBJECT_PLANE, op1);
    glTexGenf(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
    glEnable(GL_TEXTURE_GEN_T);
    glTexGenfv(GL_T, GL_OBJECT_PLANE, op3);
    glTexGenf(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);

    glActiveTexture(GL_TEXTURE1_ARB);
    glEnable(GL_TEXTURE_1D);
    glBindTexture(GL_TEXTURE_1D, tex_light1d);
    glEnable(GL_TEXTURE_GEN_S);
    glTexGenf(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
    glTexGenfv(GL_S, GL_OBJECT_PLANE, op2);

    //rendering
    //first i translate and rotate the object and then enter here
    //tex unit 0, tex 2d
    glMatrixMode(GL_TEXTURE);
    glTranslatef(.5,.5,.5);
    glScalef(1/radius,1/radius,1/radius);
    glTranslatef(-light_pos.x,-light_pos.z,0);
    //tex 1 , 1d texture
    glActiveTexture(GL_TEXTURE1_ARB);
    glMatrixMode(GL_TEXTURE);
    glTranslatef(.5,.5,.5);
    glScalef(1/radius,1/radius,1/radius);
    glRotatef(90, 1,0, 0); //should i rotate to turn y values to z values?
    glTranslatef(0,0,-lp.y);
    glMatrixMode(GL_MODELVIEW);

    but its not working....somebody help me, please....

  7. #7
    Junior Member Regular Contributor
    Join Date
    Jan 2003
    Posts
    146

    Re: Slug Production : Per Pixel Lighting demos released

    Originally posted by Leyder Dylan:
    First :

    They are not mainly there to speed up. and on NVIDIA cards they won't by default mean a possible speedup, as they all have the fixed function wich can, or can not, depending on situation, outperform the vs..

    Second : 90% of the time, the T&L part is NOT the bottleneck of your rendering. It's 90% of the time the fillrate, or sending data over the busses.

    Third : They are made to replace the fixed function by something flexible. You can do there in what ever you want. Thats their feature. They extend the capabilities of openGL.

    You can read this :

    PDF :

    http://developer.nvidia.com/docs/IO/...texProgram.pdf

    Power Point Presentation :

    http://developer.nvidia.com/docs/IO/...texProgram.ppt

    So, if I understand you correctly, adding in these four lines:

    glEnable(GL_VERTEX_PROGRAM_ARB);
    glGenProgramsARB(1, &ARB_Vextex_Program);
    glBindProgramARB(GL_VERTEX_PROGRAM_ARB, ARB_Vextex_Program);
    glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen((const char*)ARBVP), ARBVP);

    is only there to improve performance? Everything else remains the same?

  8. #8
    Member Regular Contributor
    Join Date
    Jul 2000
    Location
    Arlon, Belgium
    Posts
    486

    Re: Slug Production : Per Pixel Lighting demos released

    No, that was for introduce the ARB program. You can use it as a vertex array program and for the moment, I'm working to convert a vertex array program into a ARB vertex program.

    Please wait ...

  9. #9
    Junior Member Regular Contributor
    Join Date
    Jan 2003
    Posts
    146

    Re: Slug Production : Per Pixel Lighting demos released

    You know, if you put a fps counter in your demos, people would at least have
    something to gauge performance. I have a fast card, so I can't visually compare
    how fast it is compared to your demos.

  10. #10
    Member Regular Contributor
    Join Date
    Jul 2000
    Location
    Arlon, Belgium
    Posts
    486

    Re: Slug Production : Per Pixel Lighting demos released

    Yes, excellent idea, I'll do that tonight.

Posting Permissions

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