Transparent shell in sphere

Good Morning!
I need help with a shader.
I want to create a region of transparency on a sphere, in the shape of a spherical cap:
7700770--964378--dsaasdfsdfa.PNG

This region in red should be transparent.
First I tried to compare the uv with the measurement of the area that will be transparent, but it didn’t work.

if(input.baseUV.x > 1- UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _CorneaAlpha))
    return float4(color , 0);
    else
    return float4(color, 1);

How can I define a transparent shell on my object?

if you invert color, instead of set alpha, does that show up?

is the whole thing rendered transparently?

if not you assign the object two materials in 3D software

  • Solid portion = [geometry]
  • cap portion = [transparent]: Blend SrcAlpha OneMinusAlpha (color 1,1,1,.5)

otherwise the whole thing is transparent then make sure the blend mode supports something like Blend One OneMinusSrcAlpha, which will allow
1,1,1,1 on the solid part = opaque
.5,.5,.5,.5 = 50% transparent

https://www.youtube.com/watch?v=aAczjSvZbGQ

I can reproduce the object’s transparency, but not in the format I want.
I want to make an eye shader, and the transparency would be done on the cornea.
Example:
7701433--964507--17_45_36_372_EyeProcedyralFaceCaustic_Shader_3.jpg

But I don’t think I can do this using just 1 material.

Thanks for the answers!

you can have 1 material but the shader is specialized; Over complexity solving the problem is not advised as well as not optimized since the whole thing is an overdraw*

breaking the eye into portions (provided you are not hitting some drawcall/node limit on the CPU) and using two common shaders are re-usable (and already provided in the engine)

  • if you want 1 mat the entire eye alpha blends, the tint applied to the eye has alpha 1 while the cornea is alpha 0.05. and you still need that iris mesh and some smart UV’s to divide up the solution
    7701457--964555--PXL_20211201_191743011.jpg though alpha can be stored on vertex, no need for RGBA
1 Like