Question: Modify Program 12.4 to utilize a height map of your own design. Then add lighting and shadow mapping so that your tessellated terrain casts shadows.

Modify Program 12.4 to utilize a height map of your own design. Then add lighting and shadow mapping so that your tessellated terrain casts shadows. This is a complex exercise, because some of the code in the first and second shadow mapping passes will need to be moved to the evaluation shader.

Program 12.4Java/JOGL application // same as for Bezier surface example, with these changes:} // tex coords are distributed across 64 patches, normalized to [0..1]. Flip Y coordinates. tc =} tcs_out[gl_InvocationID] = tc[gl_InvocationID]; gl_out[gl_InvocationlD].gl_Position =} gl_Position = mvp * tessellated Point; tes_out = tc;

Java/JOGL application // same as for Bezier surface example, with these changes: gl.glPatchParameteri(GL_PATCH_VERTICES, 4); gl.glDrawArraysInstanced (GL_PATCHES, 0, 4, 64*64); Vertex Shader out vec2 tc; void main(void) {vec2 patch TexCoords[] = vec2[] (vec2(0,0), vec2(1,0), vec2(0,1), vec2(1,1)); // compute an offset for coordinates based on which instance this is int x = gl_InstanceID % 64; int y = gl_InstancelD / 64;

Step by Step Solution

3.41 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Graphics Programming Questions!