First problem, wich is actually 2 things at the same time.
Mesh with vertex painting on it.
Left:
DX11, works fine except for the fact that using TC_NormalmapUncompressed I get all these weird white dots.
Switching to DX9 or TC_NormalMap fixes this.
(not a huge problem, if not for the problem in the right image).
Right:
Only in DX9:
As soon as I do anything related to reflections (ruled out the emissive slot, just plugging in a vector3 gives no problems-
my vertex colours completely go away and I can't change them.
even doing a simple "reflection vector -> vector transform -> cubemap"
either straight in the emissive
or lerped in the diffuse (with a alpha of 0 even) gives this problem).
2nd problem:
My alpha expression for the vertex painting works fine for the normal/spec/diffuse.
But as soon as I do it for the specPower it throws this error, it doesn't matter what I put into either A or B (just putting in a constant in both), it only gets fixed by plugging a scalar into the alpha slot.
Replies
if I just plug in a scalar, then I might as wel not have the lerp there, because then it won't give a seperate specularPower value for the 2 textures, just a flat value over the whole thing that is a average (depending on the value of the scalar) of the A&B slot.
So maybe there is a reason for it, but I can't really understand why the exact same thing works for diffuse/spec/normal and not for specularPower.
edit: nevermind, thinking about your post I understand it now (plugging in a texture doesn't work, plugging in just the alpha does work).
masking out one channel did the trick, thanks ^^(since my alpha expression is just grey scale values)
The solution is to mask out the blue channel in the shader and append a constant value to it. Values between 0.75 and 1 should work fine.
How is that a solution? It's not a normal if you are replacing one of the components with an arbitrary value.
z = sqrt(1 - x^2 - y^2)
I don't know what math the shader uses to compute the Z value when using the TC_NormalmapUncompressed, but assuming it's the same as you, wouldn't that just result in the same dots appearing?
UDN Quote: Checking "Per Pixel Camera Vector" in the material properties will make both work together.
Thanks a lot for the help/responses
The problem is actually that the term under the root may evaluate to a negative number due to floating point inacurracy, which will yield an invalid result, causing fancy errors in DX11 mode.
You can easily built your own way to derive the blue channel, and use the result as the normal input for the shader. lpcstr provided the correct formula to do so, but here is an image that might help, note the clamp before the sqrt