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.4
![} // tex coords are distributed across 64 patches, normalized to [0..1]. Flip Y coordinates. tc =](https://dsd5zvtm8ll6.cloudfront.net/images/question_images/1701/6/7/7/028656d87e4a33de1701677026869.jpg)
![} tcs_out[gl_InvocationID] = tc[gl_InvocationID]; gl_out[gl_InvocationlD].gl_Position =](https://dsd5zvtm8ll6.cloudfront.net/images/question_images/1701/6/7/7/041656d87f1f224c1701677040073.jpg)

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
Get step-by-step solutions from verified subject matter experts
