4 Pages

asst9

Course: LIB 175, Fall 2009
School: Harvard
Rating:
 
 
 
 
 

Word Count: 1113

Document Preview

Graphics Computer CS175 Assignment 9: Fur Due: Monday December 1st The starter code for this part of the assignment is in the directory starter. It contains the code (the main program is asst9.cpp), the necessary textures for the shells and ns, as well as all the complete shaders needed. There are comments in asst9.cpp indicating the places in the code where you can render the ns and shells to draw the fur. There...

Register Now

Unformatted Document Excerpt

Coursehero >> Massachusetts >> Harvard >> LIB 175

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Graphics Computer CS175 Assignment 9: Fur Due: Monday December 1st The starter code for this part of the assignment is in the directory starter. It contains the code (the main program is asst9.cpp), the necessary textures for the shells and ns, as well as all the complete shaders needed. There are comments in asst9.cpp indicating the places in the code where you can render the ns and shells to draw the fur. There is an idle function activated by default, which you will need in order to simulate the dynamics. And there is a registered function for special keys (special keyboard), which you will need to handle the keyboards arrow keys. 1 Straight Fur In this assignment, a furry surface is drawn in three stages. All the drawing code is in the function draw in asst9.cpp, you can follow the explanation below in the code. First the surface itself is drawn using the shader pair shader. Second, the ns are drawn. To draw them, we rst enable alpha-blending, and disable Z-buer writes. We use the shader fins shader-pair to draw ns. Last, shells are drawn using the shader shells shader-pair. To draw them we use alpha-blending (which was enabled before), and we turn Z-buer writing back on. The code should compile and run as is. The places where your code for drawing shells and ns will be inserted are in the draw function, and are marked with a comment. All the code for sending modelview matrices, light-source position, . . . to the shaders is already in place. There are only a few variables in the shaders that your code will have to set in order to render the fur. These are: When drawing both shells and ns, you must send in both vertex positions (using glVertex3f), as well as normals (using glNormal3f). 1 When drawing the ns, for every vertex sent to the vertex shader, you will set two attribute-variables: vtexCoord fins, and vTangent fins. Handles for these are h vtexCoord fins, and h vTangent fins. Because a n has two triangles and four vertices, you will assign texture coordinates (vtexCoord fins) to map the entire n texture to each n. vTangent fins will hold the (tangent) direction of the fur, to be used for lighting calculations downstream. The direction of the fur at a point is the normal of the surface since the fur is always pointing outwards from the surface When drawing the shells, before drawing each of the layers, you must rst set the uniform-variable valpha exponent shells using the formula described in the comment in the code. When drawing the shells, for every vertex sent to the vertex shader, you will set the attribute-variable: vtexCoord shells. These are the texture coordinates used to lookup the shell texture. Each triangle in the current shell will access the same portion of the texture, so it will have the same texture coordinates. The code already loads and renders the bunny. You can add the n and then shell drawing progressively, and always see the result as you add them. The only places that need code to be inserted in are the marked comments in the draw function. The interface for this program is simply an arcball to rotate the camera with the left mouse-button, and two keys: pressing s will toggle shell-rendering on/o, and f will toggle n rendering on/o. This interface is already coded for you. You will use the GLUT UP KEY and GLUT DOWN KEY to change the density of the fur. You will implement this by changing the texture coordinates for the triangle. Because we set the textures to wrap, you can use coordinates outside of the 0..1 range. You will use the GLUT LEFT KEY and GLUT RIGHT KEY to change the length of the fur 2 Combing the Fur Imagine a single straight hair starting at a vertex p, and made up of m straight segments going in the direction of the normal n, ending at the straight tip s, as in gure 1. We draw a shell vertex at the top of each of the segments and pass n for shading in this shell. To comb the hair, will store a desired tip location for each hair t. We will now think of the hair as a polyline with m segments that starts at p, and ends at t. The rst segment will be in the original normal direction, but for each subsequent segment, n will be updated using an appropriate n. Given p, t m and n, you will gure out the n. Shells will be drawn at the ends of each of these m segments. Each n quad, will now be broken up into a bunch of small quads with its vertical edges made up of the m segments. 2 Figure 1: Combing hair: hair-tip at rest is s, but we will bend the hair from the root (p) to get to the current hair tip (t). Note that n is not the unit height normal, just proportional to it (n = f ur m N , where N is the surface normal at p). Note also that the hair length at rest is m n = m n , which is a free (adjustable) parameter of your model. You choose m, the number of segments that the hair is split into (a value of 15-30 is usually sucient). Given a unit normal at p, and a value for m, you can compute n such that m n is the desired length of the hair at rest. Then given p, s, t, m, and n, there is a single n that makes the hair bend to get to the desired hair tip t. 3 3 Dynamics Store a velocity vector v with each tip. To animate the fur do the following at each idle call Make sure the combed tip t is within a small ball of straigt tip s. Compute forces to act on the tip. There will be some gravity force (0, g, 0), where g is some constant, and a spring force. The spring force will be in the direction of the normalized s t. The springs magnitude will be a stiness constant times t s 2 . Update the tip positoin: t = t + v for some . Update the velocity: v = v + f . Damp the velocity: v = v dampingfactor. The damping factor will be some number slightly less than 1.0. Project t on to the plane at s orthogonal to n The +,- keys will control the stiness, and the x,z keys will control the damping. When the bunny is moved, it does not move the combed tips. The tips will be spring back using the dynamics. 4
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Harvard - V - 05
Volume 5, Spring Issue, 1992/'NEW LAWS FOR NEW TECHNOLOGIES: CURRENT ISSUES FACING THE SUBCOMMITTEE ON TECHNOLOGYAND THE LAWiSenator Patrick J. -'!eahy *INTRODUCT~}_~"The headlong pace of technological chang~ in .~ur society has become :"
Harvard - V - 09
Harvard Journal of Law & Technology Volume 9, Number 1 Winter 1996 BRINGING INFORMATION TO THE WORLD." TIIE GLOBAL INFORMATION INFRASTRUCTURE Vice President A1 Gore"There is a saying that if you see a tusk sticking through your tent, you can assume
Harvard - V - 10
Harvard Journal of Law & TechnologyV o l u m e 10, N u m b e r 2 W i n t e r 1997COMPUTER SCIENCE CONCEPTS IN COPYRIGHT CASES: THE PATH TO A COHERENT LAWMarci A. Hamilton* Ted Sabety'"~ T A B L E OF CONTENTS I. II. INTRODUCTION .. THE COMPUTER S
Harvard - RELEASE - 0
INDENT(1) BSD Reference Manual INDENT(1)NAME indent - indent and format C program sourceSYNOPSIS indent [input-file [output-file] [-bad | -nbad] [-bap | -nbap] [-bbb | -nbbb] [-bc | -nbc
Harvard - RELEASE - 0
RS(1) RS(1)NAME rs - reshape a data arraySYNOPSIS rs [ -[csCS][x][kKgGw][N]tTeEnyjhHm ] [ rows [ cols ] ]DESCRIPTION Rs reads the standard input, interpreting each
Harvard - SOC - 209
Department of Sociology Harvard University Qualitative Social Analysis Soc 209 Fall Term, 2004Syllabus in MS Word Format Syllabus in PDF Format Course instructor: Michle Lamont, 510 William James Hall, (617) 277-8933; mlamont@wjh.harvard.edu Office
Harvard - REU - 08
Tension Propagation along a Single Molecule of DNAYunlai Zha1, Ken Halvorsen2, Diane Schaak2, Wesley Wong21BrandeisUniversity, 2Rowland Institute at HarvardLeft: A typical construct with a glass bead (~2m) in the laser trap and a micro-pipette,
Harvard - RH - 08
DEMOGRAPHIC DRIVERS OF RENTAL DEMANDRenter households are becoming more diverse not only because of the growing numbers of immigrants and minorities, but also because of the changing age structure of the population. Meanwhile, the income and wealth
Harvard - SON - 2008
5Rental HousingRental housing is reasserting its importance in US housing markets. With so much turmoil on the forsale side, many households have reconsidered their financial choices and opted to rent rather than buy. Despite three years of incre
Harvard - SON - 2006
RENTAL HOUSINGRental markets turned a corner in 2005. For the first time in years, the number of renter households rose and the national rental vacancy rate fell. Improving job growth sparked demand just as lower multifamily rental production and hi
Harvard - REMODELING - 2009
FACT SHEET Improving Americas Housing 2009RELEASE DATE: FEBRUARY 4, 2009PURPOSE Improving Americas Housing is prepared biennially by the Remodeling Futures Program at the Joint Center for Housing Studies of Harvard University. Since 1999, these in-
Harvard - SON - 2005
DEMOGRAPHIC TRENDSAmerican households are becoming more diverse as minority, single-person, single-parent, and female-headed households make up ever larger shares of successive generations. With income and wealth also rising across all age groups, i
Harvard - RH - 06
AMERICAS RENTAL HOUSINGH O M E S F O R A D I V E R S E N A T I O NJoint Center for Housing Studies of Harvard UniversityJoint Center for Hous ing Studies of Harv a rd UniversityGraduate School of Design John F. Kennedy School of GovernmentFu
Harvard - HA - 06
"High Accuracy Atomic Physics in Astronomy", IP/ITAMP workshop, August 7-9, 2006, The Harvard-Smithsonian Center for Astrophysics, Cambridge, MA, in honor of Prof. Micheal J. SeatonOPserver: opacities and radiative accelerations on demandC. Mendoz
Harvard - DANBOTKIN - 08
ArticlesForecasting the Effects of Global Warming on BiodiversityDANIEL B. BOTKIN, HENRIK SAXE, MIGUEL B. ARAJO, RICHARD BETTS, RICHARD H. W. BRADSHAW, TOMAS CEDHAGEN, PETER CHESSON, TERRY P DAWSON, JULIE R. ETTERSON, DANIEL P FAITH, SIMON . . FER
Harvard - ICAP - 2002
Generation and Investigation of Number States of the Radiation Field1Herbert Walther Sektion Physik der Universitt Mnchen a u and Max-Planck-Institut fr Quantenoptik u 85748 Garching, Fed. Rep. of Germany Abstract The widely discussed applications i
Harvard - AY - 45
1-1Astronomy 45 Introduction to AstrophysicsAlex Dalgarno (adalgarno@cfa.harvard.edu)Astronomy 45 is an introduction to the concepts and methods of astrophysics. It includes a survey of astronomical objects, a description of astronomical measur
Harvard - ICAP - 2002
1 3 52 4 67 98 1011 1213 14 15 16 17 1819 20 21 22 23 2425 26 27 28 29 3031 32 33 34 35 3637 38 39 40 41 4243 44 45 46 47 4849 50 51 52 53 5455 56 57 58 59 6061 62 63 64 65 6667 68 69 70 71 7273 74 75 76 77 7879 80 81
Harvard - ICAP - 2002
ICAP 2002: Speakers and TitlesBEC Nobel Symposium Jook Walraven (Chair) Eric Cornell Wolfgang Ketterle Massimo Inguscio New BECs Dan Kleppner (Chair) Michael Chapman Alain Aspect Claus Zimmermann New Directions I Phillipe Bouyer (Chair) Elizabeth Do
Harvard - HA - 06
High Accuracy Atomic Physics in Astronomy, IP/ITAMP workshop, August 7-9, 2006, The Harvard-Smithsonian Center for Astrophysics, Cambridge, MA, in honor of Prof. Micheal J. SeatonFrom accurate atomic data to elaborate stellar modelingFranck Delaha
Harvard - WEEK - 2
FROM: Webnoize News August 16, 2001 industry . companiesFive Major Studios Join Forces for Movies On-Demand Serviceby Jay BreitlingFive of the seven major movie studios today announced a joint venture to develop a movies-on demand service. The g
Harvard - WEEK - 2
FROM: Webnoize News August 23, 2001 marketplace . servicesEyeing College Market, Studios Seek Tech Partnerships with Universitiesby Sara RobinsonThe venture by five Hollywood studios for distributing movies over the Internet plans to enlist univ
Alfred University - BFL - 1
Examination of Phase Separation in Alkali Borate GlassesBrian F. LonctoKazuo Inamori Schol of EngineeringDecember 7, 2005 Advisor: Dr. Alexis ClareIntroduction Alkali borate glasses are among the most studied compositions of glasses. Previou
Alfred University - TRACK - 2
Revised 1/02ALFRED UNIVERSITYCollege of Liberal Arts and SciencesTRACK II PROGRAM MANUAL FOR TRACK II STUDENTS AND THEIR ADVISORY BOARDSI.Summary and Checklist:A.Freshman year: (Foundation Year) 1. 2. _ Consult Track II Coordinator about po
Harvard - REMODELING - 2009
Emerging Industry StructureRemodeling remains an unusually fragmented industry. Joint Center estimates from the Census of the Construction Industries indicate that 530,000 contracting businesses primarily served the home improvement market in 2002.
Harvard - RH - 06
PRESERVING THE AFFORDABLE INVENT O RYFederal resources are increasingly dedicated to preserving rather than to expanding the stock of assisted rentals. At the same time, hundreds of thousands of privately owned, unsubsidized units are at risk of lo
Harvard - RH - 08
deMograPhIc drIverS of renTal deMandRenter households are becoming more diverse not only because of the growing numbers of immigrants and minorities, but also because of the changing age structure of the population. Meanwhile, the income and wealth
Harvard - DANBOTKIN - 08
JOURNAL OF QUATERNARY SCIENCE (2008) Copyright 2008 John Wiley & Sons, Ltd. Published online in Wiley InterScience (www.interscience.wiley.com) DOI: 10.1002/jqs.1165Local disappearance of bivalves in the Azores during the last glaciation SERG
Harvard - POSTERSESS - 1
A SEMI-EMPIRICAL ADJUSTMENT OF THE VIBRATIONAL DEPENDENCE OF THE POLARIZABILITY OF OZONE FOR USE IN LINE SHIFT CALCULATIONSCarlos Szembek, Bobby Antony, and Robert Gamache, Department of Environmental, Earth, and Atmospheric Sciences and The Interca
Harvard - CFA - 000400
Electronic Telegram No. 436Central Bureau for Astronomical TelegramsINTERNATIONAL ASTRONOMICAL UNIONM.S. 18, Smithsonian Astrophysical Observatory, Cambridge, MA 02138, U.S.A.IAUSUBS@CFA.HARVARD.E
Harvard - CFA - 000700
Electronic Telegram No. 777Central Bureau for Astronomical TelegramsINTERNATIONAL ASTRONOMICAL UNIONM.S. 18, Smithsonian Astrophysical Observatory, Cambridge, MA 02138, U.S.A.IAUSUBS@CFA.HARVARD.E
Harvard - ISS - 19
Decolonizing Law: Identity Politics, Human Rights, and the United NationsDarren C. Zook I dont care about the colour of the foot pressing on my neckI just want to remove it.1 Wole Soyinka Introduction Talk of reforming the United Nations has been ar
Harvard - NEUDC - 07
Peer Effects, Pupil-Teacher Ratios, and Teacher Incentives: Evidence from a Randomized Evaluation in KenyaEsther Duflo 1 , Pascaline Dupas 2 , and Michael Kremer 3, 414 September 2007This paper reports on a project designed to provide experiment
Harvard - NEUDC - 07
Coordinating Units: Farmers' Cooperatives in China -A Comparative Study of Organizational Design in Agriculture between China and JapanDongxue Zhang*Abstract:From the perspective of organization design, this paper investigatesand compares the
Harvard - NEUDC - 07
Abstract, Tables and Figures: Manipulation of a Poverty Index?Adriana Camacho Brown University adriana@brown.edu Emily Conover UC Berkeley econover@berkeley.eduOctober 12, 2007Preliminary and Incomplete. Please do not distribute or cite without
Harvard - MATH - 21
CORRECTION TO THE EXAMPLE ON IMPLICIT DIFFERENTIATIONAbstract. In my 1011am class on Friday I completely mangled an example involving implicit dierentiation. Here is what I should have said.1. The example Suppose that y is dened in terms of x by t
Harvard - MATH - 25
CORRECTION TO TODAYS LECTURETOM COATESAbstract. As Toly pointed out at the end of class, my proof that F was totally bounded contained a gap. Here is a corrected version.Theorem. Suppose that K is compact, and that F C(K) is equicontinuous and
Harvard - MATH - 25
Rudin, Continuity, Problem 11 Suppose f is a uniformly continuous mapping of a metric space X into a metric space Y and prove that {f (xn )} is a Cauchy sequence in Y for every Cauchy sequence in {xn } in X. Since f is uniformly continuous, given d(f
Harvard - HW - 3
Harvard - MATH - 25
A CLARIFICATIONTOM COATESAbstract. In class today, I completely mangled the proof of a fairly straightforward result. Here is a clearer explanation.Theorem. Suppose that fn : [a, b] R are such that fn R(), and that fn f uniformly on [a, b]. T
Harvard - MATH - 121
Math 121 Homework, Week 4Michael Von Kor October 22, 20042.3: 9,11,12,16 ; 2.4: 14,16,23; 2.5: 6(b,c),7,8 Problem 1. 9. Find linear transformations U, T : F 2 F 2 such that U T = T0 but T U = T0 . Use your answer to nd matrices A and B such that A
Harvard - MATH - 121
Mathematics 121 - Fall 2004 Linear Algebra and ApplicationsTime and Place: MWF 121, Science Center 507. Instructor: Mihnea Popa. Oce: 521 Science Center. Phone: 495-4471. E-mail: mpopa@math.harvard.edu. Oce hours: M, Tu 1-2. Textbook: Linear Algebra
Harvard - MATH - 121
MATH 121 PRACTICE PROBLEMS FOR THE FINAL DECEMBER, 2004(1) (a) Let V be a nite dimensional vector space and let T : V V be a linear map. Suppose that v1 , . . . , vk are eigenvectors for T with distinct eigenvalues 1 , . . . , k . Show that the s
Harvard - MATH - 121
MATH 121 PRACTICE PROBLEMS FOR THE MIDTERM OCTOBER 29, 2004(1) Mark each statement True or False. No explanation is necessary. (a) If S and T are linearly independent subsets of a vector space V , then S T is linearly independent. (b) The map P (
Harvard - MATH - 121
Math 121 Homework, Week 1Michael Von Kor October 1, 2004Problem 1. A real-valued function f dened on the real line is called an even function if f (x) = f (x) for each real number x. Prove that the set of even functions dened on the real line with
Harvard - MATH - 121
Math 121 Homework, Week 3Michael Von Kor October 21, 20041.6: 31,33; 2.1: 9,14,15,19,35; 2.2: 3,5,13 Problem 1. 1.6 31. Let W1 and W2 be subspaces of a vector space V having dimensions m and n, respectively, where m n. (a) Prove that dim(W1 W2 )
Harvard - MATH - 121
Math 121 Homework, Week 5Michael Von Kor November 2, 20042.6: 4,7,10,14,15,20 (nite-dimensional case only) ; 3.2: 6(d,e),14,17 Problem 1. 2.6 4. Let V = R3 , and dene f1 , f2 , f3 V as follows: f1 (x, y, z) = x 2y, f2 (x, y, z) = x + y + z, f3 (
Harvard - MATH - 121
Math 121 Homework, Week 8Michael Von Kor December 12, 20045.2: 2(d,f),7; 5.4: 13,14,15,17,18,21,36,38. Problem 1. For each of the following matrices A Mnxn (R), test A for diagonalizability, and if A is diagonalizable, nd an invertible matrix Q an
Harvard - MATH - 268
Mathematics 268 - Spring 2005 Asymptotic methods in higher dimensional geometryTime and Place: MWF 1011, Science Center 310. Instructor: Mihnea Popa. Oce: 521 Science Center. E-mail: mpopa@math.harvard.edu. Course description. The course will cover
Harvard - PDF - 24
Flora of China 24: 7677. 2000.1. TOFIELDIA Hudson, Fl. Angl., ed. 2, 157 [175]. 1778. yan chang pu shu Chen Xinqi ( Chen Sing-chi); Minoru N. Tamura Herbs perennial, with a short, ascending rhizome. Leaves basal or nearly so, 2-ranked, basally equ
Harvard - PDF - 14
Flora of China 14: 151152. 2005.73. PACHYPLEURUM Ledebour, Fl. Altaic. 1: 296. 1829. hou leng qin shu Pu Fading ( Pu Fa-ting); Mark F. Watson Arpitium Necker & Sweet. Herbs, perennial. Taproot stout, usually branched. Stem single or multicipital,
Harvard - PDF - 05
Flora of China 5: 218-219. 2003.7. PHACELLARIA Bentham in Bentham & J. D. Hooker, Gen. Pl. 3: 229. 1880. chong ji sheng shu Subshrubs or herbs, usually epiparasitic on the stems of species of Loranthaceae and Dendrotrophe. Leaves alternate, reduce
Harvard - PDF - 11
Fl. China 11: 511. 2008.7. MAPPIANTHUS Handel-Mazzetti, Anz. Akad. Wiss. Wien, Math.-Naturwiss. Kl. 58: 150. 1921. ding xin teng shu Lianas woody, roughly and somewhat rigidly strigose; tendrils thick. Leaves opposite, or subopposite, petiolate, e
Harvard - PDF - 14
Flora of China 14: 110112. 2005.51. AEGOPODIUM Linnaeus, Sp. Pl. 1: 265. 1753. yang jiao qin shu She Menglan ( Sheh Meng-lan); Mark F. Watson Herbs, perennial, essentially glabrous. Stem erect, branching above or simple. Basal and lower leaves pet
Harvard - PDF - 13
Flora of China 13: 127128. 2007.10. ITOA Hemsley, Hookers Icon. Pl. 27: t. 2688. 1901. zhi zi pi shu Mesaulosperma Slooten. Trees, dioecious (or ?monoecious), evergreen. Leaves usually alternate, sometimes subopposite; stipules early caducous; pet
Harvard - PDF - 24
Flora of China 24: 133134. 2000.18. NOTHOLIRION Wallich ex Boissier, Fl. Orient. 5: 190. 1882. jia bai he shu Liang Songyun ( Liang Song-jun); Minoru N. Tamura Herbs perennial, bulbiferous. Bulb narrowly ovoid or cylindric; tunic black-brown, scar
Harvard - PDF - 24
Flora of China 24: 205206. 2000.38. CHLOROPHYTUM Ker Gawler, Bot. Mag. 27: t. 1071. 1807. diao lan shu Chen Xinqi ( Chen Sing-chi); Minoru N. Tamura Herbs perennial, rhizomatous. Rhizome often short, inconspicuous, sometimes thick, elongate. Roots
Harvard - PDF - 24
Flora of China 24: 88. 2000.8. CHIONOGRAPHIS Maximowicz, Bull. Acad. Imp. Sci. Saint-Ptersbourg 11: 435. 1867, nom. cons. bai si cao shu Chen Xinqi ( Chen Sing-chi); Minoru N. Tamura Siraitos Rafinesque, nom. rej. Herbs perennial, often hermaphrod
Harvard - PDF - 22
Flora of China 22: 523524. 2006.166. UROCHLOA P. Beauvois, Ess. Agrostogr. 52. 1812. wei fu cao shu Chen Shouliang (); Sylvia M. Phillips Annuals or perennials, often coarse and weedy. Leaf blades linear to broadly lanceolate; ligule a ciliate mem
Harvard - PDF - 22
Flora of China 22: 639640. 2006.216. PHACELURUS Grisebach, Spic. Fl. Rumel. 2: 423. 1846. shu wei cao shu Sun Bixing ( Sun Bi-sin); Sylvia M. Phillips Thyrsia Stapf. Perennial. Culms often robust. Leaf blades linear or rarely terete; ligule membra
Harvard - PDF - 22
Flora of China 22: 552553. 2006.178. CENCHRUS Linnaeus, Sp. Pl. 2: 1049. 1753. ji li cao shu Chen Shouliang (); Sylvia M. Phillips Annuals or perennials. Culms usually branched near the base. Leaf blades usually flat; ligule a ciliate rim. Inflore