Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] Refractive / Reflective texture #9444

Open
HouleAdrien opened this issue Feb 18, 2025 · 4 comments
Open

[Feat] Refractive / Reflective texture #9444

HouleAdrien opened this issue Feb 18, 2025 · 4 comments
Labels

Comments

@HouleAdrien
Copy link

Target Use Case

Hi, so using the docs and current deck.gl I've managed to make an ocean layer for my terrain.
But right now there is no simple way to get the canvas/frambuffer of the scene with filtering on layers, and this would be a huge help to have something like this to create all kind of effects that uses reflective or refactive textures.
Maybe be this is achievable with multiview but it seems really expensive, and i'm not familiar enough with luma.gl and deck.gl to think of other ways.

Proposal

So my idea was to have two things :

  • a gltexture/image you could get from the deckgl instance that would be of what is in your canvas/frambuffer
  • a filtering function like the layerFilter one that would allow you to filter what is shown in this texture
@ibgreen
Copy link
Collaborator

ibgreen commented Feb 18, 2025

Deck integrates the Luma post processing system which is designed to be extensible and those effects work on the frame buffer.

Ocean / water terrain shaders have long been on the wishlist if you are willing to contribute you might get additional eyes on the code...

@HouleAdrien
Copy link
Author

Okay, I don't know if i'm experienced enough with deck.gl to be a real contributor, but I would gladly help , maybe you could give me a lead, do you know in this how could I render my scene to a framebuffer without creating a second mapView ?
I tried following this but didn't succeed :(

this.deckGL = new Deck({ viewState: { [this.mainMapId]: this.INITIAL_VIEW_STATE, }, layerFilter: ({ layer, viewport }) => { return layer.id.startsWith(viewport.id); }, onViewStateChange: ({ viewState }) => this.deckGL?.setProps({ viewState: { [this.mainMapId]: viewState, [this.secondMapId]: viewState, }, }), controller: true, canvas, onLoad: () => { this.onMapLoaded(); }, layers: [], views: [this.originalMapView], useDevicePixels: false, });

@ibgreen
Copy link
Collaborator

ibgreen commented Feb 18, 2025

Start by reading up on and check out effects in Luma.gl how they are implemented

https://deck.gl/docs/api-reference/core/post-process-effect

@felixpalmer
Copy link
Collaborator

You might want to take a look at RTTModifier & PostProcessModifier and how they can be used to create a layer here: https://github.com/visgl/deck.gl/blob/master/modules/carto/src/layers/heatmap-tile-layer.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants