国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看

合肥生活安徽新聞合肥交通合肥房產生活服務合肥教育合肥招聘合肥旅游文化藝術合肥美食合肥地圖合肥社保合肥醫院企業服務合肥法律

代寫CSE 167、輔導3D OpenGL Rendering

時間:2023-11-21  來源:合肥網hfw.cc  作者:hfw.cc 我要糾錯


UCSD CSE 167 Assignment 3:

3D OpenGL Rendering

Figure 1: We will develop an interactive interface for inspecting 3D models in this homework.

As you can probably tell from the previous homeworks, rendering requires computing interactions between

millions of pixels and billions of triangles. This leads to significant challenges in performance, especially when

we want to interact with the content in real-time. To make things really fast, pioneers in computer graphics

came up with the solution to use domain-specific hardware to speedup rendering. Instead of using a general

purpose computer to compute everything, we build chips that specialize at rendering. These processors are

called the Graphics Processing Units (GPUs). The idea of GPUs can be traced back to more than 40 years

ago: The first GPU, Geometry Engine was developed by Jim Clark and Marc Hannah in 1981. Jim Clark

formed the company Silicon Graphics Inc (SGI) in the same year and SGI was one of the most important

computer graphics companies in the history. Nowadays, GPUs are found to be general enough to compute

very wide-range of computation, including deep learning and many scientific computing tasks, and they are

indispensable to the human society. GPU is one of the most successful examples of domain-specific hardware.

In this homework, we will write code to render things using GPUs on your computer. To command your

GPUs, we need to send commands to it using some sort of “Application Programming Interface” (API).

These interfaces are collectively decided by the GPU companies and some other organizations, and each

hardware will come with some “drivers” that actually implement these interfaces using underlying hardware

instructions. The most popular APIs are: OpenGL, DirectX, Metal, Vulkan, and WebGPU. Among these,

DirectX is Windows only, Metal is MacOS only, WebGPU is only for browsers, and Vulkan is extremely

low-level and very verbose for providing fine-grained control (it takes literally a thousand lines to render a

single triangle in Vulkan). Therefore, we will use OpenGL in this homework: even though DirectX, Metal,

and Vulkan are more update to date (the lastest version of OpenGL is 6 years ago), OpenGL is still use

in practice and supported by all major GPUs and OSes, and it is significantly easier to learn compared to

other lower-level APIs. Just like programming languages, it’ll be a lot easier to learn other APIs once you’ve

learned OpenGL.

In this homework, we will mostly follow an online tutorial: learnopengl.com, because they likely write

significantly better tutorials than me. We will implement what we did in the previous homework in OpenGL

and hopefully see significant speedup. We will also create a Graphics User Interface (GUI) and enable

real-time interaction.

This homework is also more “open-ended” compared to the previous ones. We do not ask you to produce

the exact same output as we do. At this point, you should be familiar with the theory of rasterization. We’re

just wrangling with hardware interface, so allowing a bit of creativity seems reasonable.

1

1 Creating a window (10 pts)

Our first task, instead of rendering a single triangle, is to create a window! Read the chapters of OpenGL,

Creating a window, and Hello Window in learnopengl.com to see how to create a window with OpenGL

context using GLFW. Pick your favoriate background color. We have included GLFW and glad in balboa,

so you shouldn’t have to download them. We’re using OpenGL 3.3, but feel free to use the version you like.

Implement your code in hw_3_1 in hw3.cpp. Test it using

./balboa -hw 3_1

Once you are done, take a screenshot of the window you created and save it as outputs/hw_3_1.png.

2 Rendering a single 2D triangle (20 pts)

Yeah, it’s that time again! Read the Hello Triangle chapter and render a single triangle with constant color

(pick one that you like the most). Make sure you’ve become familiar with the ideas of shaders, VAO, VBO,

and EBO. Just to make things slightly different so that we are not just copy and pasting code, let the triangle

rotate in the image plane over time (it can be clockwise or counterclockwise, your choice). For the rotation,

you can do it whichever way you want, but I recommend you do it in the vertex shader. Read the Shaders

chapter and understand how to pass in a uniform variable, then you can use the uniform variable as the

rotation angle.

float vs. double By default, balboa uses double precision floats through the Real type. However, by

default, GLSL uses single precision floats. Be careful of this discrepancy. You can use Vector3f/Matrix3x3f

to switch to float in balboa. Also feel free to use the glm library which is used in the tutorial.

Implement your code in hw_3_2 in hw3.cpp. Test it using

./balboa -hw 3_2

This time, do a screen recording of your rotating triangle and save it as outputs/hw_3_2.mp4 (or whatever

encoding you are using).

3 Rendering 3D triangle meshes with transformations (35 pts)

Next, we’ll use OpenGL to render the type of scenes we handled in the previous homework. Read the

chapters Transformations, Coordinate systems, and cameras, and that should give you enough knowledge to

render the JSON scenes like the ones in the previous homeworks.

This part is a big jump from the previous parts. I would recommend you to do things incrementally. E.g.,

handle two 2D triangles first, add projection matrix, add view matrix, add model matrix, handle multiple

triangle meshes, and finally add camera interaction.

Below are some notes and tips:

Clip space. In Homework 2, our projection matrix convert from camera space directly to the screen space.

In OpenGL, the hardware expects the projection to convert from camera space to the clip space, which by

default ranges from −1 to 1 for x, y, and z axes. Everything outside of the clip space is clipped. Note that

the clipping happens at the far side of z as well – we use the z_far parameter in the camera in our JSON

scene to specify this. The difference in spaces means that we need to use a different projection matrix:

1

as

0 0 0

0

1

s

0 0

0 0 −

zfar

zfar−znear

zfarznear

zfar−znear

0 0 −1 0

?**7;

?**8;

?**8;

?**9;

, (1)

2

where s is the scaling/film size parameter as before, and a is the aspect ratio. The first row and the second

row scale the x and y clipping plane to [−1, 1] respectively. The third row compresses z values from −znear

to −zfar to [−1, 1]. The fourth row is the perspective projection using homogeneous coordinates.

Depth test. By default, OpenGL does not reject triangles when they are occluded. Remember to turn

on depth testing using glEnable(GL_DEPTH_TEST) and clear the Z buffer (e.g., glClear(GL_COLOR_BUFFER_BIT

| GL_DEPTH_BUFFER_BIT)).

Vertex colors. In contrast to the learnopengl tutorial, balboa stores the vertex color in a separate array.

Therefore it’s likely more convienent to create two VBOs:

unsigned int VBO_vertex;

glGenBuffers(1, &VBO_vertex);

glBindBuffer(GL_ARRAY_BUFFER, VBO_vertex);

glBufferData(GL_ARRAY_BUFFER, ...);

glVertexAttribPointer(0 /* layout index */,

3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);

glEnableVertexAttribArray(0);

unsigned int VBO_color;

glGenBuffers(1, &VBO_color);

glBindBuffer(GL_ARRAY_BUFFER, VBO_color);

glBufferData(GL_ARRAY_BUFFER, ...);

glVertexAttribPointer(1 /* layout index */,

3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);

You only need one VAO per mesh regardless.

Multiple meshes. To handle multiple meshes in a scene, create a VAO for each mesh.

Window resizing. We don’t require you to handle window resizing in this homework. It’s annoying

because you’ll need to regenerate the projection matrix every time the aspect ratio changes.

Gamma correction. When we save the image in balboa, we perform a gamma correction by taking a power

of 1

2.2

. OpenGL does not by default do this. To enable gamma correction, use glEnable(GL_FRAMEBUFFER_SRGB).

Read the gamma correction chapter in learnopengl.com to learn more.

Camera interaction. Like the tutorial, you should also implement a simple camera interaction scheme,

see the Camera chapter. A simple WSAD style translation suffices. To obtain the camera direction and

right vector, you can look at the columns of the cam_to_world matrix.

As a bonus (15 pts), add camera rotation based on mouse input like the tutorial. Note that the rotation

in the tutorial assumes a particular camera frame and would not work for our case. I recommend doing the

following: 1) store yaw and pitch angles and the original cam_to_world matrix from the scene. 2) update the

yaw and pitch based on the mouse movement offsets like in the tutorial. 3) form a rotation matrix R based

on yaw and pitch, then form a new cam_to_world matrix by multiplying the original cam_to_world matrix

with R. (Don’t overwrite the original cam_to_world matrix!)

For rotation, it might be tempting to keep only one cam_to_world matrix by keep multiplying it with

new rotation matrices. However, this is going to produce unintuitive behavior (try it!) since yaw and

pitch rotations are not commutative: applying yaw first then pitch will produce different result compared to

applying pitch first then yaw. As a result, when you chain together many pitches and yaws matrix rotations,

they will not represent the desired rotation. Yes, rotation is weird. This is why you should explicitly store

the yaw and pitch angles and modify those instead.

3

Passing parameters in callback functions. If you dislike global variables as much as me, you would

like the functions glfwSetWindowUserPointer and glfwGetWindowUserPointer. You will use it like this:

void mouse_callback(GLFWwindow* window, double xpos, double ypos) {

StructIWanttoPasstoCallback *data_ptr =

glfwGetWindowUserPointer(window);

}

GLFWwindow* window = glfwCreateWindow(width, height, "Balboa", NULL, NULL);

StructIWanttoPasstoCallback data = ...;

glfwSetWindowUserPointer(window, &data);

glfwSetCursorPosCallback(window, mouse_callback);

Debugging. Debugging OpenGL (and other graphics API) programs is painful: if you do one thing wrong,

you’ll likely get a black screen. The learnopengl tutorial provides useful tips for debugging. To debug shaders,

it’s particularly useful to use a debugger such as renderdoc. Unfortunately, none of the existing OpenGL

debuggers work on MacOS anymore (Apple makes it extremely hard to develop OpenGL on MacOS because

they want people to use Metal). For MacOS users, a potential debugging strategy is to emulate the shader

on CPU: write the same code on CPU and print out the values, and see if it does what you expect. It’s going

to be painful regardless, I’m sorry. On the other hand, this is a fruitful research area that awaits innovation

to make things better!

For the 3D transformation, copy your Homework 2 code to the parse_transformation function in hw3_scenes.cpp.

Implement the rest in hw_3_3 in hw3.cpp.

Test your OpenGL rendering using the following commands:

./balboa -hw 3_3 ../scenes/hw3/two_shapes.json

./balboa -hw 3_3 ../scenes/hw3/cube.json

./balboa -hw 3_3 ../scenes/hw3/spheres.json

./balboa -hw 3_3 ../scenes/hw3/teapot.json

./balboa -hw 3_3 ../scenes/hw3/bunny.json

./balboa -hw 3_3 ../scenes/hw3/buddha.json

For two_shapes and cube, they should render to the same images as the previous homework (before you

move the camera yourself). The rest are new scenes. (teapot.json is a higher-resolution version that has 10

times more triangles!) Record a video of you moving the camera for each scene and save them as:

outputs/hw_3_3_two_shapes.mp4

outputs/hw_3_3_cube.mp4

outputs/hw_3_3_spheres.mp4

outputs/hw_3_3_teapot.mp4

outputs/hw_3_3_bunny.mp4

outputs/hw_3_3_buddha.mp4

Acknowledgement. The bunny model was scanned by Greg Turk and Marc Levoy back in 1994 at

Stanford, so it is sometimes called the Stanford bunny. The texture of the bunny model was made by

KickAir_8p who posted the scene in blenderarists.org. The buddha texture was generated by Kun Zhou et

al. for their Texturemontage paper.

Bonus: textures (15 pts). Read the Textures chapter of learnopengl.com and implement textures for

the shapes above. We have provided the UV maps for the models except two_shapes and cube. I have also

included the original textures I used to produce the vertex colors for teapot, bunny, and buddha.

4

4 Lighting (25 pts)

For this part, read the chapters of Colors and Basic Lighting in the tutorial, and implement some basic

lighting in our viewer. Be careful about the transformation of the normals! Use the vertex colors or texture

colors as the objectColor equivalent in the tutorial. Let’s assume ambientStrength=0.1, specularStrength=0.5

and lightDir is at normalize(vec3(1, 1, 1)). Note that you can extract the camera position by looking at

the fourth column of cam_to_world.

The way the tutorial does the lighting requires defining vertex normals (an alternative is to use face

normals, but it often looks uglier). We have provided vertex normals for the following scenes:

./balboa -hw 3_4 ../scenes/hw3/spheres.json

./balboa -hw 3_4 ../scenes/hw3/teapot.json

./balboa -hw 3_4 ../scenes/hw3/bunny.json

./balboa -hw 3_4 ../scenes/hw3/buddha.json

Save your output as screenshots:

outputs/hw_3_4_spheres.png

outputs/hw_3_4_teapot.png

outputs/hw_3_4_bunny.png

outputs/hw_3_4_buddha.png

Bonus: lighting animation (10 pts). Add some animation to the light. Make it move the way you like,

and submit a video recording of the animation.

Bonus: different types of lights (10 pts). Our light currently is a directional light. Implement point

lights and spot lights (see the Light casters chapter) in your renderer, and support multiple lights.

Bonus: shadow mapping (20 pts). Implement a basic shadow map. See the Shadow Mapping chapter

in learnopengl. Support of directional lights is good enough.

5 Design your own scenes (10 pts)

We’re at the fun part again. Design your own scene and render it using your new renderer!

請加QQ:99515681 或郵箱:99515681@qq.com   WX:codehelp

 

掃一掃在手機打開當前頁
  • 上一篇:指標代寫 代寫同花順指標公式
  • 下一篇:指標代寫 代寫同花順指標公式
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    流體仿真外包多少錢_專業CFD分析代做_友商科技CAE仿真
    流體仿真外包多少錢_專業CFD分析代做_友商科
    CAE仿真分析代做公司 CFD流體仿真服務 管路流場仿真外包
    CAE仿真分析代做公司 CFD流體仿真服務 管路
    流體CFD仿真分析_代做咨詢服務_Fluent 仿真技術服務
    流體CFD仿真分析_代做咨詢服務_Fluent 仿真
    結構仿真分析服務_CAE代做咨詢外包_剛強度疲勞振動
    結構仿真分析服務_CAE代做咨詢外包_剛強度疲
    流體cfd仿真分析服務 7類仿真分析代做服務40個行業
    流體cfd仿真分析服務 7類仿真分析代做服務4
    超全面的拼多多電商運營技巧,多多開團助手,多多出評軟件徽y1698861
    超全面的拼多多電商運營技巧,多多開團助手
    CAE有限元仿真分析團隊,2026仿真代做咨詢服務平臺
    CAE有限元仿真分析團隊,2026仿真代做咨詢服
    釘釘簽到打卡位置修改神器,2026怎么修改定位在范圍內
    釘釘簽到打卡位置修改神器,2026怎么修改定
  • 短信驗證碼 豆包網頁版入口 破天一劍 目錄網 排行網

    關于我們 | 打賞支持 | 廣告服務 | 聯系我們 | 網站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網 版權所有
    ICP備06013414號-3 公安備 42010502001045

    国产人妻人伦精品_欧美一区二区三区图_亚洲欧洲久久_日韩美女av在线免费观看
    国产免费一区二区三区香蕉精| 不用播放器成人网| 欧美精品videofree1080p| 国产一区二区网| 欧美激情一级二级| 国产午夜大地久久| 在线观看av的网址| 91精品国产网站| 日日噜噜噜夜夜爽爽| 久久婷婷人人澡人人喊人人爽| 日本wwwcom| 国产精品精品视频| yy111111少妇影院日韩夜片| 日韩中文字幕免费在线| 久久久国产成人精品| 国产在线资源一区| 亚洲乱码国产一区三区| 国产成人精品视频ⅴa片软件竹菊| 欧美在线视频一区二区| 欧美极品视频一区二区三区| 国产一区福利视频| 久久亚洲春色中文字幕| 美乳视频一区二区| 国产精品第8页| 国产日韩欧美另类| 国产裸体免费无遮挡| 美女精品视频一区| 国产青春久久久国产毛片| 精品免费国产一区二区| 国产精品一区二区性色av| 欧美激情一区二区久久久| 北条麻妃在线一区| 亚洲啪啪av| 久久精品日产第一区二区三区精品版 | 国产精品激情自拍| 精品少妇一区二区三区在线| 国产精品国产精品国产专区不卡| 国产系列第一页| 亚洲午夜精品福利| 国产激情片在线观看| 欧美一级黑人aaaaaaa做受| 国产精品免费电影| 国产精品揄拍一区二区| 亚州av一区二区| 国产激情一区二区三区在线观看| 日本精品va在线观看| 久久精品视频免费播放| 国产在线一区二区三区欧美| 一卡二卡三卡视频| 久久久久久久免费| 国产在线观看一区二区三区| 亚洲欧美日韩另类精品一区二区三区| 国产不卡一区二区在线播放| 欧美日韩在线不卡一区| 国产99在线免费| 91av中文字幕| 欧美国产综合视频| 久久久久久国产精品美女| 久久资源亚洲| 国模吧一区二区| 中文字幕剧情在线观看一区| 久久久国内精品| 欧美激情第一页在线观看| 色综合久久88| 国产成人精品免费视频大全最热| 欧美日韩亚洲一区二区三区四区 | 精品国产aⅴ麻豆| 97精品免费视频| 日本不卡一二三区| 欧美日韩成人精品| 色偷偷av一区二区三区| 国产欧美精品在线播放| 日韩精品一区二区三区不卡| 国产精品久久二区| 91国产精品视频在线| 免费国产a级片| 性高潮久久久久久久久| 操91在线视频| 日韩中文字幕亚洲| 99久热re在线精品996热视频| 人妻少妇精品无码专区二区| 久久久久国色av免费观看性色| 久久99精品国产一区二区三区 | 国产麻豆电影在线观看| 日韩亚洲不卡在线| 一区二区在线观| 国产精品视频男人的天堂| 久久久伊人日本| 国产精品一香蕉国产线看观看| 欧美午夜精品久久久久久蜜| 亚洲一区二区三区色| 成人444kkkk在线观看| 日韩在线播放av| 91久久精品www人人做人人爽| 欧美韩国日本在线| 日本黄网站免费| 日韩在线国产| 在线观看免费91| 另类美女黄大片| 日韩中文理论片| 国产国语videosex另类| 粉嫩精品一区二区三区在线观看| 黄色网页免费在线观看| 天天综合狠狠精品| 伊人久久大香线蕉av一区| 久久精品视频亚洲| 日韩中文字幕在线精品| 国产z一区二区三区| 97精品伊人久久久大香线蕉| 国产男女免费视频| 免费看国产精品一二区视频| 欧美亚洲色图视频| 热99久久精品| 日本久久久久亚洲中字幕| 亚洲精品一区国产精品| 欧美精品久久久久久久久久| 精品国产一区二区三区无码| 国产精品日韩一区二区 | 色综合五月天导航| 欧美成人亚洲成人| 欧美另类99xxxxx| 久久亚洲一区二区三区四区五区高| 久久久女女女女999久久| 91久久国产婷婷一区二区| 国产精品一区二区免费在线观看| 国产伦理久久久| 国产精品一区二区三区精品 | 亚洲欧美日韩精品在线| 日本亚洲欧洲精品| 欧美xxxx黑人又粗又长精品| 久久精品视频一| av电影一区二区三区| av在线com| …久久精品99久久香蕉国产| 91久久精品一区二区别| 91精品国产一区二区三区动漫 | 国产成人亚洲精品无码h在线| 久久久亚洲影院你懂的| 久久综合中文色婷婷| 久无码久无码av无码| 久久久久久中文| 久久久av一区| 欧美精品手机在线| 在线精品日韩| 视频一区视频二区视频三区视频四区国产 | 精品视频免费观看| 国产伦精品一区二区三区高清版 | 97免费在线视频| 国产精品50p| 日韩在线www| 国产精品久久久久久久av电影 | 91精品国产综合久久久久久蜜臀| 久久伊人资源站| 久久久久久久97| 国产精品国产精品国产专区蜜臀ah| 国产精品久久久久久久久粉嫩av| 精品国产乱码一区二区三区四区| 欧美精品video| 日本一区二区三区www| 欧美大香线蕉线伊人久久| 国产日韩精品入口| 97人人模人人爽人人喊中文字| 久草视频国产在线| 国产精品盗摄久久久| 亚洲精品不卡| 欧洲日韩成人av| 国产麻豆一区二区三区在线观看 | 久久这里只有精品视频首页| 亚洲一区二区三区毛片| 日本精品久久中文字幕佐佐木| 黄色片视频在线播放| 国产精品一区二区久久久久| 国产成人黄色av| 久久这里有精品视频| 天天好比中文综合网| 精品日本一区二区三区在线观看| 国产一区二区三区小说| 久久婷婷国产综合尤物精品| 国产精品二区三区| 少妇一晚三次一区二区三区| 黄色免费高清视频| 91精品国产91| 国产精品久久久久久免费观看| 亚洲一区制服诱惑| 欧美亚洲另类激情另类| 成人在线观看毛片| 日韩在线观看免费高清| 亚洲精品中文综合第一页| 国语自产精品视频在线看一大j8| 91精品综合视频| 国产精品久久久久久久7电影| 性欧美亚洲xxxx乳在线观看| 国产欧美日韩高清| 国产精品手机视频| 日韩av一区二区三区在线| 国产伦精品一区二区三区照片91| 日韩在线免费高清视频| 亚洲综合成人婷婷小说| 国产在线精品一区二区三区| 久久av一区二区|