Skip to content

Instantly share code, notes, and snippets.

@ydaniv
Created August 20, 2019 11:23
Show Gist options
  • Save ydaniv/9638bb44f19187e7649c9deffb681c2a to your computer and use it in GitHub Desktop.
Save ydaniv/9638bb44f19187e7649c9deffb681c2a to your computer and use it in GitHub Desktop.
Introducing Kampos examples :: duotone simplified
export default function () {
return {
fragment: {
uniform: {
u_light: 'vec3',
u_dark: 'vec3'
},
main: `vec3 gray = vec3(dot(lumcoeff, color));
color = mix(u_dark, u_light, gray);`
uniforms: [
// Light tone
{
name: 'u_light',
type: 'f',
data: [1.0, 1.0, 1.0]
},
// Dark tone
{
name: 'u_dark',
type: 'f',
data: [0.0, 0.0, 0.0]
}
]
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment