Hello! The title pretty much says it all.
Anyone have ideas? I’ve achieved the effect using multiple cameras but that seems like a really inefficient way of doing things. There must be a way to do this with a shader.
Thanks!
Hello! The title pretty much says it all.
Anyone have ideas? I’ve achieved the effect using multiple cameras but that seems like a really inefficient way of doing things. There must be a way to do this with a shader.
Thanks!
Maybe you want to have an object that cuts a hole to the skybox?
In that case, you might want to have a skybox camera and a main camera.
Then use a depth mask shader on the object.
Here is the depth mask shader from Bob Berkebile
Shader "Depth Mask" {
SubShader {
Tags {"Queue" = "Geometry-10" }
Lighting Off
ZTest LEqual
ZWrite On
ColorMask 0
Pass {}
}
}
In my screenshot, I have 2 cameras at the same location.
Main camera has Depth: -1, Clear Flags: Depth only, Culling Mask: Everything except background.
Skybox camera has Depth: -2, Clear Flags: Skybox, Culling Mask: Background.
The sphere has the depth mask on it. Anything behind the depth mask objects won’t be rendered except for the background layer.
Another way to do this is to use front culling.
According to the reference manual, Cull Front: Don’t render polygons facing towards the viewer. Used for turning objects inside-out.
Shader "Custom/FrontCull" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
Pass {
Cull Front
SetTexture [_MainTex] {
ConstantColor [_Color]
Combine Constant * Texture
}
}
}
Fallback "Diffuse"
}
This way is much simpler but I don’t think this is what you’re looking for.
Hey everyone! Figured it out finally. Here’s a blog post I just wrote on how I did it.
http://blog.polycrime.com/post/81848506548/how-to-cut-a-hole-through-geometry-to-the-skybox
when i use this it works. but if i move the camera it just breaks the effect altogether. do you know a way around this so i can move the player with it keep rendering the skybox behind the object?
nevermind i fixed it