XRay Shader: How was it created?
Posted: Mon Aug 06, 2018 12:44 pm
Hey there,
I am a little unfamiliar with the higher skills of shader programming, so apologies if I am asking some very basic questions:
So, I've just updated ASE, and found the XRay sample. We're working on an XRay system in our game, and we're going to use the standard Unity route of using replacement shaders; however this looks like an interesting and easier solution.
However, because there's no documentation yet, I am left with some questions how this is implemented:
1) The vertex outline is only rendered when the Z value in the depth buffer is closer than the z of the fragment. However, I can't find any logic which actually tests this - is this a property of the outline function itself?
2) Would I be able to replicate this if I wanted to create something entirely custom? (For example, generate a color gradient for the mesh based on fragment height; and only show that on parts that are behind the current z buffer value.)
3) I was under the impression it wasn't possible to create multi-pass standard surface shaders yet. The .shader file contains multiple cg programs, but not passes. How exactly was this achieved?
My end goal is to take Unity's standard shader and a couple of our own custom ones, add new pass into it like the XRay sample but with our own visuals for about 8+ different shaders. If I can get through to that using ASE rather than hacking our tech artist's shader into existing .shader files that'd be amazing.
Thanks in advance!
Chris
I am a little unfamiliar with the higher skills of shader programming, so apologies if I am asking some very basic questions:
So, I've just updated ASE, and found the XRay sample. We're working on an XRay system in our game, and we're going to use the standard Unity route of using replacement shaders; however this looks like an interesting and easier solution.
However, because there's no documentation yet, I am left with some questions how this is implemented:
1) The vertex outline is only rendered when the Z value in the depth buffer is closer than the z of the fragment. However, I can't find any logic which actually tests this - is this a property of the outline function itself?
2) Would I be able to replicate this if I wanted to create something entirely custom? (For example, generate a color gradient for the mesh based on fragment height; and only show that on parts that are behind the current z buffer value.)
3) I was under the impression it wasn't possible to create multi-pass standard surface shaders yet. The .shader file contains multiple cg programs, but not passes. How exactly was this achieved?
My end goal is to take Unity's standard shader and a couple of our own custom ones, add new pass into it like the XRay sample but with our own visuals for about 8+ different shaders. If I can get through to that using ASE rather than hacking our tech artist's shader into existing .shader files that'd be amazing.
Thanks in advance!
Chris