Arbeiten aus dem URlaub
This commit is contained in:
27
ez-tree-jme/assets/Shaders/TreeLeaf.frag
Normal file
27
ez-tree-jme/assets/Shaders/TreeLeaf.frag
Normal file
@@ -0,0 +1,27 @@
|
||||
#import "Common/ShaderLib/GLSLCompat.glsllib"
|
||||
|
||||
uniform vec4 m_Diffuse;
|
||||
uniform sampler2D m_LeafMap;
|
||||
uniform bool m_HasLeafMap;
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec3 worldNormal;
|
||||
|
||||
void main() {
|
||||
vec3 baseColor;
|
||||
|
||||
if (m_HasLeafMap) {
|
||||
vec4 tex = texture2D(m_LeafMap, texCoord);
|
||||
if (tex.a < 0.5) discard;
|
||||
baseColor = tex.rgb * m_Diffuse.rgb;
|
||||
} else {
|
||||
// Fallback: kreisförmiger Clip
|
||||
vec2 uv = texCoord * 2.0 - 1.0;
|
||||
if (dot(uv, uv) > 0.95) discard;
|
||||
float edge = 1.0 - dot(uv, uv);
|
||||
baseColor = m_Diffuse.rgb * (0.7 + 0.3 * edge);
|
||||
}
|
||||
|
||||
// Leaves transmit light — no directional shading, uniform brightness
|
||||
gl_FragColor = vec4(baseColor, 1.0);
|
||||
}
|
||||
Reference in New Issue
Block a user