Search Unity

Black and white game?

Discussion in 'Editor & General Support' started by spiralgear, Jun 7, 2012.

  1. spiralgear

    spiralgear

    Joined:
    Dec 13, 2007
    Posts:
    528
    I got into a discussion with a graphics programmer about this, I am a bit curious.

    Hypothetically, if you made a black and white game (not just adding a black and white post effect) but designed custom shaders from the ground up to only calculate greyscale, would you see a performance benefit?

    He says shaders would be far faster by not having to include RGB calculations. He also says if you didn't use RGB textures for texture maps, and instead imported all textures as alpha only maps that would be read by the shader as greyscale that it would lessen memory usage as well.


    Is there any truth to this? I am in the process of making a black and white game for aesthetic purposes, and am currently using an image-effect to accomplish it. Would the performance benefits (if there are any) from writing black and white shaders be worth the time?
     
  2. yls

    yls

    Joined:
    Apr 13, 2012
    Posts:
    197
    I don't know about the performance about the shader but why do you need a image-effect while you could just use no color in your assets ?
     
  3. spiralgear

    spiralgear

    Joined:
    Dec 13, 2007
    Posts:
    528
    Initially the player was going to be able to flip back and fourth from color to black/white during the game but this has been changed. But many of the earlier assets still have color. I haven't gotten around to converting them to grey scale yet. But yeah the post effect is temporary.
     
  4. yls

    yls

    Joined:
    Apr 13, 2012
    Posts:
    197
    That would work only if you intend to use no tranparency in your game. Is that the case ?
     
  5. spiralgear

    spiralgear

    Joined:
    Dec 13, 2007
    Posts:
    528
    Yes actually. It is on mobile so transparency has been avoided for performance reasons anyway.
     
  6. Farfarer

    Farfarer

    Joined:
    Aug 17, 2010
    Posts:
    2,249
    I imagine that technically it would be faster, but I don't think you'd really notice a difference in anything other than, perhaps, the texture sizes.
     
  7. Molt

    Molt

    Joined:
    Sep 6, 2011
    Posts:
    103
    I'd be surprised if you saw any noticeable increase in shader performance due to GPUs being optimised heavily for RGB (Vector3 and Vector4) calculation rather than simple scaler operations.

    You could see a saving in disk/main memory by reducing the image down to a single bitplane but saving memory on the GPU would involve some custom shader work again in order not to have the texture saved as a single channel of an otherwise blank RGB or RGBA image.
     
  8. Integria

    Integria

    Joined:
    May 12, 2012
    Posts:
    145
    Modern GPU's are essentially designed to work with vector operations, so the performance benefit is entirely negliable. I suppose it is theoretically less data to upload to the GPU, and greyscale might compress better, but that's about it. The texture is likely to be represented as an RGBA texture on the GPU regardless. I suppose, if you really wanted to, you could pack four 8-bit greyscale textures, and if you had such a need, it might be worth it.
     
  9. spiralgear

    spiralgear

    Joined:
    Dec 13, 2007
    Posts:
    528
    So you are saying I could get 4 textures for the memory price of one by using R,G,B, and A as greyscale information for the shader?
     
  10. yls

    yls

    Joined:
    Apr 13, 2012
    Posts:
    197
    I guess they are saying that if you're main issue is size of your executable due to the texture it could save some space but you will have nearly no gain in performance, you would have to develop your own specific shader and it would have very few impact on the memory size needed because thay would be sorted in RGBA anyway.
     
  11. spiralgear

    spiralgear

    Joined:
    Dec 13, 2007
    Posts:
    528
    But for lessening the texture size, is it just a matter of importing them as 8-bit alphamaps, or could I use each color channel (RGB and A) to represent a different greyscale texture?