I’m trying to implement matcap shader from this reference clicktorelease.com/blog/crea … ing-shader
I copied and modified litSolid shader and changed the cubemap, so it map to the sphere on emissive texture( because env unit is cube). Here is modification of fragment shader:
I’m not sure how to integrate this. Because the environment sphere can’t be set to env texture unit because it is cubemap, so I used emissive texture for that.
Just modify ENVCUBEMAP defines in LitSolid shader like below and set your matcap texture google.pl/search?q=matcap to emmisive texture unit. Then you can use DiffEnvCube.xml technique in editor to see the effect.
Here are modifications.
vertex shader
#ifdef ENVCUBEMAP
vReflectionVec = normalize(worldPos-cCameraPos);
#endif
fragment shader
Yeah it works alright. Thanks for sharing szamq. I spent a few hours trying to figure out to get this into its own technique. The exercise was just what I needed to starting to understanding how the render passes work. I think I can package it up so its easier to use. It will take me quite a while longer to get all of the useful permutations figured out.