🔗 Demo Dump 01 (Screenspace Explorations)

-3/18/2024-"I Lived Bitch"
Somehow, I've beaten deep burnout once more (for now). In the last couple months, I've been taking up my spare time learning some deeply cursed things about the Unity Built-in Renderer Pipeline. If anybody wants to know more about how I achieved something posted here, send me a message somewhere and I'll write up another post going more in-depth.
For now, I'm just going to share a bunch of things I've done since the previous demo, here, with no context at all :]

I may or may not choose to break something down more in the future, but right now I think this is just better as a demo dump.
- Symm

🔗 An Inspired Cursed Arm (More 2D SDFs!)

Thank you to the (anonymous) person I talked with today that made me finally want to post another project here! Your interest in what I do inspired me to keep sharing.
Over the last couple months, I've been pretty busy with job hunting (and doing work I can't talk about :[ ), so I haven't had much time or energy to spend on creating things.
However, Legend of Zelda: Tears of the Kingdom came out recently, and I've been watching some friends play it. The player character, Link, has their right arm replaced with a ghosts arm in the story to prevent bodily corruption.
The first image I found of it was a still image mid-animation of Link's new arm getting an upgrade.

This inspired me to make my own corrupted arm, as my younger self used to love the corrupted arm/hand aesthetic for everything.
I am forever cursed to perpetually try and learn something new with each project I tackle (this is a good thing). For this project, I decided that I wanted to learn how to work with screen space and the depth texture! I had an idea in mind, and two major points of visual design motivation to get me started.
-LoZ: Tears of the Kingdom
-A G Jones album cover (Tangential Zones)
I took the same SDFs that I'd created in the past, and made eight separate combination shapes. All of the shapes are similar or the same as a shape from the G Jones album cover.

This lead to some interesting experimentation with some UV fract shenanigans and random ID maps via noise!
Funky cosmic egg~ For this screenshot, I was also messing with switching the final result by face, so the internal of this shape had a screenspace effect that displayed a random rune in screen-UV space. The center of the image is an "external" face of the model, on the inside of it! It's a singular object but viewed from the inside! Bit hard to visualize before the next video, sorry.

After getting this base randomly tiled effect set up and figured out, I started doing a little more testing with distortions and surface effects.Note: The external surface, the distortion is using screen-space textures. This also has a very cool effect of breaking down the surface when someone gets too close to show the underlying noise (a basic Worley btw!) that I'm using to distort the UVs.

This is an incredibly awesome effect that I loved making .... but it has a problem. This content is for VRChat, which uses Single-Pass Stereo rendering. I was not correcting my UVs for Single-Pass Stereo rendering. This resulted in the UVs not being correctly offset for both eyes, causing this weird "cross-eyed" effect. This is something I'm going to breeze over as an "I solved how to correct screen UVs for VR in Unity, but I still wasn't happy with how it actually looked in VR so I changed it." For anybody interested, check out the Unity doc page for Single Pass Stereo rendering.The arm also wasn't quite fitting the look that I wanted to go for. I made some adjustments to the design, removed the internal face screen-space visual from the features, and changed the external UV distortion to instead use texture space instead of screen space.
And with that, we reach the final version of the arm's design! As a note, there were two basic textures used for this. They are both 128x1 gradients (one set to Wrap: Repeat, one Clamped) used for a gradient remapping trick. The Repeat gradient colors the Fresnel effect, and the Clamped gradient colors the Artifact runes. Each only takes ~80 bytes of memory!

I learned how to use SPS-I-compliant depth, screen-space UVs, and some other (pretty boring) technical things along the way! It's very "shaders are my passion" looking, and god it was fun to work on. Plus, I came out the other side with something awesome for my VRChat avatar! I'm almost certain I'll mess with this "corrupted arm" material another time in the future.
For now, I'm very happy with how it turned out and everything I learned working on it.

🔗 Exploration with SDFs (AKA, A Third Eye Shader)

In my spare time while job hunting, I've taken to messing around with the SDF (Signed Distance Field) functions I've ported to Amplify Shader Editor. This time I wanted to make something more visually complex, but still be recognizable as something.
I decided on a "Third Eye" shader of some kind, inspired by the shapes and concept of The Eye of Sauron. Over the course of the last three days, I slowly built up a decent-sized series of SDF shapes and complex UV manipulations for them. For those interested, here's the ASE graph for this one! (Not quite full resolution here because of carrd's compression, sorry! Here's a full resolution version.)
It's a decently messy one, but it's all "read" from top-left to bottom-right, per-comment.

Looking at the graph, it's intended to be used as a single material on a Quad using some basic location masking to get all the colors only applied to where we want them to apply. If we don't do this whole masking process, colors will get added/blended together around the edges of shapes and produce washed-out, desaturated colors (that sometimes turn into negative/subtractive colors!).That whole mess of a graph ends up coming out looking like the following:

Which looks like this in motion!

For such a short project, it was a pretty complex one with the concepts being put to use. Getting each individual Bumpy Cog shape to rotate at a different speed/rotation from the others took a decent time to figure out, for example. It's also pretty cheap, rendering in ~.12ms in-editor.
I'm pretty proud of how it turned out despite some flaws and room to add more. It's a fun, self-inspiring project to keep working with these funny little shapes.

🔗 SDF Shape Demos

Just a quick little gallery post to show a few of the SDFs (Signed Distance Fields) that I've ported to ASE. There are a few videos at the bottom as well of some shapes I decided to animate, similar to how Inigo Quilez animates their SDFs.

Animated "Ellipse" SDF
This video also shows the minor floating point inaccuracies that I ran into porting this shape to ASE.

Animated "Moss's Egg" SDF

Animated "2D Bend" Operation Demo
The math here is the same as IQ's "Simple Bend", but shadertoy's UVs and Unity's UVs are just slightly different, so I can't quite bend from the middle of the UV in Unity using the same math.

Animated "Square Stairs" SDF

Animated "Circle Wave" SDF

🔗 Porting Inigo Quilez's SDFs to Amplify Shader Editor

I decided a couple weeks back that I wanted to learn more about SDFs (Signed Distance Fields). I remembered that a friend of mine was working with them several months back, and gave me a resource to learn more (Thank you Zekk!).
This was Inigo Quilez's article on 2D SDFs.
I then decided pretty quickly after that, that I wanted to be able to use these shapes in ASE (Amplify Shader Editor), which is how I make all of my shaders in Unity. Theoretically this task would be fairly straightforward since IQ has already figured out the code for a great number of different SDFs written in GLSL already, which were generally pretty trivial to translate into HLSL for use in Unity. I could just use Custom Expression nodes with the translated HLSL! However, Custom Expression nodes do not generate a node preview. They also break the preview of any ASE shader node that uses them, starting from the operation that a Custom Expression gets used. I wanted to be able to keep that preview window intact for an SDF, since this preview is one of the most powerful features of ASE. So I set out to recreate as many SDFs in ASE without using any Custom Expression nodes.
Two weeks later, and I've successfully recreated 36 shapes and 10 SDF-focused operations (Bend UV not pictured for .. some... reason?), including Limited Repetition in 2D, adjusted for Unity's UVs.

These functions can all be dropped into an ASE shader with no editor dependencies and minimal external function dependencies (all to be included with the package, assuming I release this somewhere).
Porting SDF shapes into ASE in this fashion has helped me learn so much more about SDFs than I ever would have just staring at the code and copy-pasting it into a shader when I want to use a particular shape.
I will say that one of the shapes proved to be a huge hassle, and I very quickly learned about floating point accuracy and how to make my numbers more accurate when a little fudging is needed. But for the Ellipse shape, I just couldn't figure anything out to get a more accurate number where it was needed.
But that was that! I had ported as many shapes as I felt I needed to for a fairly complete library of objects that could be used to form just about any shape one could think of, between the shapes themselves and all of the operations. So what do I do with these shapes now that I've ported them to ASE? Well... I hadn't thought of that part when I'd started on the project. It was all just for learning more about SDFs, that was really it!
So I decided that I'd make a couple little scenes/dioramas/pieces of programmer art using ASE and my newly created SDF functions!
I'm actually pretty happy with how the art itself turned out. It also proved that these shapes that I'd put together were in fact fully functional, as well as some fun with experimenting using Voronoi as UV coordinates for the "Starry Night Glowy Stickers" piece. Both pieces are singular materials on a default Unity Quad. No weird UV set or material shenanigans are happening. Just SDFs and some math to hold everything together. I look forward to making some more use of these SDFs in the near future!-Symm