摘要: 1、inputLayoutD3D11_INPUT_ELEMENT_DESC meshLayout[] = { {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, {"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0}, {"TEXCOORD0", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 24 阅读全文
posted @ 2012-09-09 14:38 ActionFG 阅读(236) 评论(0) 推荐(0)
摘要: 例程来自于DXSDK sample——simpleBezier11原始顶点64个,float3格式,分为4个quad(平均每个Quad有16个控制点)// Control point for a Bezier patch struct BEZIER_CONTROL_POINT { float m_vPosition[3]; }; // Simple Bezier patch for a Mobius strip // 4 patches with 16 control points each const BEZIER_CONTROL_POINT g_... 阅读全文
posted @ 2012-09-09 14:37 ActionFG 阅读(707) 评论(0) 推荐(0)
摘要: (参照例子DXSDK sample:DynamicShaderLinkage11)一、preprocessor实现shader静态分支的经典方法,代码示例如下shader中(如果显卡不支持DX11,则STATIC_PERMUTE为True):#if !defined( STATIC_PERMUTE ) iBaseLight g_abstractAmbientLighting; ... iBaseMaterial g_abstractMaterial;#else ... #define g_abstractAmbientLighting g_ambientL... 阅读全文
posted @ 2012-09-09 14:34 ActionFG 阅读(799) 评论(0) 推荐(0)
摘要: 例子见:Microsoft DirectX SDK basic compute11shader代码:struct BufType{ int i; float f;};StructuredBuffer<BufType> Buffer0 : register(t0);StructuredBuffer<BufType> Buffer1 : register(t1);RWStructuredBuffer<BufType> BufferOut : register(u0);[numthreads(1, 1, 1)]void CSMain( uint3 DTid : S 阅读全文
posted @ 2012-09-09 14:30 ActionFG 阅读(2026) 评论(0) 推荐(0)
摘要: Depth Buffer 1、Learning to Love your Z-bufferIntroductionOne of the more common OpenGL programming problems that I see concerns the poor precision of the Z buffer.Many of the early 3D adaptors for the PC have a 16 bit Z buffer, some others have 24 bits - and the very best have 32 bits. If y... 阅读全文
posted @ 2012-09-08 23:35 ActionFG 阅读(644) 评论(0) 推荐(0)
摘要: 例子见Nvidia DX10 sdk 《Stencil Routed KBuffer》主要实现:第一遍正常渲染,获得Z最小的一层深度值,第二层将第一层深度值作为ShaderResourceView传入,若场景的Z小于等于第一层深度,则discard,这样获得第二层深度值;后面以此类推。// tDepthBuffer为上一层深度, IN.HPosition为屏幕坐标 DepthColorOutput DepthPeelPS ( Geometry_VSOut IN ) { DepthColorOutput output = (DepthColorO... 阅读全文
posted @ 2012-09-08 23:31 ActionFG 阅读(275) 评论(0) 推荐(0)
摘要: 一、基础技术 将光源作为相机,渲染场景,将lightWorldViewProjectPos——处于光源相机透视坐标系下的 z/w 值写入深度图中 注意此时光源相机的projectMatrix应为: D3DXMatrixPerspectiveFovLH(&mLightProjection, D3DX_PI / 2, 1, 0.01, 4000); 采用正常相机,利用深度图再次渲染场景。 将此... 阅读全文
posted @ 2012-05-17 22:21 ActionFG 阅读(318) 评论(0) 推荐(0)
摘要: from cywater:传统Z-Test其实是发生在PS之后的,因此仅仅依靠Z-Test并不能加快多少渲染速度。而EZC则发生在光栅化之后,调用PS之前。EZC会提前对深度进行比较,如果测试通过(Z-Func),则执行PS,否则跳过此片段/像素(fragment/pixel)。不过要注意的是,在PS中不能修改深度值,否则EZC会被禁用。这样,在整个流水线阶段,深度比较发生了2次,一次是EZC,一次是传统Z-Test(注: 区别可能在于EZC无法写入深度)。除了利用EZC帮助传统Z-Test加速之外(硬件自动调用,我称其为隐式用法),目前还有2个显示引申用法:一个类似于Deferred Sha 阅读全文
posted @ 2012-02-06 11:41 ActionFG 阅读(2226) 评论(1) 推荐(1)
摘要: Depth Buffer 1、Learning to Love your Z-bufferIntroductionOne of the more common OpenGL programming problems that I see concerns the poor precision of the Z buffer.Many of the early 3D adaptors for the PC have a 16 bit Z buffer, some others have 24 bits - and the very best have 32 bits. If you are lu 阅读全文
posted @ 2012-02-06 11:39 ActionFG 阅读(663) 评论(0) 推荐(0)
摘要: 1、It is expected that graphics hardware will have a small number of fixed vector locations for passing vertex inputs. Therefore, the OpenGL Shading language defines each non-matrix input variable as taking up one such vector location. There is an implementation dependent limit on the number of locat 阅读全文
posted @ 2012-02-06 11:38 ActionFG 阅读(587) 评论(0) 推荐(0)