随笔分类 -  HLSL

摘要:D3DXCreateEffectFromFile函数中的Flags参数追加D3DXSHADER_ENABLE_BACKWARDS_COMPATIBILITY,使得编译fx时与旧版本兼容 阅读全文

posted @ 2009-03-04 22:00 活着就是幸福 阅读(288) 评论(0) 推荐(0)

摘要:1.光和材质 D3D计算物体顶点光照基于 1. 现有材质和关联的纹理纹素 2. 顶点指定的漫反射光和高光颜色 3. 光源颜色和强度,以及环境光 材质决定光如何从表面反射。没有光会产生一个剪影。 2.直射光和环境光 折射光有方向和颜色。 环境光没有位置和方向,只有颜色和强度。每盏灯都会增加环境光。 环境光使用IDirect3DDevice9::SetRenderState(... 阅读全文

posted @ 2008-12-11 22:05 活着就是幸福 阅读(376) 评论(0) 推荐(0)

摘要:Virtual Machine Block Diagram 1. Each register contains four floating-point values. 2. ■ Input registers read from the vertex buffer ■ Constant registers provide constants to the ALU ■ Te... 阅读全文

posted @ 2008-11-10 22:06 活着就是幸福 阅读(443) 评论(0) 推荐(0)

摘要:Intrinsics 内置函数 As mentioned in the preceding section, there are a number of intrinsics built into the DirectX High Level Shading Language for your convenience. Many intrinsics, such as mathemat... 阅读全文

posted @ 2008-11-07 00:09 活着就是幸福 阅读(497) 评论(0) 推荐(0)

摘要:Shader寄存器内对应顺序是 x y z w r g b a PC和XBOX360都是如此。 阅读全文

posted @ 2008-11-06 23:49 活着就是幸福 阅读(359) 评论(0) 推荐(0)

摘要:Structures 结构体 As we showed in the first example shader, it is often convenient to be able to define structures in HLSL shaders. For example, many shader writers will define an output structure ... 阅读全文

posted @ 2008-11-05 20:48 活着就是幸福 阅读(318) 评论(0) 推荐(0)

摘要:Working with Vectors 使用向量 In HLSL, there are a few "gotchas" to look out for when performing math on vectors. Fortunately, most of them are quite intuitive, given that we are writing shaders for 3D... 阅读全文

posted @ 2008-11-03 21:53 活着就是幸福 阅读(358) 评论(0) 推荐(0)

摘要:Type Modifiers 类型修饰符 There are a couple of optional type modifiers in the HLSL that you may want to use in your shaders. The familiar const type modifier is used to specify a variable whose value c... 阅读全文

posted @ 2008-11-02 22:17 活着就是幸福 阅读(262) 评论(0) 推荐(0)

摘要:Matrix Types 矩阵类型 Another very common type of variable that you will find yourself using in HLSL shaders is matrices, which are 2D arrays of data. Like scalars and vectors, matrices may be compose... 阅读全文

posted @ 2008-11-02 00:21 活着就是幸福 阅读(211) 评论(0) 推荐(0)

摘要:Now that you have a sense of what HLSL vertex and pixel shaders look like and how they interact with the low-level assembly shaders, we can discuss some of the details of the language itself. 现在你已经... 阅读全文

posted @ 2008-11-01 21:35 活着就是幸福 阅读(227) 评论(0) 推荐(0)

摘要:Ignored. 阅读全文

posted @ 2008-11-01 20:46 活着就是幸福 阅读(159) 评论(0) 推荐(0)

摘要:Below, we see a simple HLSL procedural wood pixel shader. This pixel shader, which is written to work with the vertex shader we just described, will be compiled for the ps_2_0 target. 下面,我们看看一个简单的用程序... 阅读全文

posted @ 2008-11-01 18:53 活着就是幸福 阅读(338) 评论(0) 推荐(0)

摘要:A Simple Example 一个简单的例程 Before presenting an exhaustive description of the HLSL, let's first have a look at one HLSL vertex shader and one HLSL pixel shader taken from an application which renders ... 阅读全文

posted @ 2008-11-01 18:16 活着就是幸福 阅读(322) 评论(0) 推荐(0)

摘要:Introduction 介绍 One of the most empowering new components of DirectX 9 is the High Level Shading Language (HLSL). Using this standard high level language, shader writers are able to think at the alg... 阅读全文

posted @ 2008-11-01 17:39 活着就是幸福 阅读(297) 评论(0) 推荐(0)