Jump to content
  • Advertisement

Archived

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

kieren_j

General Lighting / Textures

This topic is 6932 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In games like Quake II, Half-Life, etc., the levels are lit throughout - and quickly as well. I know these games don''t use actual "light objects" (i.e. D3DLIGHTs), and I think they use "lightmaps" instead. I saw a screenshot using only lightmaps on the CAVE Quake II site, and this definitely looks about right for the lighting seen in the levels. This is obviously a lot better than vertex lighting. I have a few questions to do with lightmaps, and also textures.
  • How would you go about generating lightmaps?
  • How would you store these lightmaps? As textures?
  • A lot of games use tiled or repeating textures - how do you do this in Direct3D? Is there a renderstate you can set to allow it, or would you need to subdivide the polys?
  • How would you detect the light level for any specified area in the level? (I''ve done some Quake2 programming before, and there''s a lightlevel variable somewhere that''s used by the monster AI to see the player)
  • How would you apply a lightmap to a texture? I''m guessing you use multiple texture stages? Thanks --------------- kieren_j

    Share this post


    Link to post
    Share on other sites
    Advertisement
    try to commpress them...
    lol..


    Posted By Xeno.
    Kobe Bryant- "Just believe in yourself"

    Share this post


    Link to post
    Share on other sites
    yep, once you compress the textures to 5% of their original size, hell, you could assign a unique texture to every polygon in the world.

    -goltrpoat


    --
    Float like a butterfly, bite like a crocodile.

    Share this post


    Link to post
    Share on other sites
  • How would you go about generating lightmaps?

    You start by mapping the lightmap to the polygon, then you can for each texel in the lightmap find its position in the world where you can light it.

  • How would you store these lightmaps? As textures?

    The lightmaps are just textures so storing them as textures would be right.

  • A lot of games use tiled or repeating textures - how do you do this in Direct3D? Is there a renderstate you can set to allow it, or would you need to subdivide the polys?

    Yes you can set the texture addressing mode with SetRenderState() with D3DRENDERSTATE_WRAP0 through D3DRENDERSTATE_WRAP7, and SetTextureStageState() with D3DTSS_ADDRESS, D3DTSS_ADDRESSU, and D3DTSS_ADDRESSV. You have to check the manual on how to use these.

  • How would you detect the light level for any specified area in the level?
    (I''ve done some Quake2 programming before, and there''s a lightlevel variable somewhere that''s used by the monster AI to see the player)

    This is done by calculating the distance to the lightsources and checking wether the lightsource is occluded or not.

  • How would you apply a lightmap to a texture? I''m guessing you use multiple texture stages?

    Either multiple texture stages or multiple render stages. In both methods the lightmap should be multiplied with the texture.


    WitchLord

    Share this post


    Link to post
    Share on other sites
    WitchLord,
    __On the last part you say multiply the texture by the lightmap. That takes care of regular light intensity. What about "over-bright" / "washed-out" parts?
    __Would they be stored as sepereate maps and how would they be blended?

    Share this post


    Link to post
    Share on other sites
    Yes, the lightmap that is multiplied with the texture is only the diffuse light. To add specular light you would need to add a second lightmap, this time you add the color of the lightmap to the previous rendering.

    - WitchLord

    Share this post


    Link to post
    Share on other sites
    Guest Anonymous Poster
    When you say unique image, are you saying that there is a texture saved in texture space for every polygon?

    Share this post


    Link to post
    Share on other sites
    quote:
    Original post by Xeno

    try to commpress them...
    lol..


    Posted By Xeno.
    Kobe Bryant- "Just believe in yourself"


    That sucks!

    Share this post


    Link to post
    Share on other sites

    • Advertisement
    ×

    Important Information

    By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

    GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

    Sign me up!