In the midpoint displacement, we will expand on it and this program uses an algo
ID: 3592702 • Letter: I
Question
In the midpoint displacement, we will expand on it and this program uses an algorithm to generate a surface and then modify the shaders to display the surface from different viewpoints. The list of commands given are:
N -- view from the north. Position = (0.0, 5.0, -10.0)
S -- view from south. Position = (0.0, 5.0, 10.0)
E -- view from east. Position = (10.0, 5.0, 0.0)
W -- view from west. Position = (-10.0, 5.0, 0.0)
A -- view from above. Position = (0.0, 11.0, 0.0)
B -- view from below. Position = (0.0, -11.0, 0.0)
It should do depth testing to handle hidden surfaces in a proper manner. The value for (H) should be the input.
The normal equation for the displacement is:
Displacement = GaussianRV (0,1) * 1/2^2*H*(i-1)
Where (I) is the iteration number (starts at 1) and (H) is the Hurst exponent (between 1.0 and 2.0).
Explanation / Answer
A component is either a face, a vertex, or a chain of edges. Components of the subdivision mesh may be tagged to have various user-defined properties. The token array tags, of length ntags, identifies these tags. Each tag has zero or more integer arguments, and zero or more floating-point arguments. The number of arguments provided with each tag is specified by the array nargs, which has a length of ntags times two. For each tag, nargs contains an integer specifying the number of integer operands found in the array intargs, followed by an integer specifying the number of floating-point operands found in the array floatargs. Thus, the length of intargs is equal to the sum of all the even-numbered elements of the array nargs. The length of floatargs is equal to the sum of all the odd-numbered elements of the array nargs.
Several tags are currently defined. The "crease" tag specifies that a certain chain of edges should be a crease. This tag has n integer arguments specifying a chain of vertices that make up the crease, and one floating-point argument giving the crease's sharpness. A crease with sharpness s is subdivided using the sharp subdivision mask for the first s subdivision steps. If s is RI_INFINITY, the edge uses the sharp mask forever and the surface will be C0 but not C1 across the edge. Each sequential pair of vertices in a crease must be the endpoints of an edge of the subdivision mesh. A mesh may have any number of independent "crease" tags.
The "corner" tag may be used to mark certain vertices. This tag has n integer arguments containing the vertex numbers of the corners and either one or n floating-point arguments that specify the sharpness of the corners. A corner with sharpness s will remain fixed for the first s subdivision steps. If s is RI_INFINITY, the corner will stay fixed forever; the surface will interpolate the vertex in a C0 but not C1 manner.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.