- Home /
Camera: Possible to render partial skybox with no background color fill?
Hi! So, I'm using some stencil tricks in my game to achieve a "portal" window effect, like so:
(a front and back view)
This part works fine. It's the work of two shaders: a "Portal" shader which looks for objects with its same stencil buffer ref number and reveals them, and a "Hidden" shader which hides stuff unless it's seen through an object with the "Portal" shader.
One thing I wanted to do was have a different skybox visible through the window as well. So, I made a custom skybox shader and added the same "Hidden" shader code to it. And it... sort of works!
The skybox is only visible through the window, which is what I want. But... anywhere the skybox isn't drawn, we've got the camera's background color. I can't for the life of me figure out how to get rid of this.
Having another camera at a lower depth with a different skybox was the plan - but that background color draws over everything. Is there any way to render only the bit of skybox that's visible and not fill the rest of the screen with background color? I get the feeling this is one of those "that's not how it works" situations, but I may as well ask.
I don't wanna make this post TOO huge, so I've popped the shader code into a pastebin here in case it helps: http://pastebin.com/n8nDtH7p
This is kind of a weird edge case and I'm still super inexperienced so I don't really know where to start when it comes to cracking this nut. Any help is appreciated!
Your answer
Follow this Question
Related Questions
Dynamic Skybox 2 Answers
Is there any way I can create a triangle shaped camera view? 1 Answer
Skybox blending 2 Answers
Represent Land 3D Area End 0 Answers