Results 1 to 5 of 5

Thread: Spotless spotlights :(

  1. #1
    Member Newbie
    Join Date
    Jul 2006
    Posts
    39

    Spotless spotlights :(

    A question regarding lights.Are spot lights really diffuse lights with the spot_cutoff ,spot_direction properties set to focus the light? Can i use spot lights to light up a region in an orthographic view. Like suppose i use glOrtho() to set up the view & then place textured quads in say the z=0 plane to place images for a 2D GAME. Now i use a spot light to light up a region of the z=0 plane...will it work?
    Or do i have to use texture effects & light maps instead ?

    I have also noticed that using spot lights does not high light a particular region of a plane when its facing the light source.The whole region is uniformly lit. How do i light up a particular region only & severely attenuate the light in the surrounding area.Basically if someone could post some code for properly creating & managing SPOT LIGHTS it will be really helpful

  2. #2

    Re: Spotless spotlights :(

    >A question regarding lights.Are spot lights really
    >diffuse lights with the spot_cutoff ,spot_direction
    >properties set to focus the light?

    Yes. (well not just diffuse. Like all lights they can have specular and ambient component too. But they are normal lights, if that is what you mean.)

    >Can i use spot lights to light up a region in an
    >orthographic view.

    Projection method makes no difference.

    >Like suppose i use glOrtho() to set up the view &
    > then place textured quads in say the z=0 plane
    >to place images for a 2D GAME. Now i use a spot
    >light to light up a region of the z=0
    >plane...will it work?
    >Or do i have to use texture effects & light maps instead ?
    >I have also noticed that using spot lights does
    >not high light a particular region of a plane
    >when its facing the light source.The whole region
    > is uniformly lit. How do i light up a particular
    > region only & severely attenuate the light in
    >the surrounding area.

    The OpenGL lights (spot or otherwise) are per vertex. To lit a large plane/polygon you need to subdivide it to small pieces or calculate the light per pixel in a shader.
    See the picture at the bottom of this page:
    http://www.lighthouse3d.com/opengl/g....php?spotlight

    In a 2D game it will be easy to just overlay a texture/circle to present the spot light. This is the medhod you most likely should use.

    >Basically if someone could
    >post some code for properly creating & managing
    >SPOT LIGHTS it will be really helpful

    Read chapter 5 from the Opengl Red Book. The book is really really old, but mostly still valid.
    http://www.gamedev.net/download/redbook.pdf
    "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

  3. #3
    Senior Member Frequent Contributor plasmonster's Avatar
    Join Date
    Mar 2004
    Posts
    739

    Re: Spotless spotlights :(

    Projective textures can be pretty cool for spotlights too.

  4. #4
    Member Newbie
    Join Date
    Jul 2006
    Posts
    39

    Re: Spotless spotlights :(

    Hey that light house link is really cooool...thankx glome!!
    Since writing shaders means i have to go through all the GLSL stuff,isnt there any shader provided by openGL itself that i can use just to test the spotlight effect.Perhaps some thing with the GLUT library. I dont want to get into writing shaders immediately..i dont really want spectacular effects....i just want to clearly see the spot light lighting up a region properly more like a spotlight than a directional one

    @sgram
    Projective textures ??!!

  5. #5

    Re: Spotless spotlights :(

    >isnt there any shader provided by openGL itself
    >that i can use just to test the spotlight effect.

    No. Unless you count the fixed function be a "shader".

    Using shaders in a 2D game is a bit overkill, so just overlay a circle on top of the other graphics and that's all the spotlight you need.
    "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Similar Threads

  1. Spotlights
    By Rodrix in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 02-06-2006, 11:15 AM
  2. Spotlights
    By Baggio in forum OpenGL: GLSL
    Replies: 2
    Last Post: 11-13-2004, 12:10 PM
  3. Spotlights
    By in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 11-07-2002, 04:48 PM
  4. Spotlights
    By NitroGL in forum OpenGL: Advanced Coding
    Replies: 8
    Last Post: 10-15-2002, 09:53 AM
  5. Spotlights
    By jade6 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 02-21-2001, 09:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean