- Home /
Need help with Shaders
So I have a very specific but simple effect I want to make with shaders, and I wouldn't mind giving some time researching about the subject and try finding the solution by myself but I'm a videogame student and that means that i need to get shit done fast.
So the effect I wanna achive is one that, given a value that can range between 1 and 0, give like a sort of horizontal "offset" to a rectangle texture, moving the image to the left as the value increases, and translating the part of the texture you can no longer see to the right part of the texture, making the ending result allways as big as the initial texture, and resulting in the exact same image with the values 0 and 1. Here are some examples:
I've got the variable working, but when I try to put it a value of 0.6, I've got something like this, with transperent pixels instead of the red ones:
I figured it had something to do with the vertex function, so I wrote this very simple code:
v2f vert (appdata v) {
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv.y = v.uv.y;
o.uv.x = v.uv.x + offset; //this is the one
return o;
}
I can't really work with the value of v.uv.x so I'm really hard stucked here. Thought maybe that o.uv.x = (v.uv.x + offset) % 1;
could work but it definetlly didn't. Any suggestions? I'm a complete beginner with shaders, so any little explanation will be apreciated. Thanks
Your answer
Follow this Question
Related Questions
Trying to achieve this color effect 0 Answers
Question about a good textures / terrain shader 1 Answer
In what way would be best to achieve a retro Gameboy simulation 0 Answers
How to apply refraction at marked texture pixels while the rest is being rendered normal? 1 Answer
How to blend colors from two texture maps in VFX graph 1 Answer