Unity 2D Shader/VFX | 20 minute read | chrysly.me
Yo!✌🏻
Welcome to my comprehensive guide on how to create a stylized black hole shader. As opposed to most tutorials online, I’ll be explaining how to implement your own black hole in Unity 2D.

Black hole shader used in Sylvie’s Constellation, inspired by Super Mario Galaxy’s black holes.
<aside>
⚠️ This tutorial was created using Unity 2022.3.14f1 with the Universal RP.
</aside>
To sell our effect visually, we’ll start by creating the warping of space around the eye of the black hole.
First, create a new Unlit Sprite Shader.

Graph settings
To distort the space around the black hole, we’ll need to grab the color value behind the fragments of the sprite itself. Most tutorials will tell you to grab this data with the Scene Color node.

This should work totally fine in Unity 3D!
However, in Unity 2D, you may have noticed that this node does not function properly.

…hold on, it’s just the default sprite?
<aside>
💡 In Unity, the Scene Color node relies on the Camera Opaque Texture, which is essentially a snapshot of the scene before any opaque objects are rendered to the screen. However, the 2D Renderer does not write to this texture which is why this node does not function as intended.
</aside>