GradientTexture1D in Visual Shader

Godot Version

4.5

Question

Hey friends!

I encountered an issue when using GradientTexture1D in Visual Shader. The following pictures show how the shader is composed and what result I get:

As you can see. The output seems incorrect when input is 0 or 1. I tested other numbers so it looks to me that this works like exclusive (0, 1), not inclusive [0, 1]. I suspect the issue is in the way I use VectorCompose to generate uv…

Any idea where the problem is and how to fix it?

Thanks!

Disable texture repeat.

Thanks. Where is the setting?

You’ll need to rearrange the network a bit. Set Texture2D node’s source to SamplerPort. Create Texture2DParameter node and plug it into Texture2D node’s Sampler2D input. Assign the actual gradient texture in material’s properties in the inspector.

The setting is in Texture2DParameter node.

1 Like

Got. Thanks!

Btw, I also have another question on this shader. How may I set emission_energy_multipler? The output node has emission input as a Vector so my guess is I have to set it somewhere else…

Multiply it within the shader and plug the result into Emission output.

1 Like

Cool, will try.

Thanks!