Book of Shaders / Fuse

Hi there!

I am working my way through the Book of Shaders and I translate the example codes into vvvv gamma with fuse.

I am now stuck with one example and I quite don’t know what I did wrong. The initial code and the result are supposed to look like this:

The patch in vvvv looks like this with a result that is similar, but not the same:

vvvvcode

You can clearly see that the “flower” look different. The colours don’t match and there is a gradient that doesn’t appear in the example file.

I am not sure what’s going one here, maybe i oversaw something or there is a detail missed?!

Thanks a lot!

2 Likes

It seems that the correct solution looks like this:

What is the meaning behind this? I am confused… are the functions “step” and “smoothstep” working differently across the board?

1 Like

Seems to be Fuse specific.

[TextureSource]

[Category("Source")]
shader Flower_TextureFX : TextureFX
{
    stage override float4 Shading()
    {
        float2 uv = streams.TexCoord;

        float2 pos = 0.5 - uv;

        float r = length(pos) * 2.0;
        float a = atan2(pos.y, pos.x);
        float f = cos(a * 3.0);

        float3 color = 1.0 - smoothstep(f, f + 0.02, r);
        return float4(color, 1.0);
    }
};
1 Like

it is just the order of the parameters, the interpolation parameter is the first pin on the fuse node, whereas it is the last one in the code. so, always check parameter names…

also, @everyoneishappy @texone @dottore why did you change the order? In VL the Lerp node, for example, also has the interpolation parameter as the last input… This is the common convention in most languages. it was just vvvv beta that did it that way, to be similar to a switch node…

🤦🏼‍♂️ Thanks.

Smoothstep.7z (4.0 KB)

Ah, ok - that’s helpful. Wouldn’t have found it out, thanks a lot!

I think someone probably changed it to try to match the Design Guidelines actually ;). I agree though, particularly in the case of intrinsic functions it should follow the HLSL order.