Shader looks different when changing color at runtime on a Visual Effect

Hallo, first of, i just started to learn shader graph and visual effects graph.

I was making a visual effect that uses a voronoi shader i made with shader graph.
At first everything worked fine, till i reached a point where i change the color of the Visual effect at runtime via code(even when giving the very same hdr color).
When i do it in the inspector it does not happen.
When i do that, the Alpha seems to become much lower to the point where it becomes barly visible.
For debugging purposes i put my shader on a simple plane (without the visual effect). There it also looks really pale from the start.
So it seems the Visual effects graph increases the Alpha of the shader, but loses that when changing the color via script.

Left side(no change to the color). Right side after giving the Viusal Effect the exact same color via script.
9758778--1397553--Visual Effect befor and after color change.png

Here is the color that i use:

The visual effect part that uses the voronoi shader just makes 1 constant particle quad and only alter the size, rotation and gives a exposed variable to change the color

The Shader

Is there some setting that would make the shader look the same on a plane, in the visual effect or after changing the color at runtime via script?

[ColorUsageAttribute(true,true)]
public Color swirl;

public void _myFunction()
{
      visualEffect.SetVector4("SwirlColor", swirl);
}

I’m using Unity 2023.2.2f1

Ok, after watching through the screenshots i made for this post i noticed in the visual effect graph the alpha of the swirl color was set to 8.
When changing the alpha in the instance of the visual effect it seem to take the the 8 from the visual effect as the base value.
After i changed the alpha in the visual effects graph to 1 there was still no change.
But when i then changed the alpha on an instance of the visual effect by 1, it loooked exactly the same as when chaning by code.

1 Like

I am glad that you found the source of the issue. Great work, it’s beautiful. Don’t hesitate to share an animated version. I’m always curious to see beautiful VFX . :slight_smile:

Thank you very much for the compliment.
Here an animated version :slight_smile:
9759015--1397601--Portal Visual Effect.gif

Im still not completly satisfied how it looks i might make the outer edge more visible and maybe give it some background to give it more contrast but i’m not yet sure how to approch that. Or maybe add some sort of distortion in the future.

In the end it should become a Portal laying on the ground where units will come out of.

Edit: fixed typo

1 Like

Here a version visible from the game camera and with team color.
9759447--1397703--Cards and Teamcolored Portals.gif

3 Likes