keplergl / kepler.gl

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
http://kepler.gl
MIT License
10.39k stars 1.74k forks source link

Control 3D lighting settings #606

Open bskrt opened 5 years ago

bskrt commented 5 years ago

Is there any way of controlling the 3D lighting effects? I've been looking into source and found the DEFAULT_LIGHT_SETTINGS var but editing those values don't seem to have any effect on the lighting of e.g. hexbin columns.

Additional question: if DEFAULT_LIGHT_SETTINGS should change the lighting effects, how would I edit the DEFAULT_LIGHT_SETTINGS from my App.js. Let's say if I would like to add a gui to control the individual values.

Thanks!

heshan0131 commented 5 years ago

After upgrade to deck.gl 7, lighting is automatically set by deck. kepler.gl's light setting is not used anymore. The default lights are 2 directional lights

If you want to control the light, you will need to set light effect to Deck.gl and material in Layer https://github.com/uber/deck.gl/blob/master/docs/developer-guide/using-lighting.md

kepler.gl currently doesn't have API for you to control lighting. But we can add one. Given there are 6 different light settings in deck.gl. And different materials in luma for lighting to taken effect The API on kepler.gl set might be as generic as

// set lighting in deck
setLightingEffect(effects: Array<Effect>)

// set material for layer
updateLayerConfig(idx: Number, material: <Object>)
bskrt commented 5 years ago

Thanks for the info @heshan0131. I'm not all that proficient in react, so how would I implement your suggestions, specifically " you will need to set light effect to Deck.gl and material in Layer"?

I get how I would have to set lighting in a deck.gl project, but not how to access those settings in kepler. Right now, I would just hardcode the default settings in de deck.gl module, but that doesn't feel like the right way to do it at all.

Thanks.

heshan0131 commented 5 years ago

yea, let me look into providing a prop on KeplerGl for you to import light settings.

This deck.gl guide explains how to set light effect in deck.gl and its layers https://github.com/uber/deck.gl/blob/master/docs/developer-guide/using-lighting.md

macrigiuseppe commented 3 years ago

Two things you can use to customize deck.gl behavior: