Archived

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

Doc Matrix

Disco Ball Lighting Effect

Recommended Posts

Hi, I was wondering what the best option would be for creating disco-ball like lighting effects. There are two types I want to implement, one which is the classic disco ball of a ball made of a mosaic of mirrors, shining little square dots around the room. The other is like a light globe encased in black plastic with circular sections cut out of it which spins, giving the effect of round circles flying around the room. Where do I need to look to implement this sort of effect? Any tips appreciated!

Share this post


Link to post
Share on other sites
Only thing i can think of is something similar to the shadow volume effect (look it up if you are not familiar with that), but instead of shadow volumes you use "lightbeam volumes", a kind of rays coming out of your disco ball location. Then instead of darkening the shadows, you lighten the points where the rays hit the geometry.
Probably quite an expensive way to do it (though a lot less expensive than actual shadow volumes - your ''shadow'' geometry is much simpler).

Share this post


Link to post
Share on other sites
As Ingenu said use projected textures. Make a cubemap that represents the color of light coming from all directions from your lightsource. Then in your shader generate texture coordinates: Texcoord.xyz = VertexPos - LightPos, and in your pixel/fragment shader (or texture combiners or whatever you use) simply do LightClr*LightAtten*CubeMap. Thats it.

Oh yeah, don't forget to turn on texture clamping for your cubemap texture...


[edited by - blue_knight on November 18, 2003 1:11:24 PM]

Share this post


Link to post
Share on other sites
Projected textures sounds like a good idea, but to get a nice round spot of light on the surface, wouldn't that surface need to be quite highly tesselated?

For instance, if I just had a big box made of 6 faces, with my disco light in the center, would I get nice round spots of light on the walls using that approach?

Update: Also, wouldn't this approach restrict the number of lights I can use? Assuming I model the disco ball as a bunch of lights all pointing different directions from the one point, wouldn't I need to apply this texture method for each of those light sources, and hence need to use some form of multi-texturing? If so, wouldn't I be restricted by the number of texture units on the card as to how many lights I can have?

Thanks for the discussion!

[edited by - Doc Matrix on November 18, 2003 9:27:11 PM]

Share this post


Link to post
Share on other sites
Your in luck, i have 3d game engine design book right here that talks about it.

quote:


...


3. The disco ball is a tesselated sphere with base texture given by the third texture in the second row. The fourth texture in the second row is applied as an environment map in the multitexturing system. The environment map as generated by capturing a rendered image of only the dance floor and walls, then distorted so that the application of the environment map is spherical.

4. The disco ball is rotated at a slow rate. The light dots on the walls and floor are generated by a projected light system using parrallel projection. The dots themselves rotate at the same rate as the disco ball.

...





Hope that helps, sounds like some heebee jeebee just describing the image it has of this disco scene, the rows and columns of textures refer to this grid of images in the book. Sorry i dont have a scanner.

Share this post


Link to post
Share on other sites
Using the projected cubemap method provides color information at the texel level, so the color is independent of tesselation level. What about shading and attenuation? You have 2 options, calculate these values at the vertex level or use a per-pixel dot product and per-pixel attenuation. At any rate, even with vertex level shading and attenuation, you will still get the nice round spots (if thats what you have in your texture). Remember the texcoord calculation is at the vertex level but the fragment data is retrieved from the texture which (since the interpolated values are linear) makes the color information from the lighting dependent on texture resolution not vertex resolution.

Share this post


Link to post
Share on other sites
If you actually do want to use multiple disco balls (the need for this seems a bit distant) you will have to use multipass techniques if your card has too few texture units. There''s not much you can do about it. There''s certainly no quick and easy way to achieve the effect other than using cube maps, which should be pretty simple to implement.

- JQ

Share this post


Link to post
Share on other sites