Custom SceneView DrawMode

The beautiful scene is from the asset store package:
RPG Medieval Kingdom Kit by BEFFIO

Screen Shot 2018-06-28 at 21.43.05

Download : https://drive.google.com/open?id=1hloorB11hPcIXIIKBIRzqvon9mpmbYPK
If you are looking for doing it in custom SRP, please visit my github

How to use :
Just add your shaders and names to the CustomDrawModeAsset

Thanks Vlad Neykov for helping me in making this little tool
( This is one of the tools I made during #UnityHackweek )

6 thoughts on “Custom SceneView DrawMode

  1. This does not work in SRP. But we can implement the same thing in the pipeline code:

    Possible pipeline codes:
    //Variables
    private static ShaderPassName passNameDefault =
    new ShaderPassName(“SRPDefaultUnlit”);
    private static Material mat;
    private static FilterRenderersSettings filterSettings;

    //In Pipeline
    DrawRendererSettings drawSettingsDefault =
    new DrawRendererSettings(cam, passNameDefault);
    drawSettingsDefault.SetShaderPassName(1,passNameDefault);
    if (mat==null) mat = new Material(CustomDrawModeAssetObject.cdma.customDrawModes[i].shader);
    drawSettingsDefault.SetOverrideMaterial( mat, 0 );
    filterSettings = new FilterRenderersSettings(true);

    filterSettings.renderQueueRange = RenderQueueRange.opaque;
    drawSettingsDefault.sorting.flags = SortFlags.CommonOpaque;
    context.DrawRenderers(cull.visibleRenderers, ref drawSettingsDefault, filterSettings);

    filterSettings.renderQueueRange = RenderQueueRange.transparent;
    drawSettingsDefault.sorting.flags = SortFlags.CommonTransparent;
    context.DrawRenderers(cull.visibleRenderers, ref drawSettingsDefault, filterSettings);

    Like

  2. Just found this while researching how to add custom draw modes for artists to check their work, so thanks! I did have a question, though: I’ve noticed that when enabled, all the other draw modes (aside from the Shading Mode and custom categories) are unselectable. I double checked your video and noticed the same thing happening there. Is there any way to get them back short of doing a domain reload and ensuring the CustomDrawModeAsset doesn’t get loaded?

    Like

Leave a comment