Skip to content

Instantly share code, notes, and snippets.

@kergalym
Last active November 30, 2021 14:42
Show Gist options
  • Save kergalym/54e50c068d84cb2974617c671c7429f5 to your computer and use it in GitHub Desktop.
Save kergalym/54e50c068d84cb2974617c671c7429f5 to your computer and use it in GitHub Desktop.
simple clounds for Panda3d
/* vertex shader */
#version 130
uniform mat4 p3d_ModelViewProjectionMatrix;
in vec4 p3d_Vertex;
in vec3 p3d_Normal;
in vec4 p3d_MultiTexCoord0;
in vec4 offset;
in vec4 uv;
in vec4 p3d_Color;
out vec4 texcoord0;
out vec4 texcoord1;
out vec4 position;
out vec4 color;
void main() {
gl_Position = p3d_ModelViewProjectionMatrix * p3d_Vertex;
position = gl_Position;
texcoord0 = p3d_MultiTexCoord0+offset+vec4(uv.xy, 0.0, 0.0);
texcoord1 = p3d_MultiTexCoord0+offset+vec4(uv.zw, 0.0, 0.0);
color = p3d_Color;
}
/*fragment shader */
#version 130
in float time;
uniform sampler2D p3d_Texture0;
in vec4 texcoord0;
in vec4 texcoord1;
uniform vec4 p3d_Color;
uniform vec4 p3d_ColorScale;
in vec4 color;
out vec4 o_color;
void main() {
// Fetch all textures.
vec4 tex0 = texture2D(p3d_Texture0, texcoord0.xy);
vec4 tex1 = texture2D(p3d_Texture0, texcoord1.xy);
o_color = vec4(color.rgb+p3d_Color.rgb, mix(tex0.a, tex1.a, time))*p3d_ColorScale;
}
@kergalym
Copy link
Author

Screenshot_20211130_204213

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment