I currently have a frag and vertex shader that allows me to add a scrolling texture over the original texture, however I want to make it so it only scrolls over a certain area of the texture. I have figured out how to shrink the scrolling texture’s box, but the smaller scrolling texture just ends up scrolling through the whole texture still.
Vertex Shader
#version 150
#moj_import <fog.glsl>
in vec3 Position;
in vec4 Color;
in vec2 UV0;
uniform mat4 ModelViewMat;
uniform mat4 ProjMat;
uniform mat4 TextureMat;
uniform int FogShape;
out float vertexDistance;
out vec4 vertexColor;
out vec2 texCoord0;
void main() {
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
vertexDistance = fog_distance(ModelViewMat, Position, FogShape);
vertexColor = Color;
texCoord0 = (TextureMat * vec4(UV0, 0.0, 1.0)).xy;
}
fragment shader
#version 150
#moj_import <fog.glsl>
uniform sampler2D Sampler0;
uniform vec4 ColorModulator;
uniform float FogStart;
uniform float FogEnd;
in float vertexDistance;
in vec4 vertexColor;
in vec2 texCoord0;
out vec4 fragColor;
void main() {
vec2 uvMin = vec2(12.0/128.0, 54.0/128.0);
vec2 uvMax = vec2(19/128.0, 65/128.0);
if (texCoord0.x < uvMin.x || texCoord0.x > uvMax.x || texCoord0.y < uvMin.y || texCoord0.y > uvMax.y) {
discard;
}
vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
if (color.a < 0.1) {
discard;
}
fragColor = color * linear_fog_fade(vertexDistance, FogStart, FogEnd);
}