js代写/webgl代写: webgl program

js代写/webgl代写: 这个是webgl的代写案例,属于难度较大的一类作业
In this assignment, you’ll combine the techniques we’ve learned in this course. You’ll render multiple animated, textured objects, and use shader programs to enhance the animations.

Getting Started
Create a project called “Program3” for this assignment. You may use any code from your previous labs, programming assignments, or the posted solutions. Solution code for Lab 7 and Programming Assignment 2 will be posted after the final deadlines for those assignments. The scene and model JSON file formats for this program will be the same as for Lab 7 (plus any enhancements that you add). Start with the Lab 7 code for loading the scene and the models.

Your project should retain the mouse view rotation and sliders for Near, Far, and FOV from Lab 7. If desired, you may remove the check boxes for perspective and showing textures (use the perspective on/off setting from the scene JSON file). You may adjust the canvas size as desired, and add any other user interface elements you wish.

Tasks
Implement the following tasks for this assignment (point values shown below).

Part 1: Textured Sphere
Modify the Sphere class from SphereL7.js to support textures and the full lighting model from Lab 7. You may use a fixed file name for the texture, or add support in the Scene JSON file for texture specification. One method of calculating texture coordinates s and t on the unit sphere from x, y, z vertex coordinates (from the Class 14 notesPreview the document) is

var t = (Math.asin(z) / Math.PI) + 0.5;
var s = 0.0;
if (z > -1.0 && z < 1.0) { s = (Math.atan2(y, x) / Math.PI) * 0.5 + 0.5; } For this assignment you need not implement the special handling for triangles which cross the texture boundary (you may see some artifacts, especially near the poles). The nasa_venus.jpg texture from Lab 7 makes a nice texture if you want an outer space look to your project, but you may use any texture. The web sites nasa3d.arc.nasa.gov (Links to an external site.)Links to an external site. and planetpixelemporium.com (Links to an external site.)Links to an external site. also have a nice selection of free planet textures, although not all are sized as powers of 2, so you may need to use an image processing program (like Gimp (Links to an external site.)Links to an external site.) to resize them. Part 2: Use Your Imagination For the second part of the assignment, design a scene of your own with lighting, texture, animation, and at least two (undergrads) or three (grad students) of the following features: Procedural texture: use shader programs to generate texturing on the fly from mathematical functions, or to dynamically modify a texture image. Bump map: see "Bump Maps: Creation and Examples" for sample bump maps and scripts to create them. Fog (density based on distance from viewer). Nearby models should be more visible than farther away models. Interaction with models using the mouse. Click on or near a model, and trigger some action based on the result. Create your own model. This should have a level of complexity at least similar to the rocket ship model. Implement a spot light, possibly even attached to an animated model. A model with animated features (for example, an airplane with a spinning propeller, or a cart with rotating wheels), or an object orbiting a planet which is orbiting the Sun. Other features that you come up with, of similar complexity. Before implementing, please talk to me or email me with a description of the feature(s) to make sure they are acceptable. Your scene should incorporate one or more instances of your textured sphere model to demonstrate that it is working. You may use any of the other models from the course, or create any of your own. Include a detailed description of the features you've implemented in the top comment section of index.html or Scene.js in your project. Make sure you describe how to use any features that require interaction. File Torus.cppPreview the document contains the C++ code used to generate the torus JSON model included in Lab 7. The code contains parameters to change the thickness and radius of the torus, and how the texture is mapped. You may use this code if you with to incorporate one or more tori in your scene with some different geometry. The code was developed in Xcode, but should run fine on Windows or Linux (let me know if you run into any problems).

发表评论

电子邮件地址不会被公开。 必填项已用*标注