meshphysical_frag.glsl 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #define PHYSICAL
  2. uniform vec3 diffuse;
  3. uniform vec3 emissive;
  4. #ifdef STANDARD_SG
  5. uniform float glossiness;
  6. uniform vec3 specular2;
  7. #else
  8. uniform float roughness;
  9. uniform float metalness;
  10. #endif
  11. uniform float opacity;
  12. #ifndef STANDARD
  13. uniform float clearCoat;
  14. uniform float clearCoatRoughness;
  15. #endif
  16. varying vec3 vViewPosition;
  17. #ifndef FLAT_SHADED
  18. varying vec3 vNormal;
  19. #endif
  20. #include <common>
  21. #include <packing>
  22. #include <color_pars_fragment>
  23. #include <uv_pars_fragment>
  24. #include <uv2_pars_fragment>
  25. #include <map_pars_fragment>
  26. #include <alphamap_pars_fragment>
  27. #include <aomap_pars_fragment>
  28. #include <lightmap_pars_fragment>
  29. #include <emissivemap_pars_fragment>
  30. #include <envmap_pars_fragment>
  31. #include <fog_pars_fragment>
  32. #include <bsdfs>
  33. #include <cube_uv_reflection_fragment>
  34. #include <lights_pars>
  35. #include <lights_physical_pars_fragment>
  36. #include <shadowmap_pars_fragment>
  37. #include <bumpmap_pars_fragment>
  38. #include <normalmap_pars_fragment>
  39. #ifdef STANDARD_SG
  40. #include <glossinessmap_pars_fragment>
  41. #include <specular2map_pars_fragment>
  42. #else
  43. #include <roughnessmap_pars_fragment>
  44. #include <metalnessmap_pars_fragment>
  45. #endif
  46. #include <logdepthbuf_pars_fragment>
  47. #include <clipping_planes_pars_fragment>
  48. void main() {
  49. #include <clipping_planes_fragment>
  50. vec4 diffuseColor = vec4( diffuse, opacity );
  51. ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
  52. vec3 totalEmissiveRadiance = emissive;
  53. #include <logdepthbuf_fragment>
  54. #include <map_fragment>
  55. #include <color_fragment>
  56. #include <alphamap_fragment>
  57. #include <alphatest_fragment>
  58. #include <specularmap_fragment>
  59. #ifdef STANDARD_SG
  60. #include <glossinessmap_fragment>
  61. #include <specular2map_fragment>
  62. #else
  63. #include <roughnessmap_fragment>
  64. #include <metalnessmap_fragment>
  65. #endif
  66. #include <normal_flip>
  67. #include <normal_fragment>
  68. #include <emissivemap_fragment>
  69. // accumulation
  70. #include <lights_physical_fragment>
  71. #include <lights_template>
  72. // modulation
  73. #include <aomap_fragment>
  74. vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
  75. gl_FragColor = vec4( outgoingLight, diffuseColor.a );
  76. #include <premultiplied_alpha_fragment>
  77. #include <tonemapping_fragment>
  78. #include <encodings_fragment>
  79. #include <fog_fragment>
  80. }