0

I am trying to achieve a slanted divider effect with WebGL. The desired outcome is something like a view with 1 interactive divider (slanted) at the middle that allows the user to drag and view a mountain terrain with different colours.

The effect should look like this: slanted draggable divider

I have experimented based on a few examples I found online, but both methods used THREE.WebGLRenderer.setScissor() for the effect, and the results are rectangles.

May I know what are the alternatives to achieve the effect? Stencil buffer and masking? Better THREE.Camera setup? glViewport?

I have tried using react-three/drei's View and changing the CSS clip-path property, but it seems to stay rectangular.

Examples:

SetScissor implementation in the examples:

  renderer.setScissor(0, 0, splitPos, sizes.height);
  renderer.render(sceneL, camera);

  renderer.setScissor(splitPos, 0, sizes.width, sizes.height);
  renderer.render(sceneR, camera);
Rabbid76
  • 202,892
  • 27
  • 131
  • 174
KN Lim
  • 1
  • 1

0 Answers0