Thread: Rendering more than 3 dynamic lights crashes engine?

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

    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
    M.Eng Computer Engineering Candidate
    B.Sc Computer Science

    Robotics and graphics enthusiast.

  2. #2
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    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,071
    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
    M.Eng Computer Engineering Candidate
    B.Sc Computer Science

    Robotics and graphics enthusiast.

  4. #4
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    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 03: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-08-2010, 12:08 AM
  2. Game Engine Link Prob
    By swgh in forum Game Programming
    Replies: 2
    Last Post: 01-26-2006, 12:14 AM
  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, 04:06 PM