how do you detect if an object is actually rendering using instancing?

instancing breaks when scaled non uniformly
there might be other cases i don’t know where it breaks
how do i see which objects render using instancing?

You can use the frame debugger. Instanced draw calls are labeled as such.

Thanks, that’s when a search field would help a lot.
From combing through the frame debugger I was surprised to find that almost none of the objects were instantiated.
Is there a way to know why instanciation broke?
Example of object, attached shader.

Shader "SG/SG Cutout Grass" {
    Properties {
        _Color ("Color",Color) = (1,1,1,1)
        _MainTex ("Texture", 2D) = "white" {}
        _RimColor ("Rim Color", Color) = (0.26,0.19,0.16,0.0)
        _RimPower ("Rim Power", Range(0.5,8.0)) = 3.0
        _Cutoff ("Cutoff",range(0,1)) = 0.5
        _WaveAndDistance ("Wave Speed", Vector) = (1,1,1,1)
    }
    SubShader {
        Tags {"Queue"="AlphaTest" "IgnoreProjector"="True" "RenderType"="TransparentCutout"}
        LOD 200
        CGPROGRAM
        #pragma surface surf WrapLambert  alphatest:_Cutoff vertex:vert addshadow fullforwardshadows
        #pragma target 3.0
        float4 _WaveAndDistance;
        #include "SGWaves.cginc"

        sampler2D _MainTex;
            fixed4 _Color;
            float4 _RimColor;
            float _RimPower;
            struct Input {
            float2 uv_MainTex;
            float3 viewDir;
            float4 vertexColor;
        };

        half4 LightingWrapLambert (SurfaceOutput s, half3 lightDir, half atten) {
            half NdotL = dot (s.Normal, lightDir);
            half diff = NdotL * 0.5 + 0.5;
            half4 c;
            atten = atten * s.Alpha;
            c.rgb = s.Albedo * _LightColor0.rgb * (diff * atten * 1.5);
            c.a = s.Alpha;
            return c;
        }

        void vert (inout appdata_full v, out Input o) {
            UNITY_INITIALIZE_OUTPUT(Input,o);
            o.vertexColor = v.color;
            WorldWaveGrass(v, v.texcoord.y);
        }
       
        void surf (Input IN, inout SurfaceOutput o) {
            half4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
            c *= _Color;
            c *= IN.vertexColor;
            o.Albedo = c.rgb;
            o.Alpha = c.a;
            half rim = 1.0 - saturate(dot (normalize(IN.viewDir), o.Normal));
            o.Emission = _RimColor.rgb * pow (rim, _RimPower);
        }
        ENDCG
    }
    Fallback "VertexLit"
}
// Upgrade NOTE: unity_Scale shader variable was removed; replaced 'unity_Scale.w' with '1.0'
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
// Upgrade NOTE: replaced '_World2Object' with 'unity_WorldToObject'

// WAVE STUFF - Nabbed from Terrain.cginc and modified - FM 06/2014

    void FastSinCos (float4 val, out float4 s, out float4 c) {
        val = val * 6.408849 - 3.1415927;
        // powers for taylor series
        float4 r5 = val * val;                    // wavevec ^ 2
        float4 r6 = r5 * r5;                        // wavevec ^ 4;
        float4 r7 = r6 * r5;                        // wavevec ^ 6;
        float4 r8 = r6 * r5;                        // wavevec ^ 8;

        float4 r1 = r5 * val;                    // wavevec ^ 3
        float4 r2 = r1 * r5;                        // wavevec ^ 5;
        float4 r3 = r2 * r5;                        // wavevec ^ 7;


        //Vectors for taylor's series expansion of sin and cos
        float4 sin7 = {1, -0.16161616, 0.0083333, -0.00019841};
        float4 cos8  = {-0.5, 0.041666666, -0.0013888889, 0.000024801587};

        // sin
        s =  val + r1 * sin7.y + r2 * sin7.z + r3 * sin7.w;

        // cos
        c = 1 + r5 * cos8.x + r6 * cos8.y + r7 * cos8.z + r8 * cos8.w;
    }
           
    float3 WaveGrass (float waveAmount, float3 vertex)
    {
        float4 _waveXSize = float4(0.012, 0.02, 0.06, 0.024) * _WaveAndDistance.y;
        float4 _waveZSize = float4 (0.006, .02, 0.02, 0.05) * _WaveAndDistance.y;
        float4 waveSpeed = float4 (0.3, .5, .4, 1.2) * 4;

        float4 _waveXmove = float4(0.012, 0.02, -0.06, 0.048) * 2;
        float4 _waveZmove = float4 (0.006, .02, -0.02, 0.1);

        float4 waves;
        waves = vertex.x * _waveXSize;
        waves += vertex.z * _waveZSize;

        // Add in time to model them over time
       
        // also add in their world z/x so as to stagger the waves slightly
        //waves += _Time[0]*(_WaveAndDistance.x+(vertex.z+vertex.x)*0.01) * waveSpeed;
        waves += _Time[0]*_WaveAndDistance.x*waveSpeed;

        float4 s, c;
        waves = frac (waves);
        FastSinCos (waves, s,c);

        s = s * s;
       
        s = s * s;
       
        s = s * waveAmount;

        float3 waveMove = float3 (0,0,0);
        waveMove.x = dot (s, _waveXmove);
        waveMove.z = dot (s, _waveZmove);

        return waveMove * _WaveAndDistance.w;
       
       
    }
   
    void WorldWaveGrass(inout appdata_full v, float waveAmount){
        // calculate wave motion based on world pos
       
        float3 pos = mul ((float3x3)unity_ObjectToWorld, v.vertex.xyz);
       
        float3 move = WaveGrass ( _WaveAndDistance.z*waveAmount, pos) ;
        pos = pos + move;
       
        v.vertex.xyz  = mul ((float3x3)(unity_WorldToObject*1.0), pos);       
   

        // end wave motion
   
   
    }

Blend Probes

1 Like

ok I tested that on URP and blend probes no longer break it - yay!
drop from 46fps to 43fps on a switch, less than 10%, I can live with that.
URP Standard is uglier than built-in’s but I’m switching over.