0
Under review

DX11 Shader not loading

Rainer Liessem 11 year бұрын updated by Freya Holmér (Developer) 11 year бұрын 6
With the latest Unity 4 Pro on a fresh project none of the DX11 Example Shaders initialize properly. As per suggestion I tried using default Unity DX11 Tesselation Shaders from their example page, and they work fine. What to do?
Image 104
Strange. Do you have a friend or another computer to try it on?
If you make a new shader, make emissive red, and connect things to the tessellation inputs, does it go black?
Yes, as soon as I attach to "DX11 Displacement", not before then.
EDIT: Sorry don't have another computer or friend to try.
Are you getting any errors in the console? Is DX11 checked if you go into the Shader Settings? ( In SF )
Yes, DX11 is checked in the Shader Settings. And I get some warnings, not errors, that I somehow forgot about:

Shader warning in 'Shader Forge/Examples/TessellationDisplacement': Program 'tessvert', implicit truncation of vector type (compiling for d3d11) at line 43
Shader warning in 'Shader Forge/Examples/TessellationDisplacement': Program 'tessvert', implicit truncation of vector type (compiling for d3d11) at line 77
Shader warning in 'Shader Forge/Examples/TessellationDisplacement': Program 'tessvert', implicit truncation of vector type (compiling for d3d11) at line 92
Shader warning in 'Shader Forge/Examples/TessellationDisplacement': Program 'tessvert', incorrect number of arguments to numeric-type constructor (compiling for d3d11) at line 120
Shader warning in 'Shader Forge/Examples/TessellationDisplacement': Program 'tessvert', syntax error: unexpected token '*' (compiling for d3d11) at line 120


On my custom DX11 shader it's a few less
Shader warning in 'Shader Forge/NewShader': Program 'tessvert', undeclared identifier 'node_15' (compiling for d3d11) at line 33
Shader warning in 'Shader Forge/NewShader': Program 'tessvert', implicit truncation of vector type (compiling for d3d11) at line 43
Shader warning in 'Shader Forge/NewShader': Program 'tessvert', implicit truncation of vector type (compiling for d3d11) at line 77
Shader warning in 'Shader Forge/NewShader': Program 'tessvert', implicit truncation of vector type (compiling for d3d11) at line 92


I remember a few weeks ago when I first went to DX11 I've actually had a non-DX11 surface shader with a vert program. That shader stayed fully black too until I replaced the output variable declaration with UNITY_INITIALIZE_OUTPUT(Input, o);

Remembering that, I tried to do the same with the shader forge generated shader and replaced every occurance of VertexOutput o; with UNITY_INITIALIZE_OUTPUT(VertexOutput, o); to see if it changes anything, but I'm not sure if I did it right because nothing changed and a new warning appears "Shader warning in 'Shader Forge/Examples/TessellationDisplacement': Program 'tessvert', undeclared identifier 'o' (compiling for d3d11) at line 43"

I have no clue what else to try, really.
Mostly works now with Beta 0.16 as long it's in Forward Mode. On deferred, the smoke on the Tesselation Displacement shader doesn't work (just like the Clip and Transmission shader). Vertex Animation has some odd fragment on deferred too. Still, huge improvement and thank you, whatever you did :)
Cool, thanks for checking! I tried it right before release too, and everything seemed to work :)
SF doesn't support deferred rendering paths at the moment, which is why you're getting those issues.