Is there a way to get something rendered with opaque alpha cutout clip but have the final output of it like %20 transparent ? And possibly use multiple passes on the same mesh that has %20 final transparency but with different UVs and stack them all together ?
I made a photoshop example to demonstrate it. The example above is the typical cutout shader. The example below is the same cutout shader with the same texture thats sampled with different vertex positions and blended with āOVERā 8 times. Iām not sure if itās possible to do it with a single material but is it possible to do it with editing the shader code of an alpha-clipped shader ?
Transparency and alpha cutoff are different rendering method.
They are separated. I think what you want is overlay blending.
For real-time changeable transparency value. Yes, a custom shader.
You can check out Shader Forge on Asset Store.
Itās easy to use to customize your own shader.
For fixed transparency value.
You can just do it on texture with greyscale alpha channel.
I use Shader Forge and asked Ace about it, although he said there might be a possible way and he didnāt really know about it. I think overlay blending requires the mesh to be written as transparent, otherwise it will render opaque and write whatevers below the render queue.
Thereās nothing really preventing alpha test and transparency from working together, especially not with modern shaders. Alpha test in modern shaders is just a clip() or discard() in the shader and can be done on any data in the shader, itās just that historically this has been the same data that eventually gets output from the shader as alpha. For old fixed function shaders this was absolutely the case and there was no way to separate the two. Now you can just call clip in the shader at one place, say from the modelās world space coordinates, and output a completely separate alpha for the final color. I didnāt know if Shader Forge lets you have outputs to both Opacity and Opacity Clip, but it should. Even many of Unityās default transparency shaders had a hardcoded AlphaTest 0.01 as an optimization.
The main problem is when people talk about alpha test theyāre thinking about alpha test with Zwrite, which is the most common usage. Zwrite with alpha is pretty rare as it can cause some peculiar artifacts, so using alpha test with transparency with Zwrite can lead to those same oddities even though the issue has nothing to do with alpha test itself.
Oh yeah, there will be some inevitable artifacts with lowering the final cutout pass transparency such as full strength shadows despite the low transparent surface or problems like deciding which pass to use the Z depth from among the samples. Although these are easily fixable by disabling the shadows on the multipass materials and just using one of the passes depth for approximation, which will also help to go easier on the calculation. When you go through the Frame Debugger in Unity, you can see the entire material is written in a single pass on top of whatevers underneath with correct Zdepth and none of the sorting issues. And the only thing to do is to write it with a lower alpha value. Theoretically this is a very simple modification of the generic alpha-clip shader, the only question is how to edit it.
The aim of this shader is to achieve the soft fuzzy look of fabric or hair like materials with minimum processing time. The beauty of this method is that it doesnāt deal with any transparency issues and rather uses multiple samples of a relatively cheap shader. Here is another example of how it would look. Ofcourse itās not perfect but even a 4 times sampled render gives quite a fuzzy look that materials like hair and rug has.
not sure if it will work for what you are trying to achieve, just some planes with some random texture off google with hair shader. For your case, probably just use the alpha technique in the hair shader minus all the anisotropic code.
The hair script from blacksmith ? It looks quite good on the sample scene but sometimes it causes odd drawing order issues depending on the mesh. Also they donāt write to the Zdepth so they will have issues with other post effects that depend on the scene depth.
my 2 last posts got deleted because āattempts must be made to solve the problem before advertisingā. So there is my attempt above. So I mean my hair shader (on the asset store) ā¦ In a wrap the shader has two passes it uses Alpha Blend for the edges and Alpha Cut for the majority of the object. You can get small sorting issues, but they are usually not too noticeable.
Yeah I had the same error when posting today as well. Might be a bug.
Yep, the hair shader you showed works like the soft edge transparent right ? I know itās quite optimized to create the soft feathery edges with a very small sacrifice. But I need to be able to render highly transparent objects that are below the 0.5 cutout range as well, in where that method gives you too much artifacts.
Wouldnāt you know how to write multiple passes of opaque meshes as transparent ? :\
Hmm I cant really think of a good solution with out running into a full depth sorting scenario.
Maybe you could do it with a full screen effect ? or maybe try using the particle shaders?
Is this for a grass like effect like the 1st screenshot ?