Search Unity

An 8-bit Atari style shader effect?

Discussion in 'Shaders' started by San_Holo, Mar 16, 2015.

  1. San_Holo

    San_Holo

    Joined:
    Sep 26, 2014
    Posts:
    135
    Hi, I was wondering if you had seen on your travels a shader which I hoped could work well with my text-meshes... An example of the effect I had in mind is below.

     
  2. San_Holo

    San_Holo

    Joined:
    Sep 26, 2014
    Posts:
    135
    Maybe this LINK may help me.
     
  3. drewmilloy

    drewmilloy

    Joined:
    Feb 21, 2017
    Posts:
    1
    Super late to the party...but this took me straight back to coding on my Atari 800XL - the colour cycling effect was done by switching the palette upon each horizontal blank interrupt - that way you could exceed the 16-colour limit!

    Anyway I got some sort of shader working that does similar:

    https://gist.github.com/amilloy/bfeca66a7331067c60f8167f58dd2f2b

    Has an _Offset property you can script or animate to scroll the colours like that example.
     
  4. San_Holo

    San_Holo

    Joined:
    Sep 26, 2014
    Posts:
    135
    thanks i'll try it out later perhaps, cheers
     
  5. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,433
    Offtopic: Those were the days. I did the same thing using inline assembler in pascal under DOS.
     
    San_Holo likes this.
  6. San_Holo

    San_Holo

    Joined:
    Sep 26, 2014
    Posts:
    135
    I tweaked It a little, added a texture component for sprites, but it looks absolutely great, with a little script to shift the offset, thanks again.

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class LogoColorScroll : MonoBehaviour
    6. {
    7.     public float ScrollSpeed = 0.2f;
    8.     public bool atariColorScroll = false;
    9.     private Material Object_Mat;
    10.     private float offset = 0f;
    11.  
    12.     void Start ()
    13.     {
    14.         Object_Mat = this.GetComponent<Renderer> ().material;
    15.     }
    16.  
    17.     void Update ()
    18.     {
    19.         if (atariColorScroll) {
    20.             offset += ScrollSpeed * Time.deltaTime;
    21.             Object_Mat.SetFloat ("_Offset", offset);
    22.         } else {
    23.             Vector2 newTextureOffset = GetComponent<Renderer> ().material.mainTextureOffset;
    24.             newTextureOffset.y += ScrollSpeed * Time.deltaTime;
    25.             GetComponent<Renderer> ().material.mainTextureOffset = newTextureOffset;
    26.         }
    27.     }
    28. }
     

    Attached Files:

unityunity