Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion jme3-core/src/main/resources/Common/MatDefs/Misc/Unshaded.frag
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ uniform vec4 m_Color;
uniform sampler2D m_ColorMap;
uniform sampler2D m_LightMap;

#ifdef DESATURATION
uniform float m_DesaturationValue;
#endif

varying vec2 texCoord1;
varying vec2 texCoord2;

Expand Down Expand Up @@ -45,6 +49,11 @@ void main(){
discard;
}
#endif

#ifdef DESATURATION
vec3 gray = vec3(dot(vec3(0.2126,0.7152,0.0722), color.rgb));
color.rgb = vec3(mix(color.rgb, gray, m_DesaturationValue));
#endif

gl_FragColor = color;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ MaterialDef Unshaded {
Float ShadowMapSize

Boolean BackfaceShadows: true

// 1.0 indicates 100% desaturation
Float DesaturationValue
}

Technique {
Expand All @@ -82,7 +85,8 @@ MaterialDef Unshaded {
NUM_BONES : NumberOfBones
DISCARD_ALPHA : AlphaDiscardThreshold
NUM_MORPH_TARGETS: NumberOfMorphTargets
NUM_TARGETS_BUFFERS: NumberOfTargetsBuffers
NUM_TARGETS_BUFFERS: NumberOfTargetsBuffers
DESATURATION : DesaturationValue
}
}

Expand Down