From: David S. <dsc...@vy...> - 2001-04-04 18:54:18
|
> >> Is it possible to modify the source such that one of the lights is a > >> spotlight? I am wanting to model placing a narrow beam on an object. > > >No, sorry. This could be added to cvisual using >projective > texture mapping, > >but that's a completely different technique from >normal lighting. > > The reason I asked the question as a lighting question is that I > know OpenGL has a spotlight capability that lets the user specify > the half angle of the light source, making it into a spotlight. > I was hoping that a similar capability might be addable / > klugeable (if I were to code it) to VPython. The first problem is that cvisual currently only uses OpenGL for rasterization, and does its own lighting calculations. This approach was chosen primarily to improve accuracy when rendering scenes with very small or very large scales, which is common when doing physics with real units. It improves speed on slower systems, but actually slows things down on fast rendering hardware. You could implement exactly the same effect in visual, but the rendering quality will not be great. OpenGL lighting, including spotlights, are calculated at each vertex rather than at each pixel. Shining a "narrow beam" on a low-polygon model, as you want to do, will produce pretty severe artifacts. Projective texture mapping, in which a texture of a circular spotlight is mapped onto the model with an appropriate blending mode, is a much higher-quality way of rendering a spotlight. However, implementing it will require some work - it will have to be added to each primitive. Dave |