# "Clipping cuboid" to remove rendererd output from an area?

**URL:** <https://forum.babylonjs.com/t/clipping-cuboid-to-remove-rendererd-output-from-an-area/11161>\
**Category:** Questions\
**Created:** [May 26, 2020, 10:03pm UTC](https://forum.babylonjs.com/t/clipping-cuboid-to-remove-rendererd-output-from-an-area/11161 "2020-05-26T22:03:51Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [May 26, 2020, 11:36pm UTC](https://forum.babylonjs.com/t/clipping-cuboid-to-remove-rendererd-output-from-an-area/11161/2 "2020-05-26T23:36:31Z")

</div>

Yes, do a post process that gets passed the camera data and has a method to establish a a cubes bounding. do a raycast to establish if the point is inside your cube and if it is render out the scene data otherwise render the clear color.

Let me see if I can get you an example at some point. Im on my phone so it would be hard right now.

_Update_ something like this, but just the part that establishes the 3d cube in space.

> [@Struggling to Convert Global Position to Shadow Map position](https://forum.babylonjs.com/t/struggling-to-convert-global-position-to-shadow-map-position/6936):
>
> I am trying to get a global position to the shadow map uv position for a ShadowGenerator Texture. float sampleSunShadow(vec3 pos){ vec4 posFromSun = vec4(pos, distance(sunPosition, pos)); vec3 clipSpace = posFromSun.xyz / posFromSun.w; vec2 uv = 0.5 \* clipSpace.xy + vec2(0.5); if (uv.x \< 0. || uv.x \> 1.0 || uv.y \< 0. || uv.y \> 1.0) { return 1.0; } return texture2D(sunShadowMap, uv).x; } This is what I am currently doing, but it seems to n…

---

_[View the full topic](https://forum.babylonjs.com/t/clipping-cuboid-to-remove-rendererd-output-from-an-area/11161)._
