Advertisement
ocuocu

substance painter base color+alphatest for npr texturing/ save as .glsl

May 24th, 2024 (edited)
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import lib-sampler.glsl
  2.  
  3. //: param auto channel_basecolor
  4. uniform SamplerSparse basecolor_tex;
  5. //: param auto channel_opacity
  6. uniform SamplerSparse opacity_tex;
  7.  
  8. void shade(V2F inputs) {
  9.     vec3 color = getBaseColor(basecolor_tex, inputs.sparse_coord);
  10.     float alpha = getOpacity(opacity_tex, inputs.sparse_coord);
  11.  
  12.     // Output color and alpha
  13.     diffuseShadingOutput(color);
  14.     alphaOutput(alpha);
  15.  
  16.     // Manual alpha testing
  17.     if (alpha < 0.5) {  // Example threshold
  18.         discard;
  19.     }
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement