Turning Shaders off for older graphics cards.

I had originally posted this in ‘Unity Support’ but as it seems to be a shader issue, I thought I’d post it here.

I’m almost finished a quick game and I am pleased for the most part, but a problem has emerged. The game looks fine on my Macbook Pro and G5 tower but, when I tested it on my wife’s iBook, the screen was black.

I tried the iBook on a scene with and without the Image Effect enabaled and the one with the effect produced the black screen. I looked at the code for the shader, Contrast Stretch, and at the beginning I found this line.

// TBD: if some shader is not supported, turn off!

I interpret this to mean that someone planned to add some code here that would detect whether the shader would run on the computer but as it’s a comment and there is no code after it, the code was never added.

I found the following code on a script called ‘ImageEffectBase’ and it seems to deal with turning the effect off if it isn’t supported.

public Shader   shader; 

   protected void Start () 
   { 
      // Disable if we don't support image effects 
      if (!SystemInfo.supportsImageEffects) { 
         enabled = false; 
         return; 
      } 
       
      // Disable the image effect if the shader can't 
      // run on the users graphics card 
      if (!shader.isSupported) 
         enabled = false; 
   }

Can I just add it to the beginning of the ‘Contrast Stretch’ script?

As I haven’t received a response, I’m wondering if this question falls into one of two categories.

  1. This is too simple a question to respond to. Look harder for the answers.

  2. This is pretty difficult and no one has come across it yet.

I imagine that it’s not the second one, so I’ll keep looking. Of course I would still appreciate any guidance regarding this question as shader scripting is completely new to me.

So I did some research and went through the documentation and found this in the information about the Contrast Stretch image effect.

Given that my wife’s computer, a 1.2 GHz G4 iBook, shows a black screen when the image effect is running, I’m wondering what can I do to alleviate this. Is this simply a case that her computer is too old?

You can find the game at the following location.

http://www.inclusionentertainment.com/Downloads/FluSeason.html

The black screen occurs after you hit start and launch the main game.

Later…

I just went and tested the image effect with the Graphics Emulation and found that you could recreate the black screen by choosing DX7 (GeForce 2).