Tag Info

Hot answers tagged


You can get this behaviour without a branch using the step function: float blendFactor = step(3.0f, dot(B.rgb, B.rgb)); return lerp(B, A, blendFactor); When B = (1, 1, 1), dot(B, B) = 3.0f, so step returns 1, blendFactor = 1, and the lerp gives a result of A. When B is anything less, dot(B, B) < 3.0f, so step returns 0, blendFactor drops to 0, and the ...


Look at the pixel shader instructions in Shader Model 2. I found "texldb" : Biased texture load instruction. This instruction uses the fourth element (.a or .w) to bias the texture-sampling level-of-detail just before sampling Syntax texldb dst, src0, src1 https://msdn.microsoft.com/en-us/library/windows/desktop/bb206217(v=vs.85).aspx


D3D9 doesn't support constant buffers but all uniforms are placed into one global "constant buffer". You can set multiple float4 constants at once with IDirect3DDevice9::SetPixelShaderConstantF() by passing the number of constants as the last argument.


screenPosition is not at the right scale for texture coordinate lookup. Texture2D::Sample expects texture coordinates (0..1) while Texture2D::Load expects texel coordinates (0..[Width or Height]-1). So you're probably sampling way off the edge of the texture and either hitting the border color, or clamping to the edge which happens to be black. As a ...

Only top voted, non community-wiki answers of a minimum length are eligible