–2 votes

Hi to make my texture its like bellow by using shader

enter image description here

Top to down postion for transparent

in Engine by (44 points)

Well, what have you tried so far?

1 Answer

0 votes

Make a shader material and then set the albedo by the y component of the uv and use a smoothstep to control.

shader_type canvas_item;

uniform float divide = 0.5;
uniform float blur = 0.1;

void fragment(){
    COLOR.w = smoothstep(divide, divide+blur, UV.y);

Then just send in your divide and blur values to control from the cpu.

by (2,156 points)

so where is my texture?
enter image description here

it is just white to transparent, I need this gradient just execute for texture alpha channel

and how to rotate it 180 degrees?

so where is my texture?
- you haven't put a sampler2D in there. Listen, easiest thing, revert the material back to having the texture. Then on the material dropdown choose "convert to shader material" and like magic you'll see all the code written for you. Then just add this code into it and you're done.

it is just white to transparent, I need this gradient just execute for texture alpha channel
- that is on the alpha channel. Combine it with the above and the texture will fade.

and how to rotate it 180 degrees?
- make blur negative.

The docs are extremely helpful here: https://docs.godotengine.org/en/stable/tutorials/shading/shading_reference/canvas_item_shader.html
Also, google "the book of shaders" and maybe spend a couple of days working through it to understand smoothstep and other essentials.

Finally, people help on this forum out of pure goodwill to other members, I'm sure you don't mean to be rude or abrupt but maybe next time you can phrase your comments to maximise their courtesy, it will reflect well on you.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.