There are two more unit-sphere les given in

Assignment Help Computer Graphics
Reference no: EM13346582

There are two more unit-sphere ?les given in https://cis.poly.edu/cs653/assg3/, with 256 and 1024 triangles, respectively.

Draw the x-, y-, z-axes, the "ground" (the quadrilateral indicating the x-z plane), and roll the wire-frame sphere as in Assignment 2. Your task here is to add the corresponding shadow of the sphere on the ground given a ?xed light source located at position L = (-14.0, 12.0,-3.0, 1.0).

Draw the shadow with color (0.25, 0.25, 0.25, 0.65). Note that the shadow should be the wire- frame sphere projected onto the ground, projected from the light source. As the sphere rolls, the shadow should also "roll" accordingly.

As another option, draw the sphere as a solid sphere and roll it as before, by drawing the sphere triangles as ?lled triangles rather than just drawing the triangle edges. Produce the corresponding shadow effect for this rolling solid sphere as well, using the same shadow color and the same light source location L. (The options are put together by a menu; see Part (b).)

Programming Tips:

1. If you experienced a strange behavior of the z-buffer where some parts of the scene disappear randomly, check your gluPerspective() command; see Useful Tips Item 2 on page 4 for the details.

2. In OpenGL, although the perspective division is automatically done to convert (x, y, z,w) to (x/w, y/w, z/w, 1) for w = 0, the OpenGL implementation actually requires that w > 0. So if you tried q = ( f(x,y,z)/ h(x,y,z) , 0, g(x,y,z)/h(x,y,z) , 1) ≡ (f(x, y, z), 0, g(x, y, z), h(x, y, z)) and it did not work, try to use q = ( -f(x,y,z)/-h(x,y,z) , 0, -g(x,y,z)/-h(x,y,z) , 1) ≡ (-f(x, y, z), 0,-g(x, y, z),-h(x, y, z)).

(b) If you just draw the shadow as in Part (a), then you will see a broken shadow. The unde- sirable effect is especially obvious for the solid sphere. This is because the shadow and the ground are on the same plane, but the z-buffer only has a limited numerical precision. As a result, some portion of the shadow may appear in front of the ground and some portion may appear behind the ground and thus blocked by the ground; the result is unpredictable. Note that what you want here is to make the shadow always appear on top of the ground, i.e., to make the shadow a decal on top of the ground. Use the technique of making a decal, as discussed in class, to achieve the desired effect.

In addition, implement "Shading" as a submenu with 2 submenu entries: "?at shading" and "smooth shading". When lighting is disabled (by choosing "Enable Lighting" and then "No"), both options should just draw the sphere as a solid sphere (see Part (a)) and give the same result.

(c) Provide a global ambient white (with color (1.0, 1.0, 1.0, 1.0)) light, and also provide a directional light source with black ambient color (0.0, 0.0, 0.0, 1.0), white diffuse and specular color (1.0, 1.0, 1.0, 1.0), and position (0.0, 0.0, 1.0, 0.0) in the eye coordinate system. Note that (0.0, 0.0, 1.0, 0.0) is in fact a vector rather than a point, and thus this light source is a distant (directional) light. The colors and the position described above are actually the default values of GL_LIGHT0, so you can set it up by just enabling GL_LIGHT0 without specifying these values. If you do want to specify the values, notice that the position (vector) value is in the eye coordinate system (meaning that the vector is ?xed relative to the viewer), and you have to specify it in an appropriate place in your program; see Useful Tips Item 3 on page 4 for more details. Give your quadrilateral "ground" that indicates the x-z plane a green diffuse color (0.0, 1.0, 0.0) (with default ambient and specular colors), and give your sphere a golden yellow diffuse and specular color (1.0, 0.84, 0.0) (and a default ambient color) with a shininess coef?cient of 125.0. Consider the four unit-sphere ?les given. Actually, there is one more piece of information implicitly given in the ?le format: each triangle (given by the coordinates of its three vertices) has its three vertices ordered such that if the ?ngers of the right hand are curled along the direction of the vertex speci?cation, the thumb will point towards the triangle's outward normal (in this case this normal points towards the outside of the sphere). Augment your data structure from Assignment 2 so that associated with each triangle you also store its outward normal vector of length 1 (i.e., the unit-length outward normal vector).

Recall that the menu entry "Shading" has two submenu entries "?at shading" and "smooth shading". Implement these entries with the following shading effects when "Enable Lighting" is "Yes":

(1) "?at shading"- ?at shade the ?lled triangles of the unit sphere, where the unit-length normal vector associated with each triangle is the normal vector that you just computed and stored.

(2) "smooth shading" - smooth shade the ?lled triangles of the unit sphere. To assign the unit- length vertex normals, use the fact that if the unit sphere is centered at the origin o and v is a point on the surface of the unit sphere, then → ov is the unit-length normal vector at v.

 

Reference no: EM13346582

Questions Cloud

Steak sauce lawrys defense case to complete a formal : steak sauce lawrys defense case to complete a formal written case analysis.chuck smith senior brand manager on a.1.
1 define open and closed loop control systems explain : 1. define open and closed loop control systems. explain difference between time varying and time invariant control
1 a firm estimates its cubic production function of the : 1. a firm estimates its cubic production function of the following formq al3 bl2and obtains the following
Marketing research project project that required to plan : marketing research project project that required to plan and strategize effectively. if you use your time efficiently.
There are two more unit-sphere les given in : there are two more unit-sphere ?les given in httpcis.poly.educs653assg3 with 256 and 1024 triangles respectively.draw
1briefly describe venture debt capital and venture equity : 1.briefly describe venture debt capital and venture equity capital.2.describe how the costs of debt and equity differ
Sockets for this problem you will implement a client-server : sockets for this problem you will implement a client-server version of the rock-paper-scissors-lizard-spock game which
Question 1assume a manufacturer incurs 2000000 hours of : question 1assume a manufacturer incurs 2000000 hours of direct productive labor in a year at a total direct labor cost
1nbsp find the natural domain of the following functions : 1.nbsp find the natural domain of the following functions. explain your results.2. given the equation y x2 - 6x 8 find

Reviews

Write a Review

Computer Graphics Questions & Answers

  Determine transfomation of triangle

Determine a transfomation of triangle A(1,0),B(0,1),c(1,1)by:- a) rotating 45 degreeabout origin and then translatingin x and y direction.

  Discussion on internet development

In 1990s, the Internet offered primarily text based web-sites. At present the Internet is rich in multimedia sites that include audio and video.

  Question about troubleshooting problem

Consider the most difficult troubleshooting problem you have encountered in your recent experience- one where the solutions was not straightforward

  What does resolution mean

What does resolution mean How is resolution connected to ppi and dpi units

  Ethernet equipment to modernize the network

An older network using ten baseT technology needs an upgrade. The network haves a total of 220 workstations and ten servers and has a network diameter of three-hundred meters.

  How many minutes of uncompressed digital video can be stored

Approximately how many minutes of uncompressed digital video could be stored and played from a standard (single-speed) CD-ROM at 640 X 480 resolution using 256 colors?

  Concepts of computer graphics

Concepts of Computer Graphics and develop a program using OpenGL

  Create a simple warm-up program using your g3d programming

create a simple warm-up program using your g3d programming and graphics environment. this will require you to minorly

  Build agraphical user interface for a text editor

Using BlueJ, Design and build aGraphical user interface for a text editor. Users should be able to enter text,edit, scroll, etc. Consider functions for formatting (font faces, style, andsize) and a character/word-count function.

  Opengl assignment using c++

This is an OpenGL assignment using C++. Work on a particle and mesh visualization tool. Data: Consider a point cloud as input data. Every point is described by a position p = (x, y, z) and a data value d = (d0,d1,d2).

  Creating temperature conversion gui application

Create a temperature conversion GUI application that changes from Fahrenheit to Celsius. The Fahrenheit temperature should be entered from the keyboard and Enter pressed.

  Relative positioning and interactive positioning

Relative Positioning and Interactive Positioning by Dragging and Clicking and some Simple Animation

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd