Question: Modify Program 13.1 so that it moves each vertex slightly toward the center of its primitive triangle. The result should look similar to the exploded
Modify Program 13.1 so that it moves each vertex slightly toward the center of its primitive triangle. The result should look similar to the exploded torus in Figure 13.5, but without the overall change in torus size.
Program 13.1![#version 430 layout (triangles) in; in vec3 varying Normal [ ]; in vec3 varying LightDir[]; in vec3 varying](https://dsd5zvtm8ll6.cloudfront.net/images/question_images/1701/6/7/7/280656d88e046ac61701677279582.jpg)
![#version 430 layout (triangles) in; in vec3 varying Normal [ ]; in](https://dsd5zvtm8ll6.cloudfront.net/images/question_images/1701/6/7/7/291656d88ebf3b901701677291564.jpg)
Figure 13.5
#version 430 layout (triangles) in; in vec3 varying Normal [ ]; in vec3 varying LightDir[]; in vec3 varying HalfVector[]; // inputs from the vertex shader out vec3 varying NormalG; // outputs through the rasterizer to the fragment shader out vec3 varyingLightDirG; out vec3 varyingHalfVectorG; layout (triangle_strip, max_vertices=3) out; // matrices and lighting uniforms same as before void main (void) { //move vertices along the normal, and pass through the other vertex attributes unchanged
Step by Step Solution
3.41 Rating (160 Votes )
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
