- Home /
(Non-Euclidean) Overlapping Textures with Multiple Cameras Problem
Hello~
I have a big problem with displaying some overlapping textures the way I want to. I'm creating a 2D Non-Euclidean Dungeon and so because of the logic (or lack thereof) of Non-Euclidean space, some rooms can overlap. Or seem to, at least, thinking in a Linear sense.
And this is where my problem occurs. Because of the overlapping rooms I figured I'd have to have multiple cameras to render them correctly at the correct times. However I'm using 2D Volumetric Lights from the Asset store, and the shaders it uses seem to just merge the object with the 2D Light mesh at render, which means that as long as there is a light over the space of an object, the later cameras will render it, regardless of what layer the light that was rendered was on... as shown here:
In this image you can see from the first room into the room drawn by LayerCamera1. Everything looks fine and great.
This is the room drawn by LayerCamera2 (which draws before 1, sorry for silly naming conventions there). Here you can see that it renders 2, then draws the first room over it when LayerCamera1 draws.
Even though the camera itself can see nothing, it merges itself with what was already onscreen because of the shaders. Which confuses me to all hell, as only the correct light (that's on the correct layer that's visible by the correct camera) can enter it's set room, no other light can, and to me it seems like it's the light shader that does the combining at the end. Oh well, I'm terrible at shaders anyhoo. Here are the shaders as well, by the way:
This is the object shader:
Shader "2DVLS/Diffuse" {
Properties { _MainTex ("Base (RGB) Trans. (Alpha)", 2D) = "white" { } }
Category
{
ZWrite On
Cull Back
Lighting Off
SubShader
{
Pass
{
ColorMask 0
}
Pass
{
Blend DstColor DstAlpha
SetTexture [_MainTex]
{
combine texture
}
}
}
}
Fallback "Diffuse"
}
And this here is the light shader (for the lightmesh itself)
Shader "2DVLS/Light" {
Properties { _MainTex ("SelfIllum Color (RGB) Alpha (A)", 2D) = "white" } Category {
Lighting Off
ZWrite Off
//Tags { "Queue" = "Geometry-10" }
Blend One One
BindChannels {
Bind "Color", color
Bind "Vertex", vertex
Bind "TexCoord", texcoord
}
SubShader
{
Pass
{
SetTexture [_MainTex]
{
Combine texture * primary
}
}
}
}
}
Any help at all would be greatly appreciated! Whether it's pointing out a mistake, suggesting another method or pointing out my idiocy for not using an obvious idea in the first place! Thanks~ :)