# SSBO Instancing Effect

vertex:
    includes: |
        struct Transform {
            mat4 model_mat;
        };
        #extension GL_ARB_shader_storage_buffer_object : enable
        layout(std430, binding = 10) buffer ShaderBuffer {
            Transform transforms[];
        };

    transform: |
        // Overwrite position and normal using SSBO data
        mat4 model_matrix = transforms[gl_InstanceID].model_mat;
        vOutput.position = (model_matrix * p3d_Vertex).xyz;
        
        // Transform normal (approximation assuming uniform scale for performance, otherwise use inverse transpose)
        mat3 normal_matrix = mat3(model_matrix); 
        vOutput.normal = normalize(normal_matrix * p3d_Normal);
        
