0
Fixed

Shader Model 2

Luca Eberhart 10 years ago updated by Jason Booth 10 years ago 12
Hi,
when I try to activate the Shader Model 2 graphic emulation the material becomes black.
Are you getting any errors?
Hi Joachim,
I'm not getting any error. If you need more information about the problem, let me know.
Which platform are you on?
Which renderers are enabled in the shader settings?
Windows 7 64 Bit
Nvidia 470 GTX
Unity 4.3.2f1
Renders: DX9, OpenGL, OpenGL ES 2.0
Strange. Does this still happen?
Yes, but the WebPlayer statistics says only 8% of users have a shader model 2.0 video card, so we so decided to ignore the problem.
I'll do a test tomorrow on other computers and let you know.
The "experimental Shader Model 2.0 force feature" works for me :)
Ah, alright! Closing this then :)
+2
So, I recently spent a lot of time porting a shader forge shader to code, and making it run on sm2 platforms. It was 135 pixel instructions, so getting that into 64 was pretty tricky. Anyway, I learned a bit about the shader compiler and it's error reporting in that process. Often, when a shader fails on a platform, it will fail silently and just draw black. This usually happens when your shader passes the compilers checks (number of interpolators, number of instructions, etc) but for some reason still has an issue on the device or in the emulator. It's pretty annoying, because you get no information about it, and can only figure out what is happening by commenting out sections of your code until you come to the offending piece.

In my case, one was simply sampling another texture seemed to put me over the line (but again, no compiler warnings/errors). What was odd about this was that I was running in SM3, and only had 5 texture samplers other than the offending one. However, swapping that out for a simple color fixed the problem. 

Oh, and annoyingly, the fallback shader is not always invoked in this case. 

Anyway, this isn't really a shader forge issue - though I suspect it will come up again in the context of SF. Given the complexity of Unity's shader compiler (cross compiling/translating, many platforms, etc), it's also not surprising that there are unfortunate dead ends like this.