Skip to content

Instantly share code, notes, and snippets.

@pragma37
Created January 19, 2021 16:55
Show Gist options
  • Save pragma37/a0fc10cf61c7e3d26beac5e0afc12fc6 to your computer and use it in GitHub Desktop.
Save pragma37/a0fc10cf61c7e3d26beac5e0afc12fc6 to your computer and use it in GitHub Desktop.
//Copyright (c) 2020 BlenderNPR and contributors. MIT license.
#include "Pipelines/NPR_Pipeline.glsl"
uniform sampler1D color_gradient;
uniform vec4 line_color = vec4(0.0,0.0,0.0,1.0);
uniform float line_id_boundary_width = 1.0;
void COMMON_PIXEL_SHADER(Surface S, inout PixelOutput PO)
{
vec3 diffuse = get_diffuse_gradient(color_gradient);
#ifdef PRE_PASS
{
int shadow = 0;
for (int i = 0; i < LIGHTS.lights_count; i++)
{
Light L = LIGHTS.lights[i];
LitSurface LS = NPR_lit_surface(S.position, S.normal, S.id, L, i);
if(LS.shadow) shadow++;
}
PO.id += 1000*shadow;
}
#endif
float line = get_line_advanced(line_id_boundary_width,0,0,0,0,0,0,0,0);
PO.color.rgb = diffuse;
PO.line_color = line_color;
PO.line_width = line;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment