Rendering more than 3 dynamic lights crashes engine?

This is a discussion on Rendering more than 3 dynamic lights crashes engine? within the Game Programming forums, part of the General Programming Boards category; So I'm still working on my GLSL lighting system. I've decided to try a virtual light mapping system that maps ...

  1. #1
    The Right Honourable psychopath's Avatar
    Join Date
    Mar 2004
    Location
    Where circles begin.
    Posts
    1,070

    Rendering more than 3 dynamic lights crashes engine?

    So I'm still working on my GLSL lighting system. I've decided to try a virtual light mapping system that maps virtual lights created in the engine, to the 8 OpenGL lights, based on contribution and brightness.

    Before attempting the full system, I tried first rendering one dynamic light...fine...two...fine....three..fine....four.. ..CRASH! And when I say fine, this also means it rendered at an acceptable framerate.

    So is this a driver issue? Problem with the code? It dosn't make much sense for 3 lights to render fine, and then 4 to crash the engine, especially when the GPU max is 8-10

    thanx,
    -psychopath
    Memorial University of Newfoundland
    Computer Science

    Mac and OpenGL evangelist.

  2. #2
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    I have no idea why it would do that. Adding lights just adds lighting calculations. Only thing I can think of is a memory or resource leak present in the code that does not show itself until stressed.

  3. #3
    The Right Honourable psychopath's Avatar
    Join Date
    Mar 2004
    Location
    Where circles begin.
    Posts
    1,070
    I just tried running it in RenderMonkey. It tells me this:

    "Link successful. The GLSL vertex shader will run in software due to the GLSL fragment shader running in software. The GLSL fragment shader will run in software - available number of ALU instructions exceeded."

    What exactly are ALU instructions?

    -psychopath
    Memorial University of Newfoundland
    Computer Science

    Mac and OpenGL evangelist.

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    Ahhh you are exceeding the limit of instructions for one pixel shader. I know that different versions of the shader language allow different numbers of instructions, or more, a limit on how many bytes of instructions you can use. The most recent one is 2.0 I believe and it allows branching as well as 256 instructions. Older PS 1.0 (XBox 1, GeForce 3 and 4, etc.) allows no branching, and 64 instructions. For version info I would consult a book as it does get rather confusing. The 3 shader books I purchased from Amazon cover the versions differences quite well.

    ALU = Arithmetic Logic Unit - I believe this interprets the codes for the GPU. Much like the instruction encoder/decoder unit for the CPU.


    Also don't do a lot of math inside of a pixel shader. This will kill your system and your FPS. Leave the heavy math to the vertex shader and then send the results to the pixel shader. For instance, computing DOT3 lighting inside of a pixel shader would not be ideal. Pre-subtraction of the vectors, pre-normalization of the vectors, etc., all will increase performance inside of the shader.

    A pixel shader only needs to do one thing and do it well. Color modification.

    1. Color value in
    2. Modify value somehow
    3. Output new color value
    Last edited by VirtualAce; 12-27-2005 at 02:06 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do the game engine and the api interact?
    By Shadow12345 in forum Game Programming
    Replies: 9
    Last Post: 12-07-2010, 11:08 PM
  2. Game Engine Link Prob
    By swgh in forum Game Programming
    Replies: 2
    Last Post: 01-25-2006, 11:14 PM
  3. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM
  4. What's a 3D engine?
    By Garfield in forum Game Programming
    Replies: 6
    Last Post: 12-18-2001, 03:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21