silly lighting idea
Blitz3D Forums/Blitz3D Programming/silly lighting idea
| ||
If you wanted to move a torch in a dark room with the mouse in first person: you could just draw black pixels to the screen everywhere but an area around the mouse cursor, would this be slow? |
| ||
why would you not just make your ambient lighting very low and a very bright light inside the torch object - that would be more realistic. Why would you draw black pixels to the screen everywhere anyway - then it would be . . . BLACK. You would need some alpha transparency to see through the black - not a good idea. |
| ||
I guess it would be very slow. For a torch you could use a DX light (CreateLight) with a very small radius. You could then use some random brightnesses (using the color of the light) for the light each loop to make it look flickering. For a headlight you can use a DX light too, together with a linepick. Simply pick the geometry the lamp is pointing to and position the light at pickedx/y/z. Of course, these lights don't cast shadows. But they look pretty good nevertheless, in a dark room with low ambienttlight. |
| ||
1. Make a quad that is so big it covers the whole screen and then some. 2. Parent this quad to the camera. 3. Texture the quad with a texture that is black at the edges with a circle of brightness in the middle. 4. Set texture when loading to enable U and V clamp. 5. Set quad to multiply blend. 6. Scale texture down until circle of light is at desired size. 7. Use mouse cursor position to adjust texture position. This will move the circle with the mouse cursor. That's your basic 2D flashlight. But just parenting a spotlight to the camera would look more realistic. |
| ||
Or have a look at this code :- http://www.blitzbasic.co.nz/codearcs/codearcs.php?code=1000 |
| ||
I would, if it weren't in a 1 point typeface. :-) |
| ||
Yeah, I get that sometimes.. Go here... www.blitzbasic.com/codearcs/codearcs.php?code=1000 |