How to ensure that a light doesn't lit walls behind corner?
Ad
Good day, I'm playing with webgl using Babylon JS and I need an advice concerning lights. I created a test cave and I placed a torch (BABYLON.PointLight) on one wall. But the light lits also walls that is behind the corner. See screenshot:
var light = new BABYLON.PointLight("light1", new BABYLON.Vector3(x, y, z), scene);
light.intensity = 0.5
light.range = 50;
The cave is not a single mesh but it's made of individual rectangular faces. How can I ensure that the lit doesn't lit walls behind the corner please?
Thank you in advance. Vojtech
Ad
Answer
Ad
Lights only colors pixels based on the direction from the pixel to the light, the normal (surface angle) of the pixel and the viewing direction. Thus, lights by themselves do not taken into account whether the light source actually reached the pixels and that must be calculated separately with a shadowing algorithm.
Ad
source: stackoverflow.com
Related Questions
Ad
- → How to update data attribute on Ajax complete
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → Octobercms Component Unique id (Twig & Javascript)
- → Passing a JS var from AJAX response to Twig
- → Laravel {!! Form::open() !!} doesn't work within AngularJS
- → DropzoneJS & Laravel - Output form validation errors
- → Import statement and Babel
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM
Ad