Hey guys, thanks for taking to time to read this. For context, I’m making a 2D game.
TL;DR: I’m looking for a simple unlit shader that will perfectly merge two textures, with full transparency, without any “blending” (or alteration of either texture).
My situation is this. I have two camera’s, my main camera and a camera for a game overlay (like a HUD). These camera’s will both produce a render texture that I want to merge together on one material. There’s a third camera that’s putting the contents of this material on the screen.
I’ve been banging my head against a wall trying to come up with a shader that will merge these two camera’s render textures perfectly. The main camera’s render texture isn’t an issue but the overlay texture contains both partial and full alpha transparency.
The simple “2 Alpha Blended Textures” example for this page in the docs works almost perfectly except for the fact that the partially transparent elements (drop shadows on the like) aren’t showing up at all.
Shader "Examples/2 Alpha Blended Textures" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_BlendTex ("Alpha Blended (RGBA) ", 2D) = "white" {}
}
SubShader {
Pass {
// Apply base texture
SetTexture [_MainTex] {
combine texture
}
// Blend in the alpha texture using the lerp operator
SetTexture [_BlendTex] {
combine texture lerp (texture) previous
}
}
}
}
As somebody who wouldn’t exactly call himself a shading expert, any edit I’ve tried to introduce has only brought me farther away from the solution. Any help or insight is very much appreciated. Thanks!