Advertisement
RTexon

Blender Bug Report

Apr 24th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 100.75 KB | None | 0 0
  1. BLENDER DEBUG OUTPUT.txt
  2. ---------------------------------------------------------------------------------------------------------------------------------------
  3. Switching to fully guarded memory allocator.
  4. Blender 2.80 (sub 58)
  5. Build: 23/04/2019 20:12 Windows Release
  6. argv[0] = blender
  7. argv[1] = --debug
  8. argv[2] = --python-expr
  9. argv[3] = import bpy; bpy.ops.wm.sysinfo(filepath=r'C:\Users\Administrator\AppData\Local\Temp\blender\debug_logs\blender_system_info.txt')
  10. read file C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\2.80\config\userpref.blend
  11. Version 280 sub 57 date 2019-04-17 19:26 hash b46245470f79
  12. Read prefs: C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\2.80\config\userpref.blend
  13. read file
  14. Version 280 sub 39 date unknown hash unknown
  15. AL lib: (EE) UpdateDeviceParams: Failed to set 48000hz, got 192000hz instead
  16. found bundled python: I:\BlenderUpdater\2.80\python
  17. GPUShader: compile error:
  18. ===== shader string 1 ====
  19. 1 #version 330
  20. ===== shader string 2 ====
  21. 2 #define GPU_VERTEX_SHADER
  22. ===== shader string 3 ====
  23. 3 #extension GL_ARB_texture_gather: enable
  24. 4 #define GPU_ARB_texture_gather
  25. 5 #extension GL_ARB_texture_query_lod: enable
  26. ===== shader string 4 ====
  27. 6 #define GPU_ATI
  28. 7 #define OS_WIN
  29. ===== shader string 5 ====
  30. 8 #define V3D_SHADING_OBJECT_OUTLINE
  31. 9 #define V3D_SHADING_SPECULAR_HIGHLIGHT
  32. 10 #define V3D_LIGHTING_STUDIO
  33. 11 #define OBJECT_ID_PASS_ENABLED
  34. 12 #define MATDATA_PASS_ENABLED
  35. 13 #define NORMAL_VIEWPORT_PASS_ENABLED
  36. 14 #define WORKBENCH_ENCODE_NORMALS
  37. ===== shader string 6 ====
  38. 15 uniform mat4 ModelViewProjectionMatrix;
  39.  
  40. 16 uniform mat4 ModelMatrix;
  41.  
  42. 17 uniform mat4 ModelMatrixInverse;
  43.  
  44. 18 uniform mat4 ProjectionMatrix;
  45.  
  46. 19 uniform mat4 ViewProjectionMatrix;
  47.  
  48. 20 uniform mat4 ViewMatrixInverse;
  49.  
  50. 21 uniform mat3 NormalMatrix;
  51.  
  52. 22
  53.  
  54. 23 #ifndef HAIR_SHADER
  55.  
  56. 24 in vec3 pos;
  57.  
  58. 25 in vec3 nor;
  59.  
  60. 26 in vec2 u; /* active texture layer */
  61.  
  62. 27 # ifdef V3D_SHADING_VERTEX_COLOR
  63.  
  64. 28 in vec3 c; /* active color */
  65.  
  66. 29 # endif
  67.  
  68. 30 # define uv u
  69.  
  70. 31 #else /* HAIR_SHADER */
  71.  
  72. 32 # ifdef V3D_SHADING_TEXTURE_COLOR
  73.  
  74. 33 uniform samplerBuffer u; /* active texture layer */
  75.  
  76. 34 # endif
  77.  
  78. 35 flat out float hair_rand;
  79.  
  80. 36 #endif /* HAIR_SHADER */
  81.  
  82. 37
  83.  
  84. 38 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
  85.  
  86. 39 out vec3 normal_viewport;
  87.  
  88. 40 #endif
  89.  
  90. 41
  91.  
  92. 42 #ifdef V3D_SHADING_TEXTURE_COLOR
  93.  
  94. 43 out vec2 uv_interp;
  95.  
  96. 44 #endif
  97.  
  98. 45 #ifdef V3D_SHADING_VERTEX_COLOR
  99.  
  100. 46 out vec3 vertexColor;
  101.  
  102. 47 #endif
  103.  
  104. 48
  105.  
  106. 49 /* From http://libnoise.sourceforge.net/noisegen/index.html */
  107.  
  108. 50 float integer_noise(int n)
  109.  
  110. 51 {
  111.  
  112. 52 n = (n >> 13) ^ n;
  113.  
  114. 53 int nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;
  115.  
  116. 54 return (float(nn) / 1073741824.0);
  117.  
  118. 55 }
  119.  
  120. 56
  121.  
  122. 57 #ifdef V3D_SHADING_VERTEX_COLOR
  123.  
  124. 58 vec3 srgb_to_linear_attr(vec3 c)
  125.  
  126. 59 {
  127.  
  128. 60 c = max(c, vec3(0.0));
  129.  
  130. 61 vec3 c1 = c * (1.0 / 12.92);
  131.  
  132. 62 vec3 c2 = pow((c + 0.055) * (1.0 / 1.055), vec3(2.4));
  133.  
  134. 63 return mix(c1, c2, step(vec3(0.04045), c));
  135.  
  136. 64 }
  137.  
  138. 65 #endif
  139.  
  140. 66
  141.  
  142. 67 void main()
  143.  
  144. 68 {
  145.  
  146. 69 #ifdef HAIR_SHADER
  147.  
  148. 70 # ifdef V3D_SHADING_TEXTURE_COLOR
  149.  
  150. 71 vec2 uv = hair_get_customdata_vec2(u);
  151.  
  152. 72 # endif
  153.  
  154. 73 float time, thick_time, thickness;
  155.  
  156. 74 vec3 pos, tan, binor;
  157.  
  158. 75 hair_get_pos_tan_binor_time((ProjectionMatrix[3][3] == 0.0),
  159.  
  160. 76 ModelMatrixInverse,
  161.  
  162. 77 ViewMatrixInverse[3].xyz,
  163.  
  164. 78 ViewMatrixInverse[2].xyz,
  165.  
  166. 79 pos,
  167.  
  168. 80 tan,
  169.  
  170. 81 binor,
  171.  
  172. 82 time,
  173.  
  174. 83 thickness,
  175.  
  176. 84 thick_time);
  177.  
  178. 85 /* To "simulate" anisotropic shading, randomize hair normal per strand. */
  179.  
  180. 86 hair_rand = integer_noise(hair_get_strand_id());
  181.  
  182. 87 tan = normalize(tan);
  183.  
  184. 88 vec3 nor = normalize(cross(binor, tan));
  185.  
  186. 89 nor = normalize(mix(nor, -tan, hair_rand * 0.10));
  187.  
  188. 90 float cos_theta = (hair_rand * 2.0 - 1.0) * 0.20;
  189.  
  190. 91 float sin_theta = sqrt(max(0.0, 1.0f - cos_theta * cos_theta));
  191.  
  192. 92 nor = nor * sin_theta + binor * cos_theta;
  193.  
  194. 93 gl_Position = ViewProjectionMatrix * vec4(pos, 1.0);
  195.  
  196. 94 #else
  197.  
  198. 95 gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
  199.  
  200. 96 #endif
  201.  
  202. 97 #ifdef V3D_SHADING_TEXTURE_COLOR
  203.  
  204. 98 uv_interp = uv;
  205.  
  206. 99 #endif
  207.  
  208. 100
  209.  
  210. 101 #ifdef V3D_SHADING_VERTEX_COLOR
  211.  
  212. 102 # ifndef HAIR_SHADER
  213.  
  214. 103 vertexColor = srgb_to_linear_attr(c);
  215.  
  216. 104 # endif
  217.  
  218. 105 #endif
  219.  
  220. 106
  221.  
  222. 107 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
  223.  
  224. 108 normal_viewport = NormalMatrix * nor;
  225.  
  226. 109 # ifndef HAIR_SHADER
  227.  
  228. 110 normal_viewport = normalize(normal_viewport);
  229.  
  230. 111 # endif
  231.  
  232. 112 #endif
  233.  
  234. 113
  235.  
  236. 114 #ifdef USE_WORLD_CLIP_PLANES
  237.  
  238. 115 world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
  239.  
  240. 116 #endif
  241.  
  242. 117 }
  243.  
  244. Vertex shader failed to compile with the following errors:
  245.  
  246. GPUShader: compile error:
  247. ===== shader string 1 ====
  248. 1 #version 330
  249. ===== shader string 2 ====
  250. 2 #define GPU_VERTEX_SHADER
  251. ===== shader string 3 ====
  252. 3 #extension GL_ARB_texture_gather: enable
  253. 4 #define GPU_ARB_texture_gather
  254. 5 #extension GL_ARB_texture_query_lod: enable
  255. ===== shader string 4 ====
  256. 6 #define GPU_ATI
  257. 7 #define OS_WIN
  258. ===== shader string 5 ====
  259. 8 #define V3D_SHADING_OBJECT_OUTLINE
  260. 9 #define V3D_SHADING_SPECULAR_HIGHLIGHT
  261. 10 #define V3D_LIGHTING_STUDIO
  262. 11 #define OBJECT_ID_PASS_ENABLED
  263. 12 #define MATDATA_PASS_ENABLED
  264. 13 #define NORMAL_VIEWPORT_PASS_ENABLED
  265. 14 #define WORKBENCH_ENCODE_NORMALS
  266. 15 #define HAIR_SHADER
  267. ===== shader string 6 ====
  268. 16 /**
  269.  
  270. 17 * Library to create hairs dynamically from control points.
  271.  
  272. 18 * This is less bandwidth intensive than fetching the vertex attributes
  273.  
  274. 19 * but does more ALU work per vertex. This also reduce the number
  275.  
  276. 20 * of data the CPU has to precompute and transfert for each update.
  277.  
  278. 21 */
  279.  
  280. 22
  281.  
  282. 23 /**
  283.  
  284. 24 * hairStrandsRes: Number of points per hair strand.
  285.  
  286. 25 * 2 - no subdivision
  287.  
  288. 26 * 3+ - 1 or more interpolated points per hair.
  289.  
  290. 27 */
  291.  
  292. 28 uniform int hairStrandsRes = 8;
  293.  
  294. 29
  295.  
  296. 30 /**
  297.  
  298. 31 * hairThicknessRes : Subdiv around the hair.
  299.  
  300. 32 * 1 - Wire Hair: Only one pixel thick, independent of view distance.
  301.  
  302. 33 * 2 - Polystrip Hair: Correct width, flat if camera is parallel.
  303.  
  304. 34 * 3+ - Cylinder Hair: Massive calculation but potentially perfect. Still need proper support.
  305.  
  306. 35 */
  307.  
  308. 36 uniform int hairThicknessRes = 1;
  309.  
  310. 37
  311.  
  312. 38 /* Hair thickness shape. */
  313.  
  314. 39 uniform float hairRadRoot = 0.01;
  315.  
  316. 40 uniform float hairRadTip = 0.0;
  317.  
  318. 41 uniform float hairRadShape = 0.5;
  319.  
  320. 42 uniform bool hairCloseTip = true;
  321.  
  322. 43
  323.  
  324. 44 uniform mat4 hairDupliMatrix;
  325.  
  326. 45
  327.  
  328. 46 /* -- Per control points -- */
  329.  
  330. 47 uniform samplerBuffer hairPointBuffer; /* RGBA32F */
  331.  
  332. 48 #define point_position xyz
  333.  
  334. 49 #define point_time w /* Position along the hair length */
  335.  
  336. 50
  337.  
  338. 51 /* -- Per strands data -- */
  339.  
  340. 52 uniform usamplerBuffer hairStrandBuffer; /* R32UI */
  341.  
  342. 53 uniform usamplerBuffer hairStrandSegBuffer; /* R16UI */
  343.  
  344. 54
  345.  
  346. 55 /* Not used, use one buffer per uv layer */
  347.  
  348. 56 //uniform samplerBuffer hairUVBuffer; /* RG32F */
  349.  
  350. 57 //uniform samplerBuffer hairColBuffer; /* RGBA16 linear color */
  351.  
  352. 58
  353.  
  354. 59 /* -- Subdivision stage -- */
  355.  
  356. 60 /**
  357.  
  358. 61 * We use a transform feedback to preprocess the strands and add more subdivision to it.
  359.  
  360. 62 * For the moment theses are simple smooth interpolation but one could hope to see the full
  361.  
  362. 63 * children particle modifiers being evaluated at this stage.
  363.  
  364. 64 *
  365.  
  366. 65 * If no more subdivision is needed, we can skip this step.
  367.  
  368. 66 */
  369.  
  370. 67
  371.  
  372. 68 #ifdef HAIR_PHASE_SUBDIV
  373.  
  374. 69 int hair_get_base_id(float local_time, int strand_segments, out float interp_time)
  375.  
  376. 70 {
  377.  
  378. 71 float time_per_strand_seg = 1.0 / float(strand_segments);
  379.  
  380. 72
  381.  
  382. 73 float ratio = local_time / time_per_strand_seg;
  383.  
  384. 74 interp_time = fract(ratio);
  385.  
  386. 75
  387.  
  388. 76 return int(ratio);
  389.  
  390. 77 }
  391.  
  392. 78
  393.  
  394. 79 void hair_get_interp_attrs(
  395.  
  396. 80 out vec4 data0, out vec4 data1, out vec4 data2, out vec4 data3, out float interp_time)
  397.  
  398. 81 {
  399.  
  400. 82 float local_time = float(gl_VertexID % hairStrandsRes) / float(hairStrandsRes - 1);
  401.  
  402. 83
  403.  
  404. 84 int hair_id = gl_VertexID / hairStrandsRes;
  405.  
  406. 85 int strand_offset = int(texelFetch(hairStrandBuffer, hair_id).x);
  407.  
  408. 86 int strand_segments = int(texelFetch(hairStrandSegBuffer, hair_id).x);
  409.  
  410. 87
  411.  
  412. 88 int id = hair_get_base_id(local_time, strand_segments, interp_time);
  413.  
  414. 89
  415.  
  416. 90 int ofs_id = id + strand_offset;
  417.  
  418. 91
  419.  
  420. 92 data0 = texelFetch(hairPointBuffer, ofs_id - 1);
  421.  
  422. 93 data1 = texelFetch(hairPointBuffer, ofs_id);
  423.  
  424. 94 data2 = texelFetch(hairPointBuffer, ofs_id + 1);
  425.  
  426. 95 data3 = texelFetch(hairPointBuffer, ofs_id + 2);
  427.  
  428. 96
  429.  
  430. 97 if (id <= 0) {
  431.  
  432. 98 /* root points. Need to reconstruct previous data. */
  433.  
  434. 99 data0 = data1 * 2.0 - data2;
  435.  
  436. 100 }
  437.  
  438. 101 if (id + 1 >= strand_segments) {
  439.  
  440. 102 /* tip points. Need to reconstruct next data. */
  441.  
  442. 103 data3 = data2 * 2.0 - data1;
  443.  
  444. 104 }
  445.  
  446. 105 }
  447.  
  448. 106 #endif
  449.  
  450. 107
  451.  
  452. 108 /* -- Drawing stage -- */
  453.  
  454. 109 /**
  455.  
  456. 110 * For final drawing, the vertex index and the number of vertex per segment
  457.  
  458. 111 */
  459.  
  460. 112
  461.  
  462. 113 #ifndef HAIR_PHASE_SUBDIV
  463.  
  464. 114 int hair_get_strand_id(void)
  465.  
  466. 115 {
  467.  
  468. 116 return gl_VertexID / (hairStrandsRes * hairThicknessRes);
  469.  
  470. 117 }
  471.  
  472. 118
  473.  
  474. 119 int hair_get_base_id(void)
  475.  
  476. 120 {
  477.  
  478. 121 return gl_VertexID / hairThicknessRes;
  479.  
  480. 122 }
  481.  
  482. 123
  483.  
  484. 124 /* Copied from cycles. */
  485.  
  486. 125 float hair_shaperadius(float shape, float root, float tip, float time)
  487.  
  488. 126 {
  489.  
  490. 127 float radius = 1.0 - time;
  491.  
  492. 128
  493.  
  494. 129 if (shape < 0.0) {
  495.  
  496. 130 radius = pow(radius, 1.0 + shape);
  497.  
  498. 131 }
  499.  
  500. 132 else {
  501.  
  502. 133 radius = pow(radius, 1.0 / (1.0 - shape));
  503.  
  504. 134 }
  505.  
  506. 135
  507.  
  508. 136 if (hairCloseTip && (time > 0.99)) {
  509.  
  510. 137 return 0.0;
  511.  
  512. 138 }
  513.  
  514. 139
  515.  
  516. 140 return (radius * (root - tip)) + tip;
  517.  
  518. 141 }
  519.  
  520. 142
  521.  
  522. 143 # ifdef OS_MAC
  523.  
  524. 144 in float dummy;
  525.  
  526. 145 # endif
  527.  
  528. 146
  529.  
  530. 147 void hair_get_pos_tan_binor_time(bool is_persp,
  531.  
  532. 148 mat4 invmodel_mat,
  533.  
  534. 149 vec3 camera_pos,
  535.  
  536. 150 vec3 camera_z,
  537.  
  538. 151 out vec3 wpos,
  539.  
  540. 152 out vec3 wtan,
  541.  
  542. 153 out vec3 wbinor,
  543.  
  544. 154 out float time,
  545.  
  546. 155 out float thickness,
  547.  
  548. 156 out float thick_time)
  549.  
  550. 157 {
  551.  
  552. 158 int id = hair_get_base_id();
  553.  
  554. 159 vec4 data = texelFetch(hairPointBuffer, id);
  555.  
  556. 160 wpos = data.point_position;
  557.  
  558. 161 time = data.point_time;
  559.  
  560. 162
  561.  
  562. 163 # ifdef OS_MAC
  563.  
  564. 164 /* Generate a dummy read to avoid the driver bug with shaders having no
  565.  
  566. 165 * vertex reads on macOS (T60171) */
  567.  
  568. 166 wpos.y += dummy * 0.0;
  569.  
  570. 167 # endif
  571.  
  572. 168
  573.  
  574. 169 if (time == 0.0) {
  575.  
  576. 170 /* Hair root */
  577.  
  578. 171 wtan = texelFetch(hairPointBuffer, id + 1).point_position - wpos;
  579.  
  580. 172 }
  581.  
  582. 173 else {
  583.  
  584. 174 wtan = wpos - texelFetch(hairPointBuffer, id - 1).point_position;
  585.  
  586. 175 }
  587.  
  588. 176
  589.  
  590. 177 wpos = (hairDupliMatrix * vec4(wpos, 1.0)).xyz;
  591.  
  592. 178 wtan = mat3(hairDupliMatrix) * wtan;
  593.  
  594. 179
  595.  
  596. 180 vec3 camera_vec = (is_persp) ? wpos - camera_pos : -camera_z;
  597.  
  598. 181 wbinor = normalize(cross(camera_vec, wtan));
  599.  
  600. 182
  601.  
  602. 183 thickness = hair_shaperadius(hairRadShape, hairRadRoot, hairRadTip, time);
  603.  
  604. 184
  605.  
  606. 185 if (hairThicknessRes > 1) {
  607.  
  608. 186 thick_time = float(gl_VertexID % hairThicknessRes) / float(hairThicknessRes - 1);
  609.  
  610. 187 thick_time = thickness * (thick_time * 2.0 - 1.0);
  611.  
  612. 188
  613.  
  614. 189 /* Take object scale into account.
  615.  
  616. 190 * NOTE: This only works fine with uniform scaling. */
  617.  
  618. 191 float scale = 1.0 / length(mat3(invmodel_mat) * wbinor);
  619.  
  620. 192
  621.  
  622. 193 wpos += wbinor * thick_time * scale;
  623.  
  624. 194 }
  625.  
  626. 195 }
  627.  
  628. 196
  629.  
  630. 197 vec2 hair_get_customdata_vec2(const samplerBuffer cd_buf)
  631.  
  632. 198 {
  633.  
  634. 199 int id = hair_get_strand_id();
  635.  
  636. 200 return texelFetch(cd_buf, id).rg;
  637.  
  638. 201 }
  639.  
  640. 202
  641.  
  642. 203 vec3 hair_get_customdata_vec3(const samplerBuffer cd_buf)
  643.  
  644. 204 {
  645.  
  646. 205 int id = hair_get_strand_id();
  647.  
  648. 206 return texelFetch(cd_buf, id).rgb;
  649.  
  650. 207 }
  651.  
  652. 208
  653.  
  654. 209 vec4 hair_get_customdata_vec4(const samplerBuffer cd_buf)
  655.  
  656. 210 {
  657.  
  658. 211 int id = hair_get_strand_id();
  659.  
  660. 212 return texelFetch(cd_buf, id).rgba;
  661.  
  662. 213 }
  663.  
  664. 214
  665.  
  666. 215 vec3 hair_get_strand_pos(void)
  667.  
  668. 216 {
  669.  
  670. 217 int id = hair_get_strand_id() * hairStrandsRes;
  671.  
  672. 218 return texelFetch(hairPointBuffer, id).point_position;
  673.  
  674. 219 }
  675.  
  676. 220
  677.  
  678. 221 #endif
  679.  
  680. 222 uniform mat4 ModelViewProjectionMatrix;
  681.  
  682. 223 uniform mat4 ModelMatrix;
  683.  
  684. 224 uniform mat4 ModelMatrixInverse;
  685.  
  686. 225 uniform mat4 ProjectionMatrix;
  687.  
  688. 226 uniform mat4 ViewProjectionMatrix;
  689.  
  690. 227 uniform mat4 ViewMatrixInverse;
  691.  
  692. 228 uniform mat3 NormalMatrix;
  693.  
  694. 229
  695.  
  696. 230 #ifndef HAIR_SHADER
  697.  
  698. 231 in vec3 pos;
  699.  
  700. 232 in vec3 nor;
  701.  
  702. 233 in vec2 u; /* active texture layer */
  703.  
  704. 234 # ifdef V3D_SHADING_VERTEX_COLOR
  705.  
  706. 235 in vec3 c; /* active color */
  707.  
  708. 236 # endif
  709.  
  710. 237 # define uv u
  711.  
  712. 238 #else /* HAIR_SHADER */
  713.  
  714. 239 # ifdef V3D_SHADING_TEXTURE_COLOR
  715.  
  716. 240 uniform samplerBuffer u; /* active texture layer */
  717.  
  718. 241 # endif
  719.  
  720. 242 flat out float hair_rand;
  721.  
  722. 243 #endif /* HAIR_SHADER */
  723.  
  724. 244
  725.  
  726. 245 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
  727.  
  728. 246 out vec3 normal_viewport;
  729.  
  730. 247 #endif
  731.  
  732. 248
  733.  
  734. 249 #ifdef V3D_SHADING_TEXTURE_COLOR
  735.  
  736. 250 out vec2 uv_interp;
  737.  
  738. 251 #endif
  739.  
  740. 252 #ifdef V3D_SHADING_VERTEX_COLOR
  741.  
  742. 253 out vec3 vertexColor;
  743.  
  744. 254 #endif
  745.  
  746. 255
  747.  
  748. 256 /* From http://libnoise.sourceforge.net/noisegen/index.html */
  749.  
  750. 257 float integer_noise(int n)
  751.  
  752. 258 {
  753.  
  754. 259 n = (n >> 13) ^ n;
  755.  
  756. 260 int nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;
  757.  
  758. 261 return (float(nn) / 1073741824.0);
  759.  
  760. 262 }
  761.  
  762. 263
  763.  
  764. 264 #ifdef V3D_SHADING_VERTEX_COLOR
  765.  
  766. 265 vec3 srgb_to_linear_attr(vec3 c)
  767.  
  768. 266 {
  769.  
  770. 267 c = max(c, vec3(0.0));
  771.  
  772. 268 vec3 c1 = c * (1.0 / 12.92);
  773.  
  774. 269 vec3 c2 = pow((c + 0.055) * (1.0 / 1.055), vec3(2.4));
  775.  
  776. 270 return mix(c1, c2, step(vec3(0.04045), c));
  777.  
  778. 271 }
  779.  
  780. 272 #endif
  781.  
  782. 273
  783.  
  784. 274 void main()
  785.  
  786. 275 {
  787.  
  788. 276 #ifdef HAIR_SHADER
  789.  
  790. 277 # ifdef V3D_SHADING_TEXTURE_COLOR
  791.  
  792. 278 vec2 uv = hair_get_customdata_vec2(u);
  793.  
  794. 279 # endif
  795.  
  796. 280 float time, thick_time, thickness;
  797.  
  798. 281 vec3 pos, tan, binor;
  799.  
  800. 282 hair_get_pos_tan_binor_time((ProjectionMatrix[3][3] == 0.0),
  801.  
  802. 283 ModelMatrixInverse,
  803.  
  804. 284 ViewMatrixInverse[3].xyz,
  805.  
  806. 285 ViewMatrixInverse[2].xyz,
  807.  
  808. 286 pos,
  809.  
  810. 287 tan,
  811.  
  812. 288 binor,
  813.  
  814. 289 time,
  815.  
  816. 290 thickness,
  817.  
  818. 291 thick_time);
  819.  
  820. 292 /* To "simulate" anisotropic shading, randomize hair normal per strand. */
  821.  
  822. 293 hair_rand = integer_noise(hair_get_strand_id());
  823.  
  824. 294 tan = normalize(tan);
  825.  
  826. 295 vec3 nor = normalize(cross(binor, tan));
  827.  
  828. 296 nor = normalize(mix(nor, -tan, hair_rand * 0.10));
  829.  
  830. 297 float cos_theta = (hair_rand * 2.0 - 1.0) * 0.20;
  831.  
  832. 298 float sin_theta = sqrt(max(0.0, 1.0f - cos_theta * cos_theta));
  833.  
  834. 299 nor = nor * sin_theta + binor * cos_theta;
  835.  
  836. 300 gl_Position = ViewProjectionMatrix * vec4(pos, 1.0);
  837.  
  838. 301 #else
  839.  
  840. 302 gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
  841.  
  842. 303 #endif
  843.  
  844. 304 #ifdef V3D_SHADING_TEXTURE_COLOR
  845.  
  846. 305 uv_interp = uv;
  847.  
  848. 306 #endif
  849.  
  850. 307
  851.  
  852. 308 #ifdef V3D_SHADING_VERTEX_COLOR
  853.  
  854. 309 # ifndef HAIR_SHADER
  855.  
  856. 310 vertexColor = srgb_to_linear_attr(c);
  857.  
  858. 311 # endif
  859.  
  860. 312 #endif
  861.  
  862. 313
  863.  
  864. 314 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
  865.  
  866. 315 normal_viewport = NormalMatrix * nor;
  867.  
  868. 316 # ifndef HAIR_SHADER
  869.  
  870. 317 normal_viewport = normalize(normal_viewport);
  871.  
  872. 318 # endif
  873.  
  874. 319 #endif
  875.  
  876. 320
  877.  
  878. 321 #ifdef USE_WORLD_CLIP_PLANES
  879.  
  880. 322 world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
  881.  
  882. 323 #endif
  883.  
  884. 324 }
  885.  
  886. Vertex shader failed to compile with the following errors:
  887.  
  888. GPUShader: compile error:
  889. ===== shader string 1 ====
  890. 1 #version 330
  891. ===== shader string 2 ====
  892. 2 #define GPU_VERTEX_SHADER
  893. ===== shader string 3 ====
  894. 3 #extension GL_ARB_texture_gather: enable
  895. 4 #define GPU_ARB_texture_gather
  896. 5 #extension GL_ARB_texture_query_lod: enable
  897. ===== shader string 4 ====
  898. 6 #define GPU_ATI
  899. 7 #define OS_WIN
  900. ===== shader string 5 ====
  901. 8 #define V3D_SHADING_OBJECT_OUTLINE
  902. 9 #define V3D_SHADING_SPECULAR_HIGHLIGHT
  903. 10 #define V3D_LIGHTING_STUDIO
  904. 11 #define OBJECT_ID_PASS_ENABLED
  905. 12 #define MATDATA_PASS_ENABLED
  906. 13 #define NORMAL_VIEWPORT_PASS_ENABLED
  907. 14 #define WORKBENCH_ENCODE_NORMALS
  908. ===== shader string 6 ====
  909. 15 uniform mat4 ModelViewProjectionMatrix;
  910.  
  911. 16 uniform mat4 ModelMatrix;
  912.  
  913. 17 uniform mat4 ModelMatrixInverse;
  914.  
  915. 18 uniform mat4 ProjectionMatrix;
  916.  
  917. 19 uniform mat4 ViewProjectionMatrix;
  918.  
  919. 20 uniform mat4 ViewMatrixInverse;
  920.  
  921. 21 uniform mat3 NormalMatrix;
  922.  
  923. 22
  924.  
  925. 23 #ifndef HAIR_SHADER
  926.  
  927. 24 in vec3 pos;
  928.  
  929. 25 in vec3 nor;
  930.  
  931. 26 in vec2 u; /* active texture layer */
  932.  
  933. 27 # ifdef V3D_SHADING_VERTEX_COLOR
  934.  
  935. 28 in vec3 c; /* active color */
  936.  
  937. 29 # endif
  938.  
  939. 30 # define uv u
  940.  
  941. 31 #else /* HAIR_SHADER */
  942.  
  943. 32 # ifdef V3D_SHADING_TEXTURE_COLOR
  944.  
  945. 33 uniform samplerBuffer u; /* active texture layer */
  946.  
  947. 34 # endif
  948.  
  949. 35 flat out float hair_rand;
  950.  
  951. 36 #endif /* HAIR_SHADER */
  952.  
  953. 37
  954.  
  955. 38 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
  956.  
  957. 39 out vec3 normal_viewport;
  958.  
  959. 40 #endif
  960.  
  961. 41
  962.  
  963. 42 #ifdef V3D_SHADING_TEXTURE_COLOR
  964.  
  965. 43 out vec2 uv_interp;
  966.  
  967. 44 #endif
  968.  
  969. 45 #ifdef V3D_SHADING_VERTEX_COLOR
  970.  
  971. 46 out vec3 vertexColor;
  972.  
  973. 47 #endif
  974.  
  975. 48
  976.  
  977. 49 /* From http://libnoise.sourceforge.net/noisegen/index.html */
  978.  
  979. 50 float integer_noise(int n)
  980.  
  981. 51 {
  982.  
  983. 52 n = (n >> 13) ^ n;
  984.  
  985. 53 int nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;
  986.  
  987. 54 return (float(nn) / 1073741824.0);
  988.  
  989. 55 }
  990.  
  991. 56
  992.  
  993. 57 #ifdef V3D_SHADING_VERTEX_COLOR
  994.  
  995. 58 vec3 srgb_to_linear_attr(vec3 c)
  996.  
  997. 59 {
  998.  
  999. 60 c = max(c, vec3(0.0));
  1000.  
  1001. 61 vec3 c1 = c * (1.0 / 12.92);
  1002.  
  1003. 62 vec3 c2 = pow((c + 0.055) * (1.0 / 1.055), vec3(2.4));
  1004.  
  1005. 63 return mix(c1, c2, step(vec3(0.04045), c));
  1006.  
  1007. 64 }
  1008.  
  1009. 65 #endif
  1010.  
  1011. 66
  1012.  
  1013. 67 void main()
  1014.  
  1015. 68 {
  1016.  
  1017. 69 #ifdef HAIR_SHADER
  1018.  
  1019. 70 # ifdef V3D_SHADING_TEXTURE_COLOR
  1020.  
  1021. 71 vec2 uv = hair_get_customdata_vec2(u);
  1022.  
  1023. 72 # endif
  1024.  
  1025. 73 float time, thick_time, thickness;
  1026.  
  1027. 74 vec3 pos, tan, binor;
  1028.  
  1029. 75 hair_get_pos_tan_binor_time((ProjectionMatrix[3][3] == 0.0),
  1030.  
  1031. 76 ModelMatrixInverse,
  1032.  
  1033. 77 ViewMatrixInverse[3].xyz,
  1034.  
  1035. 78 ViewMatrixInverse[2].xyz,
  1036.  
  1037. 79 pos,
  1038.  
  1039. 80 tan,
  1040.  
  1041. 81 binor,
  1042.  
  1043. 82 time,
  1044.  
  1045. 83 thickness,
  1046.  
  1047. 84 thick_time);
  1048.  
  1049. 85 /* To "simulate" anisotropic shading, randomize hair normal per strand. */
  1050.  
  1051. 86 hair_rand = integer_noise(hair_get_strand_id());
  1052.  
  1053. 87 tan = normalize(tan);
  1054.  
  1055. 88 vec3 nor = normalize(cross(binor, tan));
  1056.  
  1057. 89 nor = normalize(mix(nor, -tan, hair_rand * 0.10));
  1058.  
  1059. 90 float cos_theta = (hair_rand * 2.0 - 1.0) * 0.20;
  1060.  
  1061. 91 float sin_theta = sqrt(max(0.0, 1.0f - cos_theta * cos_theta));
  1062.  
  1063. 92 nor = nor * sin_theta + binor * cos_theta;
  1064.  
  1065. 93 gl_Position = ViewProjectionMatrix * vec4(pos, 1.0);
  1066.  
  1067. 94 #else
  1068.  
  1069. 95 gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
  1070.  
  1071. 96 #endif
  1072.  
  1073. 97 #ifdef V3D_SHADING_TEXTURE_COLOR
  1074.  
  1075. 98 uv_interp = uv;
  1076.  
  1077. 99 #endif
  1078.  
  1079. 100
  1080.  
  1081. 101 #ifdef V3D_SHADING_VERTEX_COLOR
  1082.  
  1083. 102 # ifndef HAIR_SHADER
  1084.  
  1085. 103 vertexColor = srgb_to_linear_attr(c);
  1086.  
  1087. 104 # endif
  1088.  
  1089. 105 #endif
  1090.  
  1091. 106
  1092.  
  1093. 107 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
  1094.  
  1095. 108 normal_viewport = NormalMatrix * nor;
  1096.  
  1097. 109 # ifndef HAIR_SHADER
  1098.  
  1099. 110 normal_viewport = normalize(normal_viewport);
  1100.  
  1101. 111 # endif
  1102.  
  1103. 112 #endif
  1104.  
  1105. 113
  1106.  
  1107. 114 #ifdef USE_WORLD_CLIP_PLANES
  1108.  
  1109. 115 world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
  1110.  
  1111. 116 #endif
  1112.  
  1113. 117 }
  1114.  
  1115. Vertex shader failed to compile with the following errors:
  1116.  
  1117. GPUShader: compile error:
  1118. ===== shader string 1 ====
  1119. 1 #version 330
  1120. ===== shader string 2 ====
  1121. 2 #define GPU_VERTEX_SHADER
  1122. ===== shader string 3 ====
  1123. 3 #extension GL_ARB_texture_gather: enable
  1124. 4 #define GPU_ARB_texture_gather
  1125. 5 #extension GL_ARB_texture_query_lod: enable
  1126. ===== shader string 4 ====
  1127. 6 #define GPU_ATI
  1128. 7 #define OS_WIN
  1129. ===== shader string 5 ====
  1130. 8 #define V3D_SHADING_OBJECT_OUTLINE
  1131. 9 #define V3D_SHADING_SPECULAR_HIGHLIGHT
  1132. 10 #define V3D_LIGHTING_STUDIO
  1133. 11 #define OBJECT_ID_PASS_ENABLED
  1134. 12 #define MATDATA_PASS_ENABLED
  1135. 13 #define NORMAL_VIEWPORT_PASS_ENABLED
  1136. 14 #define WORKBENCH_ENCODE_NORMALS
  1137. 15 #define HAIR_SHADER
  1138. ===== shader string 6 ====
  1139. 16 /**
  1140.  
  1141. 17 * Library to create hairs dynamically from control points.
  1142.  
  1143. 18 * This is less bandwidth intensive than fetching the vertex attributes
  1144.  
  1145. 19 * but does more ALU work per vertex. This also reduce the number
  1146.  
  1147. 20 * of data the CPU has to precompute and transfert for each update.
  1148.  
  1149. 21 */
  1150.  
  1151. 22
  1152.  
  1153. 23 /**
  1154.  
  1155. 24 * hairStrandsRes: Number of points per hair strand.
  1156.  
  1157. 25 * 2 - no subdivision
  1158.  
  1159. 26 * 3+ - 1 or more interpolated points per hair.
  1160.  
  1161. 27 */
  1162.  
  1163. 28 uniform int hairStrandsRes = 8;
  1164.  
  1165. 29
  1166.  
  1167. 30 /**
  1168.  
  1169. 31 * hairThicknessRes : Subdiv around the hair.
  1170.  
  1171. 32 * 1 - Wire Hair: Only one pixel thick, independent of view distance.
  1172.  
  1173. 33 * 2 - Polystrip Hair: Correct width, flat if camera is parallel.
  1174.  
  1175. 34 * 3+ - Cylinder Hair: Massive calculation but potentially perfect. Still need proper support.
  1176.  
  1177. 35 */
  1178.  
  1179. 36 uniform int hairThicknessRes = 1;
  1180.  
  1181. 37
  1182.  
  1183. 38 /* Hair thickness shape. */
  1184.  
  1185. 39 uniform float hairRadRoot = 0.01;
  1186.  
  1187. 40 uniform float hairRadTip = 0.0;
  1188.  
  1189. 41 uniform float hairRadShape = 0.5;
  1190.  
  1191. 42 uniform bool hairCloseTip = true;
  1192.  
  1193. 43
  1194.  
  1195. 44 uniform mat4 hairDupliMatrix;
  1196.  
  1197. 45
  1198.  
  1199. 46 /* -- Per control points -- */
  1200.  
  1201. 47 uniform samplerBuffer hairPointBuffer; /* RGBA32F */
  1202.  
  1203. 48 #define point_position xyz
  1204.  
  1205. 49 #define point_time w /* Position along the hair length */
  1206.  
  1207. 50
  1208.  
  1209. 51 /* -- Per strands data -- */
  1210.  
  1211. 52 uniform usamplerBuffer hairStrandBuffer; /* R32UI */
  1212.  
  1213. 53 uniform usamplerBuffer hairStrandSegBuffer; /* R16UI */
  1214.  
  1215. 54
  1216.  
  1217. 55 /* Not used, use one buffer per uv layer */
  1218.  
  1219. 56 //uniform samplerBuffer hairUVBuffer; /* RG32F */
  1220.  
  1221. 57 //uniform samplerBuffer hairColBuffer; /* RGBA16 linear color */
  1222.  
  1223. 58
  1224.  
  1225. 59 /* -- Subdivision stage -- */
  1226.  
  1227. 60 /**
  1228.  
  1229. 61 * We use a transform feedback to preprocess the strands and add more subdivision to it.
  1230.  
  1231. 62 * For the moment theses are simple smooth interpolation but one could hope to see the full
  1232.  
  1233. 63 * children particle modifiers being evaluated at this stage.
  1234.  
  1235. 64 *
  1236.  
  1237. 65 * If no more subdivision is needed, we can skip this step.
  1238.  
  1239. 66 */
  1240.  
  1241. 67
  1242.  
  1243. 68 #ifdef HAIR_PHASE_SUBDIV
  1244.  
  1245. 69 int hair_get_base_id(float local_time, int strand_segments, out float interp_time)
  1246.  
  1247. 70 {
  1248.  
  1249. 71 float time_per_strand_seg = 1.0 / float(strand_segments);
  1250.  
  1251. 72
  1252.  
  1253. 73 float ratio = local_time / time_per_strand_seg;
  1254.  
  1255. 74 interp_time = fract(ratio);
  1256.  
  1257. 75
  1258.  
  1259. 76 return int(ratio);
  1260.  
  1261. 77 }
  1262.  
  1263. 78
  1264.  
  1265. 79 void hair_get_interp_attrs(
  1266.  
  1267. 80 out vec4 data0, out vec4 data1, out vec4 data2, out vec4 data3, out float interp_time)
  1268.  
  1269. 81 {
  1270.  
  1271. 82 float local_time = float(gl_VertexID % hairStrandsRes) / float(hairStrandsRes - 1);
  1272.  
  1273. 83
  1274.  
  1275. 84 int hair_id = gl_VertexID / hairStrandsRes;
  1276.  
  1277. 85 int strand_offset = int(texelFetch(hairStrandBuffer, hair_id).x);
  1278.  
  1279. 86 int strand_segments = int(texelFetch(hairStrandSegBuffer, hair_id).x);
  1280.  
  1281. 87
  1282.  
  1283. 88 int id = hair_get_base_id(local_time, strand_segments, interp_time);
  1284.  
  1285. 89
  1286.  
  1287. 90 int ofs_id = id + strand_offset;
  1288.  
  1289. 91
  1290.  
  1291. 92 data0 = texelFetch(hairPointBuffer, ofs_id - 1);
  1292.  
  1293. 93 data1 = texelFetch(hairPointBuffer, ofs_id);
  1294.  
  1295. 94 data2 = texelFetch(hairPointBuffer, ofs_id + 1);
  1296.  
  1297. 95 data3 = texelFetch(hairPointBuffer, ofs_id + 2);
  1298.  
  1299. 96
  1300.  
  1301. 97 if (id <= 0) {
  1302.  
  1303. 98 /* root points. Need to reconstruct previous data. */
  1304.  
  1305. 99 data0 = data1 * 2.0 - data2;
  1306.  
  1307. 100 }
  1308.  
  1309. 101 if (id + 1 >= strand_segments) {
  1310.  
  1311. 102 /* tip points. Need to reconstruct next data. */
  1312.  
  1313. 103 data3 = data2 * 2.0 - data1;
  1314.  
  1315. 104 }
  1316.  
  1317. 105 }
  1318.  
  1319. 106 #endif
  1320.  
  1321. 107
  1322.  
  1323. 108 /* -- Drawing stage -- */
  1324.  
  1325. 109 /**
  1326.  
  1327. 110 * For final drawing, the vertex index and the number of vertex per segment
  1328.  
  1329. 111 */
  1330.  
  1331. 112
  1332.  
  1333. 113 #ifndef HAIR_PHASE_SUBDIV
  1334.  
  1335. 114 int hair_get_strand_id(void)
  1336.  
  1337. 115 {
  1338.  
  1339. 116 return gl_VertexID / (hairStrandsRes * hairThicknessRes);
  1340.  
  1341. 117 }
  1342.  
  1343. 118
  1344.  
  1345. 119 int hair_get_base_id(void)
  1346.  
  1347. 120 {
  1348.  
  1349. 121 return gl_VertexID / hairThicknessRes;
  1350.  
  1351. 122 }
  1352.  
  1353. 123
  1354.  
  1355. 124 /* Copied from cycles. */
  1356.  
  1357. 125 float hair_shaperadius(float shape, float root, float tip, float time)
  1358.  
  1359. 126 {
  1360.  
  1361. 127 float radius = 1.0 - time;
  1362.  
  1363. 128
  1364.  
  1365. 129 if (shape < 0.0) {
  1366.  
  1367. 130 radius = pow(radius, 1.0 + shape);
  1368.  
  1369. 131 }
  1370.  
  1371. 132 else {
  1372.  
  1373. 133 radius = pow(radius, 1.0 / (1.0 - shape));
  1374.  
  1375. 134 }
  1376.  
  1377. 135
  1378.  
  1379. 136 if (hairCloseTip && (time > 0.99)) {
  1380.  
  1381. 137 return 0.0;
  1382.  
  1383. 138 }
  1384.  
  1385. 139
  1386.  
  1387. 140 return (radius * (root - tip)) + tip;
  1388.  
  1389. 141 }
  1390.  
  1391. 142
  1392.  
  1393. 143 # ifdef OS_MAC
  1394.  
  1395. 144 in float dummy;
  1396.  
  1397. 145 # endif
  1398.  
  1399. 146
  1400.  
  1401. 147 void hair_get_pos_tan_binor_time(bool is_persp,
  1402.  
  1403. 148 mat4 invmodel_mat,
  1404.  
  1405. 149 vec3 camera_pos,
  1406.  
  1407. 150 vec3 camera_z,
  1408.  
  1409. 151 out vec3 wpos,
  1410.  
  1411. 152 out vec3 wtan,
  1412.  
  1413. 153 out vec3 wbinor,
  1414.  
  1415. 154 out float time,
  1416.  
  1417. 155 out float thickness,
  1418.  
  1419. 156 out float thick_time)
  1420.  
  1421. 157 {
  1422.  
  1423. 158 int id = hair_get_base_id();
  1424.  
  1425. 159 vec4 data = texelFetch(hairPointBuffer, id);
  1426.  
  1427. 160 wpos = data.point_position;
  1428.  
  1429. 161 time = data.point_time;
  1430.  
  1431. 162
  1432.  
  1433. 163 # ifdef OS_MAC
  1434.  
  1435. 164 /* Generate a dummy read to avoid the driver bug with shaders having no
  1436.  
  1437. 165 * vertex reads on macOS (T60171) */
  1438.  
  1439. 166 wpos.y += dummy * 0.0;
  1440.  
  1441. 167 # endif
  1442.  
  1443. 168
  1444.  
  1445. 169 if (time == 0.0) {
  1446.  
  1447. 170 /* Hair root */
  1448.  
  1449. 171 wtan = texelFetch(hairPointBuffer, id + 1).point_position - wpos;
  1450.  
  1451. 172 }
  1452.  
  1453. 173 else {
  1454.  
  1455. 174 wtan = wpos - texelFetch(hairPointBuffer, id - 1).point_position;
  1456.  
  1457. 175 }
  1458.  
  1459. 176
  1460.  
  1461. 177 wpos = (hairDupliMatrix * vec4(wpos, 1.0)).xyz;
  1462.  
  1463. 178 wtan = mat3(hairDupliMatrix) * wtan;
  1464.  
  1465. 179
  1466.  
  1467. 180 vec3 camera_vec = (is_persp) ? wpos - camera_pos : -camera_z;
  1468.  
  1469. 181 wbinor = normalize(cross(camera_vec, wtan));
  1470.  
  1471. 182
  1472.  
  1473. 183 thickness = hair_shaperadius(hairRadShape, hairRadRoot, hairRadTip, time);
  1474.  
  1475. 184
  1476.  
  1477. 185 if (hairThicknessRes > 1) {
  1478.  
  1479. 186 thick_time = float(gl_VertexID % hairThicknessRes) / float(hairThicknessRes - 1);
  1480.  
  1481. 187 thick_time = thickness * (thick_time * 2.0 - 1.0);
  1482.  
  1483. 188
  1484.  
  1485. 189 /* Take object scale into account.
  1486.  
  1487. 190 * NOTE: This only works fine with uniform scaling. */
  1488.  
  1489. 191 float scale = 1.0 / length(mat3(invmodel_mat) * wbinor);
  1490.  
  1491. 192
  1492.  
  1493. 193 wpos += wbinor * thick_time * scale;
  1494.  
  1495. 194 }
  1496.  
  1497. 195 }
  1498.  
  1499. 196
  1500.  
  1501. 197 vec2 hair_get_customdata_vec2(const samplerBuffer cd_buf)
  1502.  
  1503. 198 {
  1504.  
  1505. 199 int id = hair_get_strand_id();
  1506.  
  1507. 200 return texelFetch(cd_buf, id).rg;
  1508.  
  1509. 201 }
  1510.  
  1511. 202
  1512.  
  1513. 203 vec3 hair_get_customdata_vec3(const samplerBuffer cd_buf)
  1514.  
  1515. 204 {
  1516.  
  1517. 205 int id = hair_get_strand_id();
  1518.  
  1519. 206 return texelFetch(cd_buf, id).rgb;
  1520.  
  1521. 207 }
  1522.  
  1523. 208
  1524.  
  1525. 209 vec4 hair_get_customdata_vec4(const samplerBuffer cd_buf)
  1526.  
  1527. 210 {
  1528.  
  1529. 211 int id = hair_get_strand_id();
  1530.  
  1531. 212 return texelFetch(cd_buf, id).rgba;
  1532.  
  1533. 213 }
  1534.  
  1535. 214
  1536.  
  1537. 215 vec3 hair_get_strand_pos(void)
  1538.  
  1539. 216 {
  1540.  
  1541. 217 int id = hair_get_strand_id() * hairStrandsRes;
  1542.  
  1543. 218 return texelFetch(hairPointBuffer, id).point_position;
  1544.  
  1545. 219 }
  1546.  
  1547. 220
  1548.  
  1549. 221 #endif
  1550.  
  1551. 222 uniform mat4 ModelViewProjectionMatrix;
  1552.  
  1553. 223 uniform mat4 ModelMatrix;
  1554.  
  1555. 224 uniform mat4 ModelMatrixInverse;
  1556.  
  1557. 225 uniform mat4 ProjectionMatrix;
  1558.  
  1559. 226 uniform mat4 ViewProjectionMatrix;
  1560.  
  1561. 227 uniform mat4 ViewMatrixInverse;
  1562.  
  1563. 228 uniform mat3 NormalMatrix;
  1564.  
  1565. 229
  1566.  
  1567. 230 #ifndef HAIR_SHADER
  1568.  
  1569. 231 in vec3 pos;
  1570.  
  1571. 232 in vec3 nor;
  1572.  
  1573. 233 in vec2 u; /* active texture layer */
  1574.  
  1575. 234 # ifdef V3D_SHADING_VERTEX_COLOR
  1576.  
  1577. 235 in vec3 c; /* active color */
  1578.  
  1579. 236 # endif
  1580.  
  1581. 237 # define uv u
  1582.  
  1583. 238 #else /* HAIR_SHADER */
  1584.  
  1585. 239 # ifdef V3D_SHADING_TEXTURE_COLOR
  1586.  
  1587. 240 uniform samplerBuffer u; /* active texture layer */
  1588.  
  1589. 241 # endif
  1590.  
  1591. 242 flat out float hair_rand;
  1592.  
  1593. 243 #endif /* HAIR_SHADER */
  1594.  
  1595. 244
  1596.  
  1597. 245 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
  1598.  
  1599. 246 out vec3 normal_viewport;
  1600.  
  1601. 247 #endif
  1602.  
  1603. 248
  1604.  
  1605. 249 #ifdef V3D_SHADING_TEXTURE_COLOR
  1606.  
  1607. 250 out vec2 uv_interp;
  1608.  
  1609. 251 #endif
  1610.  
  1611. 252 #ifdef V3D_SHADING_VERTEX_COLOR
  1612.  
  1613. 253 out vec3 vertexColor;
  1614.  
  1615. 254 #endif
  1616.  
  1617. 255
  1618.  
  1619. 256 /* From http://libnoise.sourceforge.net/noisegen/index.html */
  1620.  
  1621. 257 float integer_noise(int n)
  1622.  
  1623. 258 {
  1624.  
  1625. 259 n = (n >> 13) ^ n;
  1626.  
  1627. 260 int nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;
  1628.  
  1629. 261 return (float(nn) / 1073741824.0);
  1630.  
  1631. 262 }
  1632.  
  1633. 263
  1634.  
  1635. 264 #ifdef V3D_SHADING_VERTEX_COLOR
  1636.  
  1637. 265 vec3 srgb_to_linear_attr(vec3 c)
  1638.  
  1639. 266 {
  1640.  
  1641. 267 c = max(c, vec3(0.0));
  1642.  
  1643. 268 vec3 c1 = c * (1.0 / 12.92);
  1644.  
  1645. 269 vec3 c2 = pow((c + 0.055) * (1.0 / 1.055), vec3(2.4));
  1646.  
  1647. 270 return mix(c1, c2, step(vec3(0.04045), c));
  1648.  
  1649. 271 }
  1650.  
  1651. 272 #endif
  1652.  
  1653. 273
  1654.  
  1655. 274 void main()
  1656.  
  1657. 275 {
  1658.  
  1659. 276 #ifdef HAIR_SHADER
  1660.  
  1661. 277 # ifdef V3D_SHADING_TEXTURE_COLOR
  1662.  
  1663. 278 vec2 uv = hair_get_customdata_vec2(u);
  1664.  
  1665. 279 # endif
  1666.  
  1667. 280 float time, thick_time, thickness;
  1668.  
  1669. 281 vec3 pos, tan, binor;
  1670.  
  1671. 282 hair_get_pos_tan_binor_time((ProjectionMatrix[3][3] == 0.0),
  1672.  
  1673. 283 ModelMatrixInverse,
  1674.  
  1675. 284 ViewMatrixInverse[3].xyz,
  1676.  
  1677. 285 ViewMatrixInverse[2].xyz,
  1678.  
  1679. 286 pos,
  1680.  
  1681. 287 tan,
  1682.  
  1683. 288 binor,
  1684.  
  1685. 289 time,
  1686.  
  1687. 290 thickness,
  1688.  
  1689. 291 thick_time);
  1690.  
  1691. 292 /* To "simulate" anisotropic shading, randomize hair normal per strand. */
  1692.  
  1693. 293 hair_rand = integer_noise(hair_get_strand_id());
  1694.  
  1695. 294 tan = normalize(tan);
  1696.  
  1697. 295 vec3 nor = normalize(cross(binor, tan));
  1698.  
  1699. 296 nor = normalize(mix(nor, -tan, hair_rand * 0.10));
  1700.  
  1701. 297 float cos_theta = (hair_rand * 2.0 - 1.0) * 0.20;
  1702.  
  1703. 298 float sin_theta = sqrt(max(0.0, 1.0f - cos_theta * cos_theta));
  1704.  
  1705. 299 nor = nor * sin_theta + binor * cos_theta;
  1706.  
  1707. 300 gl_Position = ViewProjectionMatrix * vec4(pos, 1.0);
  1708.  
  1709. 301 #else
  1710.  
  1711. 302 gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
  1712.  
  1713. 303 #endif
  1714.  
  1715. 304 #ifdef V3D_SHADING_TEXTURE_COLOR
  1716.  
  1717. 305 uv_interp = uv;
  1718.  
  1719. 306 #endif
  1720.  
  1721. 307
  1722.  
  1723. 308 #ifdef V3D_SHADING_VERTEX_COLOR
  1724.  
  1725. 309 # ifndef HAIR_SHADER
  1726.  
  1727. 310 vertexColor = srgb_to_linear_attr(c);
  1728.  
  1729. 311 # endif
  1730.  
  1731. 312 #endif
  1732.  
  1733. 313
  1734.  
  1735. 314 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
  1736.  
  1737. 315 normal_viewport = NormalMatrix * nor;
  1738.  
  1739. 316 # ifndef HAIR_SHADER
  1740.  
  1741. 317 normal_viewport = normalize(normal_viewport);
  1742.  
  1743. 318 # endif
  1744.  
  1745. 319 #endif
  1746.  
  1747. 320
  1748.  
  1749. 321 #ifdef USE_WORLD_CLIP_PLANES
  1750.  
  1751. 322 world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
  1752.  
  1753. 323 #endif
  1754.  
  1755. 324 }
  1756.  
  1757. Vertex shader failed to compile with the following errors:
  1758.  
  1759. GPUShader: compile error:
  1760. ===== shader string 1 ====
  1761. 1 #version 330
  1762. ===== shader string 2 ====
  1763. 2 #define GPU_VERTEX_SHADER
  1764. ===== shader string 3 ====
  1765. 3 #extension GL_ARB_texture_gather: enable
  1766. 4 #define GPU_ARB_texture_gather
  1767. 5 #extension GL_ARB_texture_query_lod: enable
  1768. ===== shader string 4 ====
  1769. 6 #define GPU_ATI
  1770. 7 #define OS_WIN
  1771. ===== shader string 5 ====
  1772. 8 #define V3D_SHADING_OBJECT_OUTLINE
  1773. 9 #define V3D_SHADING_SPECULAR_HIGHLIGHT
  1774. 10 #define V3D_LIGHTING_STUDIO
  1775. 11 #define OBJECT_ID_PASS_ENABLED
  1776. 12 #define MATDATA_PASS_ENABLED
  1777. 13 #define NORMAL_VIEWPORT_PASS_ENABLED
  1778. 14 #define WORKBENCH_ENCODE_NORMALS
  1779. ===== shader string 6 ====
  1780. 15 uniform mat4 ModelViewProjectionMatrix;
  1781.  
  1782. 16 uniform mat4 ModelMatrix;
  1783.  
  1784. 17 uniform mat4 ModelMatrixInverse;
  1785.  
  1786. 18 uniform mat4 ProjectionMatrix;
  1787.  
  1788. 19 uniform mat4 ViewProjectionMatrix;
  1789.  
  1790. 20 uniform mat4 ViewMatrixInverse;
  1791.  
  1792. 21 uniform mat3 NormalMatrix;
  1793.  
  1794. 22
  1795.  
  1796. 23 #ifndef HAIR_SHADER
  1797.  
  1798. 24 in vec3 pos;
  1799.  
  1800. 25 in vec3 nor;
  1801.  
  1802. 26 in vec2 u; /* active texture layer */
  1803.  
  1804. 27 # ifdef V3D_SHADING_VERTEX_COLOR
  1805.  
  1806. 28 in vec3 c; /* active color */
  1807.  
  1808. 29 # endif
  1809.  
  1810. 30 # define uv u
  1811.  
  1812. 31 #else /* HAIR_SHADER */
  1813.  
  1814. 32 # ifdef V3D_SHADING_TEXTURE_COLOR
  1815.  
  1816. 33 uniform samplerBuffer u; /* active texture layer */
  1817.  
  1818. 34 # endif
  1819.  
  1820. 35 flat out float hair_rand;
  1821.  
  1822. 36 #endif /* HAIR_SHADER */
  1823.  
  1824. 37
  1825.  
  1826. 38 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
  1827.  
  1828. 39 out vec3 normal_viewport;
  1829.  
  1830. 40 #endif
  1831.  
  1832. 41
  1833.  
  1834. 42 #ifdef V3D_SHADING_TEXTURE_COLOR
  1835.  
  1836. 43 out vec2 uv_interp;
  1837.  
  1838. 44 #endif
  1839.  
  1840. 45 #ifdef V3D_SHADING_VERTEX_COLOR
  1841.  
  1842. 46 out vec3 vertexColor;
  1843.  
  1844. 47 #endif
  1845.  
  1846. 48
  1847.  
  1848. 49 /* From http://libnoise.sourceforge.net/noisegen/index.html */
  1849.  
  1850. 50 float integer_noise(int n)
  1851.  
  1852. 51 {
  1853.  
  1854. 52 n = (n >> 13) ^ n;
  1855.  
  1856. 53 int nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;
  1857.  
  1858. 54 return (float(nn) / 1073741824.0);
  1859.  
  1860. 55 }
  1861.  
  1862. 56
  1863.  
  1864. 57 #ifdef V3D_SHADING_VERTEX_COLOR
  1865.  
  1866. 58 vec3 srgb_to_linear_attr(vec3 c)
  1867.  
  1868. 59 {
  1869.  
  1870. 60 c = max(c, vec3(0.0));
  1871.  
  1872. 61 vec3 c1 = c * (1.0 / 12.92);
  1873.  
  1874. 62 vec3 c2 = pow((c + 0.055) * (1.0 / 1.055), vec3(2.4));
  1875.  
  1876. 63 return mix(c1, c2, step(vec3(0.04045), c));
  1877.  
  1878. 64 }
  1879.  
  1880. 65 #endif
  1881.  
  1882. 66
  1883.  
  1884. 67 void main()
  1885.  
  1886. 68 {
  1887.  
  1888. 69 #ifdef HAIR_SHADER
  1889.  
  1890. 70 # ifdef V3D_SHADING_TEXTURE_COLOR
  1891.  
  1892. 71 vec2 uv = hair_get_customdata_vec2(u);
  1893.  
  1894. 72 # endif
  1895.  
  1896. 73 float time, thick_time, thickness;
  1897.  
  1898. 74 vec3 pos, tan, binor;
  1899.  
  1900. 75 hair_get_pos_tan_binor_time((ProjectionMatrix[3][3] == 0.0),
  1901.  
  1902. 76 ModelMatrixInverse,
  1903.  
  1904. 77 ViewMatrixInverse[3].xyz,
  1905.  
  1906. 78 ViewMatrixInverse[2].xyz,
  1907.  
  1908. 79 pos,
  1909.  
  1910. 80 tan,
  1911.  
  1912. 81 binor,
  1913.  
  1914. 82 time,
  1915.  
  1916. 83 thickness,
  1917.  
  1918. 84 thick_time);
  1919.  
  1920. 85 /* To "simulate" anisotropic shading, randomize hair normal per strand. */
  1921.  
  1922. 86 hair_rand = integer_noise(hair_get_strand_id());
  1923.  
  1924. 87 tan = normalize(tan);
  1925.  
  1926. 88 vec3 nor = normalize(cross(binor, tan));
  1927.  
  1928. 89 nor = normalize(mix(nor, -tan, hair_rand * 0.10));
  1929.  
  1930. 90 float cos_theta = (hair_rand * 2.0 - 1.0) * 0.20;
  1931.  
  1932. 91 float sin_theta = sqrt(max(0.0, 1.0f - cos_theta * cos_theta));
  1933.  
  1934. 92 nor = nor * sin_theta + binor * cos_theta;
  1935.  
  1936. 93 gl_Position = ViewProjectionMatrix * vec4(pos, 1.0);
  1937.  
  1938. 94 #else
  1939.  
  1940. 95 gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
  1941.  
  1942. 96 #endif
  1943.  
  1944. 97 #ifdef V3D_SHADING_TEXTURE_COLOR
  1945.  
  1946. 98 uv_interp = uv;
  1947.  
  1948. 99 #endif
  1949.  
  1950. 100
  1951.  
  1952. 101 #ifdef V3D_SHADING_VERTEX_COLOR
  1953.  
  1954. 102 # ifndef HAIR_SHADER
  1955.  
  1956. 103 vertexColor = srgb_to_linear_attr(c);
  1957.  
  1958. 104 # endif
  1959.  
  1960. 105 #endif
  1961.  
  1962. 106
  1963.  
  1964. 107 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
  1965.  
  1966. 108 normal_viewport = NormalMatrix * nor;
  1967.  
  1968. 109 # ifndef HAIR_SHADER
  1969.  
  1970. 110 normal_viewport = normalize(normal_viewport);
  1971.  
  1972. 111 # endif
  1973.  
  1974. 112 #endif
  1975.  
  1976. 113
  1977.  
  1978. 114 #ifdef USE_WORLD_CLIP_PLANES
  1979.  
  1980. 115 world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
  1981.  
  1982. 116 #endif
  1983.  
  1984. 117 }
  1985.  
  1986. Vertex shader failed to compile with the following errors:
  1987.  
  1988. GPUShader: compile error:
  1989. ===== shader string 1 ====
  1990. 1 #version 330
  1991. ===== shader string 2 ====
  1992. 2 #define GPU_VERTEX_SHADER
  1993. ===== shader string 3 ====
  1994. 3 #extension GL_ARB_texture_gather: enable
  1995. 4 #define GPU_ARB_texture_gather
  1996. 5 #extension GL_ARB_texture_query_lod: enable
  1997. ===== shader string 4 ====
  1998. 6 #define GPU_ATI
  1999. 7 #define OS_WIN
  2000. ===== shader string 5 ====
  2001. 8 #define V3D_SHADING_OBJECT_OUTLINE
  2002. 9 #define V3D_SHADING_SPECULAR_HIGHLIGHT
  2003. 10 #define V3D_LIGHTING_STUDIO
  2004. 11 #define OBJECT_ID_PASS_ENABLED
  2005. 12 #define MATDATA_PASS_ENABLED
  2006. 13 #define NORMAL_VIEWPORT_PASS_ENABLED
  2007. 14 #define WORKBENCH_ENCODE_NORMALS
  2008. ===== shader string 6 ====
  2009. 15 uniform mat4 ModelViewProjectionMatrix;
  2010.  
  2011. 16 uniform mat4 ModelMatrix;
  2012.  
  2013. 17 uniform mat4 ModelMatrixInverse;
  2014.  
  2015. 18 uniform mat4 ProjectionMatrix;
  2016.  
  2017. 19 uniform mat4 ViewProjectionMatrix;
  2018.  
  2019. 20 uniform mat4 ViewMatrixInverse;
  2020.  
  2021. 21 uniform mat3 NormalMatrix;
  2022.  
  2023. 22
  2024.  
  2025. 23 #ifndef HAIR_SHADER
  2026.  
  2027. 24 in vec3 pos;
  2028.  
  2029. 25 in vec3 nor;
  2030.  
  2031. 26 in vec2 u; /* active texture layer */
  2032.  
  2033. 27 # ifdef V3D_SHADING_VERTEX_COLOR
  2034.  
  2035. 28 in vec3 c; /* active color */
  2036.  
  2037. 29 # endif
  2038.  
  2039. 30 # define uv u
  2040.  
  2041. 31 #else /* HAIR_SHADER */
  2042.  
  2043. 32 # ifdef V3D_SHADING_TEXTURE_COLOR
  2044.  
  2045. 33 uniform samplerBuffer u; /* active texture layer */
  2046.  
  2047. 34 # endif
  2048.  
  2049. 35 flat out float hair_rand;
  2050.  
  2051. 36 #endif /* HAIR_SHADER */
  2052.  
  2053. 37
  2054.  
  2055. 38 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
  2056.  
  2057. 39 out vec3 normal_viewport;
  2058.  
  2059. 40 #endif
  2060.  
  2061. 41
  2062.  
  2063. 42 #ifdef V3D_SHADING_TEXTURE_COLOR
  2064.  
  2065. 43 out vec2 uv_interp;
  2066.  
  2067. 44 #endif
  2068.  
  2069. 45 #ifdef V3D_SHADING_VERTEX_COLOR
  2070.  
  2071. 46 out vec3 vertexColor;
  2072.  
  2073. 47 #endif
  2074.  
  2075. 48
  2076.  
  2077. 49 /* From http://libnoise.sourceforge.net/noisegen/index.html */
  2078.  
  2079. 50 float integer_noise(int n)
  2080.  
  2081. 51 {
  2082.  
  2083. 52 n = (n >> 13) ^ n;
  2084.  
  2085. 53 int nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;
  2086.  
  2087. 54 return (float(nn) / 1073741824.0);
  2088.  
  2089. 55 }
  2090.  
  2091. 56
  2092.  
  2093. 57 #ifdef V3D_SHADING_VERTEX_COLOR
  2094.  
  2095. 58 vec3 srgb_to_linear_attr(vec3 c)
  2096.  
  2097. 59 {
  2098.  
  2099. 60 c = max(c, vec3(0.0));
  2100.  
  2101. 61 vec3 c1 = c * (1.0 / 12.92);
  2102.  
  2103. 62 vec3 c2 = pow((c + 0.055) * (1.0 / 1.055), vec3(2.4));
  2104.  
  2105. 63 return mix(c1, c2, step(vec3(0.04045), c));
  2106.  
  2107. 64 }
  2108.  
  2109. 65 #endif
  2110.  
  2111. 66
  2112.  
  2113. 67 void main()
  2114.  
  2115. 68 {
  2116.  
  2117. 69 #ifdef HAIR_SHADER
  2118.  
  2119. 70 # ifdef V3D_SHADING_TEXTURE_COLOR
  2120.  
  2121. 71 vec2 uv = hair_get_customdata_vec2(u);
  2122.  
  2123. 72 # endif
  2124.  
  2125. 73 float time, thick_time, thickness;
  2126.  
  2127. 74 vec3 pos, tan, binor;
  2128.  
  2129. 75 hair_get_pos_tan_binor_time((ProjectionMatrix[3][3] == 0.0),
  2130.  
  2131. 76 ModelMatrixInverse,
  2132.  
  2133. 77 ViewMatrixInverse[3].xyz,
  2134.  
  2135. 78 ViewMatrixInverse[2].xyz,
  2136.  
  2137. 79 pos,
  2138.  
  2139. 80 tan,
  2140.  
  2141. 81 binor,
  2142.  
  2143. 82 time,
  2144.  
  2145. 83 thickness,
  2146.  
  2147. 84 thick_time);
  2148.  
  2149. 85 /* To "simulate" anisotropic shading, randomize hair normal per strand. */
  2150.  
  2151. 86 hair_rand = integer_noise(hair_get_strand_id());
  2152.  
  2153. 87 tan = normalize(tan);
  2154.  
  2155. 88 vec3 nor = normalize(cross(binor, tan));
  2156.  
  2157. 89 nor = normalize(mix(nor, -tan, hair_rand * 0.10));
  2158.  
  2159. 90 float cos_theta = (hair_rand * 2.0 - 1.0) * 0.20;
  2160.  
  2161. 91 float sin_theta = sqrt(max(0.0, 1.0f - cos_theta * cos_theta));
  2162.  
  2163. 92 nor = nor * sin_theta + binor * cos_theta;
  2164.  
  2165. 93 gl_Position = ViewProjectionMatrix * vec4(pos, 1.0);
  2166.  
  2167. 94 #else
  2168.  
  2169. 95 gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
  2170.  
  2171. 96 #endif
  2172.  
  2173. 97 #ifdef V3D_SHADING_TEXTURE_COLOR
  2174.  
  2175. 98 uv_interp = uv;
  2176.  
  2177. 99 #endif
  2178.  
  2179. 100
  2180.  
  2181. 101 #ifdef V3D_SHADING_VERTEX_COLOR
  2182.  
  2183. 102 # ifndef HAIR_SHADER
  2184.  
  2185. 103 vertexColor = srgb_to_linear_attr(c);
  2186.  
  2187. 104 # endif
  2188.  
  2189. 105 #endif
  2190.  
  2191. 106
  2192.  
  2193. 107 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
  2194.  
  2195. 108 normal_viewport = NormalMatrix * nor;
  2196.  
  2197. 109 # ifndef HAIR_SHADER
  2198.  
  2199. 110 normal_viewport = normalize(normal_viewport);
  2200.  
  2201. 111 # endif
  2202.  
  2203. 112 #endif
  2204.  
  2205. 113
  2206.  
  2207. 114 #ifdef USE_WORLD_CLIP_PLANES
  2208.  
  2209. 115 world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
  2210.  
  2211. 116 #endif
  2212.  
  2213. 117 }
  2214.  
  2215. Vertex shader failed to compile with the following errors:
  2216.  
  2217. GPUShader: compile error:
  2218. ===== shader string 1 ====
  2219. 1 #version 330
  2220. ===== shader string 2 ====
  2221. 2 #define GPU_VERTEX_SHADER
  2222. ===== shader string 3 ====
  2223. 3 #extension GL_ARB_texture_gather: enable
  2224. 4 #define GPU_ARB_texture_gather
  2225. 5 #extension GL_ARB_texture_query_lod: enable
  2226. ===== shader string 4 ====
  2227. 6 #define GPU_ATI
  2228. 7 #define OS_WIN
  2229. ===== shader string 5 ====
  2230. 8 #define V3D_SHADING_OBJECT_OUTLINE
  2231. 9 #define V3D_SHADING_SPECULAR_HIGHLIGHT
  2232. 10 #define V3D_LIGHTING_STUDIO
  2233. 11 #define OBJECT_ID_PASS_ENABLED
  2234. 12 #define MATDATA_PASS_ENABLED
  2235. 13 #define NORMAL_VIEWPORT_PASS_ENABLED
  2236. 14 #define WORKBENCH_ENCODE_NORMALS
  2237. 15 #define HAIR_SHADER
  2238. ===== shader string 6 ====
  2239. 16 /**
  2240.  
  2241. 17 * Library to create hairs dynamically from control points.
  2242.  
  2243. 18 * This is less bandwidth intensive than fetching the vertex attributes
  2244.  
  2245. 19 * but does more ALU work per vertex. This also reduce the number
  2246.  
  2247. 20 * of data the CPU has to precompute and transfert for each update.
  2248.  
  2249. 21 */
  2250.  
  2251. 22
  2252.  
  2253. 23 /**
  2254.  
  2255. 24 * hairStrandsRes: Number of points per hair strand.
  2256.  
  2257. 25 * 2 - no subdivision
  2258.  
  2259. 26 * 3+ - 1 or more interpolated points per hair.
  2260.  
  2261. 27 */
  2262.  
  2263. 28 uniform int hairStrandsRes = 8;
  2264.  
  2265. 29
  2266.  
  2267. 30 /**
  2268.  
  2269. 31 * hairThicknessRes : Subdiv around the hair.
  2270.  
  2271. 32 * 1 - Wire Hair: Only one pixel thick, independent of view distance.
  2272.  
  2273. 33 * 2 - Polystrip Hair: Correct width, flat if camera is parallel.
  2274.  
  2275. 34 * 3+ - Cylinder Hair: Massive calculation but potentially perfect. Still need proper support.
  2276.  
  2277. 35 */
  2278.  
  2279. 36 uniform int hairThicknessRes = 1;
  2280.  
  2281. 37
  2282.  
  2283. 38 /* Hair thickness shape. */
  2284.  
  2285. 39 uniform float hairRadRoot = 0.01;
  2286.  
  2287. 40 uniform float hairRadTip = 0.0;
  2288.  
  2289. 41 uniform float hairRadShape = 0.5;
  2290.  
  2291. 42 uniform bool hairCloseTip = true;
  2292.  
  2293. 43
  2294.  
  2295. 44 uniform mat4 hairDupliMatrix;
  2296.  
  2297. 45
  2298.  
  2299. 46 /* -- Per control points -- */
  2300.  
  2301. 47 uniform samplerBuffer hairPointBuffer; /* RGBA32F */
  2302.  
  2303. 48 #define point_position xyz
  2304.  
  2305. 49 #define point_time w /* Position along the hair length */
  2306.  
  2307. 50
  2308.  
  2309. 51 /* -- Per strands data -- */
  2310.  
  2311. 52 uniform usamplerBuffer hairStrandBuffer; /* R32UI */
  2312.  
  2313. 53 uniform usamplerBuffer hairStrandSegBuffer; /* R16UI */
  2314.  
  2315. 54
  2316.  
  2317. 55 /* Not used, use one buffer per uv layer */
  2318.  
  2319. 56 //uniform samplerBuffer hairUVBuffer; /* RG32F */
  2320.  
  2321. 57 //uniform samplerBuffer hairColBuffer; /* RGBA16 linear color */
  2322.  
  2323. 58
  2324.  
  2325. 59 /* -- Subdivision stage -- */
  2326.  
  2327. 60 /**
  2328.  
  2329. 61 * We use a transform feedback to preprocess the strands and add more subdivision to it.
  2330.  
  2331. 62 * For the moment theses are simple smooth interpolation but one could hope to see the full
  2332.  
  2333. 63 * children particle modifiers being evaluated at this stage.
  2334.  
  2335. 64 *
  2336.  
  2337. 65 * If no more subdivision is needed, we can skip this step.
  2338.  
  2339. 66 */
  2340.  
  2341. 67
  2342.  
  2343. 68 #ifdef HAIR_PHASE_SUBDIV
  2344.  
  2345. 69 int hair_get_base_id(float local_time, int strand_segments, out float interp_time)
  2346.  
  2347. 70 {
  2348.  
  2349. 71 float time_per_strand_seg = 1.0 / float(strand_segments);
  2350.  
  2351. 72
  2352.  
  2353. 73 float ratio = local_time / time_per_strand_seg;
  2354.  
  2355. 74 interp_time = fract(ratio);
  2356.  
  2357. 75
  2358.  
  2359. 76 return int(ratio);
  2360.  
  2361. 77 }
  2362.  
  2363. 78
  2364.  
  2365. 79 void hair_get_interp_attrs(
  2366.  
  2367. 80 out vec4 data0, out vec4 data1, out vec4 data2, out vec4 data3, out float interp_time)
  2368.  
  2369. 81 {
  2370.  
  2371. 82 float local_time = float(gl_VertexID % hairStrandsRes) / float(hairStrandsRes - 1);
  2372.  
  2373. 83
  2374.  
  2375. 84 int hair_id = gl_VertexID / hairStrandsRes;
  2376.  
  2377. 85 int strand_offset = int(texelFetch(hairStrandBuffer, hair_id).x);
  2378.  
  2379. 86 int strand_segments = int(texelFetch(hairStrandSegBuffer, hair_id).x);
  2380.  
  2381. 87
  2382.  
  2383. 88 int id = hair_get_base_id(local_time, strand_segments, interp_time);
  2384.  
  2385. 89
  2386.  
  2387. 90 int ofs_id = id + strand_offset;
  2388.  
  2389. 91
  2390.  
  2391. 92 data0 = texelFetch(hairPointBuffer, ofs_id - 1);
  2392.  
  2393. 93 data1 = texelFetch(hairPointBuffer, ofs_id);
  2394.  
  2395. 94 data2 = texelFetch(hairPointBuffer, ofs_id + 1);
  2396.  
  2397. 95 data3 = texelFetch(hairPointBuffer, ofs_id + 2);
  2398.  
  2399. 96
  2400.  
  2401. 97 if (id <= 0) {
  2402.  
  2403. 98 /* root points. Need to reconstruct previous data. */
  2404.  
  2405. 99 data0 = data1 * 2.0 - data2;
  2406.  
  2407. 100 }
  2408.  
  2409. 101 if (id + 1 >= strand_segments) {
  2410.  
  2411. 102 /* tip points. Need to reconstruct next data. */
  2412.  
  2413. 103 data3 = data2 * 2.0 - data1;
  2414.  
  2415. 104 }
  2416.  
  2417. 105 }
  2418.  
  2419. 106 #endif
  2420.  
  2421. 107
  2422.  
  2423. 108 /* -- Drawing stage -- */
  2424.  
  2425. 109 /**
  2426.  
  2427. 110 * For final drawing, the vertex index and the number of vertex per segment
  2428.  
  2429. 111 */
  2430.  
  2431. 112
  2432.  
  2433. 113 #ifndef HAIR_PHASE_SUBDIV
  2434.  
  2435. 114 int hair_get_strand_id(void)
  2436.  
  2437. 115 {
  2438.  
  2439. 116 return gl_VertexID / (hairStrandsRes * hairThicknessRes);
  2440.  
  2441. 117 }
  2442.  
  2443. 118
  2444.  
  2445. 119 int hair_get_base_id(void)
  2446.  
  2447. 120 {
  2448.  
  2449. 121 return gl_VertexID / hairThicknessRes;
  2450.  
  2451. 122 }
  2452.  
  2453. 123
  2454.  
  2455. 124 /* Copied from cycles. */
  2456.  
  2457. 125 float hair_shaperadius(float shape, float root, float tip, float time)
  2458.  
  2459. 126 {
  2460.  
  2461. 127 float radius = 1.0 - time;
  2462.  
  2463. 128
  2464.  
  2465. 129 if (shape < 0.0) {
  2466.  
  2467. 130 radius = pow(radius, 1.0 + shape);
  2468.  
  2469. 131 }
  2470.  
  2471. 132 else {
  2472.  
  2473. 133 radius = pow(radius, 1.0 / (1.0 - shape));
  2474.  
  2475. 134 }
  2476.  
  2477. 135
  2478.  
  2479. 136 if (hairCloseTip && (time > 0.99)) {
  2480.  
  2481. 137 return 0.0;
  2482.  
  2483. 138 }
  2484.  
  2485. 139
  2486.  
  2487. 140 return (radius * (root - tip)) + tip;
  2488.  
  2489. 141 }
  2490.  
  2491. 142
  2492.  
  2493. 143 # ifdef OS_MAC
  2494.  
  2495. 144 in float dummy;
  2496.  
  2497. 145 # endif
  2498.  
  2499. 146
  2500.  
  2501. 147 void hair_get_pos_tan_binor_time(bool is_persp,
  2502.  
  2503. 148 mat4 invmodel_mat,
  2504.  
  2505. 149 vec3 camera_pos,
  2506.  
  2507. 150 vec3 camera_z,
  2508.  
  2509. 151 out vec3 wpos,
  2510.  
  2511. 152 out vec3 wtan,
  2512.  
  2513. 153 out vec3 wbinor,
  2514.  
  2515. 154 out float time,
  2516.  
  2517. 155 out float thickness,
  2518.  
  2519. 156 out float thick_time)
  2520.  
  2521. 157 {
  2522.  
  2523. 158 int id = hair_get_base_id();
  2524.  
  2525. 159 vec4 data = texelFetch(hairPointBuffer, id);
  2526.  
  2527. 160 wpos = data.point_position;
  2528.  
  2529. 161 time = data.point_time;
  2530.  
  2531. 162
  2532.  
  2533. 163 # ifdef OS_MAC
  2534.  
  2535. 164 /* Generate a dummy read to avoid the driver bug with shaders having no
  2536.  
  2537. 165 * vertex reads on macOS (T60171) */
  2538.  
  2539. 166 wpos.y += dummy * 0.0;
  2540.  
  2541. 167 # endif
  2542.  
  2543. 168
  2544.  
  2545. 169 if (time == 0.0) {
  2546.  
  2547. 170 /* Hair root */
  2548.  
  2549. 171 wtan = texelFetch(hairPointBuffer, id + 1).point_position - wpos;
  2550.  
  2551. 172 }
  2552.  
  2553. 173 else {
  2554.  
  2555. 174 wtan = wpos - texelFetch(hairPointBuffer, id - 1).point_position;
  2556.  
  2557. 175 }
  2558.  
  2559. 176
  2560.  
  2561. 177 wpos = (hairDupliMatrix * vec4(wpos, 1.0)).xyz;
  2562.  
  2563. 178 wtan = mat3(hairDupliMatrix) * wtan;
  2564.  
  2565. 179
  2566.  
  2567. 180 vec3 camera_vec = (is_persp) ? wpos - camera_pos : -camera_z;
  2568.  
  2569. 181 wbinor = normalize(cross(camera_vec, wtan));
  2570.  
  2571. 182
  2572.  
  2573. 183 thickness = hair_shaperadius(hairRadShape, hairRadRoot, hairRadTip, time);
  2574.  
  2575. 184
  2576.  
  2577. 185 if (hairThicknessRes > 1) {
  2578.  
  2579. 186 thick_time = float(gl_VertexID % hairThicknessRes) / float(hairThicknessRes - 1);
  2580.  
  2581. 187 thick_time = thickness * (thick_time * 2.0 - 1.0);
  2582.  
  2583. 188
  2584.  
  2585. 189 /* Take object scale into account.
  2586.  
  2587. 190 * NOTE: This only works fine with uniform scaling. */
  2588.  
  2589. 191 float scale = 1.0 / length(mat3(invmodel_mat) * wbinor);
  2590.  
  2591. 192
  2592.  
  2593. 193 wpos += wbinor * thick_time * scale;
  2594.  
  2595. 194 }
  2596.  
  2597. 195 }
  2598.  
  2599. 196
  2600.  
  2601. 197 vec2 hair_get_customdata_vec2(const samplerBuffer cd_buf)
  2602.  
  2603. 198 {
  2604.  
  2605. 199 int id = hair_get_strand_id();
  2606.  
  2607. 200 return texelFetch(cd_buf, id).rg;
  2608.  
  2609. 201 }
  2610.  
  2611. 202
  2612.  
  2613. 203 vec3 hair_get_customdata_vec3(const samplerBuffer cd_buf)
  2614.  
  2615. 204 {
  2616.  
  2617. 205 int id = hair_get_strand_id();
  2618.  
  2619. 206 return texelFetch(cd_buf, id).rgb;
  2620.  
  2621. 207 }
  2622.  
  2623. 208
  2624.  
  2625. 209 vec4 hair_get_customdata_vec4(const samplerBuffer cd_buf)
  2626.  
  2627. 210 {
  2628.  
  2629. 211 int id = hair_get_strand_id();
  2630.  
  2631. 212 return texelFetch(cd_buf, id).rgba;
  2632.  
  2633. 213 }
  2634.  
  2635. 214
  2636.  
  2637. 215 vec3 hair_get_strand_pos(void)
  2638.  
  2639. 216 {
  2640.  
  2641. 217 int id = hair_get_strand_id() * hairStrandsRes;
  2642.  
  2643. 218 return texelFetch(hairPointBuffer, id).point_position;
  2644.  
  2645. 219 }
  2646.  
  2647. 220
  2648.  
  2649. 221 #endif
  2650.  
  2651. 222 uniform mat4 ModelViewProjectionMatrix;
  2652.  
  2653. 223 uniform mat4 ModelMatrix;
  2654.  
  2655. 224 uniform mat4 ModelMatrixInverse;
  2656.  
  2657. 225 uniform mat4 ProjectionMatrix;
  2658.  
  2659. 226 uniform mat4 ViewProjectionMatrix;
  2660.  
  2661. 227 uniform mat4 ViewMatrixInverse;
  2662.  
  2663. 228 uniform mat3 NormalMatrix;
  2664.  
  2665. 229
  2666.  
  2667. 230 #ifndef HAIR_SHADER
  2668.  
  2669. 231 in vec3 pos;
  2670.  
  2671. 232 in vec3 nor;
  2672.  
  2673. 233 in vec2 u; /* active texture layer */
  2674.  
  2675. 234 # ifdef V3D_SHADING_VERTEX_COLOR
  2676.  
  2677. 235 in vec3 c; /* active color */
  2678.  
  2679. 236 # endif
  2680.  
  2681. 237 # define uv u
  2682.  
  2683. 238 #else /* HAIR_SHADER */
  2684.  
  2685. 239 # ifdef V3D_SHADING_TEXTURE_COLOR
  2686.  
  2687. 240 uniform samplerBuffer u; /* active texture layer */
  2688.  
  2689. 241 # endif
  2690.  
  2691. 242 flat out float hair_rand;
  2692.  
  2693. 243 #endif /* HAIR_SHADER */
  2694.  
  2695. 244
  2696.  
  2697. 245 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
  2698.  
  2699. 246 out vec3 normal_viewport;
  2700.  
  2701. 247 #endif
  2702.  
  2703. 248
  2704.  
  2705. 249 #ifdef V3D_SHADING_TEXTURE_COLOR
  2706.  
  2707. 250 out vec2 uv_interp;
  2708.  
  2709. 251 #endif
  2710.  
  2711. 252 #ifdef V3D_SHADING_VERTEX_COLOR
  2712.  
  2713. 253 out vec3 vertexColor;
  2714.  
  2715. 254 #endif
  2716.  
  2717. 255
  2718.  
  2719. 256 /* From http://libnoise.sourceforge.net/noisegen/index.html */
  2720.  
  2721. 257 float integer_noise(int n)
  2722.  
  2723. 258 {
  2724.  
  2725. 259 n = (n >> 13) ^ n;
  2726.  
  2727. 260 int nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;
  2728.  
  2729. 261 return (float(nn) / 1073741824.0);
  2730.  
  2731. 262 }
  2732.  
  2733. 263
  2734.  
  2735. 264 #ifdef V3D_SHADING_VERTEX_COLOR
  2736.  
  2737. 265 vec3 srgb_to_linear_attr(vec3 c)
  2738.  
  2739. 266 {
  2740.  
  2741. 267 c = max(c, vec3(0.0));
  2742.  
  2743. 268 vec3 c1 = c * (1.0 / 12.92);
  2744.  
  2745. 269 vec3 c2 = pow((c + 0.055) * (1.0 / 1.055), vec3(2.4));
  2746.  
  2747. 270 return mix(c1, c2, step(vec3(0.04045), c));
  2748.  
  2749. 271 }
  2750.  
  2751. 272 #endif
  2752.  
  2753. 273
  2754.  
  2755. 274 void main()
  2756.  
  2757. 275 {
  2758.  
  2759. 276 #ifdef HAIR_SHADER
  2760.  
  2761. 277 # ifdef V3D_SHADING_TEXTURE_COLOR
  2762.  
  2763. 278 vec2 uv = hair_get_customdata_vec2(u);
  2764.  
  2765. 279 # endif
  2766.  
  2767. 280 float time, thick_time, thickness;
  2768.  
  2769. 281 vec3 pos, tan, binor;
  2770.  
  2771. 282 hair_get_pos_tan_binor_time((ProjectionMatrix[3][3] == 0.0),
  2772.  
  2773. 283 ModelMatrixInverse,
  2774.  
  2775. 284 ViewMatrixInverse[3].xyz,
  2776.  
  2777. 285 ViewMatrixInverse[2].xyz,
  2778.  
  2779. 286 pos,
  2780.  
  2781. 287 tan,
  2782.  
  2783. 288 binor,
  2784.  
  2785. 289 time,
  2786.  
  2787. 290 thickness,
  2788.  
  2789. 291 thick_time);
  2790.  
  2791. 292 /* To "simulate" anisotropic shading, randomize hair normal per strand. */
  2792.  
  2793. 293 hair_rand = integer_noise(hair_get_strand_id());
  2794.  
  2795. 294 tan = normalize(tan);
  2796.  
  2797. 295 vec3 nor = normalize(cross(binor, tan));
  2798.  
  2799. 296 nor = normalize(mix(nor, -tan, hair_rand * 0.10));
  2800.  
  2801. 297 float cos_theta = (hair_rand * 2.0 - 1.0) * 0.20;
  2802.  
  2803. 298 float sin_theta = sqrt(max(0.0, 1.0f - cos_theta * cos_theta));
  2804.  
  2805. 299 nor = nor * sin_theta + binor * cos_theta;
  2806.  
  2807. 300 gl_Position = ViewProjectionMatrix * vec4(pos, 1.0);
  2808.  
  2809. 301 #else
  2810.  
  2811. 302 gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
  2812.  
  2813. 303 #endif
  2814.  
  2815. 304 #ifdef V3D_SHADING_TEXTURE_COLOR
  2816.  
  2817. 305 uv_interp = uv;
  2818.  
  2819. 306 #endif
  2820.  
  2821. 307
  2822.  
  2823. 308 #ifdef V3D_SHADING_VERTEX_COLOR
  2824.  
  2825. 309 # ifndef HAIR_SHADER
  2826.  
  2827. 310 vertexColor = srgb_to_linear_attr(c);
  2828.  
  2829. 311 # endif
  2830.  
  2831. 312 #endif
  2832.  
  2833. 313
  2834.  
  2835. 314 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
  2836.  
  2837. 315 normal_viewport = NormalMatrix * nor;
  2838.  
  2839. 316 # ifndef HAIR_SHADER
  2840.  
  2841. 317 normal_viewport = normalize(normal_viewport);
  2842.  
  2843. 318 # endif
  2844.  
  2845. 319 #endif
  2846.  
  2847. 320
  2848.  
  2849. 321 #ifdef USE_WORLD_CLIP_PLANES
  2850.  
  2851. 322 world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
  2852.  
  2853. 323 #endif
  2854.  
  2855. 324 }
  2856.  
  2857. Vertex shader failed to compile with the following errors:
  2858.  
  2859. GPUShader: compile error:
  2860. ===== shader string 1 ====
  2861. 1 #version 330
  2862. ===== shader string 2 ====
  2863. 2 #define GPU_VERTEX_SHADER
  2864. ===== shader string 3 ====
  2865. 3 #extension GL_ARB_texture_gather: enable
  2866. 4 #define GPU_ARB_texture_gather
  2867. 5 #extension GL_ARB_texture_query_lod: enable
  2868. ===== shader string 4 ====
  2869. 6 #define GPU_ATI
  2870. 7 #define OS_WIN
  2871. ===== shader string 5 ====
  2872. 8 #define V3D_SHADING_OBJECT_OUTLINE
  2873. 9 #define V3D_SHADING_SPECULAR_HIGHLIGHT
  2874. 10 #define V3D_LIGHTING_STUDIO
  2875. 11 #define OBJECT_ID_PASS_ENABLED
  2876. 12 #define MATDATA_PASS_ENABLED
  2877. 13 #define NORMAL_VIEWPORT_PASS_ENABLED
  2878. 14 #define WORKBENCH_ENCODE_NORMALS
  2879. ===== shader string 6 ====
  2880. 15 uniform mat4 ModelViewProjectionMatrix;
  2881.  
  2882. 16 uniform mat4 ModelMatrix;
  2883.  
  2884. 17 uniform mat4 ModelMatrixInverse;
  2885.  
  2886. 18 uniform mat4 ProjectionMatrix;
  2887.  
  2888. 19 uniform mat4 ViewProjectionMatrix;
  2889.  
  2890. 20 uniform mat4 ViewMatrixInverse;
  2891.  
  2892. 21 uniform mat3 NormalMatrix;
  2893.  
  2894. 22
  2895.  
  2896. 23 #ifndef HAIR_SHADER
  2897.  
  2898. 24 in vec3 pos;
  2899.  
  2900. 25 in vec3 nor;
  2901.  
  2902. 26 in vec2 u; /* active texture layer */
  2903.  
  2904. 27 # ifdef V3D_SHADING_VERTEX_COLOR
  2905.  
  2906. 28 in vec3 c; /* active color */
  2907.  
  2908. 29 # endif
  2909.  
  2910. 30 # define uv u
  2911.  
  2912. 31 #else /* HAIR_SHADER */
  2913.  
  2914. 32 # ifdef V3D_SHADING_TEXTURE_COLOR
  2915.  
  2916. 33 uniform samplerBuffer u; /* active texture layer */
  2917.  
  2918. 34 # endif
  2919.  
  2920. 35 flat out float hair_rand;
  2921.  
  2922. 36 #endif /* HAIR_SHADER */
  2923.  
  2924. 37
  2925.  
  2926. 38 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
  2927.  
  2928. 39 out vec3 normal_viewport;
  2929.  
  2930. 40 #endif
  2931.  
  2932. 41
  2933.  
  2934. 42 #ifdef V3D_SHADING_TEXTURE_COLOR
  2935.  
  2936. 43 out vec2 uv_interp;
  2937.  
  2938. 44 #endif
  2939.  
  2940. 45 #ifdef V3D_SHADING_VERTEX_COLOR
  2941.  
  2942. 46 out vec3 vertexColor;
  2943.  
  2944. 47 #endif
  2945.  
  2946. 48
  2947.  
  2948. 49 /* From http://libnoise.sourceforge.net/noisegen/index.html */
  2949.  
  2950. 50 float integer_noise(int n)
  2951.  
  2952. 51 {
  2953.  
  2954. 52 n = (n >> 13) ^ n;
  2955.  
  2956. 53 int nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;
  2957.  
  2958. 54 return (float(nn) / 1073741824.0);
  2959.  
  2960. 55 }
  2961.  
  2962. 56
  2963.  
  2964. 57 #ifdef V3D_SHADING_VERTEX_COLOR
  2965.  
  2966. 58 vec3 srgb_to_linear_attr(vec3 c)
  2967.  
  2968. 59 {
  2969.  
  2970. 60 c = max(c, vec3(0.0));
  2971.  
  2972. 61 vec3 c1 = c * (1.0 / 12.92);
  2973.  
  2974. 62 vec3 c2 = pow((c + 0.055) * (1.0 / 1.055), vec3(2.4));
  2975.  
  2976. 63 return mix(c1, c2, step(vec3(0.04045), c));
  2977.  
  2978. 64 }
  2979.  
  2980. 65 #endif
  2981.  
  2982. 66
  2983.  
  2984. 67 void main()
  2985.  
  2986. 68 {
  2987.  
  2988. 69 #ifdef HAIR_SHADER
  2989.  
  2990. 70 # ifdef V3D_SHADING_TEXTURE_COLOR
  2991.  
  2992. 71 vec2 uv = hair_get_customdata_vec2(u);
  2993.  
  2994. 72 # endif
  2995.  
  2996. 73 float time, thick_time, thickness;
  2997.  
  2998. 74 vec3 pos, tan, binor;
  2999.  
  3000. 75 hair_get_pos_tan_binor_time((ProjectionMatrix[3][3] == 0.0),
  3001.  
  3002. 76 ModelMatrixInverse,
  3003.  
  3004. 77 ViewMatrixInverse[3].xyz,
  3005.  
  3006. 78 ViewMatrixInverse[2].xyz,
  3007.  
  3008. 79 pos,
  3009.  
  3010. 80 tan,
  3011.  
  3012. 81 binor,
  3013.  
  3014. 82 time,
  3015.  
  3016. 83 thickness,
  3017.  
  3018. 84 thick_time);
  3019.  
  3020. 85 /* To "simulate" anisotropic shading, randomize hair normal per strand. */
  3021.  
  3022. 86 hair_rand = integer_noise(hair_get_strand_id());
  3023.  
  3024. 87 tan = normalize(tan);
  3025.  
  3026. 88 vec3 nor = normalize(cross(binor, tan));
  3027.  
  3028. 89 nor = normalize(mix(nor, -tan, hair_rand * 0.10));
  3029.  
  3030. 90 float cos_theta = (hair_rand * 2.0 - 1.0) * 0.20;
  3031.  
  3032. 91 float sin_theta = sqrt(max(0.0, 1.0f - cos_theta * cos_theta));
  3033.  
  3034. 92 nor = nor * sin_theta + binor * cos_theta;
  3035.  
  3036. 93 gl_Position = ViewProjectionMatrix * vec4(pos, 1.0);
  3037.  
  3038. 94 #else
  3039.  
  3040. 95 gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
  3041.  
  3042. 96 #endif
  3043.  
  3044. 97 #ifdef V3D_SHADING_TEXTURE_COLOR
  3045.  
  3046. 98 uv_interp = uv;
  3047.  
  3048. 99 #endif
  3049.  
  3050. 100
  3051.  
  3052. 101 #ifdef V3D_SHADING_VERTEX_COLOR
  3053.  
  3054. 102 # ifndef HAIR_SHADER
  3055.  
  3056. 103 vertexColor = srgb_to_linear_attr(c);
  3057.  
  3058. 104 # endif
  3059.  
  3060. 105 #endif
  3061.  
  3062. 106
  3063.  
  3064. 107 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
  3065.  
  3066. 108 normal_viewport = NormalMatrix * nor;
  3067.  
  3068. 109 # ifndef HAIR_SHADER
  3069.  
  3070. 110 normal_viewport = normalize(normal_viewport);
  3071.  
  3072. 111 # endif
  3073.  
  3074. 112 #endif
  3075.  
  3076. 113
  3077.  
  3078. 114 #ifdef USE_WORLD_CLIP_PLANES
  3079.  
  3080. 115 world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
  3081.  
  3082. 116 #endif
  3083.  
  3084. 117 }
  3085.  
  3086. Vertex shader failed to compile with the following errors:
  3087.  
  3088. GPUShader: compile error:
  3089. ===== shader string 1 ====
  3090. 1 #version 330
  3091. ===== shader string 2 ====
  3092. 2 #define GPU_VERTEX_SHADER
  3093. ===== shader string 3 ====
  3094. 3 #extension GL_ARB_texture_gather: enable
  3095. 4 #define GPU_ARB_texture_gather
  3096. 5 #extension GL_ARB_texture_query_lod: enable
  3097. ===== shader string 4 ====
  3098. 6 #define GPU_ATI
  3099. 7 #define OS_WIN
  3100. ===== shader string 5 ====
  3101. 8 #define V3D_SHADING_OBJECT_OUTLINE
  3102. 9 #define V3D_SHADING_SPECULAR_HIGHLIGHT
  3103. 10 #define V3D_LIGHTING_STUDIO
  3104. 11 #define OBJECT_ID_PASS_ENABLED
  3105. 12 #define MATDATA_PASS_ENABLED
  3106. 13 #define NORMAL_VIEWPORT_PASS_ENABLED
  3107. 14 #define WORKBENCH_ENCODE_NORMALS
  3108. 15 #define HAIR_SHADER
  3109. ===== shader string 6 ====
  3110. 16 /**
  3111.  
  3112. 17 * Library to create hairs dynamically from control points.
  3113.  
  3114. 18 * This is less bandwidth intensive than fetching the vertex attributes
  3115.  
  3116. 19 * but does more ALU work per vertex. This also reduce the number
  3117.  
  3118. 20 * of data the CPU has to precompute and transfert for each update.
  3119.  
  3120. 21 */
  3121.  
  3122. 22
  3123.  
  3124. 23 /**
  3125.  
  3126. 24 * hairStrandsRes: Number of points per hair strand.
  3127.  
  3128. 25 * 2 - no subdivision
  3129.  
  3130. 26 * 3+ - 1 or more interpolated points per hair.
  3131.  
  3132. 27 */
  3133.  
  3134. 28 uniform int hairStrandsRes = 8;
  3135.  
  3136. 29
  3137.  
  3138. 30 /**
  3139.  
  3140. 31 * hairThicknessRes : Subdiv around the hair.
  3141.  
  3142. 32 * 1 - Wire Hair: Only one pixel thick, independent of view distance.
  3143.  
  3144. 33 * 2 - Polystrip Hair: Correct width, flat if camera is parallel.
  3145.  
  3146. 34 * 3+ - Cylinder Hair: Massive calculation but potentially perfect. Still need proper support.
  3147.  
  3148. 35 */
  3149.  
  3150. 36 uniform int hairThicknessRes = 1;
  3151.  
  3152. 37
  3153.  
  3154. 38 /* Hair thickness shape. */
  3155.  
  3156. 39 uniform float hairRadRoot = 0.01;
  3157.  
  3158. 40 uniform float hairRadTip = 0.0;
  3159.  
  3160. 41 uniform float hairRadShape = 0.5;
  3161.  
  3162. 42 uniform bool hairCloseTip = true;
  3163.  
  3164. 43
  3165.  
  3166. 44 uniform mat4 hairDupliMatrix;
  3167.  
  3168. 45
  3169.  
  3170. 46 /* -- Per control points -- */
  3171.  
  3172. 47 uniform samplerBuffer hairPointBuffer; /* RGBA32F */
  3173.  
  3174. 48 #define point_position xyz
  3175.  
  3176. 49 #define point_time w /* Position along the hair length */
  3177.  
  3178. 50
  3179.  
  3180. 51 /* -- Per strands data -- */
  3181.  
  3182. 52 uniform usamplerBuffer hairStrandBuffer; /* R32UI */
  3183.  
  3184. 53 uniform usamplerBuffer hairStrandSegBuffer; /* R16UI */
  3185.  
  3186. 54
  3187.  
  3188. 55 /* Not used, use one buffer per uv layer */
  3189.  
  3190. 56 //uniform samplerBuffer hairUVBuffer; /* RG32F */
  3191.  
  3192. 57 //uniform samplerBuffer hairColBuffer; /* RGBA16 linear color */
  3193.  
  3194. 58
  3195.  
  3196. 59 /* -- Subdivision stage -- */
  3197.  
  3198. 60 /**
  3199.  
  3200. 61 * We use a transform feedback to preprocess the strands and add more subdivision to it.
  3201.  
  3202. 62 * For the moment theses are simple smooth interpolation but one could hope to see the full
  3203.  
  3204. 63 * children particle modifiers being evaluated at this stage.
  3205.  
  3206. 64 *
  3207.  
  3208. 65 * If no more subdivision is needed, we can skip this step.
  3209.  
  3210. 66 */
  3211.  
  3212. 67
  3213.  
  3214. 68 #ifdef HAIR_PHASE_SUBDIV
  3215.  
  3216. 69 int hair_get_base_id(float local_time, int strand_segments, out float interp_time)
  3217.  
  3218. 70 {
  3219.  
  3220. 71 float time_per_strand_seg = 1.0 / float(strand_segments);
  3221.  
  3222. 72
  3223.  
  3224. 73 float ratio = local_time / time_per_strand_seg;
  3225.  
  3226. 74 interp_time = fract(ratio);
  3227.  
  3228. 75
  3229.  
  3230. 76 return int(ratio);
  3231.  
  3232. 77 }
  3233.  
  3234. 78
  3235.  
  3236. 79 void hair_get_interp_attrs(
  3237.  
  3238. 80 out vec4 data0, out vec4 data1, out vec4 data2, out vec4 data3, out float interp_time)
  3239.  
  3240. 81 {
  3241.  
  3242. 82 float local_time = float(gl_VertexID % hairStrandsRes) / float(hairStrandsRes - 1);
  3243.  
  3244. 83
  3245.  
  3246. 84 int hair_id = gl_VertexID / hairStrandsRes;
  3247.  
  3248. 85 int strand_offset = int(texelFetch(hairStrandBuffer, hair_id).x);
  3249.  
  3250. 86 int strand_segments = int(texelFetch(hairStrandSegBuffer, hair_id).x);
  3251.  
  3252. 87
  3253.  
  3254. 88 int id = hair_get_base_id(local_time, strand_segments, interp_time);
  3255.  
  3256. 89
  3257.  
  3258. 90 int ofs_id = id + strand_offset;
  3259.  
  3260. 91
  3261.  
  3262. 92 data0 = texelFetch(hairPointBuffer, ofs_id - 1);
  3263.  
  3264. 93 data1 = texelFetch(hairPointBuffer, ofs_id);
  3265.  
  3266. 94 data2 = texelFetch(hairPointBuffer, ofs_id + 1);
  3267.  
  3268. 95 data3 = texelFetch(hairPointBuffer, ofs_id + 2);
  3269.  
  3270. 96
  3271.  
  3272. 97 if (id <= 0) {
  3273.  
  3274. 98 /* root points. Need to reconstruct previous data. */
  3275.  
  3276. 99 data0 = data1 * 2.0 - data2;
  3277.  
  3278. 100 }
  3279.  
  3280. 101 if (id + 1 >= strand_segments) {
  3281.  
  3282. 102 /* tip points. Need to reconstruct next data. */
  3283.  
  3284. 103 data3 = data2 * 2.0 - data1;
  3285.  
  3286. 104 }
  3287.  
  3288. 105 }
  3289.  
  3290. 106 #endif
  3291.  
  3292. 107
  3293.  
  3294. 108 /* -- Drawing stage -- */
  3295.  
  3296. 109 /**
  3297.  
  3298. 110 * For final drawing, the vertex index and the number of vertex per segment
  3299.  
  3300. 111 */
  3301.  
  3302. 112
  3303.  
  3304. 113 #ifndef HAIR_PHASE_SUBDIV
  3305.  
  3306. 114 int hair_get_strand_id(void)
  3307.  
  3308. 115 {
  3309.  
  3310. 116 return gl_VertexID / (hairStrandsRes * hairThicknessRes);
  3311.  
  3312. 117 }
  3313.  
  3314. 118
  3315.  
  3316. 119 int hair_get_base_id(void)
  3317.  
  3318. 120 {
  3319.  
  3320. 121 return gl_VertexID / hairThicknessRes;
  3321.  
  3322. 122 }
  3323.  
  3324. 123
  3325.  
  3326. 124 /* Copied from cycles. */
  3327.  
  3328. 125 float hair_shaperadius(float shape, float root, float tip, float time)
  3329.  
  3330. 126 {
  3331.  
  3332. 127 float radius = 1.0 - time;
  3333.  
  3334. 128
  3335.  
  3336. 129 if (shape < 0.0) {
  3337.  
  3338. 130 radius = pow(radius, 1.0 + shape);
  3339.  
  3340. 131 }
  3341.  
  3342. 132 else {
  3343.  
  3344. 133 radius = pow(radius, 1.0 / (1.0 - shape));
  3345.  
  3346. 134 }
  3347.  
  3348. 135
  3349.  
  3350. 136 if (hairCloseTip && (time > 0.99)) {
  3351.  
  3352. 137 return 0.0;
  3353.  
  3354. 138 }
  3355.  
  3356. 139
  3357.  
  3358. 140 return (radius * (root - tip)) + tip;
  3359.  
  3360. 141 }
  3361.  
  3362. 142
  3363.  
  3364. 143 # ifdef OS_MAC
  3365.  
  3366. 144 in float dummy;
  3367.  
  3368. 145 # endif
  3369.  
  3370. 146
  3371.  
  3372. 147 void hair_get_pos_tan_binor_time(bool is_persp,
  3373.  
  3374. 148 mat4 invmodel_mat,
  3375.  
  3376. 149 vec3 camera_pos,
  3377.  
  3378. 150 vec3 camera_z,
  3379.  
  3380. 151 out vec3 wpos,
  3381.  
  3382. 152 out vec3 wtan,
  3383.  
  3384. 153 out vec3 wbinor,
  3385.  
  3386. 154 out float time,
  3387.  
  3388. 155 out float thickness,
  3389.  
  3390. 156 out float thick_time)
  3391.  
  3392. 157 {
  3393.  
  3394. 158 int id = hair_get_base_id();
  3395.  
  3396. 159 vec4 data = texelFetch(hairPointBuffer, id);
  3397.  
  3398. 160 wpos = data.point_position;
  3399.  
  3400. 161 time = data.point_time;
  3401.  
  3402. 162
  3403.  
  3404. 163 # ifdef OS_MAC
  3405.  
  3406. 164 /* Generate a dummy read to avoid the driver bug with shaders having no
  3407.  
  3408. 165 * vertex reads on macOS (T60171) */
  3409.  
  3410. 166 wpos.y += dummy * 0.0;
  3411.  
  3412. 167 # endif
  3413.  
  3414. 168
  3415.  
  3416. 169 if (time == 0.0) {
  3417.  
  3418. 170 /* Hair root */
  3419.  
  3420. 171 wtan = texelFetch(hairPointBuffer, id + 1).point_position - wpos;
  3421.  
  3422. 172 }
  3423.  
  3424. 173 else {
  3425.  
  3426. 174 wtan = wpos - texelFetch(hairPointBuffer, id - 1).point_position;
  3427.  
  3428. 175 }
  3429.  
  3430. 176
  3431.  
  3432. 177 wpos = (hairDupliMatrix * vec4(wpos, 1.0)).xyz;
  3433.  
  3434. 178 wtan = mat3(hairDupliMatrix) * wtan;
  3435.  
  3436. 179
  3437.  
  3438. 180 vec3 camera_vec = (is_persp) ? wpos - camera_pos : -camera_z;
  3439.  
  3440. 181 wbinor = normalize(cross(camera_vec, wtan));
  3441.  
  3442. 182
  3443.  
  3444. 183 thickness = hair_shaperadius(hairRadShape, hairRadRoot, hairRadTip, time);
  3445.  
  3446. 184
  3447.  
  3448. 185 if (hairThicknessRes > 1) {
  3449.  
  3450. 186 thick_time = float(gl_VertexID % hairThicknessRes) / float(hairThicknessRes - 1);
  3451.  
  3452. 187 thick_time = thickness * (thick_time * 2.0 - 1.0);
  3453.  
  3454. 188
  3455.  
  3456. 189 /* Take object scale into account.
  3457.  
  3458. 190 * NOTE: This only works fine with uniform scaling. */
  3459.  
  3460. 191 float scale = 1.0 / length(mat3(invmodel_mat) * wbinor);
  3461.  
  3462. 192
  3463.  
  3464. 193 wpos += wbinor * thick_time * scale;
  3465.  
  3466. 194 }
  3467.  
  3468. 195 }
  3469.  
  3470. 196
  3471.  
  3472. 197 vec2 hair_get_customdata_vec2(const samplerBuffer cd_buf)
  3473.  
  3474. 198 {
  3475.  
  3476. 199 int id = hair_get_strand_id();
  3477.  
  3478. 200 return texelFetch(cd_buf, id).rg;
  3479.  
  3480. 201 }
  3481.  
  3482. 202
  3483.  
  3484. 203 vec3 hair_get_customdata_vec3(const samplerBuffer cd_buf)
  3485.  
  3486. 204 {
  3487.  
  3488. 205 int id = hair_get_strand_id();
  3489.  
  3490. 206 return texelFetch(cd_buf, id).rgb;
  3491.  
  3492. 207 }
  3493.  
  3494. 208
  3495.  
  3496. 209 vec4 hair_get_customdata_vec4(const samplerBuffer cd_buf)
  3497.  
  3498. 210 {
  3499.  
  3500. 211 int id = hair_get_strand_id();
  3501.  
  3502. 212 return texelFetch(cd_buf, id).rgba;
  3503.  
  3504. 213 }
  3505.  
  3506. 214
  3507.  
  3508. 215 vec3 hair_get_strand_pos(void)
  3509.  
  3510. 216 {
  3511.  
  3512. 217 int id = hair_get_strand_id() * hairStrandsRes;
  3513.  
  3514. 218 return texelFetch(hairPointBuffer, id).point_position;
  3515.  
  3516. 219 }
  3517.  
  3518. 220
  3519.  
  3520. 221 #endif
  3521.  
  3522. 222 uniform mat4 ModelViewProjectionMatrix;
  3523.  
  3524. 223 uniform mat4 ModelMatrix;
  3525.  
  3526. 224 uniform mat4 ModelMatrixInverse;
  3527.  
  3528. 225 uniform mat4 ProjectionMatrix;
  3529.  
  3530. 226 uniform mat4 ViewProjectionMatrix;
  3531.  
  3532. 227 uniform mat4 ViewMatrixInverse;
  3533.  
  3534. 228 uniform mat3 NormalMatrix;
  3535.  
  3536. 229
  3537.  
  3538. 230 #ifndef HAIR_SHADER
  3539.  
  3540. 231 in vec3 pos;
  3541.  
  3542. 232 in vec3 nor;
  3543.  
  3544. 233 in vec2 u; /* active texture layer */
  3545.  
  3546. 234 # ifdef V3D_SHADING_VERTEX_COLOR
  3547.  
  3548. 235 in vec3 c; /* active color */
  3549.  
  3550. 236 # endif
  3551.  
  3552. 237 # define uv u
  3553.  
  3554. 238 #else /* HAIR_SHADER */
  3555.  
  3556. 239 # ifdef V3D_SHADING_TEXTURE_COLOR
  3557.  
  3558. 240 uniform samplerBuffer u; /* active texture layer */
  3559.  
  3560. 241 # endif
  3561.  
  3562. 242 flat out float hair_rand;
  3563.  
  3564. 243 #endif /* HAIR_SHADER */
  3565.  
  3566. 244
  3567.  
  3568. 245 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
  3569.  
  3570. 246 out vec3 normal_viewport;
  3571.  
  3572. 247 #endif
  3573.  
  3574. 248
  3575.  
  3576. 249 #ifdef V3D_SHADING_TEXTURE_COLOR
  3577.  
  3578. 250 out vec2 uv_interp;
  3579.  
  3580. 251 #endif
  3581.  
  3582. 252 #ifdef V3D_SHADING_VERTEX_COLOR
  3583.  
  3584. 253 out vec3 vertexColor;
  3585.  
  3586. 254 #endif
  3587.  
  3588. 255
  3589.  
  3590. 256 /* From http://libnoise.sourceforge.net/noisegen/index.html */
  3591.  
  3592. 257 float integer_noise(int n)
  3593.  
  3594. 258 {
  3595.  
  3596. 259 n = (n >> 13) ^ n;
  3597.  
  3598. 260 int nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;
  3599.  
  3600. 261 return (float(nn) / 1073741824.0);
  3601.  
  3602. 262 }
  3603.  
  3604. 263
  3605.  
  3606. 264 #ifdef V3D_SHADING_VERTEX_COLOR
  3607.  
  3608. 265 vec3 srgb_to_linear_attr(vec3 c)
  3609.  
  3610. 266 {
  3611.  
  3612. 267 c = max(c, vec3(0.0));
  3613.  
  3614. 268 vec3 c1 = c * (1.0 / 12.92);
  3615.  
  3616. 269 vec3 c2 = pow((c + 0.055) * (1.0 / 1.055), vec3(2.4));
  3617.  
  3618. 270 return mix(c1, c2, step(vec3(0.04045), c));
  3619.  
  3620. 271 }
  3621.  
  3622. 272 #endif
  3623.  
  3624. 273
  3625.  
  3626. 274 void main()
  3627.  
  3628. 275 {
  3629.  
  3630. 276 #ifdef HAIR_SHADER
  3631.  
  3632. 277 # ifdef V3D_SHADING_TEXTURE_COLOR
  3633.  
  3634. 278 vec2 uv = hair_get_customdata_vec2(u);
  3635.  
  3636. 279 # endif
  3637.  
  3638. 280 float time, thick_time, thickness;
  3639.  
  3640. 281 vec3 pos, tan, binor;
  3641.  
  3642. 282 hair_get_pos_tan_binor_time((ProjectionMatrix[3][3] == 0.0),
  3643.  
  3644. 283 ModelMatrixInverse,
  3645.  
  3646. 284 ViewMatrixInverse[3].xyz,
  3647.  
  3648. 285 ViewMatrixInverse[2].xyz,
  3649.  
  3650. 286 pos,
  3651.  
  3652. 287 tan,
  3653.  
  3654. 288 binor,
  3655.  
  3656. 289 time,
  3657.  
  3658. 290 thickness,
  3659.  
  3660. 291 thick_time);
  3661.  
  3662. 292 /* To "simulate" anisotropic shading, randomize hair normal per strand. */
  3663.  
  3664. 293 hair_rand = integer_noise(hair_get_strand_id());
  3665.  
  3666. 294 tan = normalize(tan);
  3667.  
  3668. 295 vec3 nor = normalize(cross(binor, tan));
  3669.  
  3670. 296 nor = normalize(mix(nor, -tan, hair_rand * 0.10));
  3671.  
  3672. 297 float cos_theta = (hair_rand * 2.0 - 1.0) * 0.20;
  3673.  
  3674. 298 float sin_theta = sqrt(max(0.0, 1.0f - cos_theta * cos_theta));
  3675.  
  3676. 299 nor = nor * sin_theta + binor * cos_theta;
  3677.  
  3678. 300 gl_Position = ViewProjectionMatrix * vec4(pos, 1.0);
  3679.  
  3680. 301 #else
  3681.  
  3682. 302 gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
  3683.  
  3684. 303 #endif
  3685.  
  3686. 304 #ifdef V3D_SHADING_TEXTURE_COLOR
  3687.  
  3688. 305 uv_interp = uv;
  3689.  
  3690. 306 #endif
  3691.  
  3692. 307
  3693.  
  3694. 308 #ifdef V3D_SHADING_VERTEX_COLOR
  3695.  
  3696. 309 # ifndef HAIR_SHADER
  3697.  
  3698. 310 vertexColor = srgb_to_linear_attr(c);
  3699.  
  3700. 311 # endif
  3701.  
  3702. 312 #endif
  3703.  
  3704. 313
  3705.  
  3706. 314 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
  3707.  
  3708. 315 normal_viewport = NormalMatrix * nor;
  3709.  
  3710. 316 # ifndef HAIR_SHADER
  3711.  
  3712. 317 normal_viewport = normalize(normal_viewport);
  3713.  
  3714. 318 # endif
  3715.  
  3716. 319 #endif
  3717.  
  3718. 320
  3719.  
  3720. 321 #ifdef USE_WORLD_CLIP_PLANES
  3721.  
  3722. 322 world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
  3723.  
  3724. 323 #endif
  3725.  
  3726. 324 }
  3727.  
  3728. Vertex shader failed to compile with the following errors:
  3729.  
  3730. GPUShader: compile error:
  3731. ===== shader string 1 ====
  3732. 1 #version 330
  3733. ===== shader string 2 ====
  3734. 2 #define GPU_VERTEX_SHADER
  3735. ===== shader string 3 ====
  3736. 3 #extension GL_ARB_texture_gather: enable
  3737. 4 #define GPU_ARB_texture_gather
  3738. 5 #extension GL_ARB_texture_query_lod: enable
  3739. ===== shader string 4 ====
  3740. 6 #define GPU_ATI
  3741. 7 #define OS_WIN
  3742. ===== shader string 5 ====
  3743. 8 #define V3D_SHADING_OBJECT_OUTLINE
  3744. 9 #define V3D_SHADING_SPECULAR_HIGHLIGHT
  3745. 10 #define V3D_LIGHTING_STUDIO
  3746. 11 #define OBJECT_ID_PASS_ENABLED
  3747. 12 #define MATDATA_PASS_ENABLED
  3748. 13 #define NORMAL_VIEWPORT_PASS_ENABLED
  3749. 14 #define WORKBENCH_ENCODE_NORMALS
  3750. ===== shader string 6 ====
  3751. 15 uniform mat4 ModelViewProjectionMatrix;
  3752.  
  3753. 16 uniform mat4 ModelMatrix;
  3754.  
  3755. 17 uniform mat4 ModelMatrixInverse;
  3756.  
  3757. 18 uniform mat4 ProjectionMatrix;
  3758.  
  3759. 19 uniform mat4 ViewProjectionMatrix;
  3760.  
  3761. 20 uniform mat4 ViewMatrixInverse;
  3762.  
  3763. 21 uniform mat3 NormalMatrix;
  3764.  
  3765. 22
  3766.  
  3767. 23 #ifndef HAIR_SHADER
  3768.  
  3769. 24 in vec3 pos;
  3770.  
  3771. 25 in vec3 nor;
  3772.  
  3773. 26 in vec2 u; /* active texture layer */
  3774.  
  3775. 27 # ifdef V3D_SHADING_VERTEX_COLOR
  3776.  
  3777. 28 in vec3 c; /* active color */
  3778.  
  3779. 29 # endif
  3780.  
  3781. 30 # define uv u
  3782.  
  3783. 31 #else /* HAIR_SHADER */
  3784.  
  3785. 32 # ifdef V3D_SHADING_TEXTURE_COLOR
  3786.  
  3787. 33 uniform samplerBuffer u; /* active texture layer */
  3788.  
  3789. 34 # endif
  3790.  
  3791. 35 flat out float hair_rand;
  3792.  
  3793. 36 #endif /* HAIR_SHADER */
  3794.  
  3795. 37
  3796.  
  3797. 38 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
  3798.  
  3799. 39 out vec3 normal_viewport;
  3800.  
  3801. 40 #endif
  3802.  
  3803. 41
  3804.  
  3805. 42 #ifdef V3D_SHADING_TEXTURE_COLOR
  3806.  
  3807. 43 out vec2 uv_interp;
  3808.  
  3809. 44 #endif
  3810.  
  3811. 45 #ifdef V3D_SHADING_VERTEX_COLOR
  3812.  
  3813. 46 out vec3 vertexColor;
  3814.  
  3815. 47 #endif
  3816.  
  3817. 48
  3818.  
  3819. 49 /* From http://libnoise.sourceforge.net/noisegen/index.html */
  3820.  
  3821. 50 float integer_noise(int n)
  3822.  
  3823. 51 {
  3824.  
  3825. 52 n = (n >> 13) ^ n;
  3826.  
  3827. 53 int nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;
  3828.  
  3829. 54 return (float(nn) / 1073741824.0);
  3830.  
  3831. 55 }
  3832.  
  3833. 56
  3834.  
  3835. 57 #ifdef V3D_SHADING_VERTEX_COLOR
  3836.  
  3837. 58 vec3 srgb_to_linear_attr(vec3 c)
  3838.  
  3839. 59 {
  3840.  
  3841. 60 c = max(c, vec3(0.0));
  3842.  
  3843. 61 vec3 c1 = c * (1.0 / 12.92);
  3844.  
  3845. 62 vec3 c2 = pow((c + 0.055) * (1.0 / 1.055), vec3(2.4));
  3846.  
  3847. 63 return mix(c1, c2, step(vec3(0.04045), c));
  3848.  
  3849. 64 }
  3850.  
  3851. 65 #endif
  3852.  
  3853. 66
  3854.  
  3855. 67 void main()
  3856.  
  3857. 68 {
  3858.  
  3859. 69 #ifdef HAIR_SHADER
  3860.  
  3861. 70 # ifdef V3D_SHADING_TEXTURE_COLOR
  3862.  
  3863. 71 vec2 uv = hair_get_customdata_vec2(u);
  3864.  
  3865. 72 # endif
  3866.  
  3867. 73 float time, thick_time, thickness;
  3868.  
  3869. 74 vec3 pos, tan, binor;
  3870.  
  3871. 75 hair_get_pos_tan_binor_time((ProjectionMatrix[3][3] == 0.0),
  3872.  
  3873. 76 ModelMatrixInverse,
  3874.  
  3875. 77 ViewMatrixInverse[3].xyz,
  3876.  
  3877. 78 ViewMatrixInverse[2].xyz,
  3878.  
  3879. 79 pos,
  3880.  
  3881. 80 tan,
  3882.  
  3883. 81 binor,
  3884.  
  3885. 82 time,
  3886.  
  3887. 83 thickness,
  3888.  
  3889. 84 thick_time);
  3890.  
  3891. 85 /* To "simulate" anisotropic shading, randomize hair normal per strand. */
  3892.  
  3893. 86 hair_rand = integer_noise(hair_get_strand_id());
  3894.  
  3895. 87 tan = normalize(tan);
  3896.  
  3897. 88 vec3 nor = normalize(cross(binor, tan));
  3898.  
  3899. 89 nor = normalize(mix(nor, -tan, hair_rand * 0.10));
  3900.  
  3901. 90 float cos_theta = (hair_rand * 2.0 - 1.0) * 0.20;
  3902.  
  3903. 91 float sin_theta = sqrt(max(0.0, 1.0f - cos_theta * cos_theta));
  3904.  
  3905. 92 nor = nor * sin_theta + binor * cos_theta;
  3906.  
  3907. 93 gl_Position = ViewProjectionMatrix * vec4(pos, 1.0);
  3908.  
  3909. 94 #else
  3910.  
  3911. 95 gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
  3912.  
  3913. 96 #endif
  3914.  
  3915. 97 #ifdef V3D_SHADING_TEXTURE_COLOR
  3916.  
  3917. 98 uv_interp = uv;
  3918.  
  3919. 99 #endif
  3920.  
  3921. 100
  3922.  
  3923. 101 #ifdef V3D_SHADING_VERTEX_COLOR
  3924.  
  3925. 102 # ifndef HAIR_SHADER
  3926.  
  3927. 103 vertexColor = srgb_to_linear_attr(c);
  3928.  
  3929. 104 # endif
  3930.  
  3931. 105 #endif
  3932.  
  3933. 106
  3934.  
  3935. 107 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
  3936.  
  3937. 108 normal_viewport = NormalMatrix * nor;
  3938.  
  3939. 109 # ifndef HAIR_SHADER
  3940.  
  3941. 110 normal_viewport = normalize(normal_viewport);
  3942.  
  3943. 111 # endif
  3944.  
  3945. 112 #endif
  3946.  
  3947. 113
  3948.  
  3949. 114 #ifdef USE_WORLD_CLIP_PLANES
  3950.  
  3951. 115 world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
  3952.  
  3953. 116 #endif
  3954.  
  3955. 117 }
  3956.  
  3957. Vertex shader failed to compile with the following errors:
  3958.  
  3959. GPUShader: compile error:
  3960. ===== shader string 1 ====
  3961. 1 #version 330
  3962. ===== shader string 2 ====
  3963. 2 #define GPU_VERTEX_SHADER
  3964. ===== shader string 3 ====
  3965. 3 #extension GL_ARB_texture_gather: enable
  3966. 4 #define GPU_ARB_texture_gather
  3967. 5 #extension GL_ARB_texture_query_lod: enable
  3968. ===== shader string 4 ====
  3969. 6 #define GPU_ATI
  3970. 7 #define OS_WIN
  3971. ===== shader string 5 ====
  3972. 8 #define V3D_SHADING_OBJECT_OUTLINE
  3973. 9 #define V3D_SHADING_SPECULAR_HIGHLIGHT
  3974. 10 #define V3D_LIGHTING_STUDIO
  3975. 11 #define OBJECT_ID_PASS_ENABLED
  3976. 12 #define MATDATA_PASS_ENABLED
  3977. 13 #define NORMAL_VIEWPORT_PASS_ENABLED
  3978. 14 #define WORKBENCH_ENCODE_NORMALS
  3979. 15 #define HAIR_SHADER
  3980. ===== shader string 6 ====
  3981. 16 /**
  3982.  
  3983. 17 * Library to create hairs dynamically from control points.
  3984.  
  3985. 18 * This is less bandwidth intensive than fetching the vertex attributes
  3986.  
  3987. 19 * but does more ALU work per vertex. This also reduce the number
  3988.  
  3989. 20 * of data the CPU has to precompute and transfert for each update.
  3990.  
  3991. 21 */
  3992.  
  3993. 22
  3994.  
  3995. 23 /**
  3996.  
  3997. 24 * hairStrandsRes: Number of points per hair strand.
  3998.  
  3999. 25 * 2 - no subdivision
  4000.  
  4001. 26 * 3+ - 1 or more interpolated points per hair.
  4002.  
  4003. 27 */
  4004.  
  4005. 28 uniform int hairStrandsRes = 8;
  4006.  
  4007. 29
  4008.  
  4009. 30 /**
  4010.  
  4011. 31 * hairThicknessRes : Subdiv around the hair.
  4012.  
  4013. 32 * 1 - Wire Hair: Only one pixel thick, independent of view distance.
  4014.  
  4015. 33 * 2 - Polystrip Hair: Correct width, flat if camera is parallel.
  4016.  
  4017. 34 * 3+ - Cylinder Hair: Massive calculation but potentially perfect. Still need proper support.
  4018.  
  4019. 35 */
  4020.  
  4021. 36 uniform int hairThicknessRes = 1;
  4022.  
  4023. 37
  4024.  
  4025. 38 /* Hair thickness shape. */
  4026.  
  4027. 39 uniform float hairRadRoot = 0.01;
  4028.  
  4029. 40 uniform float hairRadTip = 0.0;
  4030.  
  4031. 41 uniform float hairRadShape = 0.5;
  4032.  
  4033. 42 uniform bool hairCloseTip = true;
  4034.  
  4035. 43
  4036.  
  4037. 44 uniform mat4 hairDupliMatrix;
  4038.  
  4039. 45
  4040.  
  4041. 46 /* -- Per control points -- */
  4042.  
  4043. 47 uniform samplerBuffer hairPointBuffer; /* RGBA32F */
  4044.  
  4045. 48 #define point_position xyz
  4046.  
  4047. 49 #define point_time w /* Position along the hair length */
  4048.  
  4049. 50
  4050.  
  4051. 51 /* -- Per strands data -- */
  4052.  
  4053. 52 uniform usamplerBuffer hairStrandBuffer; /* R32UI */
  4054.  
  4055. 53 uniform usamplerBuffer hairStrandSegBuffer; /* R16UI */
  4056.  
  4057. 54
  4058.  
  4059. 55 /* Not used, use one buffer per uv layer */
  4060.  
  4061. 56 //uniform samplerBuffer hairUVBuffer; /* RG32F */
  4062.  
  4063. 57 //uniform samplerBuffer hairColBuffer; /* RGBA16 linear color */
  4064.  
  4065. 58
  4066.  
  4067. 59 /* -- Subdivision stage -- */
  4068.  
  4069. 60 /**
  4070.  
  4071. 61 * We use a transform feedback to preprocess the strands and add more subdivision to it.
  4072.  
  4073. 62 * For the moment theses are simple smooth interpolation but one could hope to see the full
  4074.  
  4075. 63 * children particle modifiers being evaluated at this stage.
  4076.  
  4077. 64 *
  4078.  
  4079. 65 * If no more subdivision is needed, we can skip this step.
  4080.  
  4081. 66 */
  4082.  
  4083. 67
  4084.  
  4085. 68 #ifdef HAIR_PHASE_SUBDIV
  4086.  
  4087. 69 int hair_get_base_id(float local_time, int strand_segments, out float interp_time)
  4088.  
  4089. 70 {
  4090.  
  4091. 71 float time_per_strand_seg = 1.0 / float(strand_segments);
  4092.  
  4093. 72
  4094.  
  4095. 73 float ratio = local_time / time_per_strand_seg;
  4096.  
  4097. 74 interp_time = fract(ratio);
  4098.  
  4099. 75
  4100.  
  4101. 76 return int(ratio);
  4102.  
  4103. 77 }
  4104.  
  4105. 78
  4106.  
  4107. 79 void hair_get_interp_attrs(
  4108.  
  4109. 80 out vec4 data0, out vec4 data1, out vec4 data2, out vec4 data3, out float interp_time)
  4110.  
  4111. 81 {
  4112.  
  4113. 82 float local_time = float(gl_VertexID % hairStrandsRes) / float(hairStrandsRes - 1);
  4114.  
  4115. 83
  4116.  
  4117. 84 int hair_id = gl_VertexID / hairStrandsRes;
  4118.  
  4119. 85 int strand_offset = int(texelFetch(hairStrandBuffer, hair_id).x);
  4120.  
  4121. 86 int strand_segments = int(texelFetch(hairStrandSegBuffer, hair_id).x);
  4122.  
  4123. 87
  4124.  
  4125. 88 int id = hair_get_base_id(local_time, strand_segments, interp_time);
  4126.  
  4127. 89
  4128.  
  4129. 90 int ofs_id = id + strand_offset;
  4130.  
  4131. 91
  4132.  
  4133. 92 data0 = texelFetch(hairPointBuffer, ofs_id - 1);
  4134.  
  4135. 93 data1 = texelFetch(hairPointBuffer, ofs_id);
  4136.  
  4137. 94 data2 = texelFetch(hairPointBuffer, ofs_id + 1);
  4138.  
  4139. 95 data3 = texelFetch(hairPointBuffer, ofs_id + 2);
  4140.  
  4141. 96
  4142.  
  4143. 97 if (id <= 0) {
  4144.  
  4145. 98 /* root points. Need to reconstruct previous data. */
  4146.  
  4147. 99 data0 = data1 * 2.0 - data2;
  4148.  
  4149. 100 }
  4150.  
  4151. 101 if (id + 1 >= strand_segments) {
  4152.  
  4153. 102 /* tip points. Need to reconstruct next data. */
  4154.  
  4155. 103 data3 = data2 * 2.0 - data1;
  4156.  
  4157. 104 }
  4158.  
  4159. 105 }
  4160.  
  4161. 106 #endif
  4162.  
  4163. 107
  4164.  
  4165. 108 /* -- Drawing stage -- */
  4166.  
  4167. 109 /**
  4168.  
  4169. 110 * For final drawing, the vertex index and the number of vertex per segment
  4170.  
  4171. 111 */
  4172.  
  4173. 112
  4174.  
  4175. 113 #ifndef HAIR_PHASE_SUBDIV
  4176.  
  4177. 114 int hair_get_strand_id(void)
  4178.  
  4179. 115 {
  4180.  
  4181. 116 return gl_VertexID / (hairStrandsRes * hairThicknessRes);
  4182.  
  4183. 117 }
  4184.  
  4185. 118
  4186.  
  4187. 119 int hair_get_base_id(void)
  4188.  
  4189. 120 {
  4190.  
  4191. 121 return gl_VertexID / hairThicknessRes;
  4192.  
  4193. 122 }
  4194.  
  4195. 123
  4196.  
  4197. 124 /* Copied from cycles. */
  4198.  
  4199. 125 float hair_shaperadius(float shape, float root, float tip, float time)
  4200.  
  4201. 126 {
  4202.  
  4203. 127 float radius = 1.0 - time;
  4204.  
  4205. 128
  4206.  
  4207. 129 if (shape < 0.0) {
  4208.  
  4209. 130 radius = pow(radius, 1.0 + shape);
  4210.  
  4211. 131 }
  4212.  
  4213. 132 else {
  4214.  
  4215. 133 radius = pow(radius, 1.0 / (1.0 - shape));
  4216.  
  4217. 134 }
  4218.  
  4219. 135
  4220.  
  4221. 136 if (hairCloseTip && (time > 0.99)) {
  4222.  
  4223. 137 return 0.0;
  4224.  
  4225. 138 }
  4226.  
  4227. 139
  4228.  
  4229. 140 return (radius * (root - tip)) + tip;
  4230.  
  4231. 141 }
  4232.  
  4233. 142
  4234.  
  4235. 143 # ifdef OS_MAC
  4236.  
  4237. 144 in float dummy;
  4238.  
  4239. 145 # endif
  4240.  
  4241. 146
  4242.  
  4243. 147 void hair_get_pos_tan_binor_time(bool is_persp,
  4244.  
  4245. 148 mat4 invmodel_mat,
  4246.  
  4247. 149 vec3 camera_pos,
  4248.  
  4249. 150 vec3 camera_z,
  4250.  
  4251. 151 out vec3 wpos,
  4252.  
  4253. 152 out vec3 wtan,
  4254.  
  4255. 153 out vec3 wbinor,
  4256.  
  4257. 154 out float time,
  4258.  
  4259. 155 out float thickness,
  4260.  
  4261. 156 out float thick_time)
  4262.  
  4263. 157 {
  4264.  
  4265. 158 int id = hair_get_base_id();
  4266.  
  4267. 159 vec4 data = texelFetch(hairPointBuffer, id);
  4268.  
  4269. 160 wpos = data.point_position;
  4270.  
  4271. 161 time = data.point_time;
  4272.  
  4273. 162
  4274.  
  4275. 163 # ifdef OS_MAC
  4276.  
  4277. 164 /* Generate a dummy read to avoid the driver bug with shaders having no
  4278.  
  4279. 165 * vertex reads on macOS (T60171) */
  4280.  
  4281. 166 wpos.y += dummy * 0.0;
  4282.  
  4283. 167 # endif
  4284.  
  4285. 168
  4286.  
  4287. 169 if (time == 0.0) {
  4288.  
  4289. 170 /* Hair root */
  4290.  
  4291. 171 wtan = texelFetch(hairPointBuffer, id + 1).point_position - wpos;
  4292.  
  4293. 172 }
  4294.  
  4295. 173 else {
  4296.  
  4297. 174 wtan = wpos - texelFetch(hairPointBuffer, id - 1).point_position;
  4298.  
  4299. 175 }
  4300.  
  4301. 176
  4302.  
  4303. 177 wpos = (hairDupliMatrix * vec4(wpos, 1.0)).xyz;
  4304.  
  4305. 178 wtan = mat3(hairDupliMatrix) * wtan;
  4306.  
  4307. 179
  4308.  
  4309. 180 vec3 camera_vec = (is_persp) ? wpos - camera_pos : -camera_z;
  4310.  
  4311. 181 wbinor = normalize(cross(camera_vec, wtan));
  4312.  
  4313. 182
  4314.  
  4315. 183 thickness = hair_shaperadius(hairRadShape, hairRadRoot, hairRadTip, time);
  4316.  
  4317. 184
  4318.  
  4319. 185 if (hairThicknessRes > 1) {
  4320.  
  4321. 186 thick_time = float(gl_VertexID % hairThicknessRes) / float(hairThicknessRes - 1);
  4322.  
  4323. 187 thick_time = thickness * (thick_time * 2.0 - 1.0);
  4324.  
  4325. 188
  4326.  
  4327. 189 /* Take object scale into account.
  4328.  
  4329. 190 * NOTE: This only works fine with uniform scaling. */
  4330.  
  4331. 191 float scale = 1.0 / length(mat3(invmodel_mat) * wbinor);
  4332.  
  4333. 192
  4334.  
  4335. 193 wpos += wbinor * thick_time * scale;
  4336.  
  4337. 194 }
  4338.  
  4339. 195 }
  4340.  
  4341. 196
  4342.  
  4343. 197 vec2 hair_get_customdata_vec2(const samplerBuffer cd_buf)
  4344.  
  4345. 198 {
  4346.  
  4347. 199 int id = hair_get_strand_id();
  4348.  
  4349. 200 return texelFetch(cd_buf, id).rg;
  4350.  
  4351. 201 }
  4352.  
  4353. 202
  4354.  
  4355. 203 vec3 hair_get_customdata_vec3(const samplerBuffer cd_buf)
  4356.  
  4357. 204 {
  4358.  
  4359. 205 int id = hair_get_strand_id();
  4360.  
  4361. 206 return texelFetch(cd_buf, id).rgb;
  4362.  
  4363. 207 }
  4364.  
  4365. 208
  4366.  
  4367. 209 vec4 hair_get_customdata_vec4(const samplerBuffer cd_buf)
  4368.  
  4369. 210 {
  4370.  
  4371. 211 int id = hair_get_strand_id();
  4372.  
  4373. 212 return texelFetch(cd_buf, id).rgba;
  4374.  
  4375. 213 }
  4376.  
  4377. 214
  4378.  
  4379. 215 vec3 hair_get_strand_pos(void)
  4380.  
  4381. 216 {
  4382.  
  4383. 217 int id = hair_get_strand_id() * hairStrandsRes;
  4384.  
  4385. 218 return texelFetch(hairPointBuffer, id).point_position;
  4386.  
  4387. 219 }
  4388.  
  4389. 220
  4390.  
  4391. 221 #endif
  4392.  
  4393. 222 uniform mat4 ModelViewProjectionMatrix;
  4394.  
  4395. 223 uniform mat4 ModelMatrix;
  4396.  
  4397. 224 uniform mat4 ModelMatrixInverse;
  4398.  
  4399. 225 uniform mat4 ProjectionMatrix;
  4400.  
  4401. 226 uniform mat4 ViewProjectionMatrix;
  4402.  
  4403. 227 uniform mat4 ViewMatrixInverse;
  4404.  
  4405. 228 uniform mat3 NormalMatrix;
  4406.  
  4407. 229
  4408.  
  4409. 230 #ifndef HAIR_SHADER
  4410.  
  4411. 231 in vec3 pos;
  4412.  
  4413. 232 in vec3 nor;
  4414.  
  4415. 233 in vec2 u; /* active texture layer */
  4416.  
  4417. 234 # ifdef V3D_SHADING_VERTEX_COLOR
  4418.  
  4419. 235 in vec3 c; /* active color */
  4420.  
  4421. 236 # endif
  4422.  
  4423. 237 # define uv u
  4424.  
  4425. 238 #else /* HAIR_SHADER */
  4426.  
  4427. 239 # ifdef V3D_SHADING_TEXTURE_COLOR
  4428.  
  4429. 240 uniform samplerBuffer u; /* active texture layer */
  4430.  
  4431. 241 # endif
  4432.  
  4433. 242 flat out float hair_rand;
  4434.  
  4435. 243 #endif /* HAIR_SHADER */
  4436.  
  4437. 244
  4438.  
  4439. 245 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
  4440.  
  4441. 246 out vec3 normal_viewport;
  4442.  
  4443. 247 #endif
  4444.  
  4445. 248
  4446.  
  4447. 249 #ifdef V3D_SHADING_TEXTURE_COLOR
  4448.  
  4449. 250 out vec2 uv_interp;
  4450.  
  4451. 251 #endif
  4452.  
  4453. 252 #ifdef V3D_SHADING_VERTEX_COLOR
  4454.  
  4455. 253 out vec3 vertexColor;
  4456.  
  4457. 254 #endif
  4458.  
  4459. 255
  4460.  
  4461. 256 /* From http://libnoise.sourceforge.net/noisegen/index.html */
  4462.  
  4463. 257 float integer_noise(int n)
  4464.  
  4465. 258 {
  4466.  
  4467. 259 n = (n >> 13) ^ n;
  4468.  
  4469. 260 int nn = (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;
  4470.  
  4471. 261 return (float(nn) / 1073741824.0);
  4472.  
  4473. 262 }
  4474.  
  4475. 263
  4476.  
  4477. 264 #ifdef V3D_SHADING_VERTEX_COLOR
  4478.  
  4479. 265 vec3 srgb_to_linear_attr(vec3 c)
  4480.  
  4481. 266 {
  4482.  
  4483. 267 c = max(c, vec3(0.0));
  4484.  
  4485. 268 vec3 c1 = c * (1.0 / 12.92);
  4486.  
  4487. 269 vec3 c2 = pow((c + 0.055) * (1.0 / 1.055), vec3(2.4));
  4488.  
  4489. 270 return mix(c1, c2, step(vec3(0.04045), c));
  4490.  
  4491. 271 }
  4492.  
  4493. 272 #endif
  4494.  
  4495. 273
  4496.  
  4497. 274 void main()
  4498.  
  4499. 275 {
  4500.  
  4501. 276 #ifdef HAIR_SHADER
  4502.  
  4503. 277 # ifdef V3D_SHADING_TEXTURE_COLOR
  4504.  
  4505. 278 vec2 uv = hair_get_customdata_vec2(u);
  4506.  
  4507. 279 # endif
  4508.  
  4509. 280 float time, thick_time, thickness;
  4510.  
  4511. 281 vec3 pos, tan, binor;
  4512.  
  4513. 282 hair_get_pos_tan_binor_time((ProjectionMatrix[3][3] == 0.0),
  4514.  
  4515. 283 ModelMatrixInverse,
  4516.  
  4517. 284 ViewMatrixInverse[3].xyz,
  4518.  
  4519. 285 ViewMatrixInverse[2].xyz,
  4520.  
  4521. 286 pos,
  4522.  
  4523. 287 tan,
  4524.  
  4525. 288 binor,
  4526.  
  4527. 289 time,
  4528.  
  4529. 290 thickness,
  4530.  
  4531. 291 thick_time);
  4532.  
  4533. 292 /* To "simulate" anisotropic shading, randomize hair normal per strand. */
  4534.  
  4535. 293 hair_rand = integer_noise(hair_get_strand_id());
  4536.  
  4537. 294 tan = normalize(tan);
  4538.  
  4539. 295 vec3 nor = normalize(cross(binor, tan));
  4540.  
  4541. 296 nor = normalize(mix(nor, -tan, hair_rand * 0.10));
  4542.  
  4543. 297 float cos_theta = (hair_rand * 2.0 - 1.0) * 0.20;
  4544.  
  4545. 298 float sin_theta = sqrt(max(0.0, 1.0f - cos_theta * cos_theta));
  4546.  
  4547. 299 nor = nor * sin_theta + binor * cos_theta;
  4548.  
  4549. 300 gl_Position = ViewProjectionMatrix * vec4(pos, 1.0);
  4550.  
  4551. 301 #else
  4552.  
  4553. 302 gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
  4554.  
  4555. 303 #endif
  4556.  
  4557. 304 #ifdef V3D_SHADING_TEXTURE_COLOR
  4558.  
  4559. 305 uv_interp = uv;
  4560.  
  4561. 306 #endif
  4562.  
  4563. 307
  4564.  
  4565. 308 #ifdef V3D_SHADING_VERTEX_COLOR
  4566.  
  4567. 309 # ifndef HAIR_SHADER
  4568.  
  4569. 310 vertexColor = srgb_to_linear_attr(c);
  4570.  
  4571. 311 # endif
  4572.  
  4573. 312 #endif
  4574.  
  4575. 313
  4576.  
  4577. 314 #ifdef NORMAL_VIEWPORT_PASS_ENABLED
  4578.  
  4579. 315 normal_viewport = NormalMatrix * nor;
  4580.  
  4581. 316 # ifndef HAIR_SHADER
  4582.  
  4583. 317 normal_viewport = normalize(normal_viewport);
  4584.  
  4585. 318 # endif
  4586.  
  4587. 319 #endif
  4588.  
  4589. 320
  4590.  
  4591. 321 #ifdef USE_WORLD_CLIP_PLANES
  4592.  
  4593. 322 world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
  4594.  
  4595. 323 #endif
  4596.  
  4597. 324 }
  4598.  
  4599. Vertex shader failed to compile with the following errors:
  4600.  
  4601. Error : EXCEPTION_ACCESS_VIOLATION
  4602. Address : 0x00007FF781B5E064
  4603. Module : I:\BlenderUpdater\blender.exe
  4604.  
  4605. ---------------------------------------------------------------------------------------------------------------------------------------
  4606. BLENDER SYSTEM INFO.txt
  4607. ---------------------------------------------------------------------------------------------------------------------------------------
  4608.  
  4609. ============================================
  4610. = Blender 2.80 (sub 58) System Information =
  4611. ============================================
  4612.  
  4613.  
  4614. Blender:
  4615. ============================================
  4616.  
  4617. version: 2.80 (sub 58), branch: blender2.7, commit date: 2019-04-24 02:30, hash: 1b839e85e142, type: Release
  4618. build date: 23/04/2019, 20:12
  4619. platform: Windows
  4620. binary path: 'I:\\BlenderUpdater\\blender.exe'
  4621. build cflags: /W3 /w34062 /w34115 /w34189 /wd4018 /wd4146 /wd4065 /wd4127 /wd4181 /wd4200 /wd4244 /wd4267 /wd4305 /wd4800 /wd4828 /wd4996 /we4013 /we4133 /we4431 /w35038 /DWIN32 /D_WINDOWS /W3 /nologo /J /Gd /MP -openmp
  4622. build cxxflags: /W3 /w34062 /w34115 /w34189 /wd4018 /wd4146 /wd4065 /wd4127 /wd4181 /wd4200 /wd4244 /wd4267 /wd4305 /wd4800 /wd4828 /wd4996 /we4013 /we4133 /we4431 /w35038 /DWIN32 /D_WINDOWS /W3 /GR /EHsc /nologo /J /Gd /MP /EHsc -openmp
  4623. build linkflags: /MACHINE:X64 /SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib /ignore:4049 /ignore:4217 /ignore:4221
  4624. build system: CMake
  4625.  
  4626. Python:
  4627. ============================================
  4628.  
  4629. version: 3.7.0 (default, Aug 26 2018, 16:05:01) [MSC v.1900 64 bit (AMD64)]
  4630. paths:
  4631. 'I:\\BlenderUpdater\\2.80\\scripts\\addons_contrib'
  4632. 'C:\\Users\\Administrator\\AppData\\Roaming\\Blender Foundation\\Blender\\2.80\\scripts\\addons'
  4633. 'I:\\BlenderUpdater\\2.80\\scripts\\addons'
  4634. 'I:\\BlenderUpdater\\2.80\\scripts\\startup'
  4635. 'I:\\BlenderUpdater\\2.80\\scripts\\modules'
  4636. 'C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Python36_64'
  4637. 'I:\\BlenderUpdater\\python37.zip'
  4638. 'I:\\BlenderUpdater\\2.80\\python\\DLLs'
  4639. 'I:\\BlenderUpdater\\2.80\\python\\lib'
  4640. 'I:\\BlenderUpdater'
  4641. 'I:\\BlenderUpdater\\2.80\\python'
  4642. 'I:\\BlenderUpdater\\2.80\\python\\lib\\site-packages'
  4643. 'I:\\BlenderUpdater\\2.80\\scripts\\freestyle\\modules'
  4644. 'I:\\BlenderUpdater\\2.80\\scripts\\addons\\modules'
  4645. 'C:\\Users\\Administrator\\AppData\\Roaming\\Blender Foundation\\Blender\\2.80\\scripts\\addons\\modules'
  4646.  
  4647. Python (External Binary):
  4648. ============================================
  4649.  
  4650. binary path: 'I:\\BlenderUpdater\\2.80\\python\\bin\\python.EXE'
  4651. version: Python 3.7.0
  4652.  
  4653. Directories:
  4654. ============================================
  4655.  
  4656. scripts:
  4657. 'I:\\BlenderUpdater\\2.80\\scripts\\modules'
  4658. 'I:\\BlenderUpdater\\2.80\\scripts'
  4659. 'C:\\Users\\Administrator\\AppData\\Roaming\\Blender Foundation\\Blender\\2.80\\scripts'
  4660. user scripts: 'C:\\Users\\Administrator\\AppData\\Roaming\\Blender Foundation\\Blender\\2.80\\scripts'
  4661. pref scripts: None
  4662. datafiles: 'C:\\Users\\Administrator\\AppData\\Roaming\\Blender Foundation\\Blender\\2.80\\datafiles\\'
  4663. config: 'C:\\Users\\Administrator\\AppData\\Roaming\\Blender Foundation\\Blender\\2.80\\config\\'
  4664. scripts : 'C:\\Users\\Administrator\\AppData\\Roaming\\Blender Foundation\\Blender\\2.80\\scripts\\'
  4665. autosave: 'C:\\Users\\Administrator\\AppData\\Roaming\\Blender Foundation\\Blender\\2.80\\autosave\\'
  4666. tempdir: 'C:\\Users\\Administrator\\AppData\\Local\\Temp\\blender_a20892\\'
  4667.  
  4668. FFmpeg:
  4669. ============================================
  4670.  
  4671. avcodec: '58, 18, 100'
  4672. avdevice: '58, 3, 100'
  4673. avformat: '58, 12, 100'
  4674. avutil: '56, 14, 100'
  4675. swscale: ' 5, 1, 100'
  4676.  
  4677. SDL:
  4678. ============================================
  4679.  
  4680. Version: 2.0.8
  4681. Loading method: linked (WITH_SDL_DYNLOAD=OFF)
  4682.  
  4683. Other Libraries:
  4684. ============================================
  4685.  
  4686. OpenColorIO: 1, 1, 0
  4687. OpenImageIO: 1, 8, 13
  4688. OpenShadingLanguage: 1, 9, 9
  4689. OpenSubdiv: 0, 0, 0
  4690. OpenVDB: 5, 1, 0
  4691. Alembic: 1, 7, 8
  4692.  
  4693. OpenGL:
  4694. ============================================
  4695.  
  4696. renderer: 'AMD Radeon R6 Graphics'
  4697. vendor: 'ATI Technologies Inc.'
  4698. version: '4.5.13547 Core Profile Context 25.20.15031.5004'
  4699. extensions:
  4700. GL_AMDX_debug_output
  4701. GL_AMD_blend_minmax_factor
  4702. GL_AMD_conservative_depth
  4703. GL_AMD_debug_output
  4704. GL_AMD_depth_clamp_separate
  4705. GL_AMD_draw_buffers_blend
  4706. GL_AMD_framebuffer_sample_positions
  4707. GL_AMD_gcn_shader
  4708. GL_AMD_gpu_shader_half_float
  4709. GL_AMD_gpu_shader_int16
  4710. GL_AMD_gpu_shader_int64
  4711. GL_AMD_interleaved_elements
  4712. GL_AMD_multi_draw_indirect
  4713. GL_AMD_name_gen_delete
  4714. GL_AMD_occlusion_query_event
  4715. GL_AMD_performance_monitor
  4716. GL_AMD_pinned_memory
  4717. GL_AMD_query_buffer_object
  4718. GL_AMD_sample_positions
  4719. GL_AMD_seamless_cubemap_per_texture
  4720. GL_AMD_shader_atomic_counter_ops
  4721. GL_AMD_shader_stencil_export
  4722. GL_AMD_shader_stencil_value_export
  4723. GL_AMD_shader_trace
  4724. GL_AMD_shader_trinary_minmax
  4725. GL_AMD_sparse_texture
  4726. GL_AMD_sparse_texture_pool
  4727. GL_AMD_stencil_operation_extended
  4728. GL_AMD_texture_cube_map_array
  4729. GL_AMD_texture_texture4
  4730. GL_AMD_transform_feedback3_lines_triangles
  4731. GL_AMD_transform_feedback4
  4732. GL_AMD_vertex_shader_layer
  4733. GL_AMD_vertex_shader_viewport_index
  4734. GL_ARB_ES2_compatibility
  4735. GL_ARB_ES3_1_compatibility
  4736. GL_ARB_ES3_compatibility
  4737. GL_ARB_arrays_of_arrays
  4738. GL_ARB_base_instance
  4739. GL_ARB_bindless_texture
  4740. GL_ARB_blend_func_extended
  4741. GL_ARB_buffer_storage
  4742. GL_ARB_clear_buffer_object
  4743. GL_ARB_clear_texture
  4744. GL_ARB_clip_control
  4745. GL_ARB_color_buffer_float
  4746. GL_ARB_compressed_texture_pixel_storage
  4747. GL_ARB_compute_shader
  4748. GL_ARB_conditional_render_inverted
  4749. GL_ARB_conservative_depth
  4750. GL_ARB_copy_buffer
  4751. GL_ARB_copy_image
  4752. GL_ARB_cull_distance
  4753. GL_ARB_debug_output
  4754. GL_ARB_depth_buffer_float
  4755. GL_ARB_depth_clamp
  4756. GL_ARB_depth_texture
  4757. GL_ARB_derivative_control
  4758. GL_ARB_direct_state_access
  4759. GL_ARB_draw_buffers
  4760. GL_ARB_draw_buffers_blend
  4761. GL_ARB_draw_elements_base_vertex
  4762. GL_ARB_draw_indirect
  4763. GL_ARB_draw_instanced
  4764. GL_ARB_enhanced_layouts
  4765. GL_ARB_explicit_attrib_location
  4766. GL_ARB_explicit_uniform_location
  4767. GL_ARB_fragment_coord_conventions
  4768. GL_ARB_fragment_layer_viewport
  4769. GL_ARB_fragment_program
  4770. GL_ARB_fragment_program_shadow
  4771. GL_ARB_fragment_shader
  4772. GL_ARB_framebuffer_no_attachments
  4773. GL_ARB_framebuffer_object
  4774. GL_ARB_framebuffer_sRGB
  4775. GL_ARB_geometry_shader4
  4776. GL_ARB_get_program_binary
  4777. GL_ARB_get_texture_sub_image
  4778. GL_ARB_gl_spirv
  4779. GL_ARB_gpu_shader5
  4780. GL_ARB_gpu_shader_fp64
  4781. GL_ARB_half_float_pixel
  4782. GL_ARB_half_float_vertex
  4783. GL_ARB_imaging
  4784. GL_ARB_indirect_parameters
  4785. GL_ARB_instanced_arrays
  4786. GL_ARB_internalformat_query
  4787. GL_ARB_internalformat_query2
  4788. GL_ARB_invalidate_subdata
  4789. GL_ARB_map_buffer_alignment
  4790. GL_ARB_map_buffer_range
  4791. GL_ARB_multi_bind
  4792. GL_ARB_multi_draw_indirect
  4793. GL_ARB_multisample
  4794. GL_ARB_multitexture
  4795. GL_ARB_occlusion_query
  4796. GL_ARB_occlusion_query2
  4797. GL_ARB_parallel_shader_compile
  4798. GL_ARB_pipeline_statistics_query
  4799. GL_ARB_pixel_buffer_object
  4800. GL_ARB_point_parameters
  4801. GL_ARB_point_sprite
  4802. GL_ARB_program_interface_query
  4803. GL_ARB_provoking_vertex
  4804. GL_ARB_query_buffer_object
  4805. GL_ARB_robust_buffer_access_behavior
  4806. GL_ARB_sample_shading
  4807. GL_ARB_sampler_objects
  4808. GL_ARB_seamless_cube_map
  4809. GL_ARB_seamless_cubemap_per_texture
  4810. GL_ARB_separate_shader_objects
  4811. GL_ARB_shader_atomic_counters
  4812. GL_ARB_shader_ballot
  4813. GL_ARB_shader_bit_encoding
  4814. GL_ARB_shader_draw_parameters
  4815. GL_ARB_shader_group_vote
  4816. GL_ARB_shader_image_load_store
  4817. GL_ARB_shader_image_size
  4818. GL_ARB_shader_objects
  4819. GL_ARB_shader_precision
  4820. GL_ARB_shader_stencil_export
  4821. GL_ARB_shader_storage_buffer_object
  4822. GL_ARB_shader_subroutine
  4823. GL_ARB_shader_texture_image_samples
  4824. GL_ARB_shader_texture_lod
  4825. GL_ARB_shader_viewport_layer_array
  4826. GL_ARB_shading_language_100
  4827. GL_ARB_shading_language_420pack
  4828. GL_ARB_shading_language_packing
  4829. GL_ARB_shadow
  4830. GL_ARB_shadow_ambient
  4831. GL_ARB_sparse_buffer
  4832. GL_ARB_sparse_texture
  4833. GL_ARB_spirv_extensions
  4834. GL_ARB_stencil_texturing
  4835. GL_ARB_sync
  4836. GL_ARB_tessellation_shader
  4837. GL_ARB_texture_barrier
  4838. GL_ARB_texture_border_clamp
  4839. GL_ARB_texture_buffer_object
  4840. GL_ARB_texture_buffer_object_rgb32
  4841. GL_ARB_texture_buffer_range
  4842. GL_ARB_texture_compression
  4843. GL_ARB_texture_compression_bptc
  4844. GL_ARB_texture_compression_rgtc
  4845. GL_ARB_texture_cube_map
  4846. GL_ARB_texture_cube_map_array
  4847. GL_ARB_texture_env_add
  4848. GL_ARB_texture_env_combine
  4849. GL_ARB_texture_env_crossbar
  4850. GL_ARB_texture_env_dot3
  4851. GL_ARB_texture_float
  4852. GL_ARB_texture_gather
  4853. GL_ARB_texture_mirror_clamp_to_edge
  4854. GL_ARB_texture_mirrored_repeat
  4855. GL_ARB_texture_multisample
  4856. GL_ARB_texture_non_power_of_two
  4857. GL_ARB_texture_query_levels
  4858. GL_ARB_texture_query_lod
  4859. GL_ARB_texture_rectangle
  4860. GL_ARB_texture_rg
  4861. GL_ARB_texture_rgb10_a2ui
  4862. GL_ARB_texture_snorm
  4863. GL_ARB_texture_stencil8
  4864. GL_ARB_texture_storage
  4865. GL_ARB_texture_storage_multisample
  4866. GL_ARB_texture_swizzle
  4867. GL_ARB_texture_view
  4868. GL_ARB_timer_query
  4869. GL_ARB_transform_feedback2
  4870. GL_ARB_transform_feedback3
  4871. GL_ARB_transform_feedback_instanced
  4872. GL_ARB_transform_feedback_overflow_query
  4873. GL_ARB_transpose_matrix
  4874. GL_ARB_uniform_buffer_object
  4875. GL_ARB_vertex_array_bgra
  4876. GL_ARB_vertex_array_object
  4877. GL_ARB_vertex_attrib_64bit
  4878. GL_ARB_vertex_attrib_binding
  4879. GL_ARB_vertex_buffer_object
  4880. GL_ARB_vertex_program
  4881. GL_ARB_vertex_shader
  4882. GL_ARB_vertex_type_10f_11f_11f_rev
  4883. GL_ARB_vertex_type_2_10_10_10_rev
  4884. GL_ARB_viewport_array
  4885. GL_ARB_window_pos
  4886. GL_ATI_draw_buffers
  4887. GL_ATI_envmap_bumpmap
  4888. GL_ATI_fragment_shader
  4889. GL_ATI_separate_stencil
  4890. GL_ATI_texture_compression_3dc
  4891. GL_ATI_texture_env_combine3
  4892. GL_ATI_texture_float
  4893. GL_ATI_texture_mirror_once
  4894. GL_EXT_abgr
  4895. GL_EXT_bgra
  4896. GL_EXT_bindable_uniform
  4897. GL_EXT_blend_color
  4898. GL_EXT_blend_equation_separate
  4899. GL_EXT_blend_func_separate
  4900. GL_EXT_blend_minmax
  4901. GL_EXT_blend_subtract
  4902. GL_EXT_compiled_vertex_array
  4903. GL_EXT_copy_buffer
  4904. GL_EXT_copy_texture
  4905. GL_EXT_depth_bounds_test
  4906. GL_EXT_direct_state_access
  4907. GL_EXT_draw_buffers2
  4908. GL_EXT_draw_instanced
  4909. GL_EXT_draw_range_elements
  4910. GL_EXT_fog_coord
  4911. GL_EXT_framebuffer_blit
  4912. GL_EXT_framebuffer_multisample
  4913. GL_EXT_framebuffer_object
  4914. GL_EXT_framebuffer_sRGB
  4915. GL_EXT_geometry_shader4
  4916. GL_EXT_gpu_program_parameters
  4917. GL_EXT_gpu_shader4
  4918. GL_EXT_histogram
  4919. GL_EXT_memory_object
  4920. GL_EXT_memory_object_win32
  4921. GL_EXT_multi_draw_arrays
  4922. GL_EXT_packed_depth_stencil
  4923. GL_EXT_packed_float
  4924. GL_EXT_packed_pixels
  4925. GL_EXT_pixel_buffer_object
  4926. GL_EXT_point_parameters
  4927. GL_EXT_polygon_offset_clamp
  4928. GL_EXT_provoking_vertex
  4929. GL_EXT_rescale_normal
  4930. GL_EXT_secondary_color
  4931. GL_EXT_semaphore
  4932. GL_EXT_semaphore_win32
  4933. GL_EXT_separate_specular_color
  4934. GL_EXT_shader_image_load_store
  4935. GL_EXT_shader_integer_mix
  4936. GL_EXT_shadow_funcs
  4937. GL_EXT_stencil_wrap
  4938. GL_EXT_subtexture
  4939. GL_EXT_texgen_reflection
  4940. GL_EXT_texture3D
  4941. GL_EXT_texture_array
  4942. GL_EXT_texture_buffer_object
  4943. GL_EXT_texture_compression_bptc
  4944. GL_EXT_texture_compression_latc
  4945. GL_EXT_texture_compression_rgtc
  4946. GL_EXT_texture_compression_s3tc
  4947. GL_EXT_texture_cube_map
  4948. GL_EXT_texture_edge_clamp
  4949. GL_EXT_texture_env_add
  4950. GL_EXT_texture_env_combine
  4951. GL_EXT_texture_env_dot3
  4952. GL_EXT_texture_filter_anisotropic
  4953. GL_EXT_texture_integer
  4954. GL_EXT_texture_lod
  4955. GL_EXT_texture_lod_bias
  4956. GL_EXT_texture_mirror_clamp
  4957. GL_EXT_texture_object
  4958. GL_EXT_texture_rectangle
  4959. GL_EXT_texture_sRGB
  4960. GL_EXT_texture_sRGB_decode
  4961. GL_EXT_texture_shared_exponent
  4962. GL_EXT_texture_snorm
  4963. GL_EXT_texture_storage
  4964. GL_EXT_texture_swizzle
  4965. GL_EXT_timer_query
  4966. GL_EXT_transform_feedback
  4967. GL_EXT_vertex_array
  4968. GL_EXT_vertex_array_bgra
  4969. GL_EXT_vertex_attrib_64bit
  4970. GL_IBM_texture_mirrored_repeat
  4971. GL_KHR_context_flush_control
  4972. GL_KHR_debug
  4973. GL_KHR_no_error
  4974. GL_KHR_parallel_shader_compile
  4975. GL_KHR_robust_buffer_access_behavior
  4976. GL_KHR_robustness
  4977. GL_KTX_buffer_region
  4978. GL_NV_alpha_to_coverage_dither_control
  4979. GL_NV_blend_square
  4980. GL_NV_conditional_render
  4981. GL_NV_copy_depth_to_color
  4982. GL_NV_copy_image
  4983. GL_NV_depth_buffer_float
  4984. GL_NV_explicit_multisample
  4985. GL_NV_float_buffer
  4986. GL_NV_half_float
  4987. GL_NV_primitive_restart
  4988. GL_NV_texgen_reflection
  4989. GL_NV_texture_barrier
  4990. GL_OES_EGL_image
  4991. GL_SGIS_generate_mipmap
  4992. GL_SGIS_texture_edge_clamp
  4993. GL_SGIS_texture_lod
  4994. GL_SUN_multi_draw_arrays
  4995. GL_WIN_swap_hint
  4996. WGL_EXT_swap_control
  4997.  
  4998. Implementation Dependent OpenGL Limits:
  4999. ============================================
  5000.  
  5001. Maximum DrawElements Vertices: 536870911
  5002. Maximum DrawElements Indices: 536870911
  5003.  
  5004. GLSL:
  5005. Maximum Varying Floats: 128
  5006. Maximum Vertex Attributes: 29
  5007. Maximum Vertex Uniform Components: 16384
  5008. Maximum Fragment Uniform Components: 16384
  5009. Maximum Vertex Image Units: 32
  5010. Maximum Fragment Image Units: 32
  5011. Maximum Pipeline Image Units: 160
  5012.  
  5013. Cycles:
  5014. ============================================
  5015.  
  5016.  
  5017. CPU device capabilities: SSE2 SSE3 SSE41 AVX AVX2
  5018.  
  5019. OpenCL device capabilities:
  5020. Number of platforms: 1
  5021. Platform #0
  5022. Platform Name: AMD Accelerated Parallel Processing
  5023. Platform Vendor: Advanced Micro Devices, Inc.
  5024. Platform Version: OpenCL 2.1 AMD-APP (2766.5)
  5025. Platform Profile: FULL_PROFILE
  5026. Platform Extensions: cl_khr_icd cl_khr_d3d10_sharing cl_khr_d3d11_sharing cl_khr_dx9_media_sharing cl_amd_event_callback cl_amd_offline_devices
  5027. Number of devices: 1
  5028. Device: #0
  5029. Device Name: Carrizo
  5030. Device Board Name: AMD Radeon R6 Graphics
  5031. Device Vendor: Advanced Micro Devices, Inc.
  5032. Device OpenCL C Version: OpenCL C 2.0
  5033. Device Profile: FULL_PROFILE
  5034. Device Version: OpenCL 2.0 AMD-APP (2766.5)
  5035. Device Extensions: cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_fp16 cl_khr_gl_sharing cl_khr_gl_depth_images cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_media_ops2 cl_amd_popcnt cl_khr_d3d10_sharing cl_khr_d3d11_sharing cl_khr_dx9_media_sharing cl_khr_image2d_from_buffer cl_khr_spir cl_khr_subgroups cl_khr_gl_event cl_khr_depth_images cl_khr_mipmap_image cl_khr_mipmap_image_writes cl_amd_liquid_flash cl_amd_planar_yuv
  5036. Device Max clock frequency (MHz): 720
  5037. Device Max compute units: 6
  5038. Device Max work group size: 256
  5039.  
  5040. Enabled add-ons:
  5041. ============================================
  5042.  
  5043. io_scene_fbx (version: (4, 14, 5), path: I:\BlenderUpdater\2.80\scripts\addons\io_scene_fbx\__init__.py)
  5044. io_anim_bvh (version: (1, 0, 0), path: I:\BlenderUpdater\2.80\scripts\addons\io_anim_bvh\__init__.py)
  5045. io_mesh_ply (version: (1, 0, 0), path: I:\BlenderUpdater\2.80\scripts\addons\io_mesh_ply\__init__.py)
  5046. io_scene_obj (version: (3, 5, 6), path: I:\BlenderUpdater\2.80\scripts\addons\io_scene_obj\__init__.py)
  5047. io_scene_x3d (version: (2, 2, 1), path: I:\BlenderUpdater\2.80\scripts\addons\io_scene_x3d\__init__.py)
  5048. io_mesh_stl (version: (1, 1, 3), path: I:\BlenderUpdater\2.80\scripts\addons\io_mesh_stl\__init__.py)
  5049. io_mesh_uv_layout (version: (1, 1, 1), path: I:\BlenderUpdater\2.80\scripts\addons\io_mesh_uv_layout\__init__.py)
  5050. io_curve_svg (version: UNKNOWN, path: I:\BlenderUpdater\2.80\scripts\addons\io_curve_svg\__init__.py)
  5051. cycles (version: UNKNOWN, path: I:\BlenderUpdater\2.80\scripts\addons\cycles\__init__.py)
  5052. io_scene_gltf2 (version: (0, 9, 2), path: I:\BlenderUpdater\2.80\scripts\addons\io_scene_gltf2\__init__.py)
  5053. ant_landscape (version: (0, 1, 8), path: I:\BlenderUpdater\2.80\scripts\addons\ant_landscape\__init__.py)
  5054. space_view3d_3d_navigation (version: (1, 2, 4), path: I:\BlenderUpdater\2.80\scripts\addons\space_view3d_3d_navigation.py)
  5055. add_curve_ivygen (version: (0, 1, 5), path: I:\BlenderUpdater\2.80\scripts\addons\add_curve_ivygen.py)
  5056. add_curve_sapling (version: (0, 3, 4), path: I:\BlenderUpdater\2.80\scripts\addons\add_curve_sapling\__init__.py)
  5057. add_mesh_geodesic_domes (version: (0, 3, 3), path: I:\BlenderUpdater\2.80\scripts\addons\add_mesh_geodesic_domes\__init__.py)
  5058. node_wrangler (version: (3, 35), path: I:\BlenderUpdater\2.80\scripts\addons\node_wrangler.py)
  5059. rigify (version: (0, 5, 1), path: I:\BlenderUpdater\2.80\scripts\addons\rigify\__init__.py)
  5060. RenderManForBlender-21_5_0 (version: (21, 5, 0), path: C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\RenderManForBlender-21_5_0\__init__.py)
  5061. blenderkit (version: (1, 0, 22), path: I:\BlenderUpdater\2.80\scripts\addons\blenderkit\__init__.py)
  5062. io_scene_valvesource (version: (2, 11, '0b1'), path: C:\Users\Administrator\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\io_scene_valvesource\__init__.py)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement