CS 419v/519v -- Winter Quarter 2018

Project #4

100 Points

Due: March 5

Instancing


This page was last updated: February 19, 2018



Requirements

Project #1 asked you to create your own object in a Vulkan program.
Project #2 asked you to add lighting to it.
Project #3 asked you to use create a scene with an Index Buffer
Project #4 is asking you to use Instancing to make your scene more complex and interesting

Keep the keyboard keys doing what they used to do.

Feel free to add more keyboard inputs to control more things.

Example Code

**************************************************************

    const uint32_t vertexCount = sizeof(VertexData)     / sizeof(VertexData[0]);
    const uint32_t indexCount  = sizeof(JustIndexData)  / sizeof(JustIndexData[0]);
    //const uint32_t instanceCount = 1;
    const uint32_t instanceCount = NUM_INSTANCES;
    const uint32_t firstVertex = 0;
    const uint32_t firstIndex = 0;
    const uint32_t firstInstance = 0;
    const uint32_t vertexOffset  = 0;

    if( UseIndexBuffer )
    {
            vkCmdDrawIndexed( CommandBuffers[nextImageIndex], indexCount, instanceCount, firstIndex, vertexOffset, firstInstance );
    }
    else
    {
            vkCmdDraw( CommandBuffers[nextImageIndex], vertexCount, instanceCount, firstVertex, firstInstance );
    }

**************************************************************

        int    NUMINSTANCES = 16;
        float DELTA         =  3.0;

        float xdelta = DELTA * float( gl_InstanceIndex % 4 );
        float ydelta = DELTA * float( gl_InstanceIndex / 4 );
        vColor = vec3( 1., float( (1.+gl_InstanceIndex) ) / float( NUMINSTANCES ), 0. );

        xdelta -= DELTA * sqrt( float(NUMINSTANCES) ) / 2.;
        ydelta -= DELTA * sqrt( float(NUMINSTANCES) ) / 2.;
        vec4 vertex = vec4( aVertex.xyz + vec3( xdelta, ydelta, 0. ), 1. );
        gl_Position = PVM * vertex;

**************************************************************

Turn-in:

Use the Teach system to turn in your:

  1. A one-page PDF with a title, your name, your email address, nice screen shots from your program, and the link to the Kaltura video demonstrating that your project does what the requirements ask for. I'd like you to narrate your video so that you can tell me what you did.

Grading:

FeaturePoints
Did it80
Didn't screw anything up in the process20
Potential Total100