| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 774 人关注过本帖
标题:有偿找人代写作业!!!!
只看楼主 加入收藏
HJsun
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-9-23
收藏
 问题点数:0 回复次数:1 
有偿找人代写作业!!!!
关于computer graphic 的一个作业。 制作一个raytracer,具体要求如下:
Assignment 1: a Ray Tracer

Use the description of ray tracing given in class to make a
ray tracer. In the interests of keeping things simple, you are
required to trace only spheres and infinite planes. The viewpoint
and image size can be fixed. The scene must contain at least one
(point) light source.

Your ray tracer should cast shadow rays to see whether a given
object is lit. Use the three-term lighting model to perform
lighting calculations; choose sensible material properties for
the objects in the scene. Compute at least one level of recursion on
shiny objects.

You can either compute directions for each initial ray (perspective
projection) or use the same direction for each ray (orthogonal
projection). Position the objects so that everything is visible from
the camera. You might want to aim the camera along one axis to
simplify your calculations.

Have your ray tracer cast one ray per pixel, compute a color, and
store the computed color in an array. Later, you can either write
the array to a file or display it in a window.

***Intersection calculations

Here is a bit of algebra to help with your intersection calculations.
Recall that the parametric equations for a ray beginning at
(x_0, y_0, z_0) and travelling in direction (x_d, y_d, z_d) are

x = x_d*t + x_0
y = y_d*t + y_0
z = z_d*t + z_0

and that the equation for a sphere is

r^2 = (x-x_c)^2 + (y-y_c)^2 + (z-z_c)^2

where the sphere has radius r and is centered at (x_c, y_c, z_c).

Then the intersection is simply (substituting the parametric equations
for x, y, z)

r^2 = (x_d*t + x_0 - x_c)^2 +
      (y_d*t + y_0 - y_c)^2 +
      (z_d*t + z_0 - z_c)^2

The above equation should be solved for t.
Write it in the standard quadratic form:

at^2 + bt + c = 0

where

a = x_d^2 + y_d^2 + z_d^2 = 1 (if the direction vector is normalized)
b = 2*(x_d*(x_0 - x_c) + y_d*(y_0 - y_c) + z_d*(z_0 - z_c))
c = (x_0 - x_c)^2 + (y_0 - y_c)^2 + (z_0 - z_c)^2 - r^2

The roots are given by the equation

t = (-b +/- sqrt(b^2 - 4ac))/2a

Choose the smaller of the real roots (this is the first intersection).

To avoid having to work with imaginary numbers, check whether

b^2 > 4ac

before starting. If b^2-4ac is negative, there is no intersection.

***Lighting calculations

Use the three-term lighting model. You can calculate the vectors
you need from the geometry of the situation. Remember that the
normal of a sphere is along the direction from the centre of the
sphere to the point on the sphere's surface. Make sure you put in
the shadow ray test! Also, avoid having a very big sphere that
encloses the camera.

***Adding texture

Add a checkerboard texture to the plane: repeating checks of different
colors, say c1 and c2. To do this, compute the world-space location of
the intersection point, say (x,y). Then, compute a row, column
location (r,c) where r = floor(x/s) % 2 and c = floor(y/s) % 2. The
scale of the texture is given by the parameter s. Then, let the color
be c1 if r+c is even, and c2 if r+c is odd.

***Debugging

Test your raytracer with just a single sphere, then with a sphere
and a plane, then move on to the full scene.

Your raytracer might be slow, so you may wish to build a "preview"
move for debugging which creates an extremely-low-resolution version
of the scene, just to save time as you work out the early bugs.

***Your scene

Make a simple scene containing a few spheres. You need at least one
light source and at least one shiny sphere (which produces
reflections) as well as other, non-shiny spheres. Shadows should be
cast on the ground and the ground should display the checkerboard
texture. One idea is to make a snowman (with no nose) out of spheres.
You can even give the snowman coal eyes and mouth, if you are so
inclined.

***Output

Store the finished image in a 2D pixel array, and either save it in
some simple file format (such as BMP or PPM) or draw it in a window
using OpenGL and glDrawPixels. You should hand in your source code,
complete with comments and instructions on how to use, and an output
image or screen capture.

***Bonus

For a +10% bonus, also implement transparency (transmission of light
rays). Include at least one partly transparent sphere through which
we can see another object.



联系方式:hjsungg@ or 302887497
搜索更多相关主题的帖子: 作业 
2008-01-31 06:23
踏魔狼
Rank: 6Rank: 6
等 级:贵宾
威 望:24
帖 子:1322
专家分:33
注 册:2005-9-22
收藏
得分:0 
光线跟踪程序.

=×&D o I p R e E n C g T l X&×=
2008-01-31 13:19
快速回复:有偿找人代写作业!!!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.085001 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved