I can make you an example later today or tomorrow.
EDIT: Something like this (obv. untested):
VIEW* depth_view =
{
...
}
MATERIAL* warrior_depth_mat =
{
effect = "warrior_depth.fx";
flags = AUTORELOAD;
}
MATERIAL* warrior_tex_mat =
{
event = "warrior.fx";
flags = AUTORELOAD;
}
var warrior_mat_event()
{
if(render_view == depth_view)
{
mtl = warrior_depth_mat;
return 0;
}
mtl = warrior_tex_mat;
return 0;
}
MATERIAL* warrior_mat =
{
event = warrior_mat_event;
flags = ENABLE_RENDER | OVERRIDE; // maybe try a different ENABLE_... flag here
}
Then your "warrior.fx" file is your current shader and the "warrior_depth.fx" contains a regular depth shader modified with your cropping shader where you just clip if transparent, return depth otherwise. The "samples" and the "code" folders in your Gstudio installation contain examples.