Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

RetroPixel Image Effect

Discussion in 'Works In Progress - Archive' started by mian1024, Mar 9, 2014.

  1. mian1024

    mian1024

    Joined:
    Feb 9, 2014
    Posts:
    21
    Hi guys!

    This is my first post. I'm in the process of learning shader programming and I'm working on an image effect that restricts the color space as well as (if you so wish) lowers the resolution of an image. I just want to show you guys what it can do, because I think it's kind of cool.



    $clint.png

    $starwars.png

    $fuji.png
     
    Last edited: Mar 23, 2014
  2. mian1024

    mian1024

    Joined:
    Feb 9, 2014
    Posts:
    21
    I actually didn't mean to post this as a thread, but as a post in the "small works"-thread. Please delete/destroy/move if necessary. :)
     
    Last edited: Mar 9, 2014
  3. Blacklight

    Blacklight

    Joined:
    Dec 6, 2009
    Posts:
    1,241
    That looks incredible.
     
  4. Kaze_Senshi

    Kaze_Senshi

    Joined:
    Feb 19, 2012
    Posts:
    243
    Do you have a scene where you can upload the picture to Unity to create this effect?
     
  5. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Color value divided by 64, floored, then multiplied by 64, for a 2-bit result? :)
     
  6. mian1024

    mian1024

    Joined:
    Feb 9, 2014
    Posts:
    21
    That's a good idea. I will probably do that soonish.

    What the shader does is actually to calculate the distance in the RGB cube from the original pixel color to a number of user-defined colors and then it picks the closest one. I have experimented with some math operations, but I decided to go with this algorithm, which is slower but gives more control.
     
  7. mian1024

    mian1024

    Joined:
    Feb 9, 2014
    Posts:
    21
    Added a demo video to original post.