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

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

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

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 (...)

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

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

The Knightling launches on August 28! Wishlist it now so you don't miss out: https://bit.ly/KnightlingSteam

To celebrate the game's impending release, we've added The Knightling Pack and The Knightling Community Pack back to the Shop!

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

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

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

Did you know that today is #InternationalJazzDay? 🎷😎

No? 😯 Well, we couldn't pass up this date!

And what better to celebrate this day than #Pecaminosa #OST? 🎷

Let us know what you think about it and have a great weekend!