Trippy shader

Trippy

Hey evvvverybody!

I am finally starting the quest to teach myself shaders and FUSE, so here is one of my first translations from a shadertoy-based tutorial.

The original video, which I highly recommend can be found here: https://www.youtube.com/watch?v=f4s1h2YETNY&list=PL9Zb80ovNLWGRFZVL4LcckTWnEGN73dFS

I hope it helps some other beginners to better understand how to translate what you see on youtube/shadertoy into vvvv+FUSE. (I added comments wherever applicable)

Enjoy!

An introduction to Shader Art Coding.vl (91.3 KB)

8 Likes

I saw that on shadertoy, cracking shader!

1 Like

Nice, and very understandable

1 Like

Great patch!

1 Like

Since you guys seem to enjoy it, I uploaded a newer version with more notes and previews of the different stages.

Cheers!

2 Likes

That is a really good mix of complexity and explanation with a super nice result. Really invites to play around and get into the topic. Thanks again.
Also the original video with more details of the process helps so much.
To put the tooling in perspective, see this video making use of the same concepts in unity visual shader graph:

1 Like

Haven’t taken/watched the course but from the description it seems to address the same topic:

This workshop offers an accessible introduction to the world of shader patching using vvvv gamma and FUSE. Taking inspiration from “The Book of Shaders” by Patricio Gonzalez Vivo and Jen Lowe, we’ll look into the fundamental principles and techniques that allow the creation of procedural shapes, intricate patterns, and captivating textures.

3 Likes

hehe, i just did this tutorial (which if find absolutely great) with my students this week (but in SDSL, not Fuse).

If you’re interested:
IntroToShaderArtCoding.zip (5.5 KB)

2 Likes

@catweasel time to beam it on the beach!?

@sunep thanks man!

@tgd totally, watching along is what I would recommend, a lot of explanations make more sense in the moment, and some steps he adds for clarification in the way, get deleted on the final product, so yes, watch and patch along if you can! Also, nice looking patch, how did you get that!?

@bjoern absolutely, I did watch it and it was a big help in getting my mind around the initial concepts.

@motzi great minds think alike they say :P

Absolutely!

Just playing around in your shader, dont remember exactly the bits. I was supposed to be sleeping btw. Pretty tired today. So thanks for that, grrr! ;)

1 Like

@motzi I just had a look at your files and had to laugh when I saw how little code you had to use compared to my massive patch XD

Thanks for sharing!

1 Like

yes, here’s an instance of “wow a single line of code looks much cleaner than 20 nodes”.
but on the pro side: patching this has the advantage of making everything explicit and easier to follow. if i would have tried to decipher everything from there original shader without the video explanation, i’d have hardly any clue what’s happening.
on the con side: the amount of clicking required to achieve the same result is exhausting…

i really miss some kind of middle ground here (like a “one line of code”-node, similar to the code regions concepts).

3 Likes

There is a CustomFunction node in Fuse which basically does this. For example the spherical wedge I posted here completely patched vs. using the node:

Check out the Use Custom Functions and Implement a Function help patches.

5 Likes

ah, thanks for pointing that out! i vaguely remembered that there was something like this but did not find it in a quick search (using the term “code” - maybe add this as a tag @texone ?).

still: my dream UX would look something like this

  • open nodebrowser
  • type: code: float m = length(float p) - float c * clamp(dot(float p,q),0.0, float r))
  • get a node with input pins p,c,q,r and output pin m

but i’m aware how difficult this might turn out to implement and i’m only dreaming here…

3 Likes

This may be very convenient and fast while patching but will most likely obfuscate what the patch is actually doing. Nodes like that will be a blackbox and you’d have to open up each of them (however that works) to check what it’s actually doing. Especially since coming up with (autogenerated) distinct / meaningfull names will be next to impossible I imagine.

did you see the “create nodes with ChatGPT” demo by @domj at the vvvv meetup?

It should be easy to do the same for shader files. It’s probably simpler than the C# version that he implemented.

On one hand, sure, but honestly, in Houdini the “Wrangles” (code-editor nodes) work perfectly fine in huge teams and workflows and are used everywhere, so the reality isn’t that bad, especially if it is well implemented.
The time you save is well worth it.

I personally (and many of my colleagues) find atomic-nodes much harder to read than some lines of code, and you can comment the code and give the node a descriptive name.
Houdini also makes it super easy to create a GUI for the code, so artists don’t even have to look at it.

It’s as “production proven” as it gets - hardly anybody uses the atomic nodes (VOPs) in Houdini anymore and massive productions rely fully on it.
So I’d say the benefits outweigh the issues by far.

Cheers,

Tom

Example:

So this is one node, called a “pointwrangle” since it works on points.
The VEX code is:

@Cd = vector(chramp('Gradient', @uv1.x));

f@width = chramp('Width_Curve', @uv1.x) * ch('Base_Width');
  • The “@” variables are attributes that get written onto the geometry.
  • “chramp” creates either a gradient (when its cast to a vector) or a spline editor.
  • They both sample the same uv map here. Since it’s on a spline, only uv.x is used.
  • The first is colour per point (“Cd”), the other is the width per point.
  • “ch” creates a channel, which is by default a float slider.

So the “user”/artist can just use the gradient and spline etc. and doesn’t have to - but can - look at the code.

Very efficient and very close to @motzi s dream UX above ;-)

Cheers,

Tom

2 Likes

I am looking into such things I am currently looking in simplifying the custom function implementation, my goal is tht you just provide a function and determine arguments and returntype with regex and generate all pins with name and type to match the function, idealy the function string would be set in the inspector this will not imply hlsl parsing but should make copying existing shadercode much simpler.

Based on this I am also investigating a vex like expression node where the arguements are derive based on @ variables such an expression will under the hood be wrapped into a function and than work like the customfunction node described before.

This will be based on regex not proper code parsing and you hve to make sure the code is valid but still should simplify porting snippets a lot. I am tired of converting complex calculation to nodes like you are. I have already figured out scanning a function string and generating pins So this is in active work but can not put a date on it.

3 Likes

Oh wow! I’m constantly fascinated by how close you are to “Houdini-thinking” @texone, even though you don’t even use it yourself. That sounds really promising, love it!

What makes it so extremely fast to use in Houdini is that you basically have no boilerplate and are just writing the algorithm itself, iterating automatically over points, vertices or primitives (think polygons/splines/instances) or do something a certain number of times.
Of course, this is very Houdini-specific, but I think it’s what makes it so intuitive and fast to use. My example was very simple, you can also define variables (float xyz = 20.3 or vector pnt = {0, 1.2, 7.3} ) for internal use of the VEX snippet and have all the usual suspects like loops and foreach and can even define functions inside of a snippet (local scope only), so not everything has to be attributes.

What also is interesting is, that people tend to use quite a lot of those wrangles with small snippets rather than huge monolithic ones (which would make björns black-box concerns less of a problem). Houdini combines those very efficiently and you can even put a compile-region around a bunch of nodes to make it all into one single computation for even more speed (something that VVVV/FUSE does probably anyway).

I also think that the success of the wrangles is hugely based on the fact that you can create a deep user interface in no time. You put those chxxx things in your code and press one button to create gradients, splinecurve editors, faders etc. without leaving the environment and can go as deep as you want in the “Parameter Interface Editor”, where you can create tabs for the inspector, make available options depend on certain selections, create dropdowns and checkboxes etc. - all in basically no time.

And don’t worry about a “date”, just knowing that you work on such things makes me happy :-)
Thank you!!!

And feel free to call me whenever you want to discuss something or need beta testers.

Cheers,

Tom

1 Like