I want to make it so that a model is not visible when being looked upon through the window, but is visible when looked upon normally. This is similar to topological anomalies usually seen in games such as Portal and Antichamber.
Basicly, a whole room should not be seen when seen from a certain angle - and it should also become translucent so that other models become visible through it, as if nothing was obstructing the path of light.
The one solution I can think of is to raycast the room to the camera and check if the angle matches the defined one, then set all Transparency props to 1. But will it be fast enough? I doubt. Any ways of precaching this?
The other obviously involves using a specific shader, which will basicly do the same but on gpu. But there are no shaders in Roblox yet.
Before reading your second paragraph I was already thinking a raycast. Just check if the respective wall, barrier or whatever is can be detected in front of you, and make the transparency changes on the client side
Raycasting is a solution here but I’m not sure how it would work at certain angles, glass makes transparent objects behind it invisible so you could try that.
An idea that comes to mind is fetching all the parts you plan to change the transparency of once and storing them in an array, that way you won’t have to run GetChildren(), GetDescendants() and IsA() on each iteration. Other than that I think this task is heavily parallelizable so you can take advantage of that as well. For example if you have to change the transparency of 1k parts, you can have 20 threads changing the transparency of 50 parts each all running at once, which will speed up the process.
Lastly you can run a loop and disable some part properties that you may not need(assuming you’re working with anchored parts), like CanCollide, CanQuery and CanTouch.
Another easy trick you can take advantage of is that. Basically you can set the transparency of the parts you’re interested in to a value approximating 1, like 0.9999. So if the window is made out of the glass material the parts will not be shown behind it.