Programming Assignment 1: Z-Buffer Rendering

This project is to develop a simple Z-buffer renderer to view 3D models. This will be accomplished by importing a file for a 3D model derived of triangle polygons in a specified file format (below). Sample model files are provided but the progam will work on general files of the specified type.

The program will use Lab 3 as a starter and generalize it to view the model in the file as well as allow basic manipulation as specified below. Use the Z-buffer render algorithm as detailed in class (Lecture 6) to render only the nearest polygon on the scene by storing the depth value in a custom depth data structure. The color of each triangle can be specified at random to allow a visual separation between neighboring triangles.

To be clear, your program cannot use GL functions for polygons or lines (e.g. GL_line) but instead, must draw the image one pixel at a time as was done in lab.

Note, projection can be done simply by dropping the third dimension for each vertex and drawing only the values for the x,y. (FYI, this is a simple orthographic projection.)

Next, the viewer must be able to rotate the model by spinning it about a vertical axis at the center of the model. You will determine this axis from the model file (e.g. average all vertices) To accomplish the rotation, the original 3D vertices must be rotated and then the Z-buffer renderng should be applied to the transformed points.

Finally, to receive full credit you will also need to have your code organized and well-documented, including describing carefully how to control the interaction (e.g. rotation control).

For extra credit, there are two additions to be added. First, you can receive some easy extra credit points by allowing the user to also draw a wireframe of the model by switching modes (wireframe and filled-in) Next, you can also get points for adding the ability to pan (equivalent to translating the model left-right and up-down) and zoom (equivalent in this case to performing a uniform scale on the model so that is grows larger and smaller.) The latter (pan/zoom) is all or nothing. And you should consider what is a good choice for inputs for each part of the functionality (rotate, change mode, etc.) and communicated that clearly in the program.

Point Breakdown:
Load model 20
Render 35
Rotate 35
Code comments/organization 10

Extra credit:
Zoom/pan 10
Wireframe 5

You will turn in the assignment using the standard "turn-in" before midnight on the due date. Late assignments are accepted up to one week late with penalties of 5 pts off per day, and counting the weekend as a single day.

Model file specs and samples

test.txt

4 2

200 200 200

800 200 200

200 500 200

800 500 800

0 1 2

0 3 1

sampletri.txt

4 4

200 200 200

800 200 200

500 500 800

500 200 800

0 1 2

1 3 2

2 3 0

3 1 0

samplehouse.txt

9 16

200 200 200

200 500 200

800 200 200

800 500 200

800 200 800

800 500 800

200 200 800

200 500 800

500 800 500

0 1 2

1 3 2

2 3 0

3 1 0

2 3 4

3 5 4

5 4 6

6 7 5

7 6 0

0 1 7

0 2 4

0 4 6

1 3 8

3 5 8

5 7 8

7 1 8

时间: 2024-11-01 08:44:16

Programming Assignment 1: Z-Buffer Rendering的相关文章

C200 Programming Assignment

C200 Programming Assignment № 8Computer ScienceSchool of Informatics, Computing, and EngineeringMarch 30, 2019ContentsIntroduction 2Problem 1: Newton Raphson Root Finding Algorithm 4Root . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Algorithm Part I:Programming Assignment(2)

问题描述: Programming Assignment 2: Randomized Queues and Deques Write a generic data type for a deque and a randomized queue. The goal of this assignment is to implement elementary data structures using arrays and linked lists, and to introduce you to g

Programming Assignment 3 : Pattern Recognition

这周的这个问题是在给定一系列的点中寻找多点共线的模式. 计算机视觉重要的两个部分:特征检测(Feature Dectection)和模式识别(Pattern Recognition).特征检测提取出图片的重要特征,模式识别发掘出这些特征中的模式.这里探究的点共线的问题在现实生活中也有很多应用,比如统计数据分析. Problem. 从二维平面上的N个互不相同的点中,绘制出每个(最多)连接的4个或4个以上点集合的线段. Point data type. 给定的Point类型的API public c

Programming Assignment 4: 8 Puzzle

The Problem. 求解8数码问题.用最少的移动次数能使8数码还原. Best-first search.使用A*算法来解决,我们定义一个Seach Node,它是当前搜索局面的一种状态,记录了从初始到达当前状态的移动次数和上一个状态.初始化时候,当前状态移动次数为0,上一个状态为null,将其放入优先级队列,通过不断的从优先级队列中取出Seach Node去扩展下一级的状态,直到找到目标状态.对于优先级队列中优先级的定义我们可以采用:Hamming priority function 和

Algorithm Part I:Programming Assignment(3)

问题描述: Programming Assignment 3: Pattern Recognition Write a program to recognize line patterns in a given set of points. Computer vision involves analyzing patterns in visual images and reconstructing the real-world objects that produced them. The pr

(转!)Z buffer和W buffer简介

几乎所有目前的 3D 显示芯片都有 Z buffer 或 W buffer.不过,还是常常可以看到有人对 Z buffer 和 W buffer 有一些基本的问题,像是 Z buffer 的用途.Z buffer 和 W buffer 的差别.或是一些精确度上的问题等等.这篇文章的目的就是要简单介绍一下 Z buffer 和 W buffer. Z buffer 和 W buffer 是做什么用的呢?它们的主要目的,就是去除隐藏面,也就是 Hidden surface elimination(或

Programming Assignment 1: WordNet

题目地址:http://coursera.cs.princeton.edu/algs4/assignments/wordnet.html 1. 题目阅读 WordNet定义 WordNet是指一个包含唯一根的有向无环图,图中每一组词表示同一集合,每一条边v→w表示w是v的上位词.和树不同的地方是,每一个子节点可以有许多父节点. 输入格式 同义词表 文件中每行包含一次同义名词.首先是序号:然后是词,用空格分开.若为词组,则使用下划线连接词组.最后是同义名词的注释 36,AND_circuit AN

Algorithms: Design and Analysis, Part 1 - Programming Assignment #1

自我总结: 1.编程的思维不够,虽然分析有哪些需要的函数,但是不能比较好的汇总整合 2.写代码能力,容易挫败感,经常有bug,很烦心,耐心不够好 题目: In this programming assignment you will implement one or more of the integer multiplication algorithms described in lecture. To get the most out of this assignment, your pro

CMPT 459.1-19. Programming Assignment

---title: "CMPT 459.1-19. Programming Assignment 1"subtitle: "FIFA 19Players"author: "Name - Student ID"output: html_notebook---### IntroductionThe data has detailed attributes for every player registered inthe latest edition