Skip to content

Commit

Permalink
improve format
Browse files Browse the repository at this point in the history
  • Loading branch information
jianhuang01 committed Jul 22, 2019
1 parent f8b549f commit 0352fb9
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions dev-docs/RFCs/v7.x/shadow-for-directional-lights.md
Expand Up @@ -11,7 +11,7 @@ Deck.gl has new basic lighting effect since 7.0, having shadow effects for direc

## Proposal
### API
`LightWithShadowEffect` class is the public interface to create shadow effects, it extends from LightingEffect and has one param.
`LightWithShadowEffect` class is the public interface to create shadow effects, it extends from `LightingEffect` and has one param.
* `lights`(Object): collection of light sources

New layer prop
Expand All @@ -36,26 +36,33 @@ const dirLight1 = new DirectionalLight({
direction: [-10, -20, -30]
});

const lightWithShadowEffect = new LightWithShadowEffect({ambientLight, dirLight0, dirLight1});
const lightWithShadowEffect = new LightWithShadowEffect({
ambientLight,
dirLight0,
dirLight1
});
const deckgl = new Deck({
canvas: 'my-deck-canvas',
effects: [lightWithShadowEffect],
layers: [
// building layer
new SolidPolygonLayer({
// building layer
new SolidPolygonLayer({
enableShadow: true,
...}),
// ground layer
new SolidPolygonLayer({
...
}),
// ground layer
new SolidPolygonLayer({
enableShadow: true,
...})]
...
})
]
});
```
### Workflow
* User creates LightWithShadowEffect which adds shadow modules into default shader modules
* LightWithShadowEffect is passed into deck and create shadow passes based on light directions, there is one shadow pass for each directional light, for now totally two lights are supported
* User creates `LightWithShadowEffect` instance which adds shadow modules into default shader modules
* `LightWithShadowEffect` instance is passed into deck and create shadow passes based on light directions, there is one shadow pass for each directional light, for now totally two lights are supported
* For each shadow pass, layers are rendered to a shadow map
* After all the effects are processed, there is a regular layer rendering pass, shadow maps are used to render the final shadows.

## Limitations
With the current design, the user needs to create LightWithShadowEffect before Deck's initialization, so that the default modules can be modified before layer shaders are assembled.
With the current design, the user needs to create `LightWithShadowEffect` instance before Deck's initialization, so that the default modules can be modified before layer shaders are assembled.

0 comments on commit 0352fb9

Please sign in to comment.