bviale Posted September 22, 2017 Share Posted September 22, 2017 Hello I'm trying to cover the visible area of an element through another. The camera is behind a rectangle, and at the bottom of the scene there is a picture. I'm trying to cover the area of the picture visible through the rectangle with a plane just like this : I've set up the scene with my elements but I have troubles to detect which part of the picture is visible through the rectangle. Maybe I can use BABYLON.Vector3.Project to have a projection of the picture in the rectangle ? That's my only lead at the moment to obtain a point based on the camera position. Do you guys have any idea of how I can achieve this ? Here is my playground so far : https://playground.babylonjs.com/indexstable#QQNCWU Thank you Quote Link to comment Share on other sites More sharing options...
RaananW Posted September 22, 2017 Share Posted September 22, 2017 My first instinct would be using Rays to all four corners of the transparent rectangle. Check when those rays intersect with the video, and then you have the position in which they intersect on the video mesh itself. Afterwards, it is only a matter of understanding how you need to rescale, but (without really thinking it through) it seems relatively trivial, since you know which corner intersects with it. Of course, I assume that you are always looking from the front of the transparent rectangle. Note - the position from which the ray will be sent should also be calculated. I need to think about this one a bit more Edit 1 - 4 Rays from the four corners of the transparent in using the camera's direction variable will do the trick. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.