Re: Adding quite a lot of lights in a Managed direct x application
From: Philip Taylor[ATI] (ptaylor_at_online.atitech.com)
Date: Tue, 4 May 2004 21:38:33 -0700
I had a sample on the MSDN DX site that showed how to do "virtual lights" by
rendering only the 8 closest to the object.
"Arnau" <email@example.com> wrote in message
> Thanks for the replies!
> I'll take a look at the 3rd and 4th options, as they look the best for me.
> "ZMan" <news-replies@thezbuffer> ha escrit en el missatge dels grups de
> > Your card is not unusual - all cards have limitations like this an 8 is
> > common. There are no cards which will support enough lights to do what
> > want becuase the sheer amount of calculations would take too long and
> > framerate would suffer.
> > Several options for you:
> > 1. Determine which lights affect the current view and use the closest 8.
> > a good option if you can see more than 3-4 at a time becuase lights will
> > turn on and off as you walk about and will be an odd artifact.
> > 2. If you write your own vertex or pixel shaders you can do all the
> > calculations yourself but you will probably hit a limit of instructions
> > before you get more than 8 lights.
> > 3. Use light maps. What you do here is pregenerate or edit a texture
> > looks like the pattern your street light would cast on the static
> > around it. Then you add this texture in over the top of your existing
> > textures. The problem with this approach is that other dynamic objects
> > pass into the light will not change unless you dynamically generate
> > for them or use a projected texture approach. One nice thing here is
> > you can pregenerate shadows into the texture also and save yourself
> > complicated shadow algorithms - once again though doesn't work well with
> > dynamic objects.
> > 4. If your lights have limited range you could split your scene up into
> > small blocks, each with 8 lights and render each block individually.
> > need to be real careful about pushing geometries and textures to the
> > keep this optimal though.
> > ZMan
> > "Arnau Font" <firstname.lastname@example.org> wrote in message
> > news:uu7jRjSMEHA.3696@TK2MSFTNGP09.phx.gbl...
> > > Hi,
> > >
> > > I'm writing a game that is located in a city. The view is sim city
> > > alike, but in 3D and much nearer to the ground. I was planning to add
> > > the
> > > scene some street lights, but my graphics card has a limitation of 8
> > > lights
> > > at the same time, and, probably, in a city there will be some more
> > > that!
> > > How can I light the rest of streetlights? With vertexs shaders? Has
> > > anybody
> > > got any example?
> > >
> > > Thanks!
> > >
> > > Arnau.
> > >
> > >