Skip to content

Conversation

@gchoqueux
Copy link
Contributor

@gchoqueux gchoqueux commented Oct 9, 2025

WARNING : There’s still unresolved bugs:

  • tiles disappear because of an improperly initialized bbox.
  • Opacity, vibility and effects haven’t been reconnected yet.

Description

Replace all textures array by just 2 textures, map and displacement map. All array textures are flatten in these maps.

Motivation and Context

  • removal of the layer count restriction
  • code simplification
  • first step :
    • to replace LayeredMaterial with any Three.js materials
    • to support any raster re-projection

@Desplandis
Copy link
Contributor

Desplandis commented Oct 10, 2025

Could you open a proposal for this PR? Describing what problem you want to resolve and explain your solution. =)


rtCache.set(textureSetId, renderTarget);
} else {
drawMap(renderTarget, tiles, renderer, extent);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're caching the render targets, what is the use of redrawing their textures every time we access them? Am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's temporary. I'll add a mechanism to update the texture and parent texture when the opacity changes.


drawMap(renderTarget, tiles, renderer, extent);

rtCache.set(textureSetId, renderTarget);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was caching array render targets instead of array textures because it was impossible to extract the textures from the RTs and manage their memory separately, but maybe now that you're using simple render targets, this becomes possible and we can just maintain a cache of textures directly, and only use one RT for everything?

Copy link
Contributor Author

@gchoqueux gchoqueux Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, There might be a problem with the framebuffer linked to the render target
To try

renderer.setRenderTarget(previousRenderTarget);
renderer.setClearAlpha(a);

return renderTarget;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The returned value is not used anymore and the documented type is now incorrect

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's draft PR, it's still evolving, no need for an in-depth review right now

* @param tiles - An array of RasterTile objects, each containing textures.
* @param max - The maximum number of layers for the DataArrayTexture.
* @param type - Layer set identifier: 'c' for color, 'e' for elevation.
* @param renderer - The renderer used to render textures.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be updated

uniform vec4 offsetScale;
uniform float opacity;
const float CTOYL = 20037508.34 / 3.141592653589793 * 0.69314718;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you comment what these numbers represent?

Copy link
Contributor Author

@gchoqueux gchoqueux Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll add some comment

  • 20037508.34 : max projection in speudo mercator
  • 0,69... : Ln(2)

uniforms: {
// This uniform will be updated with each source 2D texture
map: { value: null },
texture_footprint: { value: new THREE.Vector2() },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you comment what these properties represent?

Copy link
Contributor Author

@gchoqueux gchoqueux Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Footprint means the area/extent covered by something on the ground.

  • map: map to project on the ground
  • texture_footprint : texture coverage on ground
  • camera_footprint : camera coverage visible on ground
  • offsetScale: the map portion to be projected

@gchoqueux gchoqueux force-pushed the refacto/oneMap branch 2 times, most recently from 743300c to e40bdb5 Compare November 19, 2025 15:18
@gchoqueux gchoqueux force-pushed the refacto/oneMap branch 3 times, most recently from 6b4f653 to b8f2e2e Compare December 15, 2025 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants