Allow directional lights to automatically follow shadows#5025
Allow directional lights to automatically follow shadows#5025dmarcos merged 6 commits intoaframevr:masterfrom
Conversation
|
TODO: Update renderer docs and update material docs |
|
Can we break exposure and auto shadows in two PRs? Sorry for the extra work. It will make for a more clear changelog and easier to debug in the future if there are any issues |
|
sure, i'll leave this one for shadows and make a new one for exposure related bits |
81ec901 to
59d8a5f
Compare
| target: 'light.target', | ||
| envmap: 'light.envMap' | ||
| envmap: 'light.envMap', | ||
| 'auto-shadow-cam': 'light.shadowCameraAutoTarget' |
There was a problem hiding this comment.
camel case for consistency with property names convention and probably avoid shortening automaticShadowCameraTarget makes sense?
c83d7e8 to
8351215
Compare
|
I updated the name to be |
src/components/light.js
Outdated
|
|
||
| var probeCache = {}; | ||
|
|
||
| function distanceOfPointFromPlane (positionOnPlane, planeNormal, p1) { |
There was a problem hiding this comment.
Maybe factor out into utils/math.js to keep this tidier.
src/components/light.js
Outdated
| this.updateShadow(); | ||
| }, | ||
|
|
||
| tick: (function tickSetup () { |
src/components/light.js
Outdated
| var sphere = new THREE.Sphere(); | ||
| var tempVector = new THREE.Vector3(); | ||
|
|
||
| return function tick () { |
src/components/light.js
Outdated
| var tempVector = new THREE.Vector3(); | ||
|
|
||
| return function tick () { | ||
| if ( |
There was a problem hiding this comment.
anyway to simplify this condition and do an early return for readability?
if (XXX) { return; }
| <html> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <title>Hello, World! • A-Frame</title> |
There was a problem hiding this comment.
Hello, AR World! perhaps to differentiate
| <head> | ||
| <meta charset="utf-8"> | ||
| <title>Hello, World! • A-Frame</title> | ||
| <meta name="description" content="Hello, World! • A-Frame"> |
src/utils/math.js
Outdated
| * @param {THREE.Vector3} p1 point to test | ||
| * @returns Number | ||
| */ | ||
| function distanceOfPointFromPlane (positionOnPlane, planeNormal, p1) { |
src/utils/math.js
Outdated
| * @param {THREE.Vector3} out where to store the result. | ||
| * @returns | ||
| */ | ||
| function nearestPointInPlane (positionOnPlane, planeNormal, p1, out) { |
There was a problem hiding this comment.
pointToTest instead of p1
resultPoint
|
Fixed, sorry for the delay. |
|
Thanks so much for the patience! I really appreciate. This is awesome work. Thanks soooo much! Have a nice wekend. |
Description:
To make AR look believable it really helps to have tone mapping and have shadows that show on the real floor.
Unfortunately when you place an AR object it's easy to leave the region covered by the shadow map. This PR adds the ability to
allow the light's shadow map to automatically follow a particular 3D model to ensure it always has a good shadow.
Changes proposed:
shadowCamAutoTargetto light for Directional lights andauto-shadow-camto<a-light>In the image above both Torus Knots are pure white but the one on the left has
toneMapped:falseto still displays brightly.There is a link to the live demo so you can see how the AR looks: https://ada-aframe-test.glitch.me/
The example included in this relies on #5029