Hi, I’m pretty new to shaders and I only really have experience with surface shaders in Unity.
Basically, I want to have a cutout-like effect dictated by a secondary texture’s alpha but instead of not drawing a pixel I’d like to instead draw another texture. Right now I can the first part but the second part eludes me.
Whenever I tried that I could only seem to figure out how to draw the third texture when the secondary texture, used to sample alpha value, had alpha. I couldn’t achieve the cutout-like effect no matter what I tried.
This is the desired look:
But that is currently achieved by duplicating the mesh and having two different materials on each. I cannot figure out how to achieve filling out cutout-like alpha effect with the lava-like texture.
There I use a black and white blending texture. If the pixel is white th second texture is used and if the pixel is black the the main texture is used. This may not be the solution but I think it’s better than the if statement.
Hmmmm, well I don’t necessarily want to use the emission texture based on a white or black pixel or alpha directly. I need an alpha cutoff-like effect so that I can finely control the amount of cracks in my lava cracked rocks seen here: https://i.gyazo.com/b5dc1b889c923d08e116df8099a4d730.mp4.
The question I face now is if I were to find a way to remove the if/branch would it be more efficient? I’d have to do a texture lookup all the time for the emission texture.