Check out this JSFiddle demonstration of a bat-signal inspired spotlight effect.
Creating realistic lighting and shadows in a 3D environment can be quite challenging due to the numerous parameters involved. Adjusting these parameters correctly is essential to achieve the desired visual effects. One handy line of code that can help you in this process is:
light.shadowMapVisible = true;
Light objects themselves are not visible in the scene. To make a light source like the sun visible, you need to create both the light source itself and an object to represent the sun. Without a surface for the light to shine on, the light will not be visible. In the example provided, a sphere acts as the surface for the light, and a yellow transparent cone simulates the light beam. Adding textures to the cone can enhance the realism of the effect.
In a real-world setting, light beams are visible due to reflections off particles in the air. In a 3D environment, these particles need to be explicitly created, hence the use of the cone to mimic the effect. Good luck in your lighting experiments!
Here are some helpful tips:
Remember that there are different types of lights, each with its own characteristics such as shadow casting abilities and material compatibility.
The renderer in your 3D environment has a "maxLights" parameter set to a default of 4, so keep this limit in mind when adding multiple light sources.