• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

Drag0n

More than GL_LIGHTn lights?

14 posts in this topic

Is there a way to have more lights in the scene than the standard 0-7? In the Red Book is explained that the number of light sources may vary depending on the particular implementation. But that''s not what I mean. So, is there a way to have more than 7 lights? For example, 20? Thx Drag0n "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning..."
0

Share this post


Link to post
Share on other sites
In the standard windows implementation no. But through the xtensions of your videocard it might be possible...
0

Share this post


Link to post
Share on other sites
AFAIK it is possible to do this by:
1) using vertex shaders that can handle any number of lights
or
2) rendering with the standard OpenGL pipeline using multiple passes
0

Share this post


Link to post
Share on other sites
That''s how many lights are guaranteed to be rendered in hardware by any standard OpenGL implementation. If you use more, it may fall back into software rendering. Just remember a couple things:
  • Most objects won''t look any different when you have 7 lights compared to 20. Pick 7 or less that are the closest.
  • You can always write your own lighting ruitines.

    [Resist Windows XP''s Invasive Production Activation Technology!]
  • 0

    Share this post


    Link to post
    Share on other sites
    Well, you should be a bit more creative and do it with a max of eight lights, you could do the following: make your 3D engine/level design so that you can see no more than eight lights at the same time. Make your own light class and copy its parameters onto the OpenGL standard lights that are visible...
    Or you can do this (a lot harder): Make an omni light (say LIGHT0 or something) and let it be the sun (place it high, huge attenuation, etc) and precalculate the shadows and map them over the scene, if you need any RT lights use the other seven...

    Personally i''d go for the first option, ''cause its a lot easier :-)

    Hope this helps...

    The Jaguar
    0

    Share this post


    Link to post
    Share on other sites
    I''ve been thinking about this kind of stuff a lot lately... Here are my two.. or three... or maybe even four cents.

    - First of all, I wouldn''t recommend going above the 8 light limit that OpenGL provides. You risk some slowdown on cards that don''t support more than those 8 lights.

    - Second of all... Why use OpenGL''s DYNAMIC hardware accelerated lights for lighting a static scene? Its craziness I tell you. Generate a radiosity solution, or lots of light/attenuation maps, and light the freaking scene!

    - I would strongly suggest making a singleton OpenGL hardware light manager (to manage the 8 available lights that you are almost guaranteed), and use those lights for things that are completely dynamic (like lighting a missle trail) and such. And then use lightmaps for things such as, sun coming through a window, ceiling lights, etc.

    I am doing research on all the types of lighting available right now, I will then weigh each types pros and cons. Then work on an implementation for my engine... Once thats done I''ll work on a nifty tech demo, and write a nice long tutorial on everything I learned, and implementating light!

    ------------------------------
    Trent (ShiningKnight)
    E-mail me
    ShiningKnight Games
    0

    Share this post


    Link to post
    Share on other sites
    after many hours of searching, i still couldnt find the link i wanted. damn flipcode changing everything around. it basically went like this (i think).


    you have 8 lights to play with. instead of using 8 lights for the whole scene, use 8 lights per object (how you define an "object" is up to you). when you come to render the object, enable the 8 lights that are closest to it, and render the object. then move onto the next object, enable the 8 lights that are closest to that object, render, and repeat.

    it doesnt matter what order you plug your lights into the GL_LIGHTi definitions. example:

    ----------------------------------------------------------------

    struct CLight
    {
    CVector Pos;
    };

    struct CObject
    {
    CVector Pos;
    };

    #define LIGHT_NUM 30

    CLight Lights[LIGHT_NUM];

    void CalcLights (CObject *Obj)
    {
    int i;

    float LightDis[LIGHT_NUM];
    int LightID[LIGHT_NUM];

    // != should be "less than" but the forums thing its an
    // html tag
    for (i = 0; i != LIGHT_NUM; i++)
    {
    LightID = i;
    LightDis[i] = calcDistance (Obj->Pos, &Lights[i].Pos);
    }

    // Now sort the distance values from lowest to highest.
    // when swapping values about, remember to swap the LightID
    // values too, example:
    //
    // LightDis[3] = LightDis[4];
    // LightID[3] = LightID[4];
    //
    // that way we know that the 5th light (remember we start
    // at zero) is now located in the 3rd position.

    GLSetLight (GL_LIGHT0, &Lights[LightID[0]]);
    GLSetLight (GL_LIGHT1, &Lights[LightID[1]]);
    GLSetLight (GL_LIGHT2, &Lights[LightID[2]]);
    GLSetLight (GL_LIGHT3, &Lights[LightID[3]]);
    GLSetLight (GL_LIGHT4, &Lights[LightID[4]]);
    GLSetLight (GL_LIGHT5, &Lights[LightID[5]]);
    GLSetLight (GL_LIGHT6, &Lights[LightID[6]]);
    GLSetLight (GL_LIGHT7, &Lights[LightID[7]]);
    }

    ----------------------------------------------------------------

    or something like that anyway. hey, i never said it was a particulally good article .


    MENTAL


    Edited by - MENTAL on October 10, 2001 6:36:04 AM

    Edited by - MENTAL on October 10, 2001 6:37:16 AM
    0

    Share this post


    Link to post
    Share on other sites
    Thx @all!

    I think the idea is good to use only the number of lights provided by the OpenGL implementation.

    Drag0n
    0

    Share this post


    Link to post
    Share on other sites
    What I suggest is writing a static vertex-shader light class,
    then have a dynamic ogl light class.
    Thats what I think I am going to end up doing.
    I`ve already got a fairly simple OGL light class.
    I can send you the code and help you out if you like
    ~V''lion

    I came, I saw, I got programmers block.
    ~V''''lion
    0

    Share this post


    Link to post
    Share on other sites
    what about Per Pixel Lighting?

    I know only ATi Radeon and above can do it at a reasonable speed (i own a radeon), but i have no idea how to implement it...
    It looks a WHOLE lot better than per vertex lighting...
    so maybe it''s worth implementing...(i am not sure though how many light sources it allows..but because it works on texture space, it may be a lot more than 8...i might be wrong though)

    (can anyone PLEASE point me to how to do that? iv''e been looking for a long time and all i found was DOT3 bump mapping (which is also a way of per pixel lighting, but I wanna know how to do the lighting itself..not bumpmapping...)
    PLEASE help if you can.
    0

    Share this post


    Link to post
    Share on other sites
    This question has popped up a few times on these boards before.MENTAL pretty much nailed it. You never need more than 8 lights on one particular mesh, in fact, 8 is usually too much because of the huge slowdown you get with multiple lights. For instance, FPS with 8 lights is usually about 10% of that with 1 light. If you really feel you need 8 lights acting on a particular polygon, use static lightmaps or devise your own software lighting solution (as in Quake2).

    www.elf-stone.com
    0

    Share this post


    Link to post
    Share on other sites
    Trent, are you stalking every thread i post on?!?!?!

    oh yeah, you have to - you moderate this forum.

    there goes my conspricicy theory .

    MENTAL
    0

    Share this post


    Link to post
    Share on other sites
    I''m not sure for platforms other than MSVC/Win32, but the MSDN docs say that GL_LIGHTn is guaranteed to be GL_LIGHT0+n. You can query the maximum number of lights by doing:

    int numOfLights = 8;
    glGetIntegerv (GL_MAX_LIGHTS, &numOfLights);

    Still, as has been said by others: don''t use that many lights anyway...
    0

    Share this post


    Link to post
    Share on other sites