理解D3D—(2)最多混合几层texture
来源:互联网 发布:java解析wsdl 编辑:程序博客网 时间:2024/05/29 02:54
理解D3D—(2)最多混合几层texture
先提出问题
Q:要是模型有很多层贴图,再加上shadow map,还有ssao,岂不是会不够用了?
A:
参考资料
IDirect3DDevice9::SetTexture
Assigns a texture to a stage for a device.
HRESULT SetTexture(DWORD Sampler,IDirect3DBaseTexture9 * pTexture);
Parameters
- Sampler
Zero based sampler number. Textures are bound to samplers; samplers define sampling state such as the filtering mode and the address wrapping mode. Textures are referenced differently by the programmable and the fixed function pipeline【可编程着色器和固定管线,这两种情况下,textures不同】:
- Programmable shaders reference textures using the sampler number. The number of samplers available to a programmable shader is dependent on the shader version【可编程着色器的有效采样器的数目取决于着色器的版本】. For vertex shaders, seeSampler (Direct3D 9 asm-vs). For pixel shaders see Sampler (Direct3D 9 asm-ps).
- The fixed function pipeline on the other hand, references textures by texture stage number【另一方面,固定管线取决于texture stage的数目】. The maximum number of samplers is determined from two caps:MaxSimultaneousTextures and MaxTextureBlendStages of the D3DCAPS9 structure.
[in] There are two other special cases for stage/sampler numbers.
- A special number called D3DDMAPSAMPLER is used for Displacement Mapping (Direct3D 9).
- A programmable vertex shader uses a special number defined by a D3DVERTEXTEXTURESAMPLER when accessing Vertex Textures in vs_3_0 (DirectX HLSL).
- pTexture
- [in] Pointer to an IDirect3DBaseTexture9 interface, representing the texture being set.
Remarks
IDirect3DDevice9::SetTexture is not allowed if the texture is created with a pool type of D3DPOOL_SCRATCH.IDirect3DDevice9::SetTexture is not allowed with a pool type of D3DPOOL_SYSTEMMEM texture unless DevCaps is set with D3DDEVCAPS_TEXTURESYSTEMMEMORY.
IDirect3DDevice9::SetTextureStageState
Sets the state value for the currently assigned texture.
HRESULT SetTextureStageState(DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value);
Parameters
- Stage
- [in] Stage identifier of the texture for which the state value is set. Stage identifiers are zero-based. Devices can have up to eight set textures, so the maximum value allowed for Stage is 7【Stage标识符从0开始。设备可以有8组textures,所以Stage的最大值为7】. 【Q:eight set textures == 8组textures?啥意思?】
- Type
- [in] Texture state to set. This parameter can be any member of the D3DTEXTURESTAGESTATETYPE enumerated type.
- Value
- [in] State value to set. The meaning of this value is determined by the Type parameter.
Gamebryo里面
nid3dpass.h
// Max number of blending stages supported.// Should correspond to the number of pixel shader instructions allowed. static unsigned int ms_uiMaxTextureBlendStages;// Max number of textures that can be bound to the blending stages.// Should correspond to the number of texture registers supported by the// pixel shaders. static unsigned int ms_uiMaxSimultaneousTextures;// Max number of samplers supported.// Can only be greater than ms_uiMaxTextureBlendStages under DX9 when// PS2.0 (or greater) hardware is supported. static unsigned int ms_uiMaxSamplers;
内网跟踪了下LightSpeed的版本蜗牛的例子StandardMaterial,ms_uiMaxTextureBlendStages == 8.
Bump maps
Dark maps
Decal maps (up to 3)
Detail maps
Gloss maps
Glow maps
- Normal maps
Parallax maps
Environment maps
Q:已经9个了,那Base maps呢?
A:ms_uiMaxSamplers可以比ms_uiMaxTextureBlendStages大了,呵呵,加上Base maps一共10个,还有shadow,猜想ms_uiMaxSamplers至少==11.
2009-9-30 经跟踪代码,Pixel Shader版本大于2,就是16个。就是device capabilities嘛,一初始化程序就能确定。device::GetDeviceCaps(…)
nidx9renderer.cpp
NiDX9Renderer::InitializeDeviceCaps
Parameters
- pCaps
- [out] Pointer to a D3DCAPS9 structure, describing the returned device.
Return Values
If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be D3DERR_INVALIDCALL.
Remarks
IDirect3DDevice9::GetDeviceCaps retrieves the software vertex pipeline capabilities when the device is being used in software vertex processing mode.
- 理解D3D—(2)最多混合几层texture
- 理解D3D—(2)最多混合几层texture
- D3D中的texture应用示例
- 【D3D Review】Blending 混合
- D3D学习笔记:混合
- D3D纹理混合方式
- D3D纹理混合
- D3D混合纹理
- D3D中的混合
- D3D变换的理解
- (D3D)dx9实现渲染到纹理(Render To Texture, RTT)
- Alpha 混合(三)Texture alpha
- 在C++里边定义一个宏,最多可以包含几层?
- D3D深度测试和Alpha混合
- 理解D3D--(0)批次batch
- D3D动画相关接口理解
- D3D之2D游戏编程(一)——D3D图形管道
- DDS支持的Mipmap Texture/Cubemap Texture/Volume Texture 纹理理解
- 使用nginx获取get/post参数值并返回给客户端
- 关于bootstrap的字体图标问题
- JS检查变量是否存在
- iOS 悬浮按钮
- 浅谈Linux下的五种I/O模型
- 理解D3D—(2)最多混合几层texture
- CS231n课程笔记翻译:图像分类笔记(上)
- introduction to db--学习记录
- android.permission.INTERACT_ACROSS_USERS_FULL
- android hook技术-Xposed框架 帮你轻松应对支付宝2016晒账单
- 面试算法学习-2-字符串包含
- Lua 模块与包
- datePickerDialog年月选择弹框 自定义 拿来就用
- java异常体系结构