3D图形渲染及数字图像处理算法相关文集

sample2D( depth_buffer_last, (pixel_coordinates * inverse(MPV_current) * MPV_last).xy )

如果是shadowmap,就用那个light space projection matrix。scatter的问题 bilateral filter 搞下。

Direct3D 12 resources in HLSL are bound to virtual registers within logical register spaces:

  • t – for shader resource views (SRV)
  • s – for samplers
  • u – for unordered access views (UAV)
  • b – for constant buffer views (CBV)

在Direct3D的颜色表示中,_SNORM 后缀表示带符号的规格化的整数;它在一个资源中表示为一个带符号的整型数据,且在shader中被解释为一个带符号的范围在[-1, 1]的浮点值。对于以2的补码形式的整数来说,最大值为1.0f(一个5位的二进制数01111映射为1.0f),最小值是-1.0f(一个5位二进制数10000映射为-1.0f)。此外,第二小的数也被映射为-1.0f(一个5位的二进制数10001被映射为-1.0f)。整数结果的表示被均匀地分布在(-1.0 … 0.0f) 浮点值范围内,且相对的其补集表示的数在 (0.0f … 1.0f) 范围内。_UNORM 后缀表示无符号规格化整数;它在一个资源中被解释为一个无符号整数,且在shader中被解释为一个无符号的规格化的浮点数,范围在[0, 1]内。所有0被映射为0.0f,而所有的1被映射为1.0f。一个均匀分布的浮点值序列被表示为从0.0f到1.0f。例如,一个2比特的UNORM(00, 01, 10, 11)分别表示为:0.0f,1/3,2/3及1.0f。详情可参考:Format Modifiers

OpenGL/Vulkan 中的颜色格式与 Direct3D 类似,可参考:Image Format。其中陈述了:

Normalized integer formats themselves are broken down into 2 kinds: unsigned normalized and signed normalized. Unsigned normalized integers store floating-point values on the range [0, 1], while signed normalized integers store values on the range [-1, 1].

在Vulkan中,SSCALED 后缀表示带符号的整数;它在主机端的资源中表示一个带符号的整数,且在shader中被解释为一个与主机端的值相对应的带符号的浮点数。USCALED 后缀表示无符号的整数;它在主机端的资源中表示一个无符号的整数,且在shader中被解释为一个与主机端的值相对应的无符号的浮点数。详情可见:VK_FORMAT_R8G8B8A8_[U/S]SCALED vs VK_FORMAT_A8B8G8R8_[U/S]SCALED_PACK32 ?

A mesh is a collection of vertices, edges, and faces that define a 3D object’s shape and geometry, it’s used to represent 3D objects in computer graphics programs; it provides a way to define the object’s surface in terms of vertices, edges, and faces.

var geometry = new THREE.BoxGeometry(1, 1, 1),
var material = new THREE.MeshBasicMaterial({color: 0x00ff00}),
var cube = new THREE.Mesh(geometry, material),
scene.add(cube)

Geometry Image Relevant Repositories


invariant 限定符

invariant 可以作用于顶点着色器输出的任何一个 outvarying 变量。

当着色器被编译时,编译器会对其进行优化,这种优化操作可能引起指令重排序(instruction reordering),指令重排序可能引起的结果是当两个着色器进行相同的计算时无法保证得到相同的结果。

例如,在两个顶点着色器中,变量 gl_Position 使用相同的表达式赋值,并且当着色程序运行时,在表达式中传入相等的变量值,则两个着色器中 gl_Position 的值无法保证相等,这是因为两个着色器是分别单独编译的。这将会引起 multi-pass 算法的几何不一致问题。
通常情况下,不同着色器之间的这种值的差异是允许存在的。如果要避免这种差异,则可以将变量声明为 invariant,可以单独指定某个变量或进行全局设置。

使用 invariant 限定符可以使输出的变量保持不变。invariant 限定符可以作用于之前已声明的变量使其具有不变性,也可以在声明变量时直接作为声明的一部分,可参考以下两段示例代码:

varying mediump vec3 Color;
// 使已存在的 color 变量不可变
invariant Color;

invariant varying mediump vec3 Color;

以上是仅有的使用 invariant 限定符情境。如果在声明时使用 invariant 限定符,则必须保证其放在存储限定符(varyingout)之前。

只有以下变量可以声明为 invariant

  • 由顶点着色器输出的内置的特殊变量
  • 由顶点着色器输出的 outvarying 变量
  • 向片段着色器输入的内置的特殊变量
  • 向片段着色器输入的 invarying 变量
  • 由片段着色器输出的内置的特殊变量

Direct3D extrapolation

The number of sample locations is dependent on the multisample mode. Vertex attributes are interpolated at pixel centers, since this is where the pixel shader is invoked (this becomes extrapolation if the center is not covered). Attributes can be flagged in the pixel shader to be centroid sampled, which causes non-covered pixels to interpolate the attribute at intersection of the pixel’s area and the primitive. A pixel shader runs for each 2x2 pixel area to support derivative calculations (which use x and y deltas). This means that shader invocations occur more than is shown to fill out the minimum 2x2 quanta (which is independent of multisampling). The shader result is written out for each covered sample that passes the per-sample depth-stencil test.

When a sample-frequency interpolation mode is not needed on an attribute, pixel-frequency interpolation-modes such as linear evaluate at the pixel center. However with sample count > 1 on the RenderTarget, attributes could be interpolated at the pixel center even though the center of the pixel may not be covered by the primitive, in which case interpolation becomes “extrapolation”. This “extrapolation” can be undesirable in some cases, so short of going to sample-frequency interpolation, a compromise is the centroid interpolation mode.

Centroid behaves exactly as follows:

  • (1) If all samples in the primitive are covered, the attribute is evaluated at the pixel center (even if the sample pattern does not happen to have a sample location there).
  • (2) Else the attribute is evaluated at the first covered sample, in increasing order of sample index, where sample coverage is after ANDing the coverage with the SampleMask Rasterizer State.
  • (3) If no samples are covered, such as on helper pixels executed off the bounds of a primitive to fill out 2x2 pixel stamps, the attribute is evaluated as follows: If the SampleMask Rasterizer state is a subset of the samples in the pixel, then the first sample covered by the SampleMask Rasterizer State is the evaluation point. Otherwise (full SampleMask), the pixel center is the evaluation point.

OpenGL中对各种四元向量数据类型的分量标识

  • 顶点坐标:x, y, z, w
  • 纹理坐标:s, t, r, q
  • 颜色通道:r, g, b, a

Vertex Splitting

Vertex splitting is a technique used in computer graphics to handle texture seams. If a single vertex location on a mesh needs two different texture coordinates, then that vertex location gets split into two vertices to send to the GPU - both with the same position, but one with texture coordinate A and one with texture coordinate B. – What does ‘vertex splitting’ mean?

In graph theory, vertex splitting is also a problem where the objective is to determine a minimum number of vertices to split so that the resulting directed acyclic graph (DAG) has no path of length d2. – Vertex Splitting In Dags And Applications To Partial Scan Designs And Lossy Circuits


PS2模拟器相关技术


Switch模拟器


以下为各个图形API的图形流水线

Metal API
OpenGL
OpenGL ES

我们可以看到,OpenGL与OpenGL ES基本是一样的。此外,如果想了解OpenGL图形渲染流水线更为细节的情况,可参考此文:https://www.khronos.org/opengl/wiki/Rendering_Pipeline_Overview


Pixel与Texel

pixel 这个单词来源于pixelement的缩写,表示图像元素,因此简称像素
同样,texel 则是textureelement的缩写,表示纹理元素

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值