benji Profile picture
Sep 23 12 tweets 6 min read
1/ Everybody told me they liked the last thread about simple effects in Pinni, so why not another one?

Customizable transition shaders in less than 4 lines 🧵:
#gamedev #tutorial #shader #hlsl #madewithunity
2/ Once again starting from a basic fragment shader. This will work in ANY engine, but we're using GLSL for simplicity.

Here's our base texture:
3/ What's the goal of this shader?

1. We want to black out the screen up to a certain point
2. That point should depend on the progress of the transition

Let's map the path of the transition in black and white. We can get a value based on each UV's distance from the center.
/4 Now let's add a uniform called `cutoff`, and use that to push the map values by +/- 1.0 in either direction.

You can already see where the effect's going; but just wait until you see what one extra line can do!
5/ We're going to add one more uniform called `ease` that will control the edges of our circle.

Multiply our old output by ease to get a controlled line quality.
6/ Here's the code before and after adding the ease uniform.
7/ Now we just need to "mix" between the black and our original texture and we've got the basic effect!

NOTE: in HLSL/Unity you would replace "mix" with "lerp" and "clamp" with "saturate".
8/ So we're done, right?

Well, not really. Simple yes, but customizable no. There's a tiny bit more we need to add.

"But we're already at 4 lines, how could you add more? You lied to me!!"
8/ Rather than generating black and white maps from shader code, Pinni uses textures of gradients.

We can draw any crazy transition effect we want and the shader will animate it!
9/ With one simple change and an added uniform called "pattern", we can take textures that look like the images below and turn them into transitions.
BONUS/ Do you want to get REALLY fancy with it?

Replace that "vec4(0.0)" in the mix with whatever color you want. Or, better yet, use a texture for a loading screen!
END ???/ Follow me and wishlist our game on Steam for more stupid simple shaders that look nice :))

store.steampowered.com/app/1822590/Pi…

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with benji

benji Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @jumpquestgame

Sep 16
1/ Have been asked about the Pinni distortion effect quite a few times, so thought I'd explain how it works.

One of my fave effects, displacement maps 🧵:
#gamedev #tutorial #shader #hlsl
2/ Going to start with a basic texture from Pinni to demonstrate each step.

The shader can work in any game engine; in Pinni we use Unity's awful shaders language, but for readability I'll be using HLSL. ImageImage
3/ Distorting an image from a fragment shader basically means taking each UV coordinate and moving it.

We want to move in the opposite direction of the origin, which we can get from the normalized (direction-only) result of our UV coordinate minus the center. Image
Read 14 tweets
Jul 16
1/ Are you an indie dev tired of supporting a proprietary game engine with immoral business practices?

Open source game engines, a 🧵:
2/ Godot has 50.8k stars on Github for all of the right reasons.

If you use Unity for 2D, Godot's workflow will feel right at home, and supports C# as well as their own python-like language.

(also, it was used on Sonic Colors?!?) ImageImage
3/ Monogame (XNA), another C# framework. This is THE 2D game framework imo, used on some of the best selling indie games of all time:

Terraria, Stardew Valley, Celeste, Bastion, and sooo many more... ImageImageImageImage
Read 13 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(