by fox64194167
The picture below is a .X file opened by DirectX Mesh View. Today, we look at the X file’s detail information. I strongly recommand readers search “X File Format Reference” topic in DirectX SDK documentation. The variable-length header is compulsory and must be at the beginning of the data stream. The header contains the following data. Type Re […]
by fox64194167
What is a face normal? A face normal is a vector that describes the direction a polygon is facing(see figure 1) Figure 1: The face normal of a surface What is a vertex normal? Vertex normal have some relationships with face normal. We will discuss it in “How to calculate face normal and vertex normal?” Sometimes we can set vertex normal just as same as face […]
by fox64194167
首先我们来看下这个项目的效果,一个照片被”黑白化” 下面这张是原图。 我们来看下是如何实现的,首先你要有点知识关于“DirectX Texture(纹理)”. 如果你还没有的话,可以看下这篇文章 “DirectX 9.0 C++ tutorial Texture ”. 今天的主题是 HLSL and Pixel Shader(像素着色器), 这两个主题有点难。 介绍: HLSL 是 “High-LevelShading Language” 的简写. 我们可以使用 HLSL去写一些小的 Pixel Shade 项目.简要地说, 顶点着色器和像素着色器就是我们自行编写的一些规模较小的定制程序。这些定制程序可取代固定功能流水线中的某一功能,并在图形卡的GPU中执 […]
by fox64194167
First we look at the project result: A picture that looks “grey”. Below is the original Picture. So let’s see how to do it. First you had to know some knowledge about “DirectX Texture”. If you don’t, you can see the article “DirectX 9.0 C++ tutorial Texture ” Firstly. Today’s topic is HLSL and Pixel Shader, it’s a some kind difficult topic. Introduction: H […]
by fox64194167
写在前面:正当很高兴地完成了矩阵相关的旋转后,发现如果涉及到旋转;矩阵,欧拉角(EulerAngles) ,四元数(Quaternions)这三个概念哪本书上都会提。这次先讲下欧拉角。 1.什么是欧拉角 欧拉角是由三个角组成,这三个角分别是Yaw,Pitch,Roll。很难翻译这三个单词,Yaw 表示绕y轴旋转的角度,Pitch表示绕x轴旋转的角度,Roll表示绕z轴旋转的角度。也就是说,任意的旋转角度都可以通过这三次按照先后顺序旋转得到。矩阵很难让人具体形象表示,欧拉角就容易多了。注意可能很多地方三个角的先后次序不一样,我们这里选择跟DirectX 中的D3DXMatrixRotationYawPitchRoll函数保持一致,先绕y轴旋转,在绕x轴旋转,最后绕z轴旋转。 感觉Yaw(偏航),Pitch(投掷;倾斜;坠落),Roll(转动) 介绍飞 […]
by fox64194167
还记得DirectX 9.0 C++ 教程 光照中这个旋转的水壶吗?当时我们用的是官方函数D3DXMatrixRotationY(D3DXMATRIX *pOut, FLOAT Angle)。刚刚我们已经学习了线性代数中的一些基础知识,Matrix 矩阵,单位矩阵,Transposition,矩阵与矩阵相乘,矩阵中的旋转(Rotation),我已经迫不及待想用自己写的旋转函数替换官方旋转函数了,来更好的记住数学知识,你呢? 对上面这张gif图片是如何制作感兴趣?看截取视频,然后制成gif 教程 首先看下数学公式: 由上面的数学公式,我们转换的C++函数: //—————————————————————————– // Name: setupRota […]