程序代写代做 html GPU graph c# clock DNA 2020/5/3 CSCI B481 – Interactive Graphics – Spring 2020 – Final Project – DRAFT

2020/5/3 CSCI B481 – Interactive Graphics – Spring 2020 – Final Project – DRAFT
CSCI B481 – Interactive Graphics Spring 2020
Final Project – DRAFT Practical Part – Unity Project
Submit a Programming Project to IU GitHub, by the official time scheduled for the B481 course final exam, i.e. 10:15 a.m.-12:15 p.m., Fri., May 3.
In this case, you will design an implement a Unity-based application of your choice, which should however include a minimal set of features, as from the
detailed here:
.
1. Create a 3D virtual environment with controls that allow you to navigate the
camera (virtual viewer) through the entire space. Different applications will require different navigation-control approaches, e.g.:
airplane-like controls for terrains,
ground-level controls for first-person-like systems of rooms and corridors, inspection controls for molecules and other complex models, etc.
2. In your 3D rendering and user interaction code, implement at least the following features:
a. . Non-trivial lighting models and materials are expected, with light computation computed by your own code in the vertex/fragment shaders ( built-in Unity illumination!). Example: two lights with distinct diffuse and specular properties, with light ON/OFF controls either as HUD or as SerializeField properties; material models that use interesting choices of ambient, diffuse, and specular parameters.
b. . The user should have a feeling of good control while moving through the scene. At least two different camera views/controls should be provided, either simultaneously or to be alternated (controlled either by HUD controls or as SerializeField properties)
c. . At least one object should be spontaneously moving, with animation controlled by your own code in the C# program.
d. Either or , computed by your own code in the fragment shader. Textures / bump maps must be used in a non-trivial way (←the linked WebGL examples would be considered “trivial”).
e. . Nothing fancy – a button should disclose a summary of the mouse and/or keyboard-activated controls, in “play mode”, as a “HUD ”
https://legacy.cs.indiana.edu/classes/b481/2020/assignments/final.html 1/13
tcejorp elpmaxe
gnippaMpmuBerutxeT noitaminA
ton
lairetam dna gnithgiL
neercs pleH
noitom aremaC
tnemnorivnE lautriV a fo noitagivaN

2020/5/3 CSCI B481 – Interactive Graphics – Spring 2020 – Final Project – DRAFT
on the top of the 3D scene. 3. Example details:
for generating terrain models, several exponential expressions of the form z(x,y) = a * ( – ( (x-x0)2 + (y-y0)2 ) / w2 ) can be used together, to create nice “mountains” in the grid using xij = (i, j, z(i, j) ), e.g.:
a minimal “flying” interface using the mouse:
. Move the viewer in the scene towards
the screen center, or backwards, away from the screen center.
. Spin the viewer in the scene leaving the “world
up” direction fixed; i.e., the previous screen center rotates to the right or left, respectively, along the screen horizon.
viewing elevation in the scene.
. Raise or lower the viewer’s
If you choose to work on a Programming Project to be submitted in place of a written Final Exam for B481, you may present your B481 Project at the
on Tuesday, April 23rd 11 a.m. to 1 p.m. in the Luddy Hall Foyer.
To participate at the SICE DEMO Day, you need to complete the registration form registration form before 11:59PM on April 17, 2019, at the latest. In that form, under
enter “B481”, and under enter “Interactive Graphics” (both without quotes).
Demo
In the demo videos below, the surface is generated by a Catmull-Rom spline patch with 4×4 control vertices, slowly oscillating.
The different views in the four videos provide some details of the (50×50 vertices) mesh, and of the vertices themselves that compose the mesh.
In the demo videos, no illumination nor mapping is applied to the spline surfaces: only a color gradient to test the mesh structure.
https://legacy.cs.indiana.edu/classes/b481/2020/assignments/final.html 2/13
hcraeseR gnirpS ECIS
:emaN esruoC :rebmuN esruoC detailiffA yaD OMED
drawkcab/drawrof esuom tfeL tfihS
thgir/tfel esuom tfeL drawkcab/drawrof esuom tfeL
pxe

2020/5/3 CSCI B481 – Interactive Graphics – Spring 2020 – Final Project – DRAFT
In your completed Final Project, the splie surface needs to be both illuminated .
0:00
https://legacy.cs.indiana.edu/classes/b481/2020/assignments/final.html 3/13
dna
derutxet

2020/5/3 CSCI B481 – Interactive Graphics – Spring 2020 – Final Project – DRAFT
0:00
https://legacy.cs.indiana.edu/classes/b481/2020/assignments/final.html 4/13

2020/5/3 CSCI B481 – Interactive Graphics – Spring 2020 – Final Project – DRAFT
0:00
https://legacy.cs.indiana.edu/classes/b481/2020/assignments/final.html 5/13

2020/5/3 CSCI B481 – Interactive Graphics – Spring 2020 – Final Project – DRAFT
0:00
Tasks
The starting task of Final Project is to convert your Assignment 05 (i.e. the Vertex Shader implementation of a Cubic Spline Curve in 3D), so that it correctly represents a Cubic Spline Surface in 3D.
Please refer to the textbook sections “The Cubic Interpolating Patch” and “Bezier Surface Patches” i.e. Chapter sections 11.4.2 and 11.7.3 (in the 7th edition Textbook) / Chapter sections 11.4.2 and 11.7.3 (in the 6th edition Textbook). Also, look at Prof.Andy Hanson’s notes about computing Bilinear Patches and Spline Surfaces.
Just as in previous Assignments, we’re approximating the curve by drawing a sequence of line segments ← this is the “base” Cubic Spline Curve, with vertex coordinates computed e.g. by Hermite Form.
However, this time the surface is generated by interpolating across two dimensional
https://legacy.cs.indiana.edu/classes/b481/2020/assignments/final.html 6/13

2020/5/3 CSCI B481 – Interactive Graphics – Spring 2020 – Final Project – DRAFT
parameters, and vertices compose a mesh of triangles.
Note: just like for previous assignments, don’t use Unity Surface Shaders for any of the Final Project tasks. The entire illumination equation “by hand” needs to be provided in the Fragment Shader, together with your choice of mapping. The shader file needs to be defined in Unity ShaderLab syntax, where the shader code is marked by the CGPROGRAM keyword, and the code that follows CGPROGRAM is written in regular HLSL/Cg shading language.
A. [30 points]
Warm-up questions
These questions are to provide some foundation context to the coding tasks that follow (see below for Task A details).
B. [30 points]
Draw and animate a Cubic Spline Patch Surface, defined by 4×4 control vertices. You may choose the type of spline to generate, e.g. Bezier, Catmull- Rom, or B-Spline.
Animate the positions of the sixteen Spline Curve control vertices (do use the
” ” method as from previous assignments to position the control vertices manually), so that each control point follows its own, separate periodic/oscillatory motion (distinct from the other control vertices). Make sure that the control vertices move at different positions, i.e. control vertices should not all be on the same plane (nor any other plane)!
Here’s some that you may find useful in defining the position of a given point on the spline surface.
Of course, since we’re computing the spline curve position , the for loops are to be prepared in advance, CPU-side, since each vertex shader instance computes only ! The mesh of triangles, and the corresponding vertices, need to be computed in advance.
/* —– —– —– —– spline surface —– —– —– —– */ typeVertex3D points1[4], points2[4];
typeVertex3D point1, point2, point3;
const float u_inc = 0.02;
const float v_inc = 0.02;
for (float u = 0.0; u < 1; u += u_inc) { https://legacy.cs.indiana.edu/classes/b481/2020/assignments/final.html 7/13 redahs xetrev eht ni xetrev laudividni ,elgnis eno "edocoduesp" zz,y,x ton tcejbOgarD 2020/5/3 CSCI B481 - Interactive Graphics - Spring 2020 - Final Project - DRAFT /* spline interpolation through 4 horizontal control points, to obtain intermediate points, over which to interpolate vertically. */ for (int i = 0; i < 4; ++i) { spline(gMyControlPoints[0][i], gMyControlPoints[1][i], gMyControlPoints[2][i], gMyControlPoints[3][i], spline(gMyControlPoints[0][i], gMyControlPoints[1][i], gMyControlPoints[2][i], gMyControlPoints[3][i], u, points1[i]); u+u_inc, points2[i]); } /* spline interpolation through thus obtained 4 vertical control points: */ if (gMySplineDrawingMode==0) { glBegin(GL_POINTS); } else { glBegin(GL_QUAD_STRIP); } spline(points1[0], points1[1], points1[2], points1[3], 0.0, point1); spline(points2[0], points2[1], points2[2], points2[3], 0.0, point2); glColor3f(u, 0.0, 0.0); glVertex3f(point1[0], point1[1], point1[2]); glVertex3f(point2[0], point2[1], point2[2]); point3[0] = point2[0]; point3[1] = point2[1]; point3[2] = point2[2]; for (float v = v_inc; v <= 1; v += v_inc) { spline(points1[0], points1[1], points1[2], points1[3], v, point1); spline(points2[0], points2[1], points2[2], points2[3], v, point2); glColor3f(u, v, (u+v)/2.0); glVertex3f(point1[0], point1[1], point1[2]); glVertex3f(point2[0], point2[1], point2[2]); } glEnd(); } In the above example (ANSI-C & fixed-pipeline OpenGL), the spline is computed with the help of linear interpolations, as defined below: void linear(typeVertex3D p0, typeVertex3D p1, float t, typeVertex3D pResult) { x1, typeVertex3D x2, typeVertex3D x3, float t, 4 controls to 3 outputs */ 3 outputs to 2 outputs */ pResult[0] = (1 - t)*p0[0] + t*p1[0]; pResult[1] = (1 - t)*p0[1] + t*p1[1]; pResult[2] = (1 - t)*p0[2] + t*p1[2]; } void spline(typeVertex3D x0, typeVertex3D typeVertex3D pResult) { typeVertex3D p10, p11, p12, p20, p21; /* 1st level of interpolation reduces linear (x0, x1, f10(t), p10); linear (x1, x2, f11(t), p11); linear (x2, x3, f12(t), p12); /* 2nd level of interpolation reduces linear (p10, p11, f20(t), p20); linear (p11, p12, f21(t), p21); /* last level returns interpolation of last two outputs */ linear(p20, p21, f3(t), pResult); /* return pResult; */ } /* spline() */ https://legacy.cs.indiana.edu/classes/b481/2020/assignments/final.html 8/13 2020/5/3 CSCI B481 - Interactive Graphics - Spring 2020 - Final Project - DRAFT C. [10 points] Implement the illumination equation in the Fragment Shader, in the same way as specified for Assignment 05, i.e.: with a single point-light source, positioned at a finite distance to the curve, so that distinct shades may be clearly visible in the rendering. The illumination equation needs to contain all three components: diffuse, specular, and ambient illumination components (further illumination components are not required: i.e. you don't need to provide emission light effect, spotlight effects, distance attenuation, etc.) For Final Project, animate the position of the point-light source, and provide a placeholder (e.g. a sphere) to show where the light is positioned at any time. Animate the camera position: the point of view needs to move in a circular orbit around the Cubic Spline Curve mesh object. Changes in the specular highlights should thus be apparent, from looking at the curve surface from different points of view. D. [30 points] While maintaining the illumination equation from Task Bin the Fragment Shader, apply a non-trivial mapping of your choice (e.g. texture-, bump-, or environment- mapping) to the spline curve rendered as from Task A. This mapping is necessarily computed in the Fragment Shader. Please refer to the Unity online Manual for several specific examples that include configuring and evaluating mapping in the shaders. Implement these functionalities within the same Unity project. Task A details --- Warm-up questions: We suggest that you complete these you work on your Final Project implementation. Write your answers in the same file named a04 .txt (or a04 .pdf if you need any text formatting, etc.) as described below in the Final Project Submission Instructions. 1. Computing Normals to Polyhedron Faces (for use in Illumination Equations). Premise: if you have to evaluate the illumination equation on each polygon face of a polyhedron 3D model object, you need to compute (at least) one normal vector https://legacy.cs.indiana.edu/classes/b481/2020/assignments/final.html 9/13 emanresuruoy emanresuruoy erofeb 2020/5/3 CSCI B481 - Interactive Graphics - Spring 2020 - Final Project - DRAFT per polygon face. In the simplest case, each polygon face is a triangle. For this homework task, you only need to compute the normal ( ). Let's assume a triangle with the 3D vertices in this order (positive, counterclockwise) : x1=(x1,y1,z1), x2=(x2,y2,z2), and x3=(x3,y3,z3). 1. Write down the vector components of this cross-product (explicitly in terms of x1, y1, etc.), i.e. [(x2 - x1) ⨯ (x3 - x2)] = ? 2. There are six identical forms of this particular normal direction, written in terms of the cross products of x2-x1, x3-x2, and x1-x3 Three of these six identical forms are basically different in their apparent from, and three other forms are derived from one of the first three, with order and sign changes. Write down these six equivalent forms. (Note: e.g. use x2-x1 only in that order, and not in the x1-x2 order: the two orderings are for this particular homework task.) 2. Texture Mapping Explain the necessary setup for texture-mapping a single polygon and a single (given) 2D texture map, resulting in the image below. a. Write down the graphics primitives (vertices, coordinates, etc.) that will draw a flat hexagonal mesh of triangles on the 2D screen (i.e., centered at 0,0 with height 2.0 and width 2.0) with vertical left and right edges. b. Write down the pseudocode that will map some predefined texture (do not define it) onto the entire hexagon, with the top line of the texture following the upper two edges of the hexagon, and similarly for the bottom. : the standard texture interpolation does not do a pretty job of this without a lot of trouble - which you are not expected to solve for this specific homework question. It is perfectly acceptable to provide a texture mapping that would look something like this (this is direct output from a program https://legacy.cs.indiana.edu/classes/b481/2020/assignments/final.html 10/13 noitanimulli eht ton cificeps rotcev etarapes a sa deredisnoc eb ot ton etoN noitauqe 2020/5/3 CSCI B481 - Interactive Graphics - Spring 2020 - Final Project - DRAFT running with a 2D orthographic setup, a 3D projection setup!) : Your answer to the above two questions should contain sufficiently explicit mathematics that the reader could write a program. Understanding Texture Mapping: c. What would we have to do to our polygon models to achieve the effect of texture mapping, if texture mapping were supported directly in the graphics API? Assume in this part that you have flat Gouraud interpolation available, and pass-through shaders with the mandated outputs. , only d. First, how would implement the scan conversion process we called Goraud interpolation if you had to do it by writing shader software code, e.g. if you to programmable GPU shaders that could control the rasterization/interpolation part of the GPU process (you don't need to write down how the graphics pipeline interpolation process works, just carefully review the Gouraud interpolation process before answering this part). Now, that you to such programmable GPU shaders that could control the rasterization/interpolation part of the GPU process; how would you now implement texture mapping? (for this question, you need to again assume as if texture mapping were supported directly in the graphics pipeline, just as in the previous question) e. What is MIPmapping, and what problem does it solve? 3. Bump Mapping a. In a polygon-projection pipeline, does Bump Mapping affect the geometry or topology of a surface? If yes, how? If not, in which way does it enhance the rendering of lit wrinkled surfaces? https://legacy.cs.indiana.edu/classes/b481/2020/assignments/final.html 11/13 ton sredahs UPG gnimmargorp ot ssecca on ylno ton ton ssecca evah emussa ssecca dah uoyweiver 2020/5/3 CSCI B481 - Interactive Graphics - Spring 2020 - Final Project - DRAFT b. What is a Height Map? How is it used in Bump Mapping? What data type is used in a Height Map in a shader program? c. What is a Normal Map? How does it relate to a Height Map? What data type is used in a Normal Map in a shader program? d. What is the Tangent Space? What are the Tangent, Normal and Binormal vectors? e. Now, that you have a that uses a Normal Map object for rendering. Provide a pseudocode description of the process required to transform the provided Height Map object to the Normal Map object required by the Bump Mapping implementation. : you may assume the two squares in the following image as representing of the Normal and Bump maps: the first one is the input you have available, the second one is what you have to compute, and will be used by the Bump Mapping implementation. : the colors in the figure above represent how the Normal and Bump map would look like you were to display them as . Recall that a Bump Mapping-based rendering will use these maps to display them as images or texture maps. Your answer to the above five questions should contain sufficiently explicit mathematics that the reader could write a program. Any vectors and matrices you need in your explanation, you may define directly by components, or via API calls, and thereafter represent them by symbols. Getting Help How do I get help with Final Project, or with anything related CSCI B481? If you need help: attend office hours https://legacy.cs.indiana.edu/classes/b481/2020/assignments/final.html 12/13 ton segamifi noitatnemelpmi gnippaM pmuB desab-redahs etelpmoc emussa tniH elpmaxE :A :Q 2020/5/3 CSCI B481 - Interactive Graphics - Spring 2020 - Final Project - DRAFT ask the AIs and Instructor: the recommended way to contact both AIs and instructors is by sending an email from your IU email address to: csci-b481-b481-ai-l@list.indiana.edu consult the Unity online Script Reference manual consult lecture notes consult any other provided references in the lecture notes Final Project - Submission Instructions: 1. Write a brief plain-text file named a04 .txt. 1. the text, in the first line at the top, include "B481 / Spring 2020", "Final Project", your full name and your IU username. You need to use either ASCII or UTF8 as text encoding. 2. If you have formatted text, save it to a pdf file and name your file accordingly (i.e. a04 .pdf). 3. Do not use any other document file formats: submitted files other than plain text (in either ASCII or UTF8) or pdf will be ignored and will receive 0 points. In your plain-text file, describe: The Unity environment you used for the assignment (i.e. a list of all C# files included in the assignment, the version of Unity you used, any particular assets, etc.). The parts of the coding assignment that you completed. (optional) Anything you are proud of in the code and want us to notice. 2. In your B481 / Spring 2020 IU GitHub repository, place your (uncompressed) Unity project folder, as well as your a04 .txt file in a subdirectory named /assignments/a04/, and it to your github.iu.edu repository by due on Sunday, April 28 at 11:59PM (it's also OK if you need more time for the Unity project, but your answers to the in Task A be turned in by Sunday, April 28 at 11:59PM, since we're going to release sample answers right after the deadline!). 3. Please do not omit your username from the filename. 4. P.S.: should in fact be your IU username i.e. email ID, not the numeric ID nor the word 5. also submit a assignment A04. Last updated: April 24, 2020 *.zip version of the same folder, on IU Canvas, under https://legacy.cs.indiana.edu/classes/b481/2020/assignments/final.html 13/13 tsum snoitseuq pu-mraw hsuptimmoc emanresuruoy emanresuruoy emanresuruoy desserpmoc ...emanresuruoy ude*anaidni*ajtim emanresuruoy tsum nI