Create sky wall textured

Hello,

For make my problem simple i created for you an example (capture example bellow).

I have a blue box and on a top 4 red walls containing a green ball. So i want to make all the red box invisible from the exterior with his content for the user (like there is only the sky). So the only way to see the green ball is to enter in the walls. How i can do it ?

In practice, i want to do it to make a house with 3 floors but when you are outside you see only 2 floors (this will confuse the user a lot).

Confusing indeed. It get the feeling you want to hide the green parts behind the red parts while the red parts always remain invisible. I have no idea what the sky has to do with that, but alright.

It can be done in a few passes in this order:

  1. Draw the green parts only to the z-buffer with color write off (makes sure red parts behind green parts don’t hide the green parts)
  2. Draw the red parts with z-test, but without z-write or color write and while marking the stencil buffer (marks where an object is behind the invisible red parts)
  3. Draw the green parts as usual, but not where the stencil buffer is marked (skips where invisible red parts are in front)

Thanks for helping me,

I’m new on unity 3d and i don’t understrand what i need to do :confused: if i want to know how to do this it’s because i’m working on the script of a project and this thing can change many part of the script so i need to understand how to do it.

So simply i re-explain with a basic example :

Try to imagine that this things is a house (i know i forgot the roof side tiles ^^). So on the top of the roof, there is a box white with in a green ball. You can see in the background the sky so i want to create the illusion that there is nothing on the roof.

If my walls are invisible so i will see what is in this box, so i need to make the white box like the sky. but if i use a simple texture, by the different angles the user will see that this is a box.

I searched on youtube some tutorials to do this illusion but i didn’t found one.