I'd like to have my player's prefab in the the top corner of the screen within a circle I've made. I have no issues showing the prefab within a render texture but it seems my Mask Material (under Combatants > Combatants > Portraits) isn't masking the render texture properly within a circle maks I made.
What should the settings for the Mask Material be shader-wise and image-wise? I've tried different images (no alpha, with alpha, b/w, inverted, etc.) and different shader types for the Mask Material to no avail yet.
Congratulations, you've found a bug :D It's an issue when showing a portrait as a HUD element, which ignores the mask material.
Will be fixed in the next update :)
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
I'm back messing with prefab portrait masks and have had a great deal of trouble with this.
Only through a lot of trial and error did I get a material/shader combo to seem to actually mask the prefab camera and it was by using accidentally trying a material that has an unlit dissolve shader. The shader uses my mask texture as the alpha and when the dissolve is applied I get the mask shape I want.
All other sprite or UI materials seem to ignore any alpha masks of any sort whether they're grayscale or actual alpha channel. I've tried a variety of sprite alpha settings, material combinations, etc.
Is there a specific material/shader like UI/Default, UI/Unlit/Transparent, Sprites/Default, etc. or setting I'm overlooking here?
Hm, I'm not really a shader expert, but you can't use just any shader for a mask material (AFAIK).
Post edited by gamingislove on
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
For anyone needing custom masks for Prefab Views, this simple shader works as an alpha mask when applied to a material then dropped into the Prefab View settings.
It's an issue when showing a portrait as a HUD element, which ignores the mask material.
Will be fixed in the next update :)
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Only through a lot of trial and error did I get a material/shader combo to seem to actually mask the prefab camera and it was by using accidentally trying a material that has an unlit dissolve shader. The shader uses my mask texture as the alpha and when the dissolve is applied I get the mask shape I want.
All other sprite or UI materials seem to ignore any alpha masks of any sort whether they're grayscale or actual alpha channel. I've tried a variety of sprite alpha settings, material combinations, etc.
Is there a specific material/shader like UI/Default, UI/Unlit/Transparent, Sprites/Default, etc. or setting I'm overlooking here?
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
I was assuming the prefab view works like a standard canvas Image object with the Mask script attached like below.
However, since it's a Raw Image from a Render Texture, it must use a Material that has a shader with the right alpha setup apparently.
Shader "MaskedTexture"
{
Properties
{
_Mask ("Culling Mask", 2D) = "white" {}
_Cutoff ("Alpha cutoff", Range (0,1)) = 0.1
}
SubShader
{
Tags {"Queue"="Transparent"}
Lighting Off
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
AlphaTest GEqual [_Cutoff]
Pass
{
SetTexture [_Mask] {combine texture}
}
}
}