3 years ago

I wanted to make a pallete-swap system to replicate what the #NES does, so I made a simple shader on shaderGraph for that.

It samples each color channel and replaces it with the color defined on the material

NES link looks good in blue!
#Unity #Gamedev


Initially I had 2 different textures for a "green link" and "red link", but I knew that wouldn't scale well.

So I started looking at shaderGraph. I have some experience using Unreal's shader editor, and turns out it was indeed really similar.

What I needed to do was have a texture with each area I wanted to color, what way I could set each area with the color I wanted.

My first solution was to have a different texture for each color, with all 3 sampled by the shader and composed into the final sprite.

It worked. But, again, that little voice of "this won't scale well" kept ringing. Imagine needing 3 or 4 different textures for each object.

So after a quick google search for possible solutions, I decided to make each different color be defined on a different color channel of a main texture.

That way I only need a single texture for everything and I get to color all the sprites however I want in runtime!

Since I usually work *with* artists I don't usually get to mess with shaders all that much. I've dabbled on writing shader code over the years, but this is my first time actually using shader graph. It's pretty good, I'm impressed!

Now I only need to learn how to organize shadergraphs properly. This little shader is already a mess.



5 comments

Loading...

Next up

So...I'm trying to recreate something of an "Nintendo 64 as seen through CRT" effect in Unity #unity #retro #N64 #indieGame #indieDev

A cool thing about having all your entities work the same is that you can easily make anything playable and everything functions nicely. Gonna make a longer post about it later. I might also soon change the art to something original

Testing different pathfinding options+ Some advice on Plugin use on #Unity Initially I tried to use Unity's own system, but that didn't work out with a grid-based game. Eventually I went with something based on A* and Code Monkey's grid system (...)

Yooka-Replaylee is Coming Soon!

Its packed with new moves, more story, exciting challenges, hidden secrets, and more than double the collectibles to uncover.

Complete our quest to get HYPED and check out the game on Steam: https://bit.ly/YookaReplayleeSteam

After implementing some of the structure I learned on #UE4 into #unity and some input juggling I've "accidentally" made multiplayer Every character has a "characterController" and these can have a separate input source. Every character should be playable

Yooka-Replaylee is the remastered version of the 3D indie platforming darling, Yooka-Laylee.

Celebrate the game's upcoming release on October 9 by completing this quest! Buy Yooka-Replaylee stickers with Coins!

Wishlist on Steam: https://bit.ly/YookaReplayleeSteam

Starting a devlog: How to keep your Unity project from crumbling upon itself (from some nerd who's been using Unity for over a decade and one really hard burnout) #unity3d #gamedev #fangame

Generic component system is done... kinda. Activation is messy. You currently need to specifically setup the projectile separate from the equipment data. If I don't fix it it'll be a trap for myself later. Works fine though. No specific code required

Happy #WIPWednesday! Are you working on a game? Making some art? Practicing a song? Something else? Tell us in the comments!

art comission.