You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers. No questions about C++ programming or topics which are answered in the tutorials!
Im trying to set mWorldViewProj as a Shader Constant like below but getting an error on the console window saying 'HLSL variable to set not found "mWorldViewProj" Available variables are:'.
It's in the vertex shader, this is straight out from the shaders demo. I can't see what im doing differently, here is the rest of the hlsl code, it doesn't do anything at the moment.
The problem is that you are not using mWorldViewProj to produce the final product in your shader, so it gets discarded. Even if it is declared in the shader file, even if it is used in some random expression in the shader, if a uniform does not contribute to the final output value of the shader it is optimized out, and setting it in Direct3D will yield that error message.
Out.Pos = mul(float4(Pos.xyz , 1), mWorldViewProj);
// Or it might be "mWorldViewProj, float4(Pos.xyz , 1)", I forgot the order of multiplication for D3D, been doing too much GLSL lately...
Though I'm not sure what you're shader is trying to achieve by only using the first 2 components of the position...
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Same error here, but mWorldViewProj is actually used in my very simple shader.
I know it does not directly contribute to the pixel output, but is still needed for vertex POSITION. Is there any way to make it not being discarded ?
Or am i doing something wrong ? (this shader works in other engines)
After recompiled Irrlicht with directx sdk august 2007 (was previously june 2006), and d3dx9d.dll only in the linker (no d3dx8d.dll), it's working.
Strange...