中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Chapter 4. Math for 3D Graphics(3D圖形中的數學)

發布時間:2020-03-04 23:17:31 來源:網絡 閱讀:429 作者:萌谷王 欄目:游戲開發

周一到周五,每天一篇,北京時間早上7點準時更新~

What You’ll Learn in This Chapter(本章你將會學到啥)

What a vector is, and why you should care about them(什么是向量以及為什么你需要注意他們)
What a matrix is, and why you should care more about them(什么是矩陣以及為什么你需要更注意它們)
How we use matrices and vectors to move geometry around(我們如何使用矩陣和向量來移動幾何物體)
What the OpenGL conventions and coordinate spaces are(OpenGL中的轉換以及坐標空間是啥)
So far, you have learned to draw points, lines, and triangles and have written simple shaders that pass your hard-coded vertex data through unmodified(現在,你已經學過了如何繪制點、線以及三角形,并且我們寫了一些簡單的shader,它們不對數據進行修改,僅僅是起到了在圖形管線中傳遞數據的作用). We haven’t really been rendering in 3D—which is odd for a book on 3D graphics!(我們還沒有真正的渲染3D的東西,這對于一本3D圖形的書來說不是很奇怪嗎) Well, to turn a collection of shapes into a coherent scene, you must arrange them in relation to one another and to the viewer(然而,要有條理的去在3D場景中組織物體,你必須管理他們之間的相對關系以及和攝像機的關系). In this chapter, you start moving shapes and objects around in your coordinate system(在本小節,你將開始在你的坐標系統中移動物體). The ability to place and orient your objects in a scene is a crucial tool for any 3D graphics programmer(對于3D程序員來說,在場景中去放置和旋轉物體的能力是非常關鍵的). As you will see, it is actually convenient to describe your objects’ dimensions around the origin and then transform the objects into the desired positions(你將會看到,去定義物體的維度以及控制物體的位置還是比較容易的)

Is This the Dreaded Math Chapter?(這是一個狗帶的數學章節嗎)

In most books on 3D graphics programming, yes, this would be the dreaded math chapter(在大多數3D圖形書籍里,確實,這就是一章狗帶的數學內容). However, you can relax; we take a more moderate approach to these principles than some texts(不過,你可以放輕松,我們將使用一些更舒適的手段來講解這些原理而不是緊靠文字描述)

One of the fundamental mathematical operations that will be performed by your shaders is the coordinate transform, which boils down to multiplying matrices with vectors and with each other(最基本的數學操作中的一個就是你會在shader中用到的坐標系轉換,它涉及到矩陣與矩陣以及矩陣與向量的乘法). The keys to object and coordinate transformations are two matrix conventions used by OpenGL programmers(對于OpenGL程序員來說,坐標系轉換的關鍵在于兩個矩陣). To familiarize you with these matrices, this chapter strikes a compromise between two extremes in computer graphics philosophy(為了讓你熟悉 這些矩陣,本章節將采用計算機圖形學中兩種極端 思路的這種方案來進行講解). On the one hand, we could warn you, “Please review a textbook on linear algebra before reading this chapter.”(一方面,我們會警告你說,請在閱讀本章之前,先看一看線性代數的 書) On the other hand, we could perpetuate the deceptive reassurance that you can “learn to do 3D graphics without all those complex mathematical formulas.”(另一方面,我們也會不斷的告訴你,即便沒有那些復雜的數學理論,你也可以學會3D圖形學) But we don’t agree with either camp(但是,我們實際上兩邊都不同意)

In reality, you can get along just fine without understanding the finer mathematics of 3D graphics, just as you can drive your car every day without having to know anything at all about automotive mechanics and the internal combustion engine(實際上,你可以在不必精通3D數學的情況下,很好的處理3D編程問題,就像你不必懂什么汽車生產以及發動機的原理就能開車一樣). But you had better know enough about your car to realize that you need an oil change every so often, that you have to fill the tank with gas regularly, and that you must change the tires when they get bald(但是你最好是更多的了解你的車子,這樣你就可以知道什么時候該加油了 ,什么時候該打氣了). This knowledge makes you a responsible (and safe!) automobile owner(這些知識能讓你更好的玩轉你的車子). If you want to be a responsible and capable OpenGL programmer, the same standards apply(如果你希望變成一個更強的OpenGL程序員,道理是一樣的). You need to understand at least the basics so you know what can be done and which tools best suit the job(你至少需要了解最基本的數學,這樣你才能知道你可以做什么以及什么工具是最適合你的項目的). If you are a beginner you will find that, with some practice, matrix math and vectors will gradually make more sense, and you will develop a more intuitive (and powerful) ability to make full use of the concepts we introduce in this chapter(如果你是一個新手,你將會發現,隨著不斷的練習,你將會得到更多的矩陣以及向量方面的體會,并且你將能更好的去理解我們本章節提到的這些概念)

So even if you don’t already have the ability to multiply two matrices in your head, you need to know what matrices are and how they serve as the means to OpenGL’s 3D magic(所以,即便你不知道如何計算矩陣的乘法,你需要知道什么是矩陣,以及他們在OpenGL中的意義). But before you go dusting off that old linear algebra textbook (doesn’t everyone have one?)(但是在你開始再次翻開你的線性代數課本之前,不要害怕:因為我們的sb7庫里面應包含了一個叫vmath的組件,它能很好的幫你解決數學計算方面的問題), have no fear: The sb7 library has a component called vmath that contains a number of useful classes and functions that can be used to represent and manipulate vectors and matrices. They can be used directly with OpenGL and are very similar in syntax and appearance to GLSL—the language you’ll be writing your shaders in(他們可以像你即將在shader中使用矩陣的方式一樣使用). So, you don’t have to do all your matrix and vector manipulation yourself, but it’s still a good idea to know what they are and how to apply them(所以你并不需要自己親手實現所有這些數學計算,但是知道怎么實現這些數學計算以及如何應用他們任然是值得你努力的方向). See—you can eat your cake and have it, too!

本日的翻譯就到這里,明天見,拜拜~~

第一時間獲取最新橋段,請關注東漢書院以及圖形之心公眾號

東漢書院,等你來玩哦

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

海兴县| 永清县| 怀集县| 马龙县| 常熟市| 锦州市| 和静县| 炉霍县| 石家庄市| 湖口县| 南漳县| 兰考县| 宜黄县| 金溪县| 罗源县| 奉新县| 鸡东县| 桦川县| 桑植县| 吉林省| 安平县| 茂名市| 蛟河市| 芦溪县| 彩票| 富平县| 永修县| 天等县| 通海县| 雷波县| 陵水| 略阳县| 波密县| 武安市| 莲花县| 沂南县| 分宜县| 古丈县| 辉县市| 安化县| 永定县|