Name
*
Code
{"properties":{"frame":0,"maxFrame":600,"maxFrameLocked":false,"realtimeState":true,"mainCameraPath":"/cameras/cameras:sopGroup/perspectiveCamera1","versions":{"polygonjs":"1.5.66"}},"root":{"type":"root","nodes":{"geo1":{"type":"geo","nodes":{"plane1":{"type":"plane"},"material1":{"type":"material","params":{"material":"../MAT/meshBasicBuilder1"},"inputs":["plane1"],"flags":{"display":true}},"MAT":{"type":"materialsNetwork","nodes":{"meshBasicBuilder1":{"type":"meshBasicBuilder","nodes":{"globals1":{"type":"globals"},"output1":{"type":"output","inputs":[null,null,{"index":2,"inputName":"color","node":"vec4ToVec3_1","output":"vec3"}]},"vec2ToVec3_1":{"type":"vec2ToVec3","params":{"vec2":{"overriden_options":{}},"z":{"overriden_options":{}}},"inputs":[{"index":0,"inputName":"vec2","node":"subtract2","output":"subtract"}]},"subtract2":{"type":"subtract","params":{"sub0":{"type":"vector2","default_value":[0,0],"options":{"spare":true,"editable":false,"computeOnDirty":true,"dependentOnFoundParam":false}},"sub1":{"type":"vector2","default_value":[0,0],"options":{"spare":true,"editable":true,"computeOnDirty":true,"dependentOnFoundParam":false},"raw_input":[0.5,0.5]}},"inputs":[{"index":0,"inputName":"sub0","node":"globals1","output":"uv"}],"connection_points":{"in":[{"name":"sub0","type":"vec2"},{"name":"sub1","type":"vec2"}],"out":[{"name":"subtract","type":"vec2"}]}},"colorCorrect1":{"type":"colorCorrect","params":{"color":{"overriden_options":{}},"from":1,"to":0},"inputs":[{"index":0,"inputName":"color","node":"vec3ToVec4_1","output":"vec4"}]},"vec3ToVec4_1":{"type":"vec3ToVec4","params":{"vec3":{"overriden_options":{}},"w":{"overriden_options":{}}},"inputs":[{"index":0,"inputName":"vec3","node":"vec2ToVec3_1","output":"vec3"}]},"vec4ToVec3_1":{"type":"vec4ToVec3","params":{"vec4":{"overriden_options":{}}},"inputs":[{"index":0,"inputName":"vec4","node":"colorCorrect1","output":"out"}]}},"persisted_config":{"material":{"metadata":{"version":4.6,"type":"Material","generator":"Material.toJSON"},"uuid":"/geo1/MAT/meshBasicBuilder1-main","type":"MeshBasicMaterial","color":16777215,"reflectivity":1,"refractionRatio":0.98,"blendColor":0,"fog":false},"onBeforeCompileDataJSONWithoutShaders":{"paramConfigs":[],"timeDependent":false,"resolutionDependent":false,"raymarchingLightsWorldCoordsDependent":false},"customMaterials":{"customDepthMaterial":{"material":{"metadata":{"version":4.6,"type":"Material","generator":"Material.toJSON"},"uuid":"/geo1/MAT/meshBasicBuilder1-customDepthMaterial","type":"MeshDepthMaterial","name":"customDepthMaterial","side":1,"blendColor":0,"depthPacking":3201},"onBeforeCompileDataJSONWithoutShaders":{"paramConfigs":[],"timeDependent":false,"resolutionDependent":false,"raymarchingLightsWorldCoordsDependent":false}},"customDistanceMaterial":{"material":{"metadata":{"version":4.6,"type":"Material","generator":"Material.toJSON"},"uuid":"/geo1/MAT/meshBasicBuilder1-customDistanceMaterial","type":"MeshDistanceMaterial","name":"customDistanceMaterial","blendColor":0},"onBeforeCompileDataJSONWithoutShaders":{"paramConfigs":[],"timeDependent":false,"resolutionDependent":false,"raymarchingLightsWorldCoordsDependent":false}},"customDepthDOFMaterial":{"material":{"metadata":{"version":4.6,"type":"Material","generator":"Material.toJSON"},"uuid":"/geo1/MAT/meshBasicBuilder1-customDepthDOFMaterial","type":"MeshDepthMaterial","name":"customDepthDOFMaterial","blendColor":0,"depthPacking":3200},"onBeforeCompileDataJSONWithoutShaders":{"paramConfigs":[],"timeDependent":false,"resolutionDependent":false,"raymarchingLightsWorldCoordsDependent":false}}}}}}}},"params":{"CADLinearTolerance":{"overriden_options":{"callback":"{}"}},"CADAngularTolerance":{"overriden_options":{"callback":"{}"}},"CADCurveAbscissa":{"overriden_options":{"callback":"{}"}},"CADCurveTolerance":{"overriden_options":{"callback":"{}"}},"CADDisplayEdges":{"overriden_options":{"callback":"{}"}},"CADEdgesColor":{"overriden_options":{"callback":"{}"}},"CADDisplayMeshes":{"overriden_options":{"callback":"{}"}},"CADMeshesColor":{"overriden_options":{"callback":"{}"}},"CADWireframe":{"overriden_options":{"callback":"{}"}},"CSGFacetAngle":{"overriden_options":{"callback":"{}"}},"CSGLinesColor":{"overriden_options":{"callback":"{}"}},"CSGMeshesColor":{"overriden_options":{"callback":"{}"}},"CSGWireframe":{"overriden_options":{"callback":"{}"}},"QUADTriangles":{"overriden_options":{"callback":"{}"}},"QUADWireframe":{"overriden_options":{"callback":"{}"}},"TetScale":{"overriden_options":{"callback":"{}"}},"TetDisplayLines":{"overriden_options":{"callback":"{}"}},"TetDisplaySharedFaces":{"overriden_options":{"callback":"{}"}},"TetDisplayPoints":{"overriden_options":{"callback":"{}"}},"TetDisplayCenter":{"overriden_options":{"callback":"{}"}},"TetDisplaySphere":{"overriden_options":{"callback":"{}"}}},"flags":{"display":true}},"COP":{"type":"copNetwork","nodes":{"envMap":{"type":"envMap","inputs":["imageEnv"]},"imageEnv":{"type":"imageEXR","params":{"tminFilter":true,"tmagFilter":true,"tanisotropy":true,"useRendererMaxAnisotropy":true}},"image1":{"type":"image"}}},"lights":{"type":"geo","nodes":{"hemisphereLight1":{"type":"hemisphereLight","params":{"intensity":0.52}},"spotLight1":{"type":"spotLight","params":{"decay":0.1,"distance":10,"castShadow":true}},"polarTransform1":{"type":"polarTransform","params":{"center":[0,0.7,0],"latitude":25.2,"depth":3},"inputs":["spotLight1"]},"merge1":{"type":"merge","inputs":["hemisphereLight1","polarTransform1"],"flags":{"display":true}}},"params":{"CADLinearTolerance":{"overriden_options":{"callback":"{}"}},"CADAngularTolerance":{"overriden_options":{"callback":"{}"}},"CADCurveAbscissa":{"overriden_options":{"callback":"{}"}},"CADCurveTolerance":{"overriden_options":{"callback":"{}"}},"CADDisplayEdges":{"overriden_options":{"callback":"{}"}},"CADEdgesColor":{"overriden_options":{"callback":"{}"}},"CADDisplayMeshes":{"overriden_options":{"callback":"{}"}},"CADMeshesColor":{"overriden_options":{"callback":"{}"}},"CADWireframe":{"overriden_options":{"callback":"{}"}},"CSGFacetAngle":{"overriden_options":{"callback":"{}"}},"CSGLinesColor":{"overriden_options":{"callback":"{}"}},"CSGMeshesColor":{"overriden_options":{"callback":"{}"}},"CSGWireframe":{"overriden_options":{"callback":"{}"}},"QUADTriangles":{"overriden_options":{"callback":"{}"}},"QUADWireframe":{"overriden_options":{"callback":"{}"}},"TetScale":{"overriden_options":{"callback":"{}"}},"TetDisplayLines":{"overriden_options":{"callback":"{}"}},"TetDisplaySharedFaces":{"overriden_options":{"callback":"{}"}},"TetDisplayPoints":{"overriden_options":{"callback":"{}"}},"TetDisplayCenter":{"overriden_options":{"callback":"{}"}},"TetDisplaySphere":{"overriden_options":{"callback":"{}"}}},"flags":{"display":true}},"cameras":{"type":"geo","nodes":{"perspectiveCamera1":{"type":"perspectiveCamera","params":{"position":[0.08545380203960441,1.5602120603036882,0.8830091854174875],"rotation":[-61.7023899016352,-0.11919869782992192,-0.22139686695529964]}},"cameraControls1":{"type":"cameraControls","nodes":{"cameraOrbitControls1":{"type":"cameraOrbitControls","params":{"target":[0.08773341037027677,0.5954089967550629,0.36356816948000514]}}},"params":{"node":"cameraOrbitControls1"},"inputs":["perspectiveCamera1"]},"cameraRenderer1":{"type":"cameraRenderer","nodes":{"WebGLRenderer1":{"type":"WebGLRenderer","params":{"toneMapping":0}}},"params":{"node":"WebGLRenderer1"},"inputs":["cameraControls1"],"flags":{"display":true}}},"params":{"CADLinearTolerance":{"overriden_options":{"callback":"{}"}},"CADAngularTolerance":{"overriden_options":{"callback":"{}"}},"CADCurveAbscissa":{"overriden_options":{"callback":"{}"}},"CADCurveTolerance":{"overriden_options":{"callback":"{}"}},"CADDisplayEdges":{"overriden_options":{"callback":"{}"}},"CADEdgesColor":{"overriden_options":{"callback":"{}"}},"CADDisplayMeshes":{"overriden_options":{"callback":"{}"}},"CADMeshesColor":{"overriden_options":{"callback":"{}"}},"CADWireframe":{"overriden_options":{"callback":"{}"}},"CSGFacetAngle":{"overriden_options":{"callback":"{}"}},"CSGLinesColor":{"overriden_options":{"callback":"{}"}},"CSGMeshesColor":{"overriden_options":{"callback":"{}"}},"CSGWireframe":{"overriden_options":{"callback":"{}"}},"QUADTriangles":{"overriden_options":{"callback":"{}"}},"QUADWireframe":{"overriden_options":{"callback":"{}"}},"TetScale":{"overriden_options":{"callback":"{}"}},"TetDisplayLines":{"overriden_options":{"callback":"{}"}},"TetDisplaySharedFaces":{"overriden_options":{"callback":"{}"}},"TetDisplayPoints":{"overriden_options":{"callback":"{}"}},"TetDisplayCenter":{"overriden_options":{"callback":"{}"}},"TetDisplaySphere":{"overriden_options":{"callback":"{}"}}},"flags":{"display":true}},"geo2":{"type":"geo","nodes":{"planeHelper1":{"type":"planeHelper","flags":{"display":true}}},"params":{"CADLinearTolerance":{"overriden_options":{"callback":"{}"}},"CADAngularTolerance":{"overriden_options":{"callback":"{}"}},"CADCurveAbscissa":{"overriden_options":{"callback":"{}"}},"CADCurveTolerance":{"overriden_options":{"callback":"{}"}},"CADDisplayEdges":{"overriden_options":{"callback":"{}"}},"CADEdgesColor":{"overriden_options":{"callback":"{}"}},"CADDisplayMeshes":{"overriden_options":{"callback":"{}"}},"CADMeshesColor":{"overriden_options":{"callback":"{}"}},"CADWireframe":{"overriden_options":{"callback":"{}"}},"CSGFacetAngle":{"overriden_options":{"callback":"{}"}},"CSGLinesColor":{"overriden_options":{"callback":"{}"}},"CSGMeshesColor":{"overriden_options":{"callback":"{}"}},"CSGWireframe":{"overriden_options":{"callback":"{}"}},"QUADTriangles":{"overriden_options":{"callback":"{}"}},"QUADWireframe":{"overriden_options":{"callback":"{}"}},"TetScale":{"overriden_options":{"callback":"{}"}},"TetDisplayLines":{"overriden_options":{"callback":"{}"}},"TetDisplaySharedFaces":{"overriden_options":{"callback":"{}"}},"TetDisplayPoints":{"overriden_options":{"callback":"{}"}},"TetDisplayCenter":{"overriden_options":{"callback":"{}"}},"TetDisplaySphere":{"overriden_options":{"callback":"{}"}}},"flags":{"display":true}}},"params":{"mainCameraPath":"/cameras/cameras:sopGroup/perspectiveCamera1"}},"ui":{"nodes":{"geo1":{"pos":[50,-300],"selection":["MAT"],"nodes":{"plane1":{"pos":[-100,200]},"material1":{"pos":[-100,350]},"MAT":{"pos":[-300,350],"selection":["meshBasicBuilder1"],"nodes":{"meshBasicBuilder1":{"pos":[-50,-150],"nodes":{"globals1":{"pos":[-350,0]},"output1":{"pos":[550,0]},"vec2ToVec3_1":{"pos":[50,50]},"subtract2":{"pos":[-150,50]},"colorCorrect1":{"pos":[300,200]},"vec3ToVec4_1":{"pos":[150,200]},"vec4ToVec3_1":{"pos":[450,200]}}}}}}},"COP":{"pos":[-200,0],"selection":["image1"],"nodes":{"envMap":{"pos":[50,250]},"imageEnv":{"pos":[50,100]},"image1":{"pos":[-200,100]}}},"lights":{"pos":[50,-200],"selection":["hemisphereLight1"],"nodes":{"hemisphereLight1":{"pos":[50,-50]},"spotLight1":{"pos":[300,-50]},"polarTransform1":{"pos":[300,150]},"merge1":{"pos":[100,300]}}},"cameras":{"pos":[50,-100],"nodes":{"perspectiveCamera1":{"pos":[0,-50]},"cameraControls1":{"pos":[0,150],"nodes":{"cameraOrbitControls1":{"pos":[0,0]}}},"cameraRenderer1":{"pos":[-50,300],"selection":["WebGLRenderer1"],"nodes":{"WebGLRenderer1":{"pos":[0,0]}}}}},"geo2":{"pos":[50,-400],"nodes":{"planeHelper1":{"pos":[0,-50]}}}}},"shaders":{"/geo1/MAT/meshBasicBuilder1":{"vertex":"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n\n\n\n// /geo1/MAT/meshBasicBuilder1/globals1\nvarying vec2 v_POLY_globals1_uv;\n\n\n\n\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\n\n\n\t// /geo1/MAT/meshBasicBuilder1/globals1\n\tv_POLY_globals1_uv = vec2(uv);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/output1\n\tvec3 transformed = position;\n\tvec3 objectNormal = normal;\n\t#ifdef USE_TANGENT\n\t\tvec3 objectTangent = vec3( tangent.xyz );\n\t#endif\n\n\n\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n// removed:\n//\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n// removed:\n//\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}","fragment":"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n\n\n\n// /geo1/MAT/meshBasicBuilder1/colorCorrect1\n// from https://github.com/williammalo/hsluv-glsl\n/*\nHSLUV-GLSL v4.2\nHSLUV is a human-friendly alternative to HSL. ( http://www.hsluv.org )\nGLSL port by William Malo ( https://github.com/williammalo )\nPut this code in your fragment shader.\n*/\n\nvec3 hsluv_intersectLineLine(vec3 line1x, vec3 line1y, vec3 line2x, vec3 line2y) {\n\treturn (line1y - line2y) / (line2x - line1x);\n}\n\nvec3 hsluv_distanceFromPole(vec3 pointx,vec3 pointy) {\n\treturn sqrt(pointx*pointx + pointy*pointy);\n}\n\nvec3 hsluv_lengthOfRayUntilIntersect(float theta, vec3 x, vec3 y) {\n\tvec3 len = y / (sin(theta) - x * cos(theta));\n\tif (len.r < 0.0) {len.r=1000.0;}\n\tif (len.g < 0.0) {len.g=1000.0;}\n\tif (len.b < 0.0) {len.b=1000.0;}\n\treturn len;\n}\n\nfloat hsluv_maxSafeChromaForL(float L){\n\tmat3 m2 = mat3(\n\t\t 3.2409699419045214 ,-0.96924363628087983 , 0.055630079696993609,\n\t\t-1.5373831775700935 , 1.8759675015077207 ,-0.20397695888897657 ,\n\t\t-0.49861076029300328 , 0.041555057407175613, 1.0569715142428786 \n\t);\n\tfloat sub0 = L + 16.0;\n\tfloat sub1 = sub0 * sub0 * sub0 * .000000641;\n\tfloat sub2 = sub1 > 0.0088564516790356308 ? sub1 : L / 903.2962962962963;\n\n\tvec3 top1 = (284517.0 * m2[0] - 94839.0 * m2[2]) * sub2;\n\tvec3 bottom = (632260.0 * m2[2] - 126452.0 * m2[1]) * sub2;\n\tvec3 top2 = (838422.0 * m2[2] + 769860.0 * m2[1] + 731718.0 * m2[0]) * L * sub2;\n\n\tvec3 bounds0x = top1 / bottom;\n\tvec3 bounds0y = top2 / bottom;\n\n\tvec3 bounds1x = top1 / (bottom+126452.0);\n\tvec3 bounds1y = (top2-769860.0*L) / (bottom+126452.0);\n\n\tvec3 xs0 = hsluv_intersectLineLine(bounds0x, bounds0y, -1.0/bounds0x, vec3(0.0) );\n\tvec3 xs1 = hsluv_intersectLineLine(bounds1x, bounds1y, -1.0/bounds1x, vec3(0.0) );\n\n\tvec3 lengths0 = hsluv_distanceFromPole( xs0, bounds0y + xs0 * bounds0x );\n\tvec3 lengths1 = hsluv_distanceFromPole( xs1, bounds1y + xs1 * bounds1x );\n\n\treturn min(lengths0.r,\n\t\t\tmin(lengths1.r,\n\t\t\tmin(lengths0.g,\n\t\t\tmin(lengths1.g,\n\t\t\tmin(lengths0.b,\n\t\t\t\tlengths1.b)))));\n}\n\nfloat hsluv_maxChromaForLH(float L, float H) {\n\n\tfloat hrad = radians(H);\n\n\tmat3 m2 = mat3(\n\t\t 3.2409699419045214 ,-0.96924363628087983 , 0.055630079696993609,\n\t\t-1.5373831775700935 , 1.8759675015077207 ,-0.20397695888897657 ,\n\t\t-0.49861076029300328 , 0.041555057407175613, 1.0569715142428786 \n\t);\n\tfloat sub1 = pow(L + 16.0, 3.0) / 1560896.0;\n\tfloat sub2 = sub1 > 0.0088564516790356308 ? sub1 : L / 903.2962962962963;\n\n\tvec3 top1 = (284517.0 * m2[0] - 94839.0 * m2[2]) * sub2;\n\tvec3 bottom = (632260.0 * m2[2] - 126452.0 * m2[1]) * sub2;\n\tvec3 top2 = (838422.0 * m2[2] + 769860.0 * m2[1] + 731718.0 * m2[0]) * L * sub2;\n\n\tvec3 bound0x = top1 / bottom;\n\tvec3 bound0y = top2 / bottom;\n\n\tvec3 bound1x = top1 / (bottom+126452.0);\n\tvec3 bound1y = (top2-769860.0*L) / (bottom+126452.0);\n\n\tvec3 lengths0 = hsluv_lengthOfRayUntilIntersect(hrad, bound0x, bound0y );\n\tvec3 lengths1 = hsluv_lengthOfRayUntilIntersect(hrad, bound1x, bound1y );\n\n\treturn min(lengths0.r,\n\t\t\tmin(lengths1.r,\n\t\t\tmin(lengths0.g,\n\t\t\tmin(lengths1.g,\n\t\t\tmin(lengths0.b,\n\t\t\t\tlengths1.b)))));\n}\n\nfloat hsluv_fromLinear(float c) {\n\treturn c <= 0.0031308 ? 12.92 * c : 1.055 * pow(c, 1.0 / 2.4) - 0.055;\n}\nvec3 hsluv_fromLinear(vec3 c) {\n\treturn vec3( hsluv_fromLinear(c.r), hsluv_fromLinear(c.g), hsluv_fromLinear(c.b) );\n}\n\nfloat hsluv_toLinear(float c) {\n\treturn c > 0.04045 ? pow((c + 0.055) / (1.0 + 0.055), 2.4) : c / 12.92;\n}\n\nvec3 hsluv_toLinear(vec3 c) {\n\treturn vec3( hsluv_toLinear(c.r), hsluv_toLinear(c.g), hsluv_toLinear(c.b) );\n}\n\nfloat hsluv_yToL(float Y){\n\treturn Y <= 0.0088564516790356308 ? Y * 903.2962962962963 : 116.0 * pow(Y, 1.0 / 3.0) - 16.0;\n}\n\nfloat hsluv_lToY(float L) {\n\treturn L <= 8.0 ? L / 903.2962962962963 : pow((L + 16.0) / 116.0, 3.0);\n}\n\nvec3 xyzToRgb(vec3 tuple) {\n\tconst mat3 m = mat3( \n\t\t3.2409699419045214 ,-1.5373831775700935 ,-0.49861076029300328 ,\n\t\t-0.96924363628087983 , 1.8759675015077207 , 0.041555057407175613,\n\t\t0.055630079696993609,-0.20397695888897657, 1.0569715142428786 );\n\t\n\treturn hsluv_fromLinear(tuple*m);\n}\n\nvec3 rgbToXyz(vec3 tuple) {\n\tconst mat3 m = mat3(\n\t\t0.41239079926595948 , 0.35758433938387796, 0.18048078840183429 ,\n\t\t0.21263900587151036 , 0.71516867876775593, 0.072192315360733715,\n\t\t0.019330818715591851, 0.11919477979462599, 0.95053215224966058 \n\t);\n\treturn hsluv_toLinear(tuple) * m;\n}\n\nvec3 xyzToLuv(vec3 tuple){\n\tfloat X = tuple.x;\n\tfloat Y = tuple.y;\n\tfloat Z = tuple.z;\n\n\tfloat L = hsluv_yToL(Y);\n\t\n\tfloat div = 1./dot(tuple,vec3(1,15,3)); \n\n\treturn vec3(\n\t\t1.,\n\t\t(52. * (X*div) - 2.57179),\n\t\t(117.* (Y*div) - 6.08816)\n\t) * L;\n}\n\n\nvec3 luvToXyz(vec3 tuple) {\n\tfloat L = tuple.x;\n\n\tfloat U = tuple.y / (13.0 * L) + 0.19783000664283681;\n\tfloat V = tuple.z / (13.0 * L) + 0.468319994938791;\n\n\tfloat Y = hsluv_lToY(L);\n\tfloat X = 2.25 * U * Y / V;\n\tfloat Z = (3./V - 5.)*Y - (X/3.);\n\n\treturn vec3(X, Y, Z);\n}\n\nvec3 luvToLch(vec3 tuple) {\n\tfloat L = tuple.x;\n\tfloat U = tuple.y;\n\tfloat V = tuple.z;\n\n\tfloat C = length(tuple.yz);\n\tfloat H = degrees(atan(V,U));\n\tif (H < 0.0) {\n\t\tH = 360.0 + H;\n\t}\n\t\n\treturn vec3(L, C, H);\n}\n\nvec3 lchToLuv(vec3 tuple) {\n\tfloat hrad = radians(tuple.b);\n\treturn vec3(\n\t\ttuple.r,\n\t\tcos(hrad) * tuple.g,\n\t\tsin(hrad) * tuple.g\n\t);\n}\n\nvec3 hsluvToLch(vec3 tuple) {\n\ttuple.g *= hsluv_maxChromaForLH(tuple.b, tuple.r) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToHsluv(vec3 tuple) {\n\ttuple.g /= hsluv_maxChromaForLH(tuple.r, tuple.b) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 hpluvToLch(vec3 tuple) {\n\ttuple.g *= hsluv_maxSafeChromaForL(tuple.b) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToHpluv(vec3 tuple) {\n\ttuple.g /= hsluv_maxSafeChromaForL(tuple.r) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToRgb(vec3 tuple) {\n\treturn xyzToRgb(luvToXyz(lchToLuv(tuple)));\n}\n\nvec3 rgbToLch(vec3 tuple) {\n\treturn luvToLch(xyzToLuv(rgbToXyz(tuple)));\n}\n\nvec3 hsluvToRgb(vec3 tuple) {\n\treturn lchToRgb(hsluvToLch(tuple));\n}\n\nvec3 rgbToHsluv(vec3 tuple) {\n\treturn lchToHsluv(rgbToLch(tuple));\n}\n\nvec3 hpluvToRgb(vec3 tuple) {\n\treturn lchToRgb(hpluvToLch(tuple));\n}\n\nvec3 rgbToHpluv(vec3 tuple) {\n\treturn lchToHpluv(rgbToLch(tuple));\n}\n\nvec3 luvToRgb(vec3 tuple){\n\treturn xyzToRgb(luvToXyz(tuple));\n}\n\n// allow vec4's\nvec4 xyzToRgb(vec4 c) {return vec4( xyzToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToXyz(vec4 c) {return vec4( rgbToXyz( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 xyzToLuv(vec4 c) {return vec4( xyzToLuv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToXyz(vec4 c) {return vec4( luvToXyz( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToLch(vec4 c) {return vec4( luvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToLuv(vec4 c) {return vec4( lchToLuv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hsluvToLch(vec4 c) {return vec4( hsluvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToHsluv(vec4 c) {return vec4( lchToHsluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hpluvToLch(vec4 c) {return vec4( hpluvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToHpluv(vec4 c) {return vec4( lchToHpluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToRgb(vec4 c) {return vec4( lchToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToLch(vec4 c) {return vec4( rgbToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hsluvToRgb(vec4 c) {return vec4( hsluvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToHsluv(vec4 c) {return vec4( rgbToHsluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hpluvToRgb(vec4 c) {return vec4( hpluvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToHpluv(vec4 c) {return vec4( rgbToHpluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToRgb(vec4 c) {return vec4( luvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\n// allow 3 floats\nvec3 xyzToRgb(float x, float y, float z) {return xyzToRgb( vec3(x,y,z) );}\nvec3 rgbToXyz(float x, float y, float z) {return rgbToXyz( vec3(x,y,z) );}\nvec3 xyzToLuv(float x, float y, float z) {return xyzToLuv( vec3(x,y,z) );}\nvec3 luvToXyz(float x, float y, float z) {return luvToXyz( vec3(x,y,z) );}\nvec3 luvToLch(float x, float y, float z) {return luvToLch( vec3(x,y,z) );}\nvec3 lchToLuv(float x, float y, float z) {return lchToLuv( vec3(x,y,z) );}\nvec3 hsluvToLch(float x, float y, float z) {return hsluvToLch( vec3(x,y,z) );}\nvec3 lchToHsluv(float x, float y, float z) {return lchToHsluv( vec3(x,y,z) );}\nvec3 hpluvToLch(float x, float y, float z) {return hpluvToLch( vec3(x,y,z) );}\nvec3 lchToHpluv(float x, float y, float z) {return lchToHpluv( vec3(x,y,z) );}\nvec3 lchToRgb(float x, float y, float z) {return lchToRgb( vec3(x,y,z) );}\nvec3 rgbToLch(float x, float y, float z) {return rgbToLch( vec3(x,y,z) );}\nvec3 hsluvToRgb(float x, float y, float z) {return hsluvToRgb( vec3(x,y,z) );}\nvec3 rgbToHsluv(float x, float y, float z) {return rgbToHsluv( vec3(x,y,z) );}\nvec3 hpluvToRgb(float x, float y, float z) {return hpluvToRgb( vec3(x,y,z) );}\nvec3 rgbToHpluv(float x, float y, float z) {return rgbToHpluv( vec3(x,y,z) );}\nvec3 luvToRgb(float x, float y, float z) {return luvToRgb( vec3(x,y,z) );}\n// allow 4 floats\nvec4 xyzToRgb(float x, float y, float z, float a) {return xyzToRgb( vec4(x,y,z,a) );}\nvec4 rgbToXyz(float x, float y, float z, float a) {return rgbToXyz( vec4(x,y,z,a) );}\nvec4 xyzToLuv(float x, float y, float z, float a) {return xyzToLuv( vec4(x,y,z,a) );}\nvec4 luvToXyz(float x, float y, float z, float a) {return luvToXyz( vec4(x,y,z,a) );}\nvec4 luvToLch(float x, float y, float z, float a) {return luvToLch( vec4(x,y,z,a) );}\nvec4 lchToLuv(float x, float y, float z, float a) {return lchToLuv( vec4(x,y,z,a) );}\nvec4 hsluvToLch(float x, float y, float z, float a) {return hsluvToLch( vec4(x,y,z,a) );}\nvec4 lchToHsluv(float x, float y, float z, float a) {return lchToHsluv( vec4(x,y,z,a) );}\nvec4 hpluvToLch(float x, float y, float z, float a) {return hpluvToLch( vec4(x,y,z,a) );}\nvec4 lchToHpluv(float x, float y, float z, float a) {return lchToHpluv( vec4(x,y,z,a) );}\nvec4 lchToRgb(float x, float y, float z, float a) {return lchToRgb( vec4(x,y,z,a) );}\nvec4 rgbToLch(float x, float y, float z, float a) {return rgbToLch( vec4(x,y,z,a) );}\nvec4 hsluvToRgb(float x, float y, float z, float a) {return hsluvToRgb( vec4(x,y,z,a) );}\nvec4 rgbToHslul(float x, float y, float z, float a) {return rgbToHsluv( vec4(x,y,z,a) );}\nvec4 hpluvToRgb(float x, float y, float z, float a) {return hpluvToRgb( vec4(x,y,z,a) );}\nvec4 rgbToHpluv(float x, float y, float z, float a) {return rgbToHpluv( vec4(x,y,z,a) );}\nvec4 luvToRgb(float x, float y, float z, float a) {return luvToRgb( vec4(x,y,z,a) );}\n\n/*\nEND HSLUV-GLSL\n*/\n\n\n// from https://gist.github.com/mattatz/44f081cac87e2f7c8980\n// converted to glsl by gui@polygonjs.com\n// and made function names consistent with the ones above\n/*\n * Conversion between RGB and LAB colorspace.\n * Import from flowabs glsl program : https://code.google.com/p/flowabs/source/browse/glsl/?r=f36cbdcf7790a28d90f09e2cf89ec9a64911f138\n */\n\n\n\nvec3 xyzToLab( vec3 c ) {\n\tvec3 n = c / vec3(95.047, 100, 108.883);\n\tvec3 v;\n\tv.x = ( n.x > 0.008856 ) ? pow( n.x, 1.0 / 3.0 ) : ( 7.787 * n.x ) + ( 16.0 / 116.0 );\n\tv.y = ( n.y > 0.008856 ) ? pow( n.y, 1.0 / 3.0 ) : ( 7.787 * n.y ) + ( 16.0 / 116.0 );\n\tv.z = ( n.z > 0.008856 ) ? pow( n.z, 1.0 / 3.0 ) : ( 7.787 * n.z ) + ( 16.0 / 116.0 );\n\treturn vec3(( 116.0 * v.y ) - 16.0, 500.0 * ( v.x - v.y ), 200.0 * ( v.y - v.z ));\n}\n\nvec3 rgbToLab( vec3 c ) {\n\tvec3 lab = xyzToLab( rgbToXyz( c ) );\n\treturn vec3( lab.x / 100.0, 0.5 + 0.5 * ( lab.y / 127.0 ), 0.5 + 0.5 * ( lab.z / 127.0 ));\n}\n\nvec3 labToXyz( vec3 c ) {\n\tfloat fy = ( c.x + 16.0 ) / 116.0;\n\tfloat fx = c.y / 500.0 + fy;\n\tfloat fz = fy - c.z / 200.0;\n\treturn vec3(\n\t\t 95.047 * (( fx > 0.206897 ) ? fx * fx * fx : ( fx - 16.0 / 116.0 ) / 7.787),\n\t\t100.000 * (( fy > 0.206897 ) ? fy * fy * fy : ( fy - 16.0 / 116.0 ) / 7.787),\n\t\t108.883 * (( fz > 0.206897 ) ? fz * fz * fz : ( fz - 16.0 / 116.0 ) / 7.787)\n\t);\n}\n\n\n\nvec3 labToRgb( vec3 c ) {\n\treturn xyzToRgb( labToXyz( vec3(100.0 * c.x, 2.0 * 127.0 * (c.y - 0.5), 2.0 * 127.0 * (c.z - 0.5)) ) );\n}\n\n// adapted from\n// THREEjs math/Color.js\nfloat sRGBToLinear( float c ) {\n\treturn ( c < 0.04045 ) ? c * 0.0773993808 : pow( c * 0.9478672986 + 0.0521327014, 2.4 );\n}\nvec3 sRGBToLinear( vec3 c ) {\n\treturn vec3( sRGBToLinear(c.r), sRGBToLinear(c.g), sRGBToLinear(c.b) );\n}\nvec4 sRGBToLinear( vec4 c ) {\n\treturn vec4( sRGBToLinear(c.r), sRGBToLinear(c.g), sRGBToLinear(c.b), c.a );\n}\n\n\n\n\n\n\n\n// /geo1/MAT/meshBasicBuilder1/globals1\nvarying vec2 v_POLY_globals1_uv;\n\n\n\n\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\n\n\t// /geo1/MAT/meshBasicBuilder1/subtract2\n\tvec2 v_POLY_subtract2_subtract = (v_POLY_globals1_uv - vec2(0.5, 0.5));\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec2ToVec3_1\n\tvec3 v_POLY_vec2ToVec3_1_vec3 = vec3(v_POLY_subtract2_subtract.xy, 0.0);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec3ToVec4_1\n\tvec4 v_POLY_vec3ToVec4_1_vec4 = vec4(v_POLY_vec2ToVec3_1_vec3.xyz, 0.0);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/colorCorrect1\n\tvec4 v_POLY_colorCorrect1_out = sRGBToLinear(v_POLY_vec3ToVec4_1_vec4);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec4ToVec3_1\n\tvec3 v_POLY_vec4ToVec3_1_vec3 = v_POLY_colorCorrect1_out.xyz;\n\t\n\t// /geo1/MAT/meshBasicBuilder1/output1\n\tdiffuseColor.xyz = v_POLY_vec4ToVec3_1_vec3;\n\n\n\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}","customDepthMaterial.vertex":"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n\n\n\n// /geo1/MAT/meshBasicBuilder1/globals1\nvarying vec2 v_POLY_globals1_uv;\n\n\n\n\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n// removed:\n//\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n// removed:\n//\t#include <begin_vertex>\n\n\n\n\t// /geo1/MAT/meshBasicBuilder1/globals1\n\tv_POLY_globals1_uv = vec2(uv);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/output1\n\tvec3 transformed = position;\n\tvec3 objectNormal = normal;\n\t#ifdef USE_TANGENT\n\t\tvec3 objectTangent = vec3( tangent.xyz );\n\t#endif\n\n\n\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}","customDepthMaterial.fragment":"\n// INSERT DEFINES\n\n\n#if DEPTH_PACKING == 3200\n\n\tuniform float opacity;\n\n#endif\n\n#include <common>\n\n\n\n// /geo1/MAT/meshBasicBuilder1/colorCorrect1\n// from https://github.com/williammalo/hsluv-glsl\n/*\nHSLUV-GLSL v4.2\nHSLUV is a human-friendly alternative to HSL. ( http://www.hsluv.org )\nGLSL port by William Malo ( https://github.com/williammalo )\nPut this code in your fragment shader.\n*/\n\nvec3 hsluv_intersectLineLine(vec3 line1x, vec3 line1y, vec3 line2x, vec3 line2y) {\n\treturn (line1y - line2y) / (line2x - line1x);\n}\n\nvec3 hsluv_distanceFromPole(vec3 pointx,vec3 pointy) {\n\treturn sqrt(pointx*pointx + pointy*pointy);\n}\n\nvec3 hsluv_lengthOfRayUntilIntersect(float theta, vec3 x, vec3 y) {\n\tvec3 len = y / (sin(theta) - x * cos(theta));\n\tif (len.r < 0.0) {len.r=1000.0;}\n\tif (len.g < 0.0) {len.g=1000.0;}\n\tif (len.b < 0.0) {len.b=1000.0;}\n\treturn len;\n}\n\nfloat hsluv_maxSafeChromaForL(float L){\n\tmat3 m2 = mat3(\n\t\t 3.2409699419045214 ,-0.96924363628087983 , 0.055630079696993609,\n\t\t-1.5373831775700935 , 1.8759675015077207 ,-0.20397695888897657 ,\n\t\t-0.49861076029300328 , 0.041555057407175613, 1.0569715142428786 \n\t);\n\tfloat sub0 = L + 16.0;\n\tfloat sub1 = sub0 * sub0 * sub0 * .000000641;\n\tfloat sub2 = sub1 > 0.0088564516790356308 ? sub1 : L / 903.2962962962963;\n\n\tvec3 top1 = (284517.0 * m2[0] - 94839.0 * m2[2]) * sub2;\n\tvec3 bottom = (632260.0 * m2[2] - 126452.0 * m2[1]) * sub2;\n\tvec3 top2 = (838422.0 * m2[2] + 769860.0 * m2[1] + 731718.0 * m2[0]) * L * sub2;\n\n\tvec3 bounds0x = top1 / bottom;\n\tvec3 bounds0y = top2 / bottom;\n\n\tvec3 bounds1x = top1 / (bottom+126452.0);\n\tvec3 bounds1y = (top2-769860.0*L) / (bottom+126452.0);\n\n\tvec3 xs0 = hsluv_intersectLineLine(bounds0x, bounds0y, -1.0/bounds0x, vec3(0.0) );\n\tvec3 xs1 = hsluv_intersectLineLine(bounds1x, bounds1y, -1.0/bounds1x, vec3(0.0) );\n\n\tvec3 lengths0 = hsluv_distanceFromPole( xs0, bounds0y + xs0 * bounds0x );\n\tvec3 lengths1 = hsluv_distanceFromPole( xs1, bounds1y + xs1 * bounds1x );\n\n\treturn min(lengths0.r,\n\t\t\tmin(lengths1.r,\n\t\t\tmin(lengths0.g,\n\t\t\tmin(lengths1.g,\n\t\t\tmin(lengths0.b,\n\t\t\t\tlengths1.b)))));\n}\n\nfloat hsluv_maxChromaForLH(float L, float H) {\n\n\tfloat hrad = radians(H);\n\n\tmat3 m2 = mat3(\n\t\t 3.2409699419045214 ,-0.96924363628087983 , 0.055630079696993609,\n\t\t-1.5373831775700935 , 1.8759675015077207 ,-0.20397695888897657 ,\n\t\t-0.49861076029300328 , 0.041555057407175613, 1.0569715142428786 \n\t);\n\tfloat sub1 = pow(L + 16.0, 3.0) / 1560896.0;\n\tfloat sub2 = sub1 > 0.0088564516790356308 ? sub1 : L / 903.2962962962963;\n\n\tvec3 top1 = (284517.0 * m2[0] - 94839.0 * m2[2]) * sub2;\n\tvec3 bottom = (632260.0 * m2[2] - 126452.0 * m2[1]) * sub2;\n\tvec3 top2 = (838422.0 * m2[2] + 769860.0 * m2[1] + 731718.0 * m2[0]) * L * sub2;\n\n\tvec3 bound0x = top1 / bottom;\n\tvec3 bound0y = top2 / bottom;\n\n\tvec3 bound1x = top1 / (bottom+126452.0);\n\tvec3 bound1y = (top2-769860.0*L) / (bottom+126452.0);\n\n\tvec3 lengths0 = hsluv_lengthOfRayUntilIntersect(hrad, bound0x, bound0y );\n\tvec3 lengths1 = hsluv_lengthOfRayUntilIntersect(hrad, bound1x, bound1y );\n\n\treturn min(lengths0.r,\n\t\t\tmin(lengths1.r,\n\t\t\tmin(lengths0.g,\n\t\t\tmin(lengths1.g,\n\t\t\tmin(lengths0.b,\n\t\t\t\tlengths1.b)))));\n}\n\nfloat hsluv_fromLinear(float c) {\n\treturn c <= 0.0031308 ? 12.92 * c : 1.055 * pow(c, 1.0 / 2.4) - 0.055;\n}\nvec3 hsluv_fromLinear(vec3 c) {\n\treturn vec3( hsluv_fromLinear(c.r), hsluv_fromLinear(c.g), hsluv_fromLinear(c.b) );\n}\n\nfloat hsluv_toLinear(float c) {\n\treturn c > 0.04045 ? pow((c + 0.055) / (1.0 + 0.055), 2.4) : c / 12.92;\n}\n\nvec3 hsluv_toLinear(vec3 c) {\n\treturn vec3( hsluv_toLinear(c.r), hsluv_toLinear(c.g), hsluv_toLinear(c.b) );\n}\n\nfloat hsluv_yToL(float Y){\n\treturn Y <= 0.0088564516790356308 ? Y * 903.2962962962963 : 116.0 * pow(Y, 1.0 / 3.0) - 16.0;\n}\n\nfloat hsluv_lToY(float L) {\n\treturn L <= 8.0 ? L / 903.2962962962963 : pow((L + 16.0) / 116.0, 3.0);\n}\n\nvec3 xyzToRgb(vec3 tuple) {\n\tconst mat3 m = mat3( \n\t\t3.2409699419045214 ,-1.5373831775700935 ,-0.49861076029300328 ,\n\t\t-0.96924363628087983 , 1.8759675015077207 , 0.041555057407175613,\n\t\t0.055630079696993609,-0.20397695888897657, 1.0569715142428786 );\n\t\n\treturn hsluv_fromLinear(tuple*m);\n}\n\nvec3 rgbToXyz(vec3 tuple) {\n\tconst mat3 m = mat3(\n\t\t0.41239079926595948 , 0.35758433938387796, 0.18048078840183429 ,\n\t\t0.21263900587151036 , 0.71516867876775593, 0.072192315360733715,\n\t\t0.019330818715591851, 0.11919477979462599, 0.95053215224966058 \n\t);\n\treturn hsluv_toLinear(tuple) * m;\n}\n\nvec3 xyzToLuv(vec3 tuple){\n\tfloat X = tuple.x;\n\tfloat Y = tuple.y;\n\tfloat Z = tuple.z;\n\n\tfloat L = hsluv_yToL(Y);\n\t\n\tfloat div = 1./dot(tuple,vec3(1,15,3)); \n\n\treturn vec3(\n\t\t1.,\n\t\t(52. * (X*div) - 2.57179),\n\t\t(117.* (Y*div) - 6.08816)\n\t) * L;\n}\n\n\nvec3 luvToXyz(vec3 tuple) {\n\tfloat L = tuple.x;\n\n\tfloat U = tuple.y / (13.0 * L) + 0.19783000664283681;\n\tfloat V = tuple.z / (13.0 * L) + 0.468319994938791;\n\n\tfloat Y = hsluv_lToY(L);\n\tfloat X = 2.25 * U * Y / V;\n\tfloat Z = (3./V - 5.)*Y - (X/3.);\n\n\treturn vec3(X, Y, Z);\n}\n\nvec3 luvToLch(vec3 tuple) {\n\tfloat L = tuple.x;\n\tfloat U = tuple.y;\n\tfloat V = tuple.z;\n\n\tfloat C = length(tuple.yz);\n\tfloat H = degrees(atan(V,U));\n\tif (H < 0.0) {\n\t\tH = 360.0 + H;\n\t}\n\t\n\treturn vec3(L, C, H);\n}\n\nvec3 lchToLuv(vec3 tuple) {\n\tfloat hrad = radians(tuple.b);\n\treturn vec3(\n\t\ttuple.r,\n\t\tcos(hrad) * tuple.g,\n\t\tsin(hrad) * tuple.g\n\t);\n}\n\nvec3 hsluvToLch(vec3 tuple) {\n\ttuple.g *= hsluv_maxChromaForLH(tuple.b, tuple.r) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToHsluv(vec3 tuple) {\n\ttuple.g /= hsluv_maxChromaForLH(tuple.r, tuple.b) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 hpluvToLch(vec3 tuple) {\n\ttuple.g *= hsluv_maxSafeChromaForL(tuple.b) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToHpluv(vec3 tuple) {\n\ttuple.g /= hsluv_maxSafeChromaForL(tuple.r) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToRgb(vec3 tuple) {\n\treturn xyzToRgb(luvToXyz(lchToLuv(tuple)));\n}\n\nvec3 rgbToLch(vec3 tuple) {\n\treturn luvToLch(xyzToLuv(rgbToXyz(tuple)));\n}\n\nvec3 hsluvToRgb(vec3 tuple) {\n\treturn lchToRgb(hsluvToLch(tuple));\n}\n\nvec3 rgbToHsluv(vec3 tuple) {\n\treturn lchToHsluv(rgbToLch(tuple));\n}\n\nvec3 hpluvToRgb(vec3 tuple) {\n\treturn lchToRgb(hpluvToLch(tuple));\n}\n\nvec3 rgbToHpluv(vec3 tuple) {\n\treturn lchToHpluv(rgbToLch(tuple));\n}\n\nvec3 luvToRgb(vec3 tuple){\n\treturn xyzToRgb(luvToXyz(tuple));\n}\n\n// allow vec4's\nvec4 xyzToRgb(vec4 c) {return vec4( xyzToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToXyz(vec4 c) {return vec4( rgbToXyz( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 xyzToLuv(vec4 c) {return vec4( xyzToLuv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToXyz(vec4 c) {return vec4( luvToXyz( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToLch(vec4 c) {return vec4( luvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToLuv(vec4 c) {return vec4( lchToLuv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hsluvToLch(vec4 c) {return vec4( hsluvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToHsluv(vec4 c) {return vec4( lchToHsluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hpluvToLch(vec4 c) {return vec4( hpluvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToHpluv(vec4 c) {return vec4( lchToHpluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToRgb(vec4 c) {return vec4( lchToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToLch(vec4 c) {return vec4( rgbToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hsluvToRgb(vec4 c) {return vec4( hsluvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToHsluv(vec4 c) {return vec4( rgbToHsluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hpluvToRgb(vec4 c) {return vec4( hpluvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToHpluv(vec4 c) {return vec4( rgbToHpluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToRgb(vec4 c) {return vec4( luvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\n// allow 3 floats\nvec3 xyzToRgb(float x, float y, float z) {return xyzToRgb( vec3(x,y,z) );}\nvec3 rgbToXyz(float x, float y, float z) {return rgbToXyz( vec3(x,y,z) );}\nvec3 xyzToLuv(float x, float y, float z) {return xyzToLuv( vec3(x,y,z) );}\nvec3 luvToXyz(float x, float y, float z) {return luvToXyz( vec3(x,y,z) );}\nvec3 luvToLch(float x, float y, float z) {return luvToLch( vec3(x,y,z) );}\nvec3 lchToLuv(float x, float y, float z) {return lchToLuv( vec3(x,y,z) );}\nvec3 hsluvToLch(float x, float y, float z) {return hsluvToLch( vec3(x,y,z) );}\nvec3 lchToHsluv(float x, float y, float z) {return lchToHsluv( vec3(x,y,z) );}\nvec3 hpluvToLch(float x, float y, float z) {return hpluvToLch( vec3(x,y,z) );}\nvec3 lchToHpluv(float x, float y, float z) {return lchToHpluv( vec3(x,y,z) );}\nvec3 lchToRgb(float x, float y, float z) {return lchToRgb( vec3(x,y,z) );}\nvec3 rgbToLch(float x, float y, float z) {return rgbToLch( vec3(x,y,z) );}\nvec3 hsluvToRgb(float x, float y, float z) {return hsluvToRgb( vec3(x,y,z) );}\nvec3 rgbToHsluv(float x, float y, float z) {return rgbToHsluv( vec3(x,y,z) );}\nvec3 hpluvToRgb(float x, float y, float z) {return hpluvToRgb( vec3(x,y,z) );}\nvec3 rgbToHpluv(float x, float y, float z) {return rgbToHpluv( vec3(x,y,z) );}\nvec3 luvToRgb(float x, float y, float z) {return luvToRgb( vec3(x,y,z) );}\n// allow 4 floats\nvec4 xyzToRgb(float x, float y, float z, float a) {return xyzToRgb( vec4(x,y,z,a) );}\nvec4 rgbToXyz(float x, float y, float z, float a) {return rgbToXyz( vec4(x,y,z,a) );}\nvec4 xyzToLuv(float x, float y, float z, float a) {return xyzToLuv( vec4(x,y,z,a) );}\nvec4 luvToXyz(float x, float y, float z, float a) {return luvToXyz( vec4(x,y,z,a) );}\nvec4 luvToLch(float x, float y, float z, float a) {return luvToLch( vec4(x,y,z,a) );}\nvec4 lchToLuv(float x, float y, float z, float a) {return lchToLuv( vec4(x,y,z,a) );}\nvec4 hsluvToLch(float x, float y, float z, float a) {return hsluvToLch( vec4(x,y,z,a) );}\nvec4 lchToHsluv(float x, float y, float z, float a) {return lchToHsluv( vec4(x,y,z,a) );}\nvec4 hpluvToLch(float x, float y, float z, float a) {return hpluvToLch( vec4(x,y,z,a) );}\nvec4 lchToHpluv(float x, float y, float z, float a) {return lchToHpluv( vec4(x,y,z,a) );}\nvec4 lchToRgb(float x, float y, float z, float a) {return lchToRgb( vec4(x,y,z,a) );}\nvec4 rgbToLch(float x, float y, float z, float a) {return rgbToLch( vec4(x,y,z,a) );}\nvec4 hsluvToRgb(float x, float y, float z, float a) {return hsluvToRgb( vec4(x,y,z,a) );}\nvec4 rgbToHslul(float x, float y, float z, float a) {return rgbToHsluv( vec4(x,y,z,a) );}\nvec4 hpluvToRgb(float x, float y, float z, float a) {return hpluvToRgb( vec4(x,y,z,a) );}\nvec4 rgbToHpluv(float x, float y, float z, float a) {return rgbToHpluv( vec4(x,y,z,a) );}\nvec4 luvToRgb(float x, float y, float z, float a) {return luvToRgb( vec4(x,y,z,a) );}\n\n/*\nEND HSLUV-GLSL\n*/\n\n\n// from https://gist.github.com/mattatz/44f081cac87e2f7c8980\n// converted to glsl by gui@polygonjs.com\n// and made function names consistent with the ones above\n/*\n * Conversion between RGB and LAB colorspace.\n * Import from flowabs glsl program : https://code.google.com/p/flowabs/source/browse/glsl/?r=f36cbdcf7790a28d90f09e2cf89ec9a64911f138\n */\n\n\n\nvec3 xyzToLab( vec3 c ) {\n\tvec3 n = c / vec3(95.047, 100, 108.883);\n\tvec3 v;\n\tv.x = ( n.x > 0.008856 ) ? pow( n.x, 1.0 / 3.0 ) : ( 7.787 * n.x ) + ( 16.0 / 116.0 );\n\tv.y = ( n.y > 0.008856 ) ? pow( n.y, 1.0 / 3.0 ) : ( 7.787 * n.y ) + ( 16.0 / 116.0 );\n\tv.z = ( n.z > 0.008856 ) ? pow( n.z, 1.0 / 3.0 ) : ( 7.787 * n.z ) + ( 16.0 / 116.0 );\n\treturn vec3(( 116.0 * v.y ) - 16.0, 500.0 * ( v.x - v.y ), 200.0 * ( v.y - v.z ));\n}\n\nvec3 rgbToLab( vec3 c ) {\n\tvec3 lab = xyzToLab( rgbToXyz( c ) );\n\treturn vec3( lab.x / 100.0, 0.5 + 0.5 * ( lab.y / 127.0 ), 0.5 + 0.5 * ( lab.z / 127.0 ));\n}\n\nvec3 labToXyz( vec3 c ) {\n\tfloat fy = ( c.x + 16.0 ) / 116.0;\n\tfloat fx = c.y / 500.0 + fy;\n\tfloat fz = fy - c.z / 200.0;\n\treturn vec3(\n\t\t 95.047 * (( fx > 0.206897 ) ? fx * fx * fx : ( fx - 16.0 / 116.0 ) / 7.787),\n\t\t100.000 * (( fy > 0.206897 ) ? fy * fy * fy : ( fy - 16.0 / 116.0 ) / 7.787),\n\t\t108.883 * (( fz > 0.206897 ) ? fz * fz * fz : ( fz - 16.0 / 116.0 ) / 7.787)\n\t);\n}\n\n\n\nvec3 labToRgb( vec3 c ) {\n\treturn xyzToRgb( labToXyz( vec3(100.0 * c.x, 2.0 * 127.0 * (c.y - 0.5), 2.0 * 127.0 * (c.z - 0.5)) ) );\n}\n\n// adapted from\n// THREEjs math/Color.js\nfloat sRGBToLinear( float c ) {\n\treturn ( c < 0.04045 ) ? c * 0.0773993808 : pow( c * 0.9478672986 + 0.0521327014, 2.4 );\n}\nvec3 sRGBToLinear( vec3 c ) {\n\treturn vec3( sRGBToLinear(c.r), sRGBToLinear(c.g), sRGBToLinear(c.b) );\n}\nvec4 sRGBToLinear( vec4 c ) {\n\treturn vec4( sRGBToLinear(c.r), sRGBToLinear(c.g), sRGBToLinear(c.b), c.a );\n}\n\n\n\n\n\n\n\n// /geo1/MAT/meshBasicBuilder1/globals1\nvarying vec2 v_POLY_globals1_uv;\n\n\n\n\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvarying vec2 vHighPrecisionZW;\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4( 1.0 );\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tdiffuseColor.a = opacity;\n\n\t#endif\n\n\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\n\n\n\t// /geo1/MAT/meshBasicBuilder1/subtract2\n\tvec2 v_POLY_subtract2_subtract = (v_POLY_globals1_uv - vec2(0.5, 0.5));\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec2ToVec3_1\n\tvec3 v_POLY_vec2ToVec3_1_vec3 = vec3(v_POLY_subtract2_subtract.xy, 0.0);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec3ToVec4_1\n\tvec4 v_POLY_vec3ToVec4_1_vec4 = vec4(v_POLY_vec2ToVec3_1_vec3.xyz, 0.0);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/colorCorrect1\n\tvec4 v_POLY_colorCorrect1_out = sRGBToLinear(v_POLY_vec3ToVec4_1_vec4);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec4ToVec3_1\n\tvec3 v_POLY_vec4ToVec3_1_vec3 = v_POLY_colorCorrect1_out.xyz;\n\t\n\t// /geo1/MAT/meshBasicBuilder1/output1\n\tdiffuseColor.xyz = v_POLY_vec4ToVec3_1_vec3;\n\n\n\n\n\t// INSERT BODY\n\t// the new body lines should be added before the alphatest_fragment\n\t// so that alpha is set before (which is really how it would be set if the alphamap_fragment above was used by the material node parameters)\n\n\t#include <alphatest_fragment>\n\n\t#include <logdepthbuf_fragment>\n\n\n\t// Higher precision equivalent of gl_FragCoord.z. This assumes depthRange has been left to its default values.\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), diffuseColor.a );\n\n\t#elif DEPTH_PACKING == 3201\n\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\n\t#endif\n\n}\n","customDistanceMaterial.vertex":"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n\n\n\n// /geo1/MAT/meshBasicBuilder1/globals1\nvarying vec2 v_POLY_globals1_uv;\n\n\n\n\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n// removed:\n//\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n// removed:\n//\t#include <begin_vertex>\n\n\n\n\t// /geo1/MAT/meshBasicBuilder1/globals1\n\tv_POLY_globals1_uv = vec2(uv);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/output1\n\tvec3 transformed = position;\n\tvec3 objectNormal = normal;\n\t#ifdef USE_TANGENT\n\t\tvec3 objectTangent = vec3( tangent.xyz );\n\t#endif\n\n\n\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}","customDistanceMaterial.fragment":"\n// INSERT DEFINES\n\n#define DISTANCE\n\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n\n#include <common>\n\n\n\n// /geo1/MAT/meshBasicBuilder1/colorCorrect1\n// from https://github.com/williammalo/hsluv-glsl\n/*\nHSLUV-GLSL v4.2\nHSLUV is a human-friendly alternative to HSL. ( http://www.hsluv.org )\nGLSL port by William Malo ( https://github.com/williammalo )\nPut this code in your fragment shader.\n*/\n\nvec3 hsluv_intersectLineLine(vec3 line1x, vec3 line1y, vec3 line2x, vec3 line2y) {\n\treturn (line1y - line2y) / (line2x - line1x);\n}\n\nvec3 hsluv_distanceFromPole(vec3 pointx,vec3 pointy) {\n\treturn sqrt(pointx*pointx + pointy*pointy);\n}\n\nvec3 hsluv_lengthOfRayUntilIntersect(float theta, vec3 x, vec3 y) {\n\tvec3 len = y / (sin(theta) - x * cos(theta));\n\tif (len.r < 0.0) {len.r=1000.0;}\n\tif (len.g < 0.0) {len.g=1000.0;}\n\tif (len.b < 0.0) {len.b=1000.0;}\n\treturn len;\n}\n\nfloat hsluv_maxSafeChromaForL(float L){\n\tmat3 m2 = mat3(\n\t\t 3.2409699419045214 ,-0.96924363628087983 , 0.055630079696993609,\n\t\t-1.5373831775700935 , 1.8759675015077207 ,-0.20397695888897657 ,\n\t\t-0.49861076029300328 , 0.041555057407175613, 1.0569715142428786 \n\t);\n\tfloat sub0 = L + 16.0;\n\tfloat sub1 = sub0 * sub0 * sub0 * .000000641;\n\tfloat sub2 = sub1 > 0.0088564516790356308 ? sub1 : L / 903.2962962962963;\n\n\tvec3 top1 = (284517.0 * m2[0] - 94839.0 * m2[2]) * sub2;\n\tvec3 bottom = (632260.0 * m2[2] - 126452.0 * m2[1]) * sub2;\n\tvec3 top2 = (838422.0 * m2[2] + 769860.0 * m2[1] + 731718.0 * m2[0]) * L * sub2;\n\n\tvec3 bounds0x = top1 / bottom;\n\tvec3 bounds0y = top2 / bottom;\n\n\tvec3 bounds1x = top1 / (bottom+126452.0);\n\tvec3 bounds1y = (top2-769860.0*L) / (bottom+126452.0);\n\n\tvec3 xs0 = hsluv_intersectLineLine(bounds0x, bounds0y, -1.0/bounds0x, vec3(0.0) );\n\tvec3 xs1 = hsluv_intersectLineLine(bounds1x, bounds1y, -1.0/bounds1x, vec3(0.0) );\n\n\tvec3 lengths0 = hsluv_distanceFromPole( xs0, bounds0y + xs0 * bounds0x );\n\tvec3 lengths1 = hsluv_distanceFromPole( xs1, bounds1y + xs1 * bounds1x );\n\n\treturn min(lengths0.r,\n\t\t\tmin(lengths1.r,\n\t\t\tmin(lengths0.g,\n\t\t\tmin(lengths1.g,\n\t\t\tmin(lengths0.b,\n\t\t\t\tlengths1.b)))));\n}\n\nfloat hsluv_maxChromaForLH(float L, float H) {\n\n\tfloat hrad = radians(H);\n\n\tmat3 m2 = mat3(\n\t\t 3.2409699419045214 ,-0.96924363628087983 , 0.055630079696993609,\n\t\t-1.5373831775700935 , 1.8759675015077207 ,-0.20397695888897657 ,\n\t\t-0.49861076029300328 , 0.041555057407175613, 1.0569715142428786 \n\t);\n\tfloat sub1 = pow(L + 16.0, 3.0) / 1560896.0;\n\tfloat sub2 = sub1 > 0.0088564516790356308 ? sub1 : L / 903.2962962962963;\n\n\tvec3 top1 = (284517.0 * m2[0] - 94839.0 * m2[2]) * sub2;\n\tvec3 bottom = (632260.0 * m2[2] - 126452.0 * m2[1]) * sub2;\n\tvec3 top2 = (838422.0 * m2[2] + 769860.0 * m2[1] + 731718.0 * m2[0]) * L * sub2;\n\n\tvec3 bound0x = top1 / bottom;\n\tvec3 bound0y = top2 / bottom;\n\n\tvec3 bound1x = top1 / (bottom+126452.0);\n\tvec3 bound1y = (top2-769860.0*L) / (bottom+126452.0);\n\n\tvec3 lengths0 = hsluv_lengthOfRayUntilIntersect(hrad, bound0x, bound0y );\n\tvec3 lengths1 = hsluv_lengthOfRayUntilIntersect(hrad, bound1x, bound1y );\n\n\treturn min(lengths0.r,\n\t\t\tmin(lengths1.r,\n\t\t\tmin(lengths0.g,\n\t\t\tmin(lengths1.g,\n\t\t\tmin(lengths0.b,\n\t\t\t\tlengths1.b)))));\n}\n\nfloat hsluv_fromLinear(float c) {\n\treturn c <= 0.0031308 ? 12.92 * c : 1.055 * pow(c, 1.0 / 2.4) - 0.055;\n}\nvec3 hsluv_fromLinear(vec3 c) {\n\treturn vec3( hsluv_fromLinear(c.r), hsluv_fromLinear(c.g), hsluv_fromLinear(c.b) );\n}\n\nfloat hsluv_toLinear(float c) {\n\treturn c > 0.04045 ? pow((c + 0.055) / (1.0 + 0.055), 2.4) : c / 12.92;\n}\n\nvec3 hsluv_toLinear(vec3 c) {\n\treturn vec3( hsluv_toLinear(c.r), hsluv_toLinear(c.g), hsluv_toLinear(c.b) );\n}\n\nfloat hsluv_yToL(float Y){\n\treturn Y <= 0.0088564516790356308 ? Y * 903.2962962962963 : 116.0 * pow(Y, 1.0 / 3.0) - 16.0;\n}\n\nfloat hsluv_lToY(float L) {\n\treturn L <= 8.0 ? L / 903.2962962962963 : pow((L + 16.0) / 116.0, 3.0);\n}\n\nvec3 xyzToRgb(vec3 tuple) {\n\tconst mat3 m = mat3( \n\t\t3.2409699419045214 ,-1.5373831775700935 ,-0.49861076029300328 ,\n\t\t-0.96924363628087983 , 1.8759675015077207 , 0.041555057407175613,\n\t\t0.055630079696993609,-0.20397695888897657, 1.0569715142428786 );\n\t\n\treturn hsluv_fromLinear(tuple*m);\n}\n\nvec3 rgbToXyz(vec3 tuple) {\n\tconst mat3 m = mat3(\n\t\t0.41239079926595948 , 0.35758433938387796, 0.18048078840183429 ,\n\t\t0.21263900587151036 , 0.71516867876775593, 0.072192315360733715,\n\t\t0.019330818715591851, 0.11919477979462599, 0.95053215224966058 \n\t);\n\treturn hsluv_toLinear(tuple) * m;\n}\n\nvec3 xyzToLuv(vec3 tuple){\n\tfloat X = tuple.x;\n\tfloat Y = tuple.y;\n\tfloat Z = tuple.z;\n\n\tfloat L = hsluv_yToL(Y);\n\t\n\tfloat div = 1./dot(tuple,vec3(1,15,3)); \n\n\treturn vec3(\n\t\t1.,\n\t\t(52. * (X*div) - 2.57179),\n\t\t(117.* (Y*div) - 6.08816)\n\t) * L;\n}\n\n\nvec3 luvToXyz(vec3 tuple) {\n\tfloat L = tuple.x;\n\n\tfloat U = tuple.y / (13.0 * L) + 0.19783000664283681;\n\tfloat V = tuple.z / (13.0 * L) + 0.468319994938791;\n\n\tfloat Y = hsluv_lToY(L);\n\tfloat X = 2.25 * U * Y / V;\n\tfloat Z = (3./V - 5.)*Y - (X/3.);\n\n\treturn vec3(X, Y, Z);\n}\n\nvec3 luvToLch(vec3 tuple) {\n\tfloat L = tuple.x;\n\tfloat U = tuple.y;\n\tfloat V = tuple.z;\n\n\tfloat C = length(tuple.yz);\n\tfloat H = degrees(atan(V,U));\n\tif (H < 0.0) {\n\t\tH = 360.0 + H;\n\t}\n\t\n\treturn vec3(L, C, H);\n}\n\nvec3 lchToLuv(vec3 tuple) {\n\tfloat hrad = radians(tuple.b);\n\treturn vec3(\n\t\ttuple.r,\n\t\tcos(hrad) * tuple.g,\n\t\tsin(hrad) * tuple.g\n\t);\n}\n\nvec3 hsluvToLch(vec3 tuple) {\n\ttuple.g *= hsluv_maxChromaForLH(tuple.b, tuple.r) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToHsluv(vec3 tuple) {\n\ttuple.g /= hsluv_maxChromaForLH(tuple.r, tuple.b) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 hpluvToLch(vec3 tuple) {\n\ttuple.g *= hsluv_maxSafeChromaForL(tuple.b) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToHpluv(vec3 tuple) {\n\ttuple.g /= hsluv_maxSafeChromaForL(tuple.r) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToRgb(vec3 tuple) {\n\treturn xyzToRgb(luvToXyz(lchToLuv(tuple)));\n}\n\nvec3 rgbToLch(vec3 tuple) {\n\treturn luvToLch(xyzToLuv(rgbToXyz(tuple)));\n}\n\nvec3 hsluvToRgb(vec3 tuple) {\n\treturn lchToRgb(hsluvToLch(tuple));\n}\n\nvec3 rgbToHsluv(vec3 tuple) {\n\treturn lchToHsluv(rgbToLch(tuple));\n}\n\nvec3 hpluvToRgb(vec3 tuple) {\n\treturn lchToRgb(hpluvToLch(tuple));\n}\n\nvec3 rgbToHpluv(vec3 tuple) {\n\treturn lchToHpluv(rgbToLch(tuple));\n}\n\nvec3 luvToRgb(vec3 tuple){\n\treturn xyzToRgb(luvToXyz(tuple));\n}\n\n// allow vec4's\nvec4 xyzToRgb(vec4 c) {return vec4( xyzToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToXyz(vec4 c) {return vec4( rgbToXyz( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 xyzToLuv(vec4 c) {return vec4( xyzToLuv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToXyz(vec4 c) {return vec4( luvToXyz( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToLch(vec4 c) {return vec4( luvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToLuv(vec4 c) {return vec4( lchToLuv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hsluvToLch(vec4 c) {return vec4( hsluvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToHsluv(vec4 c) {return vec4( lchToHsluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hpluvToLch(vec4 c) {return vec4( hpluvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToHpluv(vec4 c) {return vec4( lchToHpluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToRgb(vec4 c) {return vec4( lchToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToLch(vec4 c) {return vec4( rgbToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hsluvToRgb(vec4 c) {return vec4( hsluvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToHsluv(vec4 c) {return vec4( rgbToHsluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hpluvToRgb(vec4 c) {return vec4( hpluvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToHpluv(vec4 c) {return vec4( rgbToHpluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToRgb(vec4 c) {return vec4( luvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\n// allow 3 floats\nvec3 xyzToRgb(float x, float y, float z) {return xyzToRgb( vec3(x,y,z) );}\nvec3 rgbToXyz(float x, float y, float z) {return rgbToXyz( vec3(x,y,z) );}\nvec3 xyzToLuv(float x, float y, float z) {return xyzToLuv( vec3(x,y,z) );}\nvec3 luvToXyz(float x, float y, float z) {return luvToXyz( vec3(x,y,z) );}\nvec3 luvToLch(float x, float y, float z) {return luvToLch( vec3(x,y,z) );}\nvec3 lchToLuv(float x, float y, float z) {return lchToLuv( vec3(x,y,z) );}\nvec3 hsluvToLch(float x, float y, float z) {return hsluvToLch( vec3(x,y,z) );}\nvec3 lchToHsluv(float x, float y, float z) {return lchToHsluv( vec3(x,y,z) );}\nvec3 hpluvToLch(float x, float y, float z) {return hpluvToLch( vec3(x,y,z) );}\nvec3 lchToHpluv(float x, float y, float z) {return lchToHpluv( vec3(x,y,z) );}\nvec3 lchToRgb(float x, float y, float z) {return lchToRgb( vec3(x,y,z) );}\nvec3 rgbToLch(float x, float y, float z) {return rgbToLch( vec3(x,y,z) );}\nvec3 hsluvToRgb(float x, float y, float z) {return hsluvToRgb( vec3(x,y,z) );}\nvec3 rgbToHsluv(float x, float y, float z) {return rgbToHsluv( vec3(x,y,z) );}\nvec3 hpluvToRgb(float x, float y, float z) {return hpluvToRgb( vec3(x,y,z) );}\nvec3 rgbToHpluv(float x, float y, float z) {return rgbToHpluv( vec3(x,y,z) );}\nvec3 luvToRgb(float x, float y, float z) {return luvToRgb( vec3(x,y,z) );}\n// allow 4 floats\nvec4 xyzToRgb(float x, float y, float z, float a) {return xyzToRgb( vec4(x,y,z,a) );}\nvec4 rgbToXyz(float x, float y, float z, float a) {return rgbToXyz( vec4(x,y,z,a) );}\nvec4 xyzToLuv(float x, float y, float z, float a) {return xyzToLuv( vec4(x,y,z,a) );}\nvec4 luvToXyz(float x, float y, float z, float a) {return luvToXyz( vec4(x,y,z,a) );}\nvec4 luvToLch(float x, float y, float z, float a) {return luvToLch( vec4(x,y,z,a) );}\nvec4 lchToLuv(float x, float y, float z, float a) {return lchToLuv( vec4(x,y,z,a) );}\nvec4 hsluvToLch(float x, float y, float z, float a) {return hsluvToLch( vec4(x,y,z,a) );}\nvec4 lchToHsluv(float x, float y, float z, float a) {return lchToHsluv( vec4(x,y,z,a) );}\nvec4 hpluvToLch(float x, float y, float z, float a) {return hpluvToLch( vec4(x,y,z,a) );}\nvec4 lchToHpluv(float x, float y, float z, float a) {return lchToHpluv( vec4(x,y,z,a) );}\nvec4 lchToRgb(float x, float y, float z, float a) {return lchToRgb( vec4(x,y,z,a) );}\nvec4 rgbToLch(float x, float y, float z, float a) {return rgbToLch( vec4(x,y,z,a) );}\nvec4 hsluvToRgb(float x, float y, float z, float a) {return hsluvToRgb( vec4(x,y,z,a) );}\nvec4 rgbToHslul(float x, float y, float z, float a) {return rgbToHsluv( vec4(x,y,z,a) );}\nvec4 hpluvToRgb(float x, float y, float z, float a) {return hpluvToRgb( vec4(x,y,z,a) );}\nvec4 rgbToHpluv(float x, float y, float z, float a) {return rgbToHpluv( vec4(x,y,z,a) );}\nvec4 luvToRgb(float x, float y, float z, float a) {return luvToRgb( vec4(x,y,z,a) );}\n\n/*\nEND HSLUV-GLSL\n*/\n\n\n// from https://gist.github.com/mattatz/44f081cac87e2f7c8980\n// converted to glsl by gui@polygonjs.com\n// and made function names consistent with the ones above\n/*\n * Conversion between RGB and LAB colorspace.\n * Import from flowabs glsl program : https://code.google.com/p/flowabs/source/browse/glsl/?r=f36cbdcf7790a28d90f09e2cf89ec9a64911f138\n */\n\n\n\nvec3 xyzToLab( vec3 c ) {\n\tvec3 n = c / vec3(95.047, 100, 108.883);\n\tvec3 v;\n\tv.x = ( n.x > 0.008856 ) ? pow( n.x, 1.0 / 3.0 ) : ( 7.787 * n.x ) + ( 16.0 / 116.0 );\n\tv.y = ( n.y > 0.008856 ) ? pow( n.y, 1.0 / 3.0 ) : ( 7.787 * n.y ) + ( 16.0 / 116.0 );\n\tv.z = ( n.z > 0.008856 ) ? pow( n.z, 1.0 / 3.0 ) : ( 7.787 * n.z ) + ( 16.0 / 116.0 );\n\treturn vec3(( 116.0 * v.y ) - 16.0, 500.0 * ( v.x - v.y ), 200.0 * ( v.y - v.z ));\n}\n\nvec3 rgbToLab( vec3 c ) {\n\tvec3 lab = xyzToLab( rgbToXyz( c ) );\n\treturn vec3( lab.x / 100.0, 0.5 + 0.5 * ( lab.y / 127.0 ), 0.5 + 0.5 * ( lab.z / 127.0 ));\n}\n\nvec3 labToXyz( vec3 c ) {\n\tfloat fy = ( c.x + 16.0 ) / 116.0;\n\tfloat fx = c.y / 500.0 + fy;\n\tfloat fz = fy - c.z / 200.0;\n\treturn vec3(\n\t\t 95.047 * (( fx > 0.206897 ) ? fx * fx * fx : ( fx - 16.0 / 116.0 ) / 7.787),\n\t\t100.000 * (( fy > 0.206897 ) ? fy * fy * fy : ( fy - 16.0 / 116.0 ) / 7.787),\n\t\t108.883 * (( fz > 0.206897 ) ? fz * fz * fz : ( fz - 16.0 / 116.0 ) / 7.787)\n\t);\n}\n\n\n\nvec3 labToRgb( vec3 c ) {\n\treturn xyzToRgb( labToXyz( vec3(100.0 * c.x, 2.0 * 127.0 * (c.y - 0.5), 2.0 * 127.0 * (c.z - 0.5)) ) );\n}\n\n// adapted from\n// THREEjs math/Color.js\nfloat sRGBToLinear( float c ) {\n\treturn ( c < 0.04045 ) ? c * 0.0773993808 : pow( c * 0.9478672986 + 0.0521327014, 2.4 );\n}\nvec3 sRGBToLinear( vec3 c ) {\n\treturn vec3( sRGBToLinear(c.r), sRGBToLinear(c.g), sRGBToLinear(c.b) );\n}\nvec4 sRGBToLinear( vec4 c ) {\n\treturn vec4( sRGBToLinear(c.r), sRGBToLinear(c.g), sRGBToLinear(c.b), c.a );\n}\n\n\n\n\n\n\n\n// /geo1/MAT/meshBasicBuilder1/globals1\nvarying vec2 v_POLY_globals1_uv;\n\n\n\n\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main () {\n\n\t#include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4( 1.0 );\n\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\n\n\n\t// /geo1/MAT/meshBasicBuilder1/subtract2\n\tvec2 v_POLY_subtract2_subtract = (v_POLY_globals1_uv - vec2(0.5, 0.5));\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec2ToVec3_1\n\tvec3 v_POLY_vec2ToVec3_1_vec3 = vec3(v_POLY_subtract2_subtract.xy, 0.0);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec3ToVec4_1\n\tvec4 v_POLY_vec3ToVec4_1_vec4 = vec4(v_POLY_vec2ToVec3_1_vec3.xyz, 0.0);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/colorCorrect1\n\tvec4 v_POLY_colorCorrect1_out = sRGBToLinear(v_POLY_vec3ToVec4_1_vec4);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec4ToVec3_1\n\tvec3 v_POLY_vec4ToVec3_1_vec3 = v_POLY_colorCorrect1_out.xyz;\n\t\n\t// /geo1/MAT/meshBasicBuilder1/output1\n\tdiffuseColor.xyz = v_POLY_vec4ToVec3_1_vec3;\n\n\n\n\n\t// INSERT BODY\n\n\t#include <alphatest_fragment>\n\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist ); // clamp to [ 0, 1 ]\n\n\tgl_FragColor = packDepthToRGBA( dist );\n\n}\n","customDepthDOFMaterial.vertex":"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n\n\n\n// /geo1/MAT/meshBasicBuilder1/globals1\nvarying vec2 v_POLY_globals1_uv;\n\n\n\n\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n// removed:\n//\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n// removed:\n//\t#include <begin_vertex>\n\n\n\n\t// /geo1/MAT/meshBasicBuilder1/globals1\n\tv_POLY_globals1_uv = vec2(uv);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/output1\n\tvec3 transformed = position;\n\tvec3 objectNormal = normal;\n\t#ifdef USE_TANGENT\n\t\tvec3 objectTangent = vec3( tangent.xyz );\n\t#endif\n\n\n\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}","customDepthDOFMaterial.fragment":"\n// INSERT DEFINES\n\n\n#if DEPTH_PACKING == 3200\n\n\tuniform float opacity;\n\n#endif\n\n#include <common>\n\n\n\n// /geo1/MAT/meshBasicBuilder1/colorCorrect1\n// from https://github.com/williammalo/hsluv-glsl\n/*\nHSLUV-GLSL v4.2\nHSLUV is a human-friendly alternative to HSL. ( http://www.hsluv.org )\nGLSL port by William Malo ( https://github.com/williammalo )\nPut this code in your fragment shader.\n*/\n\nvec3 hsluv_intersectLineLine(vec3 line1x, vec3 line1y, vec3 line2x, vec3 line2y) {\n\treturn (line1y - line2y) / (line2x - line1x);\n}\n\nvec3 hsluv_distanceFromPole(vec3 pointx,vec3 pointy) {\n\treturn sqrt(pointx*pointx + pointy*pointy);\n}\n\nvec3 hsluv_lengthOfRayUntilIntersect(float theta, vec3 x, vec3 y) {\n\tvec3 len = y / (sin(theta) - x * cos(theta));\n\tif (len.r < 0.0) {len.r=1000.0;}\n\tif (len.g < 0.0) {len.g=1000.0;}\n\tif (len.b < 0.0) {len.b=1000.0;}\n\treturn len;\n}\n\nfloat hsluv_maxSafeChromaForL(float L){\n\tmat3 m2 = mat3(\n\t\t 3.2409699419045214 ,-0.96924363628087983 , 0.055630079696993609,\n\t\t-1.5373831775700935 , 1.8759675015077207 ,-0.20397695888897657 ,\n\t\t-0.49861076029300328 , 0.041555057407175613, 1.0569715142428786 \n\t);\n\tfloat sub0 = L + 16.0;\n\tfloat sub1 = sub0 * sub0 * sub0 * .000000641;\n\tfloat sub2 = sub1 > 0.0088564516790356308 ? sub1 : L / 903.2962962962963;\n\n\tvec3 top1 = (284517.0 * m2[0] - 94839.0 * m2[2]) * sub2;\n\tvec3 bottom = (632260.0 * m2[2] - 126452.0 * m2[1]) * sub2;\n\tvec3 top2 = (838422.0 * m2[2] + 769860.0 * m2[1] + 731718.0 * m2[0]) * L * sub2;\n\n\tvec3 bounds0x = top1 / bottom;\n\tvec3 bounds0y = top2 / bottom;\n\n\tvec3 bounds1x = top1 / (bottom+126452.0);\n\tvec3 bounds1y = (top2-769860.0*L) / (bottom+126452.0);\n\n\tvec3 xs0 = hsluv_intersectLineLine(bounds0x, bounds0y, -1.0/bounds0x, vec3(0.0) );\n\tvec3 xs1 = hsluv_intersectLineLine(bounds1x, bounds1y, -1.0/bounds1x, vec3(0.0) );\n\n\tvec3 lengths0 = hsluv_distanceFromPole( xs0, bounds0y + xs0 * bounds0x );\n\tvec3 lengths1 = hsluv_distanceFromPole( xs1, bounds1y + xs1 * bounds1x );\n\n\treturn min(lengths0.r,\n\t\t\tmin(lengths1.r,\n\t\t\tmin(lengths0.g,\n\t\t\tmin(lengths1.g,\n\t\t\tmin(lengths0.b,\n\t\t\t\tlengths1.b)))));\n}\n\nfloat hsluv_maxChromaForLH(float L, float H) {\n\n\tfloat hrad = radians(H);\n\n\tmat3 m2 = mat3(\n\t\t 3.2409699419045214 ,-0.96924363628087983 , 0.055630079696993609,\n\t\t-1.5373831775700935 , 1.8759675015077207 ,-0.20397695888897657 ,\n\t\t-0.49861076029300328 , 0.041555057407175613, 1.0569715142428786 \n\t);\n\tfloat sub1 = pow(L + 16.0, 3.0) / 1560896.0;\n\tfloat sub2 = sub1 > 0.0088564516790356308 ? sub1 : L / 903.2962962962963;\n\n\tvec3 top1 = (284517.0 * m2[0] - 94839.0 * m2[2]) * sub2;\n\tvec3 bottom = (632260.0 * m2[2] - 126452.0 * m2[1]) * sub2;\n\tvec3 top2 = (838422.0 * m2[2] + 769860.0 * m2[1] + 731718.0 * m2[0]) * L * sub2;\n\n\tvec3 bound0x = top1 / bottom;\n\tvec3 bound0y = top2 / bottom;\n\n\tvec3 bound1x = top1 / (bottom+126452.0);\n\tvec3 bound1y = (top2-769860.0*L) / (bottom+126452.0);\n\n\tvec3 lengths0 = hsluv_lengthOfRayUntilIntersect(hrad, bound0x, bound0y );\n\tvec3 lengths1 = hsluv_lengthOfRayUntilIntersect(hrad, bound1x, bound1y );\n\n\treturn min(lengths0.r,\n\t\t\tmin(lengths1.r,\n\t\t\tmin(lengths0.g,\n\t\t\tmin(lengths1.g,\n\t\t\tmin(lengths0.b,\n\t\t\t\tlengths1.b)))));\n}\n\nfloat hsluv_fromLinear(float c) {\n\treturn c <= 0.0031308 ? 12.92 * c : 1.055 * pow(c, 1.0 / 2.4) - 0.055;\n}\nvec3 hsluv_fromLinear(vec3 c) {\n\treturn vec3( hsluv_fromLinear(c.r), hsluv_fromLinear(c.g), hsluv_fromLinear(c.b) );\n}\n\nfloat hsluv_toLinear(float c) {\n\treturn c > 0.04045 ? pow((c + 0.055) / (1.0 + 0.055), 2.4) : c / 12.92;\n}\n\nvec3 hsluv_toLinear(vec3 c) {\n\treturn vec3( hsluv_toLinear(c.r), hsluv_toLinear(c.g), hsluv_toLinear(c.b) );\n}\n\nfloat hsluv_yToL(float Y){\n\treturn Y <= 0.0088564516790356308 ? Y * 903.2962962962963 : 116.0 * pow(Y, 1.0 / 3.0) - 16.0;\n}\n\nfloat hsluv_lToY(float L) {\n\treturn L <= 8.0 ? L / 903.2962962962963 : pow((L + 16.0) / 116.0, 3.0);\n}\n\nvec3 xyzToRgb(vec3 tuple) {\n\tconst mat3 m = mat3( \n\t\t3.2409699419045214 ,-1.5373831775700935 ,-0.49861076029300328 ,\n\t\t-0.96924363628087983 , 1.8759675015077207 , 0.041555057407175613,\n\t\t0.055630079696993609,-0.20397695888897657, 1.0569715142428786 );\n\t\n\treturn hsluv_fromLinear(tuple*m);\n}\n\nvec3 rgbToXyz(vec3 tuple) {\n\tconst mat3 m = mat3(\n\t\t0.41239079926595948 , 0.35758433938387796, 0.18048078840183429 ,\n\t\t0.21263900587151036 , 0.71516867876775593, 0.072192315360733715,\n\t\t0.019330818715591851, 0.11919477979462599, 0.95053215224966058 \n\t);\n\treturn hsluv_toLinear(tuple) * m;\n}\n\nvec3 xyzToLuv(vec3 tuple){\n\tfloat X = tuple.x;\n\tfloat Y = tuple.y;\n\tfloat Z = tuple.z;\n\n\tfloat L = hsluv_yToL(Y);\n\t\n\tfloat div = 1./dot(tuple,vec3(1,15,3)); \n\n\treturn vec3(\n\t\t1.,\n\t\t(52. * (X*div) - 2.57179),\n\t\t(117.* (Y*div) - 6.08816)\n\t) * L;\n}\n\n\nvec3 luvToXyz(vec3 tuple) {\n\tfloat L = tuple.x;\n\n\tfloat U = tuple.y / (13.0 * L) + 0.19783000664283681;\n\tfloat V = tuple.z / (13.0 * L) + 0.468319994938791;\n\n\tfloat Y = hsluv_lToY(L);\n\tfloat X = 2.25 * U * Y / V;\n\tfloat Z = (3./V - 5.)*Y - (X/3.);\n\n\treturn vec3(X, Y, Z);\n}\n\nvec3 luvToLch(vec3 tuple) {\n\tfloat L = tuple.x;\n\tfloat U = tuple.y;\n\tfloat V = tuple.z;\n\n\tfloat C = length(tuple.yz);\n\tfloat H = degrees(atan(V,U));\n\tif (H < 0.0) {\n\t\tH = 360.0 + H;\n\t}\n\t\n\treturn vec3(L, C, H);\n}\n\nvec3 lchToLuv(vec3 tuple) {\n\tfloat hrad = radians(tuple.b);\n\treturn vec3(\n\t\ttuple.r,\n\t\tcos(hrad) * tuple.g,\n\t\tsin(hrad) * tuple.g\n\t);\n}\n\nvec3 hsluvToLch(vec3 tuple) {\n\ttuple.g *= hsluv_maxChromaForLH(tuple.b, tuple.r) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToHsluv(vec3 tuple) {\n\ttuple.g /= hsluv_maxChromaForLH(tuple.r, tuple.b) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 hpluvToLch(vec3 tuple) {\n\ttuple.g *= hsluv_maxSafeChromaForL(tuple.b) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToHpluv(vec3 tuple) {\n\ttuple.g /= hsluv_maxSafeChromaForL(tuple.r) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToRgb(vec3 tuple) {\n\treturn xyzToRgb(luvToXyz(lchToLuv(tuple)));\n}\n\nvec3 rgbToLch(vec3 tuple) {\n\treturn luvToLch(xyzToLuv(rgbToXyz(tuple)));\n}\n\nvec3 hsluvToRgb(vec3 tuple) {\n\treturn lchToRgb(hsluvToLch(tuple));\n}\n\nvec3 rgbToHsluv(vec3 tuple) {\n\treturn lchToHsluv(rgbToLch(tuple));\n}\n\nvec3 hpluvToRgb(vec3 tuple) {\n\treturn lchToRgb(hpluvToLch(tuple));\n}\n\nvec3 rgbToHpluv(vec3 tuple) {\n\treturn lchToHpluv(rgbToLch(tuple));\n}\n\nvec3 luvToRgb(vec3 tuple){\n\treturn xyzToRgb(luvToXyz(tuple));\n}\n\n// allow vec4's\nvec4 xyzToRgb(vec4 c) {return vec4( xyzToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToXyz(vec4 c) {return vec4( rgbToXyz( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 xyzToLuv(vec4 c) {return vec4( xyzToLuv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToXyz(vec4 c) {return vec4( luvToXyz( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToLch(vec4 c) {return vec4( luvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToLuv(vec4 c) {return vec4( lchToLuv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hsluvToLch(vec4 c) {return vec4( hsluvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToHsluv(vec4 c) {return vec4( lchToHsluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hpluvToLch(vec4 c) {return vec4( hpluvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToHpluv(vec4 c) {return vec4( lchToHpluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToRgb(vec4 c) {return vec4( lchToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToLch(vec4 c) {return vec4( rgbToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hsluvToRgb(vec4 c) {return vec4( hsluvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToHsluv(vec4 c) {return vec4( rgbToHsluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hpluvToRgb(vec4 c) {return vec4( hpluvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToHpluv(vec4 c) {return vec4( rgbToHpluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToRgb(vec4 c) {return vec4( luvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\n// allow 3 floats\nvec3 xyzToRgb(float x, float y, float z) {return xyzToRgb( vec3(x,y,z) );}\nvec3 rgbToXyz(float x, float y, float z) {return rgbToXyz( vec3(x,y,z) );}\nvec3 xyzToLuv(float x, float y, float z) {return xyzToLuv( vec3(x,y,z) );}\nvec3 luvToXyz(float x, float y, float z) {return luvToXyz( vec3(x,y,z) );}\nvec3 luvToLch(float x, float y, float z) {return luvToLch( vec3(x,y,z) );}\nvec3 lchToLuv(float x, float y, float z) {return lchToLuv( vec3(x,y,z) );}\nvec3 hsluvToLch(float x, float y, float z) {return hsluvToLch( vec3(x,y,z) );}\nvec3 lchToHsluv(float x, float y, float z) {return lchToHsluv( vec3(x,y,z) );}\nvec3 hpluvToLch(float x, float y, float z) {return hpluvToLch( vec3(x,y,z) );}\nvec3 lchToHpluv(float x, float y, float z) {return lchToHpluv( vec3(x,y,z) );}\nvec3 lchToRgb(float x, float y, float z) {return lchToRgb( vec3(x,y,z) );}\nvec3 rgbToLch(float x, float y, float z) {return rgbToLch( vec3(x,y,z) );}\nvec3 hsluvToRgb(float x, float y, float z) {return hsluvToRgb( vec3(x,y,z) );}\nvec3 rgbToHsluv(float x, float y, float z) {return rgbToHsluv( vec3(x,y,z) );}\nvec3 hpluvToRgb(float x, float y, float z) {return hpluvToRgb( vec3(x,y,z) );}\nvec3 rgbToHpluv(float x, float y, float z) {return rgbToHpluv( vec3(x,y,z) );}\nvec3 luvToRgb(float x, float y, float z) {return luvToRgb( vec3(x,y,z) );}\n// allow 4 floats\nvec4 xyzToRgb(float x, float y, float z, float a) {return xyzToRgb( vec4(x,y,z,a) );}\nvec4 rgbToXyz(float x, float y, float z, float a) {return rgbToXyz( vec4(x,y,z,a) );}\nvec4 xyzToLuv(float x, float y, float z, float a) {return xyzToLuv( vec4(x,y,z,a) );}\nvec4 luvToXyz(float x, float y, float z, float a) {return luvToXyz( vec4(x,y,z,a) );}\nvec4 luvToLch(float x, float y, float z, float a) {return luvToLch( vec4(x,y,z,a) );}\nvec4 lchToLuv(float x, float y, float z, float a) {return lchToLuv( vec4(x,y,z,a) );}\nvec4 hsluvToLch(float x, float y, float z, float a) {return hsluvToLch( vec4(x,y,z,a) );}\nvec4 lchToHsluv(float x, float y, float z, float a) {return lchToHsluv( vec4(x,y,z,a) );}\nvec4 hpluvToLch(float x, float y, float z, float a) {return hpluvToLch( vec4(x,y,z,a) );}\nvec4 lchToHpluv(float x, float y, float z, float a) {return lchToHpluv( vec4(x,y,z,a) );}\nvec4 lchToRgb(float x, float y, float z, float a) {return lchToRgb( vec4(x,y,z,a) );}\nvec4 rgbToLch(float x, float y, float z, float a) {return rgbToLch( vec4(x,y,z,a) );}\nvec4 hsluvToRgb(float x, float y, float z, float a) {return hsluvToRgb( vec4(x,y,z,a) );}\nvec4 rgbToHslul(float x, float y, float z, float a) {return rgbToHsluv( vec4(x,y,z,a) );}\nvec4 hpluvToRgb(float x, float y, float z, float a) {return hpluvToRgb( vec4(x,y,z,a) );}\nvec4 rgbToHpluv(float x, float y, float z, float a) {return rgbToHpluv( vec4(x,y,z,a) );}\nvec4 luvToRgb(float x, float y, float z, float a) {return luvToRgb( vec4(x,y,z,a) );}\n\n/*\nEND HSLUV-GLSL\n*/\n\n\n// from https://gist.github.com/mattatz/44f081cac87e2f7c8980\n// converted to glsl by gui@polygonjs.com\n// and made function names consistent with the ones above\n/*\n * Conversion between RGB and LAB colorspace.\n * Import from flowabs glsl program : https://code.google.com/p/flowabs/source/browse/glsl/?r=f36cbdcf7790a28d90f09e2cf89ec9a64911f138\n */\n\n\n\nvec3 xyzToLab( vec3 c ) {\n\tvec3 n = c / vec3(95.047, 100, 108.883);\n\tvec3 v;\n\tv.x = ( n.x > 0.008856 ) ? pow( n.x, 1.0 / 3.0 ) : ( 7.787 * n.x ) + ( 16.0 / 116.0 );\n\tv.y = ( n.y > 0.008856 ) ? pow( n.y, 1.0 / 3.0 ) : ( 7.787 * n.y ) + ( 16.0 / 116.0 );\n\tv.z = ( n.z > 0.008856 ) ? pow( n.z, 1.0 / 3.0 ) : ( 7.787 * n.z ) + ( 16.0 / 116.0 );\n\treturn vec3(( 116.0 * v.y ) - 16.0, 500.0 * ( v.x - v.y ), 200.0 * ( v.y - v.z ));\n}\n\nvec3 rgbToLab( vec3 c ) {\n\tvec3 lab = xyzToLab( rgbToXyz( c ) );\n\treturn vec3( lab.x / 100.0, 0.5 + 0.5 * ( lab.y / 127.0 ), 0.5 + 0.5 * ( lab.z / 127.0 ));\n}\n\nvec3 labToXyz( vec3 c ) {\n\tfloat fy = ( c.x + 16.0 ) / 116.0;\n\tfloat fx = c.y / 500.0 + fy;\n\tfloat fz = fy - c.z / 200.0;\n\treturn vec3(\n\t\t 95.047 * (( fx > 0.206897 ) ? fx * fx * fx : ( fx - 16.0 / 116.0 ) / 7.787),\n\t\t100.000 * (( fy > 0.206897 ) ? fy * fy * fy : ( fy - 16.0 / 116.0 ) / 7.787),\n\t\t108.883 * (( fz > 0.206897 ) ? fz * fz * fz : ( fz - 16.0 / 116.0 ) / 7.787)\n\t);\n}\n\n\n\nvec3 labToRgb( vec3 c ) {\n\treturn xyzToRgb( labToXyz( vec3(100.0 * c.x, 2.0 * 127.0 * (c.y - 0.5), 2.0 * 127.0 * (c.z - 0.5)) ) );\n}\n\n// adapted from\n// THREEjs math/Color.js\nfloat sRGBToLinear( float c ) {\n\treturn ( c < 0.04045 ) ? c * 0.0773993808 : pow( c * 0.9478672986 + 0.0521327014, 2.4 );\n}\nvec3 sRGBToLinear( vec3 c ) {\n\treturn vec3( sRGBToLinear(c.r), sRGBToLinear(c.g), sRGBToLinear(c.b) );\n}\nvec4 sRGBToLinear( vec4 c ) {\n\treturn vec4( sRGBToLinear(c.r), sRGBToLinear(c.g), sRGBToLinear(c.b), c.a );\n}\n\n\n\n\n\n\n\n// /geo1/MAT/meshBasicBuilder1/globals1\nvarying vec2 v_POLY_globals1_uv;\n\n\n\n\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvarying vec2 vHighPrecisionZW;\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4( 1.0 );\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tdiffuseColor.a = opacity;\n\n\t#endif\n\n\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\n\n\n\t// /geo1/MAT/meshBasicBuilder1/subtract2\n\tvec2 v_POLY_subtract2_subtract = (v_POLY_globals1_uv - vec2(0.5, 0.5));\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec2ToVec3_1\n\tvec3 v_POLY_vec2ToVec3_1_vec3 = vec3(v_POLY_subtract2_subtract.xy, 0.0);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec3ToVec4_1\n\tvec4 v_POLY_vec3ToVec4_1_vec4 = vec4(v_POLY_vec2ToVec3_1_vec3.xyz, 0.0);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/colorCorrect1\n\tvec4 v_POLY_colorCorrect1_out = sRGBToLinear(v_POLY_vec3ToVec4_1_vec4);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec4ToVec3_1\n\tvec3 v_POLY_vec4ToVec3_1_vec3 = v_POLY_colorCorrect1_out.xyz;\n\t\n\t// /geo1/MAT/meshBasicBuilder1/output1\n\tdiffuseColor.xyz = v_POLY_vec4ToVec3_1_vec3;\n\n\n\n\n\t// INSERT BODY\n\t// the new body lines should be added before the alphatest_fragment\n\t// so that alpha is set before (which is really how it would be set if the alphamap_fragment above was used by the material node parameters)\n\n\t#include <alphatest_fragment>\n\n\t#include <logdepthbuf_fragment>\n\n\n\t// Higher precision equivalent of gl_FragCoord.z. This assumes depthRange has been left to its default values.\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), diffuseColor.a );\n\n\t#elif DEPTH_PACKING == 3201\n\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\n\t#endif\n\n}\n"}},"jsFunctionBodies":{}}
Code editor
{"multiple_panel":{"split_ratio":0.5,"split_panel0":{"split_ratio":0.5543217692883486,"split_panel0":{"panelTypes":["viewer"],"currentPanelIndex":0,"panel_data":{"camera":"/cameras/cameras:sopGroup/perspectiveCamera1","isViewerInitLayoutData":true,"linkIndex":1,"overlayedNetwork":{"allowed":false,"displayed":false}}},"split_panel1":{"panelTypes":["params"],"currentPanelIndex":0,"panel_data":{"active_folder":392,"linkIndex":1}},"split_mode":"vertical"},"split_panel1":{"panelTypes":["network","params","viewer"],"currentPanelIndex":0,"panel_data":{"camera":{"position":{"x":-149.05297258917093,"y":-271.68106351895847},"zoom":0.7192221069335931},"history":{"2":{"position":{"x":-127.23709817345446,"y":70.54961652487995},"zoom":1.0222221069335933},"36":{"position":{"x":130.37228858252482,"y":-547.4355329613236},"zoom":0.7192221069335931},"195":{"position":{"x":50,"y":-300},"zoom":1.0222221069335933},"386":{"position":{"x":50,"y":150},"zoom":0.7192221069335931},"389":{"position":{"x":-149.05297258917093,"y":-271.68106351895847},"zoom":0.7192221069335931},"980":{"position":{"x":200,"y":-275},"zoom":1.0222221069335933},"1093":{"position":{"x":18.695648643334593,"y":86.41303630677339},"zoom":1.0222221069335933},"1096":{"position":{"x":-149.05297258917093,"y":-271.68106351895847},"zoom":0.7192221069335931},"1460":{"position":{"x":25,"y":-125},"zoom":1.0222221069335933},"1617":{"position":{"x":-38.15217821593596,"y":-96.8478370096836},"zoom":1.0222221069335933}},"paramsDisplayed":false,"linkIndex":1}},"split_mode":"horizontal"},"currentNodes":["/geo1/MAT/meshBasicBuilder1","/","/","/","/","/","/","/"],"navigationHistory":{"nodePaths":{"1":["/geo1/MAT","/geo1/MAT/meshBasicBuilder1","/geo1/MAT","/geo1","/","/cameras","/cameras/cameraRenderer1","/cameras","/","/geo1","/geo1/MAT","/geo1/MAT/meshBasicBuilder1","/geo1/MAT","/geo1","/","/cameras","/","/geo1","/geo1/MAT","/geo1/MAT/meshBasicBuilder1"],"2":["/"],"3":["/"],"4":["/"],"5":["/"],"6":["/"],"7":["/"],"8":["/"]},"index":{"1":19,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0}},"fullscreenPanelId":null,"saveOptions":{"checkRemoteAssetsUse":true,"minimizeFilesCount":false},"paramsModal":[{"nodePath":"/cameras/cameraRenderer1/WebGLRenderer1","style":{"top":594,"left":1057.5,"width":600,"height":576.6}}]}
Used nodes
cop/envMap;cop/image;cop/imageEXR;event/cameraOrbitControls;mat/meshBasicBuilder;obj/copNetwork;obj/geo;rop/WebGLRenderer;sop/cameraControls;sop/cameraRenderer;sop/hemisphereLight;sop/material;sop/materialsNetwork;sop/merge;sop/perspectiveCamera;sop/plane;sop/planeHelper;sop/polarTransform;sop/spotLight
Used operations
Used modules
Used assemblers
GL_MESH_BASIC
Used integrations
[]
Used assets
Nodes map
{"/geo1":"obj/geo","/geo1/plane1":"sop/plane","/geo1/material1":"sop/material","/geo1/MAT":"sop/materialsNetwork","/geo1/MAT/meshBasicBuilder1":"mat/meshBasicBuilder","/COP":"obj/copNetwork","/COP/envMap":"cop/envMap","/COP/imageEnv":"cop/imageEXR","/COP/image1":"cop/image","/lights":"obj/geo","/lights/hemisphereLight1":"sop/hemisphereLight","/lights/spotLight1":"sop/spotLight","/lights/polarTransform1":"sop/polarTransform","/lights/merge1":"sop/merge","/cameras":"obj/geo","/cameras/perspectiveCamera1":"sop/perspectiveCamera","/cameras/cameraControls1":"sop/cameraControls","/cameras/cameraControls1/cameraOrbitControls1":"event/cameraOrbitControls","/cameras/cameraRenderer1":"sop/cameraRenderer","/cameras/cameraRenderer1/WebGLRenderer1":"rop/WebGLRenderer","/geo2":"obj/geo","/geo2/planeHelper1":"sop/planeHelper"}
Js version
Editor version
Engine version
Name
*
Code
{"properties":{"frame":0,"maxFrame":600,"maxFrameLocked":false,"realtimeState":true,"mainCameraPath":"/cameras/cameras:sopGroup/perspectiveCamera1","versions":{"polygonjs":"1.5.66"}},"root":{"type":"root","nodes":{"geo1":{"type":"geo","nodes":{"plane1":{"type":"plane"},"material1":{"type":"material","params":{"material":"../MAT/meshBasicBuilder1"},"inputs":["plane1"],"flags":{"display":true}},"MAT":{"type":"materialsNetwork","nodes":{"meshBasicBuilder1":{"type":"meshBasicBuilder","nodes":{"globals1":{"type":"globals"},"output1":{"type":"output","inputs":[null,null,{"index":2,"inputName":"color","node":"vec4ToVec3_1","output":"vec3"}]},"vec2ToVec3_1":{"type":"vec2ToVec3","params":{"vec2":{"overriden_options":{}},"z":{"overriden_options":{}}},"inputs":[{"index":0,"inputName":"vec2","node":"subtract2","output":"subtract"}]},"subtract2":{"type":"subtract","params":{"sub0":{"type":"vector2","default_value":[0,0],"options":{"spare":true,"editable":false,"computeOnDirty":true,"dependentOnFoundParam":false}},"sub1":{"type":"vector2","default_value":[0,0],"options":{"spare":true,"editable":true,"computeOnDirty":true,"dependentOnFoundParam":false},"raw_input":[0.5,0.5]}},"inputs":[{"index":0,"inputName":"sub0","node":"globals1","output":"uv"}],"connection_points":{"in":[{"name":"sub0","type":"vec2"},{"name":"sub1","type":"vec2"}],"out":[{"name":"subtract","type":"vec2"}]}},"colorCorrect1":{"type":"colorCorrect","params":{"color":{"overriden_options":{}},"from":1,"to":0},"inputs":[{"index":0,"inputName":"color","node":"vec3ToVec4_1","output":"vec4"}]},"vec3ToVec4_1":{"type":"vec3ToVec4","params":{"vec3":{"overriden_options":{}},"w":{"overriden_options":{}}},"inputs":[{"index":0,"inputName":"vec3","node":"vec2ToVec3_1","output":"vec3"}]},"vec4ToVec3_1":{"type":"vec4ToVec3","params":{"vec4":{"overriden_options":{}}},"inputs":[{"index":0,"inputName":"vec4","node":"colorCorrect1","output":"out"}]}},"persisted_config":{"material":{"metadata":{"version":4.6,"type":"Material","generator":"Material.toJSON"},"uuid":"/geo1/MAT/meshBasicBuilder1-main","type":"MeshBasicMaterial","color":16777215,"reflectivity":1,"refractionRatio":0.98,"blendColor":0,"fog":false},"onBeforeCompileDataJSONWithoutShaders":{"paramConfigs":[],"timeDependent":false,"resolutionDependent":false,"raymarchingLightsWorldCoordsDependent":false},"customMaterials":{"customDepthMaterial":{"material":{"metadata":{"version":4.6,"type":"Material","generator":"Material.toJSON"},"uuid":"/geo1/MAT/meshBasicBuilder1-customDepthMaterial","type":"MeshDepthMaterial","name":"customDepthMaterial","side":1,"blendColor":0,"depthPacking":3201},"onBeforeCompileDataJSONWithoutShaders":{"paramConfigs":[],"timeDependent":false,"resolutionDependent":false,"raymarchingLightsWorldCoordsDependent":false}},"customDistanceMaterial":{"material":{"metadata":{"version":4.6,"type":"Material","generator":"Material.toJSON"},"uuid":"/geo1/MAT/meshBasicBuilder1-customDistanceMaterial","type":"MeshDistanceMaterial","name":"customDistanceMaterial","blendColor":0},"onBeforeCompileDataJSONWithoutShaders":{"paramConfigs":[],"timeDependent":false,"resolutionDependent":false,"raymarchingLightsWorldCoordsDependent":false}},"customDepthDOFMaterial":{"material":{"metadata":{"version":4.6,"type":"Material","generator":"Material.toJSON"},"uuid":"/geo1/MAT/meshBasicBuilder1-customDepthDOFMaterial","type":"MeshDepthMaterial","name":"customDepthDOFMaterial","blendColor":0,"depthPacking":3200},"onBeforeCompileDataJSONWithoutShaders":{"paramConfigs":[],"timeDependent":false,"resolutionDependent":false,"raymarchingLightsWorldCoordsDependent":false}}}}}}}},"params":{"CADLinearTolerance":{"overriden_options":{"callback":"{}"}},"CADAngularTolerance":{"overriden_options":{"callback":"{}"}},"CADCurveAbscissa":{"overriden_options":{"callback":"{}"}},"CADCurveTolerance":{"overriden_options":{"callback":"{}"}},"CADDisplayEdges":{"overriden_options":{"callback":"{}"}},"CADEdgesColor":{"overriden_options":{"callback":"{}"}},"CADDisplayMeshes":{"overriden_options":{"callback":"{}"}},"CADMeshesColor":{"overriden_options":{"callback":"{}"}},"CADWireframe":{"overriden_options":{"callback":"{}"}},"CSGFacetAngle":{"overriden_options":{"callback":"{}"}},"CSGLinesColor":{"overriden_options":{"callback":"{}"}},"CSGMeshesColor":{"overriden_options":{"callback":"{}"}},"CSGWireframe":{"overriden_options":{"callback":"{}"}},"QUADTriangles":{"overriden_options":{"callback":"{}"}},"QUADWireframe":{"overriden_options":{"callback":"{}"}},"TetScale":{"overriden_options":{"callback":"{}"}},"TetDisplayLines":{"overriden_options":{"callback":"{}"}},"TetDisplaySharedFaces":{"overriden_options":{"callback":"{}"}},"TetDisplayPoints":{"overriden_options":{"callback":"{}"}},"TetDisplayCenter":{"overriden_options":{"callback":"{}"}},"TetDisplaySphere":{"overriden_options":{"callback":"{}"}}},"flags":{"display":true}},"COP":{"type":"copNetwork","nodes":{"envMap":{"type":"envMap","inputs":["imageEnv"]},"imageEnv":{"type":"imageEXR","params":{"tminFilter":true,"tmagFilter":true,"tanisotropy":true,"useRendererMaxAnisotropy":true}},"image1":{"type":"image"}}},"lights":{"type":"geo","nodes":{"hemisphereLight1":{"type":"hemisphereLight","params":{"intensity":0.52}},"spotLight1":{"type":"spotLight","params":{"decay":0.1,"distance":10,"castShadow":true}},"polarTransform1":{"type":"polarTransform","params":{"center":[0,0.7,0],"latitude":25.2,"depth":3},"inputs":["spotLight1"]},"merge1":{"type":"merge","inputs":["hemisphereLight1","polarTransform1"],"flags":{"display":true}}},"params":{"CADLinearTolerance":{"overriden_options":{"callback":"{}"}},"CADAngularTolerance":{"overriden_options":{"callback":"{}"}},"CADCurveAbscissa":{"overriden_options":{"callback":"{}"}},"CADCurveTolerance":{"overriden_options":{"callback":"{}"}},"CADDisplayEdges":{"overriden_options":{"callback":"{}"}},"CADEdgesColor":{"overriden_options":{"callback":"{}"}},"CADDisplayMeshes":{"overriden_options":{"callback":"{}"}},"CADMeshesColor":{"overriden_options":{"callback":"{}"}},"CADWireframe":{"overriden_options":{"callback":"{}"}},"CSGFacetAngle":{"overriden_options":{"callback":"{}"}},"CSGLinesColor":{"overriden_options":{"callback":"{}"}},"CSGMeshesColor":{"overriden_options":{"callback":"{}"}},"CSGWireframe":{"overriden_options":{"callback":"{}"}},"QUADTriangles":{"overriden_options":{"callback":"{}"}},"QUADWireframe":{"overriden_options":{"callback":"{}"}},"TetScale":{"overriden_options":{"callback":"{}"}},"TetDisplayLines":{"overriden_options":{"callback":"{}"}},"TetDisplaySharedFaces":{"overriden_options":{"callback":"{}"}},"TetDisplayPoints":{"overriden_options":{"callback":"{}"}},"TetDisplayCenter":{"overriden_options":{"callback":"{}"}},"TetDisplaySphere":{"overriden_options":{"callback":"{}"}}},"flags":{"display":true}},"cameras":{"type":"geo","nodes":{"perspectiveCamera1":{"type":"perspectiveCamera","params":{"position":[0.08545380203960441,1.5602120603036882,0.8830091854174875],"rotation":[-61.7023899016352,-0.11919869782992192,-0.22139686695529964]}},"cameraControls1":{"type":"cameraControls","nodes":{"cameraOrbitControls1":{"type":"cameraOrbitControls","params":{"target":[0.08773341037027677,0.5954089967550629,0.36356816948000514]}}},"params":{"node":"cameraOrbitControls1"},"inputs":["perspectiveCamera1"]},"cameraRenderer1":{"type":"cameraRenderer","nodes":{"WebGLRenderer1":{"type":"WebGLRenderer","params":{"toneMapping":0}}},"params":{"node":"WebGLRenderer1"},"inputs":["cameraControls1"],"flags":{"display":true}}},"params":{"CADLinearTolerance":{"overriden_options":{"callback":"{}"}},"CADAngularTolerance":{"overriden_options":{"callback":"{}"}},"CADCurveAbscissa":{"overriden_options":{"callback":"{}"}},"CADCurveTolerance":{"overriden_options":{"callback":"{}"}},"CADDisplayEdges":{"overriden_options":{"callback":"{}"}},"CADEdgesColor":{"overriden_options":{"callback":"{}"}},"CADDisplayMeshes":{"overriden_options":{"callback":"{}"}},"CADMeshesColor":{"overriden_options":{"callback":"{}"}},"CADWireframe":{"overriden_options":{"callback":"{}"}},"CSGFacetAngle":{"overriden_options":{"callback":"{}"}},"CSGLinesColor":{"overriden_options":{"callback":"{}"}},"CSGMeshesColor":{"overriden_options":{"callback":"{}"}},"CSGWireframe":{"overriden_options":{"callback":"{}"}},"QUADTriangles":{"overriden_options":{"callback":"{}"}},"QUADWireframe":{"overriden_options":{"callback":"{}"}},"TetScale":{"overriden_options":{"callback":"{}"}},"TetDisplayLines":{"overriden_options":{"callback":"{}"}},"TetDisplaySharedFaces":{"overriden_options":{"callback":"{}"}},"TetDisplayPoints":{"overriden_options":{"callback":"{}"}},"TetDisplayCenter":{"overriden_options":{"callback":"{}"}},"TetDisplaySphere":{"overriden_options":{"callback":"{}"}}},"flags":{"display":true}},"geo2":{"type":"geo","nodes":{"planeHelper1":{"type":"planeHelper","flags":{"display":true}}},"params":{"CADLinearTolerance":{"overriden_options":{"callback":"{}"}},"CADAngularTolerance":{"overriden_options":{"callback":"{}"}},"CADCurveAbscissa":{"overriden_options":{"callback":"{}"}},"CADCurveTolerance":{"overriden_options":{"callback":"{}"}},"CADDisplayEdges":{"overriden_options":{"callback":"{}"}},"CADEdgesColor":{"overriden_options":{"callback":"{}"}},"CADDisplayMeshes":{"overriden_options":{"callback":"{}"}},"CADMeshesColor":{"overriden_options":{"callback":"{}"}},"CADWireframe":{"overriden_options":{"callback":"{}"}},"CSGFacetAngle":{"overriden_options":{"callback":"{}"}},"CSGLinesColor":{"overriden_options":{"callback":"{}"}},"CSGMeshesColor":{"overriden_options":{"callback":"{}"}},"CSGWireframe":{"overriden_options":{"callback":"{}"}},"QUADTriangles":{"overriden_options":{"callback":"{}"}},"QUADWireframe":{"overriden_options":{"callback":"{}"}},"TetScale":{"overriden_options":{"callback":"{}"}},"TetDisplayLines":{"overriden_options":{"callback":"{}"}},"TetDisplaySharedFaces":{"overriden_options":{"callback":"{}"}},"TetDisplayPoints":{"overriden_options":{"callback":"{}"}},"TetDisplayCenter":{"overriden_options":{"callback":"{}"}},"TetDisplaySphere":{"overriden_options":{"callback":"{}"}}},"flags":{"display":true}}},"params":{"mainCameraPath":"/cameras/cameras:sopGroup/perspectiveCamera1"}},"ui":{"nodes":{"geo1":{"pos":[50,-300],"selection":["MAT"],"nodes":{"plane1":{"pos":[-100,200]},"material1":{"pos":[-100,350]},"MAT":{"pos":[-300,350],"selection":["meshBasicBuilder1"],"nodes":{"meshBasicBuilder1":{"pos":[-50,-150],"nodes":{"globals1":{"pos":[-350,0]},"output1":{"pos":[550,0]},"vec2ToVec3_1":{"pos":[50,50]},"subtract2":{"pos":[-150,50]},"colorCorrect1":{"pos":[300,200]},"vec3ToVec4_1":{"pos":[150,200]},"vec4ToVec3_1":{"pos":[450,200]}}}}}}},"COP":{"pos":[-200,0],"selection":["image1"],"nodes":{"envMap":{"pos":[50,250]},"imageEnv":{"pos":[50,100]},"image1":{"pos":[-200,100]}}},"lights":{"pos":[50,-200],"selection":["hemisphereLight1"],"nodes":{"hemisphereLight1":{"pos":[50,-50]},"spotLight1":{"pos":[300,-50]},"polarTransform1":{"pos":[300,150]},"merge1":{"pos":[100,300]}}},"cameras":{"pos":[50,-100],"nodes":{"perspectiveCamera1":{"pos":[0,-50]},"cameraControls1":{"pos":[0,150],"nodes":{"cameraOrbitControls1":{"pos":[0,0]}}},"cameraRenderer1":{"pos":[-50,300],"selection":["WebGLRenderer1"],"nodes":{"WebGLRenderer1":{"pos":[0,0]}}}}},"geo2":{"pos":[50,-400],"nodes":{"planeHelper1":{"pos":[0,-50]}}}}},"shaders":{"/geo1/MAT/meshBasicBuilder1":{"vertex":"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n\n\n\n// /geo1/MAT/meshBasicBuilder1/globals1\nvarying vec2 v_POLY_globals1_uv;\n\n\n\n\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\n\n\n\t// /geo1/MAT/meshBasicBuilder1/globals1\n\tv_POLY_globals1_uv = vec2(uv);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/output1\n\tvec3 transformed = position;\n\tvec3 objectNormal = normal;\n\t#ifdef USE_TANGENT\n\t\tvec3 objectTangent = vec3( tangent.xyz );\n\t#endif\n\n\n\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n// removed:\n//\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n// removed:\n//\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}","fragment":"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n\n\n\n// /geo1/MAT/meshBasicBuilder1/colorCorrect1\n// from https://github.com/williammalo/hsluv-glsl\n/*\nHSLUV-GLSL v4.2\nHSLUV is a human-friendly alternative to HSL. ( http://www.hsluv.org )\nGLSL port by William Malo ( https://github.com/williammalo )\nPut this code in your fragment shader.\n*/\n\nvec3 hsluv_intersectLineLine(vec3 line1x, vec3 line1y, vec3 line2x, vec3 line2y) {\n\treturn (line1y - line2y) / (line2x - line1x);\n}\n\nvec3 hsluv_distanceFromPole(vec3 pointx,vec3 pointy) {\n\treturn sqrt(pointx*pointx + pointy*pointy);\n}\n\nvec3 hsluv_lengthOfRayUntilIntersect(float theta, vec3 x, vec3 y) {\n\tvec3 len = y / (sin(theta) - x * cos(theta));\n\tif (len.r < 0.0) {len.r=1000.0;}\n\tif (len.g < 0.0) {len.g=1000.0;}\n\tif (len.b < 0.0) {len.b=1000.0;}\n\treturn len;\n}\n\nfloat hsluv_maxSafeChromaForL(float L){\n\tmat3 m2 = mat3(\n\t\t 3.2409699419045214 ,-0.96924363628087983 , 0.055630079696993609,\n\t\t-1.5373831775700935 , 1.8759675015077207 ,-0.20397695888897657 ,\n\t\t-0.49861076029300328 , 0.041555057407175613, 1.0569715142428786 \n\t);\n\tfloat sub0 = L + 16.0;\n\tfloat sub1 = sub0 * sub0 * sub0 * .000000641;\n\tfloat sub2 = sub1 > 0.0088564516790356308 ? sub1 : L / 903.2962962962963;\n\n\tvec3 top1 = (284517.0 * m2[0] - 94839.0 * m2[2]) * sub2;\n\tvec3 bottom = (632260.0 * m2[2] - 126452.0 * m2[1]) * sub2;\n\tvec3 top2 = (838422.0 * m2[2] + 769860.0 * m2[1] + 731718.0 * m2[0]) * L * sub2;\n\n\tvec3 bounds0x = top1 / bottom;\n\tvec3 bounds0y = top2 / bottom;\n\n\tvec3 bounds1x = top1 / (bottom+126452.0);\n\tvec3 bounds1y = (top2-769860.0*L) / (bottom+126452.0);\n\n\tvec3 xs0 = hsluv_intersectLineLine(bounds0x, bounds0y, -1.0/bounds0x, vec3(0.0) );\n\tvec3 xs1 = hsluv_intersectLineLine(bounds1x, bounds1y, -1.0/bounds1x, vec3(0.0) );\n\n\tvec3 lengths0 = hsluv_distanceFromPole( xs0, bounds0y + xs0 * bounds0x );\n\tvec3 lengths1 = hsluv_distanceFromPole( xs1, bounds1y + xs1 * bounds1x );\n\n\treturn min(lengths0.r,\n\t\t\tmin(lengths1.r,\n\t\t\tmin(lengths0.g,\n\t\t\tmin(lengths1.g,\n\t\t\tmin(lengths0.b,\n\t\t\t\tlengths1.b)))));\n}\n\nfloat hsluv_maxChromaForLH(float L, float H) {\n\n\tfloat hrad = radians(H);\n\n\tmat3 m2 = mat3(\n\t\t 3.2409699419045214 ,-0.96924363628087983 , 0.055630079696993609,\n\t\t-1.5373831775700935 , 1.8759675015077207 ,-0.20397695888897657 ,\n\t\t-0.49861076029300328 , 0.041555057407175613, 1.0569715142428786 \n\t);\n\tfloat sub1 = pow(L + 16.0, 3.0) / 1560896.0;\n\tfloat sub2 = sub1 > 0.0088564516790356308 ? sub1 : L / 903.2962962962963;\n\n\tvec3 top1 = (284517.0 * m2[0] - 94839.0 * m2[2]) * sub2;\n\tvec3 bottom = (632260.0 * m2[2] - 126452.0 * m2[1]) * sub2;\n\tvec3 top2 = (838422.0 * m2[2] + 769860.0 * m2[1] + 731718.0 * m2[0]) * L * sub2;\n\n\tvec3 bound0x = top1 / bottom;\n\tvec3 bound0y = top2 / bottom;\n\n\tvec3 bound1x = top1 / (bottom+126452.0);\n\tvec3 bound1y = (top2-769860.0*L) / (bottom+126452.0);\n\n\tvec3 lengths0 = hsluv_lengthOfRayUntilIntersect(hrad, bound0x, bound0y );\n\tvec3 lengths1 = hsluv_lengthOfRayUntilIntersect(hrad, bound1x, bound1y );\n\n\treturn min(lengths0.r,\n\t\t\tmin(lengths1.r,\n\t\t\tmin(lengths0.g,\n\t\t\tmin(lengths1.g,\n\t\t\tmin(lengths0.b,\n\t\t\t\tlengths1.b)))));\n}\n\nfloat hsluv_fromLinear(float c) {\n\treturn c <= 0.0031308 ? 12.92 * c : 1.055 * pow(c, 1.0 / 2.4) - 0.055;\n}\nvec3 hsluv_fromLinear(vec3 c) {\n\treturn vec3( hsluv_fromLinear(c.r), hsluv_fromLinear(c.g), hsluv_fromLinear(c.b) );\n}\n\nfloat hsluv_toLinear(float c) {\n\treturn c > 0.04045 ? pow((c + 0.055) / (1.0 + 0.055), 2.4) : c / 12.92;\n}\n\nvec3 hsluv_toLinear(vec3 c) {\n\treturn vec3( hsluv_toLinear(c.r), hsluv_toLinear(c.g), hsluv_toLinear(c.b) );\n}\n\nfloat hsluv_yToL(float Y){\n\treturn Y <= 0.0088564516790356308 ? Y * 903.2962962962963 : 116.0 * pow(Y, 1.0 / 3.0) - 16.0;\n}\n\nfloat hsluv_lToY(float L) {\n\treturn L <= 8.0 ? L / 903.2962962962963 : pow((L + 16.0) / 116.0, 3.0);\n}\n\nvec3 xyzToRgb(vec3 tuple) {\n\tconst mat3 m = mat3( \n\t\t3.2409699419045214 ,-1.5373831775700935 ,-0.49861076029300328 ,\n\t\t-0.96924363628087983 , 1.8759675015077207 , 0.041555057407175613,\n\t\t0.055630079696993609,-0.20397695888897657, 1.0569715142428786 );\n\t\n\treturn hsluv_fromLinear(tuple*m);\n}\n\nvec3 rgbToXyz(vec3 tuple) {\n\tconst mat3 m = mat3(\n\t\t0.41239079926595948 , 0.35758433938387796, 0.18048078840183429 ,\n\t\t0.21263900587151036 , 0.71516867876775593, 0.072192315360733715,\n\t\t0.019330818715591851, 0.11919477979462599, 0.95053215224966058 \n\t);\n\treturn hsluv_toLinear(tuple) * m;\n}\n\nvec3 xyzToLuv(vec3 tuple){\n\tfloat X = tuple.x;\n\tfloat Y = tuple.y;\n\tfloat Z = tuple.z;\n\n\tfloat L = hsluv_yToL(Y);\n\t\n\tfloat div = 1./dot(tuple,vec3(1,15,3)); \n\n\treturn vec3(\n\t\t1.,\n\t\t(52. * (X*div) - 2.57179),\n\t\t(117.* (Y*div) - 6.08816)\n\t) * L;\n}\n\n\nvec3 luvToXyz(vec3 tuple) {\n\tfloat L = tuple.x;\n\n\tfloat U = tuple.y / (13.0 * L) + 0.19783000664283681;\n\tfloat V = tuple.z / (13.0 * L) + 0.468319994938791;\n\n\tfloat Y = hsluv_lToY(L);\n\tfloat X = 2.25 * U * Y / V;\n\tfloat Z = (3./V - 5.)*Y - (X/3.);\n\n\treturn vec3(X, Y, Z);\n}\n\nvec3 luvToLch(vec3 tuple) {\n\tfloat L = tuple.x;\n\tfloat U = tuple.y;\n\tfloat V = tuple.z;\n\n\tfloat C = length(tuple.yz);\n\tfloat H = degrees(atan(V,U));\n\tif (H < 0.0) {\n\t\tH = 360.0 + H;\n\t}\n\t\n\treturn vec3(L, C, H);\n}\n\nvec3 lchToLuv(vec3 tuple) {\n\tfloat hrad = radians(tuple.b);\n\treturn vec3(\n\t\ttuple.r,\n\t\tcos(hrad) * tuple.g,\n\t\tsin(hrad) * tuple.g\n\t);\n}\n\nvec3 hsluvToLch(vec3 tuple) {\n\ttuple.g *= hsluv_maxChromaForLH(tuple.b, tuple.r) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToHsluv(vec3 tuple) {\n\ttuple.g /= hsluv_maxChromaForLH(tuple.r, tuple.b) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 hpluvToLch(vec3 tuple) {\n\ttuple.g *= hsluv_maxSafeChromaForL(tuple.b) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToHpluv(vec3 tuple) {\n\ttuple.g /= hsluv_maxSafeChromaForL(tuple.r) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToRgb(vec3 tuple) {\n\treturn xyzToRgb(luvToXyz(lchToLuv(tuple)));\n}\n\nvec3 rgbToLch(vec3 tuple) {\n\treturn luvToLch(xyzToLuv(rgbToXyz(tuple)));\n}\n\nvec3 hsluvToRgb(vec3 tuple) {\n\treturn lchToRgb(hsluvToLch(tuple));\n}\n\nvec3 rgbToHsluv(vec3 tuple) {\n\treturn lchToHsluv(rgbToLch(tuple));\n}\n\nvec3 hpluvToRgb(vec3 tuple) {\n\treturn lchToRgb(hpluvToLch(tuple));\n}\n\nvec3 rgbToHpluv(vec3 tuple) {\n\treturn lchToHpluv(rgbToLch(tuple));\n}\n\nvec3 luvToRgb(vec3 tuple){\n\treturn xyzToRgb(luvToXyz(tuple));\n}\n\n// allow vec4's\nvec4 xyzToRgb(vec4 c) {return vec4( xyzToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToXyz(vec4 c) {return vec4( rgbToXyz( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 xyzToLuv(vec4 c) {return vec4( xyzToLuv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToXyz(vec4 c) {return vec4( luvToXyz( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToLch(vec4 c) {return vec4( luvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToLuv(vec4 c) {return vec4( lchToLuv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hsluvToLch(vec4 c) {return vec4( hsluvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToHsluv(vec4 c) {return vec4( lchToHsluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hpluvToLch(vec4 c) {return vec4( hpluvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToHpluv(vec4 c) {return vec4( lchToHpluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToRgb(vec4 c) {return vec4( lchToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToLch(vec4 c) {return vec4( rgbToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hsluvToRgb(vec4 c) {return vec4( hsluvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToHsluv(vec4 c) {return vec4( rgbToHsluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hpluvToRgb(vec4 c) {return vec4( hpluvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToHpluv(vec4 c) {return vec4( rgbToHpluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToRgb(vec4 c) {return vec4( luvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\n// allow 3 floats\nvec3 xyzToRgb(float x, float y, float z) {return xyzToRgb( vec3(x,y,z) );}\nvec3 rgbToXyz(float x, float y, float z) {return rgbToXyz( vec3(x,y,z) );}\nvec3 xyzToLuv(float x, float y, float z) {return xyzToLuv( vec3(x,y,z) );}\nvec3 luvToXyz(float x, float y, float z) {return luvToXyz( vec3(x,y,z) );}\nvec3 luvToLch(float x, float y, float z) {return luvToLch( vec3(x,y,z) );}\nvec3 lchToLuv(float x, float y, float z) {return lchToLuv( vec3(x,y,z) );}\nvec3 hsluvToLch(float x, float y, float z) {return hsluvToLch( vec3(x,y,z) );}\nvec3 lchToHsluv(float x, float y, float z) {return lchToHsluv( vec3(x,y,z) );}\nvec3 hpluvToLch(float x, float y, float z) {return hpluvToLch( vec3(x,y,z) );}\nvec3 lchToHpluv(float x, float y, float z) {return lchToHpluv( vec3(x,y,z) );}\nvec3 lchToRgb(float x, float y, float z) {return lchToRgb( vec3(x,y,z) );}\nvec3 rgbToLch(float x, float y, float z) {return rgbToLch( vec3(x,y,z) );}\nvec3 hsluvToRgb(float x, float y, float z) {return hsluvToRgb( vec3(x,y,z) );}\nvec3 rgbToHsluv(float x, float y, float z) {return rgbToHsluv( vec3(x,y,z) );}\nvec3 hpluvToRgb(float x, float y, float z) {return hpluvToRgb( vec3(x,y,z) );}\nvec3 rgbToHpluv(float x, float y, float z) {return rgbToHpluv( vec3(x,y,z) );}\nvec3 luvToRgb(float x, float y, float z) {return luvToRgb( vec3(x,y,z) );}\n// allow 4 floats\nvec4 xyzToRgb(float x, float y, float z, float a) {return xyzToRgb( vec4(x,y,z,a) );}\nvec4 rgbToXyz(float x, float y, float z, float a) {return rgbToXyz( vec4(x,y,z,a) );}\nvec4 xyzToLuv(float x, float y, float z, float a) {return xyzToLuv( vec4(x,y,z,a) );}\nvec4 luvToXyz(float x, float y, float z, float a) {return luvToXyz( vec4(x,y,z,a) );}\nvec4 luvToLch(float x, float y, float z, float a) {return luvToLch( vec4(x,y,z,a) );}\nvec4 lchToLuv(float x, float y, float z, float a) {return lchToLuv( vec4(x,y,z,a) );}\nvec4 hsluvToLch(float x, float y, float z, float a) {return hsluvToLch( vec4(x,y,z,a) );}\nvec4 lchToHsluv(float x, float y, float z, float a) {return lchToHsluv( vec4(x,y,z,a) );}\nvec4 hpluvToLch(float x, float y, float z, float a) {return hpluvToLch( vec4(x,y,z,a) );}\nvec4 lchToHpluv(float x, float y, float z, float a) {return lchToHpluv( vec4(x,y,z,a) );}\nvec4 lchToRgb(float x, float y, float z, float a) {return lchToRgb( vec4(x,y,z,a) );}\nvec4 rgbToLch(float x, float y, float z, float a) {return rgbToLch( vec4(x,y,z,a) );}\nvec4 hsluvToRgb(float x, float y, float z, float a) {return hsluvToRgb( vec4(x,y,z,a) );}\nvec4 rgbToHslul(float x, float y, float z, float a) {return rgbToHsluv( vec4(x,y,z,a) );}\nvec4 hpluvToRgb(float x, float y, float z, float a) {return hpluvToRgb( vec4(x,y,z,a) );}\nvec4 rgbToHpluv(float x, float y, float z, float a) {return rgbToHpluv( vec4(x,y,z,a) );}\nvec4 luvToRgb(float x, float y, float z, float a) {return luvToRgb( vec4(x,y,z,a) );}\n\n/*\nEND HSLUV-GLSL\n*/\n\n\n// from https://gist.github.com/mattatz/44f081cac87e2f7c8980\n// converted to glsl by gui@polygonjs.com\n// and made function names consistent with the ones above\n/*\n * Conversion between RGB and LAB colorspace.\n * Import from flowabs glsl program : https://code.google.com/p/flowabs/source/browse/glsl/?r=f36cbdcf7790a28d90f09e2cf89ec9a64911f138\n */\n\n\n\nvec3 xyzToLab( vec3 c ) {\n\tvec3 n = c / vec3(95.047, 100, 108.883);\n\tvec3 v;\n\tv.x = ( n.x > 0.008856 ) ? pow( n.x, 1.0 / 3.0 ) : ( 7.787 * n.x ) + ( 16.0 / 116.0 );\n\tv.y = ( n.y > 0.008856 ) ? pow( n.y, 1.0 / 3.0 ) : ( 7.787 * n.y ) + ( 16.0 / 116.0 );\n\tv.z = ( n.z > 0.008856 ) ? pow( n.z, 1.0 / 3.0 ) : ( 7.787 * n.z ) + ( 16.0 / 116.0 );\n\treturn vec3(( 116.0 * v.y ) - 16.0, 500.0 * ( v.x - v.y ), 200.0 * ( v.y - v.z ));\n}\n\nvec3 rgbToLab( vec3 c ) {\n\tvec3 lab = xyzToLab( rgbToXyz( c ) );\n\treturn vec3( lab.x / 100.0, 0.5 + 0.5 * ( lab.y / 127.0 ), 0.5 + 0.5 * ( lab.z / 127.0 ));\n}\n\nvec3 labToXyz( vec3 c ) {\n\tfloat fy = ( c.x + 16.0 ) / 116.0;\n\tfloat fx = c.y / 500.0 + fy;\n\tfloat fz = fy - c.z / 200.0;\n\treturn vec3(\n\t\t 95.047 * (( fx > 0.206897 ) ? fx * fx * fx : ( fx - 16.0 / 116.0 ) / 7.787),\n\t\t100.000 * (( fy > 0.206897 ) ? fy * fy * fy : ( fy - 16.0 / 116.0 ) / 7.787),\n\t\t108.883 * (( fz > 0.206897 ) ? fz * fz * fz : ( fz - 16.0 / 116.0 ) / 7.787)\n\t);\n}\n\n\n\nvec3 labToRgb( vec3 c ) {\n\treturn xyzToRgb( labToXyz( vec3(100.0 * c.x, 2.0 * 127.0 * (c.y - 0.5), 2.0 * 127.0 * (c.z - 0.5)) ) );\n}\n\n// adapted from\n// THREEjs math/Color.js\nfloat sRGBToLinear( float c ) {\n\treturn ( c < 0.04045 ) ? c * 0.0773993808 : pow( c * 0.9478672986 + 0.0521327014, 2.4 );\n}\nvec3 sRGBToLinear( vec3 c ) {\n\treturn vec3( sRGBToLinear(c.r), sRGBToLinear(c.g), sRGBToLinear(c.b) );\n}\nvec4 sRGBToLinear( vec4 c ) {\n\treturn vec4( sRGBToLinear(c.r), sRGBToLinear(c.g), sRGBToLinear(c.b), c.a );\n}\n\n\n\n\n\n\n\n// /geo1/MAT/meshBasicBuilder1/globals1\nvarying vec2 v_POLY_globals1_uv;\n\n\n\n\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\n\n\t// /geo1/MAT/meshBasicBuilder1/subtract2\n\tvec2 v_POLY_subtract2_subtract = (v_POLY_globals1_uv - vec2(0.5, 0.5));\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec2ToVec3_1\n\tvec3 v_POLY_vec2ToVec3_1_vec3 = vec3(v_POLY_subtract2_subtract.xy, 0.0);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec3ToVec4_1\n\tvec4 v_POLY_vec3ToVec4_1_vec4 = vec4(v_POLY_vec2ToVec3_1_vec3.xyz, 0.0);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/colorCorrect1\n\tvec4 v_POLY_colorCorrect1_out = sRGBToLinear(v_POLY_vec3ToVec4_1_vec4);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec4ToVec3_1\n\tvec3 v_POLY_vec4ToVec3_1_vec3 = v_POLY_colorCorrect1_out.xyz;\n\t\n\t// /geo1/MAT/meshBasicBuilder1/output1\n\tdiffuseColor.xyz = v_POLY_vec4ToVec3_1_vec3;\n\n\n\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}","customDepthMaterial.vertex":"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n\n\n\n// /geo1/MAT/meshBasicBuilder1/globals1\nvarying vec2 v_POLY_globals1_uv;\n\n\n\n\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n// removed:\n//\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n// removed:\n//\t#include <begin_vertex>\n\n\n\n\t// /geo1/MAT/meshBasicBuilder1/globals1\n\tv_POLY_globals1_uv = vec2(uv);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/output1\n\tvec3 transformed = position;\n\tvec3 objectNormal = normal;\n\t#ifdef USE_TANGENT\n\t\tvec3 objectTangent = vec3( tangent.xyz );\n\t#endif\n\n\n\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}","customDepthMaterial.fragment":"\n// INSERT DEFINES\n\n\n#if DEPTH_PACKING == 3200\n\n\tuniform float opacity;\n\n#endif\n\n#include <common>\n\n\n\n// /geo1/MAT/meshBasicBuilder1/colorCorrect1\n// from https://github.com/williammalo/hsluv-glsl\n/*\nHSLUV-GLSL v4.2\nHSLUV is a human-friendly alternative to HSL. ( http://www.hsluv.org )\nGLSL port by William Malo ( https://github.com/williammalo )\nPut this code in your fragment shader.\n*/\n\nvec3 hsluv_intersectLineLine(vec3 line1x, vec3 line1y, vec3 line2x, vec3 line2y) {\n\treturn (line1y - line2y) / (line2x - line1x);\n}\n\nvec3 hsluv_distanceFromPole(vec3 pointx,vec3 pointy) {\n\treturn sqrt(pointx*pointx + pointy*pointy);\n}\n\nvec3 hsluv_lengthOfRayUntilIntersect(float theta, vec3 x, vec3 y) {\n\tvec3 len = y / (sin(theta) - x * cos(theta));\n\tif (len.r < 0.0) {len.r=1000.0;}\n\tif (len.g < 0.0) {len.g=1000.0;}\n\tif (len.b < 0.0) {len.b=1000.0;}\n\treturn len;\n}\n\nfloat hsluv_maxSafeChromaForL(float L){\n\tmat3 m2 = mat3(\n\t\t 3.2409699419045214 ,-0.96924363628087983 , 0.055630079696993609,\n\t\t-1.5373831775700935 , 1.8759675015077207 ,-0.20397695888897657 ,\n\t\t-0.49861076029300328 , 0.041555057407175613, 1.0569715142428786 \n\t);\n\tfloat sub0 = L + 16.0;\n\tfloat sub1 = sub0 * sub0 * sub0 * .000000641;\n\tfloat sub2 = sub1 > 0.0088564516790356308 ? sub1 : L / 903.2962962962963;\n\n\tvec3 top1 = (284517.0 * m2[0] - 94839.0 * m2[2]) * sub2;\n\tvec3 bottom = (632260.0 * m2[2] - 126452.0 * m2[1]) * sub2;\n\tvec3 top2 = (838422.0 * m2[2] + 769860.0 * m2[1] + 731718.0 * m2[0]) * L * sub2;\n\n\tvec3 bounds0x = top1 / bottom;\n\tvec3 bounds0y = top2 / bottom;\n\n\tvec3 bounds1x = top1 / (bottom+126452.0);\n\tvec3 bounds1y = (top2-769860.0*L) / (bottom+126452.0);\n\n\tvec3 xs0 = hsluv_intersectLineLine(bounds0x, bounds0y, -1.0/bounds0x, vec3(0.0) );\n\tvec3 xs1 = hsluv_intersectLineLine(bounds1x, bounds1y, -1.0/bounds1x, vec3(0.0) );\n\n\tvec3 lengths0 = hsluv_distanceFromPole( xs0, bounds0y + xs0 * bounds0x );\n\tvec3 lengths1 = hsluv_distanceFromPole( xs1, bounds1y + xs1 * bounds1x );\n\n\treturn min(lengths0.r,\n\t\t\tmin(lengths1.r,\n\t\t\tmin(lengths0.g,\n\t\t\tmin(lengths1.g,\n\t\t\tmin(lengths0.b,\n\t\t\t\tlengths1.b)))));\n}\n\nfloat hsluv_maxChromaForLH(float L, float H) {\n\n\tfloat hrad = radians(H);\n\n\tmat3 m2 = mat3(\n\t\t 3.2409699419045214 ,-0.96924363628087983 , 0.055630079696993609,\n\t\t-1.5373831775700935 , 1.8759675015077207 ,-0.20397695888897657 ,\n\t\t-0.49861076029300328 , 0.041555057407175613, 1.0569715142428786 \n\t);\n\tfloat sub1 = pow(L + 16.0, 3.0) / 1560896.0;\n\tfloat sub2 = sub1 > 0.0088564516790356308 ? sub1 : L / 903.2962962962963;\n\n\tvec3 top1 = (284517.0 * m2[0] - 94839.0 * m2[2]) * sub2;\n\tvec3 bottom = (632260.0 * m2[2] - 126452.0 * m2[1]) * sub2;\n\tvec3 top2 = (838422.0 * m2[2] + 769860.0 * m2[1] + 731718.0 * m2[0]) * L * sub2;\n\n\tvec3 bound0x = top1 / bottom;\n\tvec3 bound0y = top2 / bottom;\n\n\tvec3 bound1x = top1 / (bottom+126452.0);\n\tvec3 bound1y = (top2-769860.0*L) / (bottom+126452.0);\n\n\tvec3 lengths0 = hsluv_lengthOfRayUntilIntersect(hrad, bound0x, bound0y );\n\tvec3 lengths1 = hsluv_lengthOfRayUntilIntersect(hrad, bound1x, bound1y );\n\n\treturn min(lengths0.r,\n\t\t\tmin(lengths1.r,\n\t\t\tmin(lengths0.g,\n\t\t\tmin(lengths1.g,\n\t\t\tmin(lengths0.b,\n\t\t\t\tlengths1.b)))));\n}\n\nfloat hsluv_fromLinear(float c) {\n\treturn c <= 0.0031308 ? 12.92 * c : 1.055 * pow(c, 1.0 / 2.4) - 0.055;\n}\nvec3 hsluv_fromLinear(vec3 c) {\n\treturn vec3( hsluv_fromLinear(c.r), hsluv_fromLinear(c.g), hsluv_fromLinear(c.b) );\n}\n\nfloat hsluv_toLinear(float c) {\n\treturn c > 0.04045 ? pow((c + 0.055) / (1.0 + 0.055), 2.4) : c / 12.92;\n}\n\nvec3 hsluv_toLinear(vec3 c) {\n\treturn vec3( hsluv_toLinear(c.r), hsluv_toLinear(c.g), hsluv_toLinear(c.b) );\n}\n\nfloat hsluv_yToL(float Y){\n\treturn Y <= 0.0088564516790356308 ? Y * 903.2962962962963 : 116.0 * pow(Y, 1.0 / 3.0) - 16.0;\n}\n\nfloat hsluv_lToY(float L) {\n\treturn L <= 8.0 ? L / 903.2962962962963 : pow((L + 16.0) / 116.0, 3.0);\n}\n\nvec3 xyzToRgb(vec3 tuple) {\n\tconst mat3 m = mat3( \n\t\t3.2409699419045214 ,-1.5373831775700935 ,-0.49861076029300328 ,\n\t\t-0.96924363628087983 , 1.8759675015077207 , 0.041555057407175613,\n\t\t0.055630079696993609,-0.20397695888897657, 1.0569715142428786 );\n\t\n\treturn hsluv_fromLinear(tuple*m);\n}\n\nvec3 rgbToXyz(vec3 tuple) {\n\tconst mat3 m = mat3(\n\t\t0.41239079926595948 , 0.35758433938387796, 0.18048078840183429 ,\n\t\t0.21263900587151036 , 0.71516867876775593, 0.072192315360733715,\n\t\t0.019330818715591851, 0.11919477979462599, 0.95053215224966058 \n\t);\n\treturn hsluv_toLinear(tuple) * m;\n}\n\nvec3 xyzToLuv(vec3 tuple){\n\tfloat X = tuple.x;\n\tfloat Y = tuple.y;\n\tfloat Z = tuple.z;\n\n\tfloat L = hsluv_yToL(Y);\n\t\n\tfloat div = 1./dot(tuple,vec3(1,15,3)); \n\n\treturn vec3(\n\t\t1.,\n\t\t(52. * (X*div) - 2.57179),\n\t\t(117.* (Y*div) - 6.08816)\n\t) * L;\n}\n\n\nvec3 luvToXyz(vec3 tuple) {\n\tfloat L = tuple.x;\n\n\tfloat U = tuple.y / (13.0 * L) + 0.19783000664283681;\n\tfloat V = tuple.z / (13.0 * L) + 0.468319994938791;\n\n\tfloat Y = hsluv_lToY(L);\n\tfloat X = 2.25 * U * Y / V;\n\tfloat Z = (3./V - 5.)*Y - (X/3.);\n\n\treturn vec3(X, Y, Z);\n}\n\nvec3 luvToLch(vec3 tuple) {\n\tfloat L = tuple.x;\n\tfloat U = tuple.y;\n\tfloat V = tuple.z;\n\n\tfloat C = length(tuple.yz);\n\tfloat H = degrees(atan(V,U));\n\tif (H < 0.0) {\n\t\tH = 360.0 + H;\n\t}\n\t\n\treturn vec3(L, C, H);\n}\n\nvec3 lchToLuv(vec3 tuple) {\n\tfloat hrad = radians(tuple.b);\n\treturn vec3(\n\t\ttuple.r,\n\t\tcos(hrad) * tuple.g,\n\t\tsin(hrad) * tuple.g\n\t);\n}\n\nvec3 hsluvToLch(vec3 tuple) {\n\ttuple.g *= hsluv_maxChromaForLH(tuple.b, tuple.r) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToHsluv(vec3 tuple) {\n\ttuple.g /= hsluv_maxChromaForLH(tuple.r, tuple.b) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 hpluvToLch(vec3 tuple) {\n\ttuple.g *= hsluv_maxSafeChromaForL(tuple.b) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToHpluv(vec3 tuple) {\n\ttuple.g /= hsluv_maxSafeChromaForL(tuple.r) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToRgb(vec3 tuple) {\n\treturn xyzToRgb(luvToXyz(lchToLuv(tuple)));\n}\n\nvec3 rgbToLch(vec3 tuple) {\n\treturn luvToLch(xyzToLuv(rgbToXyz(tuple)));\n}\n\nvec3 hsluvToRgb(vec3 tuple) {\n\treturn lchToRgb(hsluvToLch(tuple));\n}\n\nvec3 rgbToHsluv(vec3 tuple) {\n\treturn lchToHsluv(rgbToLch(tuple));\n}\n\nvec3 hpluvToRgb(vec3 tuple) {\n\treturn lchToRgb(hpluvToLch(tuple));\n}\n\nvec3 rgbToHpluv(vec3 tuple) {\n\treturn lchToHpluv(rgbToLch(tuple));\n}\n\nvec3 luvToRgb(vec3 tuple){\n\treturn xyzToRgb(luvToXyz(tuple));\n}\n\n// allow vec4's\nvec4 xyzToRgb(vec4 c) {return vec4( xyzToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToXyz(vec4 c) {return vec4( rgbToXyz( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 xyzToLuv(vec4 c) {return vec4( xyzToLuv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToXyz(vec4 c) {return vec4( luvToXyz( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToLch(vec4 c) {return vec4( luvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToLuv(vec4 c) {return vec4( lchToLuv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hsluvToLch(vec4 c) {return vec4( hsluvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToHsluv(vec4 c) {return vec4( lchToHsluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hpluvToLch(vec4 c) {return vec4( hpluvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToHpluv(vec4 c) {return vec4( lchToHpluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToRgb(vec4 c) {return vec4( lchToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToLch(vec4 c) {return vec4( rgbToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hsluvToRgb(vec4 c) {return vec4( hsluvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToHsluv(vec4 c) {return vec4( rgbToHsluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hpluvToRgb(vec4 c) {return vec4( hpluvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToHpluv(vec4 c) {return vec4( rgbToHpluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToRgb(vec4 c) {return vec4( luvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\n// allow 3 floats\nvec3 xyzToRgb(float x, float y, float z) {return xyzToRgb( vec3(x,y,z) );}\nvec3 rgbToXyz(float x, float y, float z) {return rgbToXyz( vec3(x,y,z) );}\nvec3 xyzToLuv(float x, float y, float z) {return xyzToLuv( vec3(x,y,z) );}\nvec3 luvToXyz(float x, float y, float z) {return luvToXyz( vec3(x,y,z) );}\nvec3 luvToLch(float x, float y, float z) {return luvToLch( vec3(x,y,z) );}\nvec3 lchToLuv(float x, float y, float z) {return lchToLuv( vec3(x,y,z) );}\nvec3 hsluvToLch(float x, float y, float z) {return hsluvToLch( vec3(x,y,z) );}\nvec3 lchToHsluv(float x, float y, float z) {return lchToHsluv( vec3(x,y,z) );}\nvec3 hpluvToLch(float x, float y, float z) {return hpluvToLch( vec3(x,y,z) );}\nvec3 lchToHpluv(float x, float y, float z) {return lchToHpluv( vec3(x,y,z) );}\nvec3 lchToRgb(float x, float y, float z) {return lchToRgb( vec3(x,y,z) );}\nvec3 rgbToLch(float x, float y, float z) {return rgbToLch( vec3(x,y,z) );}\nvec3 hsluvToRgb(float x, float y, float z) {return hsluvToRgb( vec3(x,y,z) );}\nvec3 rgbToHsluv(float x, float y, float z) {return rgbToHsluv( vec3(x,y,z) );}\nvec3 hpluvToRgb(float x, float y, float z) {return hpluvToRgb( vec3(x,y,z) );}\nvec3 rgbToHpluv(float x, float y, float z) {return rgbToHpluv( vec3(x,y,z) );}\nvec3 luvToRgb(float x, float y, float z) {return luvToRgb( vec3(x,y,z) );}\n// allow 4 floats\nvec4 xyzToRgb(float x, float y, float z, float a) {return xyzToRgb( vec4(x,y,z,a) );}\nvec4 rgbToXyz(float x, float y, float z, float a) {return rgbToXyz( vec4(x,y,z,a) );}\nvec4 xyzToLuv(float x, float y, float z, float a) {return xyzToLuv( vec4(x,y,z,a) );}\nvec4 luvToXyz(float x, float y, float z, float a) {return luvToXyz( vec4(x,y,z,a) );}\nvec4 luvToLch(float x, float y, float z, float a) {return luvToLch( vec4(x,y,z,a) );}\nvec4 lchToLuv(float x, float y, float z, float a) {return lchToLuv( vec4(x,y,z,a) );}\nvec4 hsluvToLch(float x, float y, float z, float a) {return hsluvToLch( vec4(x,y,z,a) );}\nvec4 lchToHsluv(float x, float y, float z, float a) {return lchToHsluv( vec4(x,y,z,a) );}\nvec4 hpluvToLch(float x, float y, float z, float a) {return hpluvToLch( vec4(x,y,z,a) );}\nvec4 lchToHpluv(float x, float y, float z, float a) {return lchToHpluv( vec4(x,y,z,a) );}\nvec4 lchToRgb(float x, float y, float z, float a) {return lchToRgb( vec4(x,y,z,a) );}\nvec4 rgbToLch(float x, float y, float z, float a) {return rgbToLch( vec4(x,y,z,a) );}\nvec4 hsluvToRgb(float x, float y, float z, float a) {return hsluvToRgb( vec4(x,y,z,a) );}\nvec4 rgbToHslul(float x, float y, float z, float a) {return rgbToHsluv( vec4(x,y,z,a) );}\nvec4 hpluvToRgb(float x, float y, float z, float a) {return hpluvToRgb( vec4(x,y,z,a) );}\nvec4 rgbToHpluv(float x, float y, float z, float a) {return rgbToHpluv( vec4(x,y,z,a) );}\nvec4 luvToRgb(float x, float y, float z, float a) {return luvToRgb( vec4(x,y,z,a) );}\n\n/*\nEND HSLUV-GLSL\n*/\n\n\n// from https://gist.github.com/mattatz/44f081cac87e2f7c8980\n// converted to glsl by gui@polygonjs.com\n// and made function names consistent with the ones above\n/*\n * Conversion between RGB and LAB colorspace.\n * Import from flowabs glsl program : https://code.google.com/p/flowabs/source/browse/glsl/?r=f36cbdcf7790a28d90f09e2cf89ec9a64911f138\n */\n\n\n\nvec3 xyzToLab( vec3 c ) {\n\tvec3 n = c / vec3(95.047, 100, 108.883);\n\tvec3 v;\n\tv.x = ( n.x > 0.008856 ) ? pow( n.x, 1.0 / 3.0 ) : ( 7.787 * n.x ) + ( 16.0 / 116.0 );\n\tv.y = ( n.y > 0.008856 ) ? pow( n.y, 1.0 / 3.0 ) : ( 7.787 * n.y ) + ( 16.0 / 116.0 );\n\tv.z = ( n.z > 0.008856 ) ? pow( n.z, 1.0 / 3.0 ) : ( 7.787 * n.z ) + ( 16.0 / 116.0 );\n\treturn vec3(( 116.0 * v.y ) - 16.0, 500.0 * ( v.x - v.y ), 200.0 * ( v.y - v.z ));\n}\n\nvec3 rgbToLab( vec3 c ) {\n\tvec3 lab = xyzToLab( rgbToXyz( c ) );\n\treturn vec3( lab.x / 100.0, 0.5 + 0.5 * ( lab.y / 127.0 ), 0.5 + 0.5 * ( lab.z / 127.0 ));\n}\n\nvec3 labToXyz( vec3 c ) {\n\tfloat fy = ( c.x + 16.0 ) / 116.0;\n\tfloat fx = c.y / 500.0 + fy;\n\tfloat fz = fy - c.z / 200.0;\n\treturn vec3(\n\t\t 95.047 * (( fx > 0.206897 ) ? fx * fx * fx : ( fx - 16.0 / 116.0 ) / 7.787),\n\t\t100.000 * (( fy > 0.206897 ) ? fy * fy * fy : ( fy - 16.0 / 116.0 ) / 7.787),\n\t\t108.883 * (( fz > 0.206897 ) ? fz * fz * fz : ( fz - 16.0 / 116.0 ) / 7.787)\n\t);\n}\n\n\n\nvec3 labToRgb( vec3 c ) {\n\treturn xyzToRgb( labToXyz( vec3(100.0 * c.x, 2.0 * 127.0 * (c.y - 0.5), 2.0 * 127.0 * (c.z - 0.5)) ) );\n}\n\n// adapted from\n// THREEjs math/Color.js\nfloat sRGBToLinear( float c ) {\n\treturn ( c < 0.04045 ) ? c * 0.0773993808 : pow( c * 0.9478672986 + 0.0521327014, 2.4 );\n}\nvec3 sRGBToLinear( vec3 c ) {\n\treturn vec3( sRGBToLinear(c.r), sRGBToLinear(c.g), sRGBToLinear(c.b) );\n}\nvec4 sRGBToLinear( vec4 c ) {\n\treturn vec4( sRGBToLinear(c.r), sRGBToLinear(c.g), sRGBToLinear(c.b), c.a );\n}\n\n\n\n\n\n\n\n// /geo1/MAT/meshBasicBuilder1/globals1\nvarying vec2 v_POLY_globals1_uv;\n\n\n\n\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvarying vec2 vHighPrecisionZW;\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4( 1.0 );\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tdiffuseColor.a = opacity;\n\n\t#endif\n\n\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\n\n\n\t// /geo1/MAT/meshBasicBuilder1/subtract2\n\tvec2 v_POLY_subtract2_subtract = (v_POLY_globals1_uv - vec2(0.5, 0.5));\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec2ToVec3_1\n\tvec3 v_POLY_vec2ToVec3_1_vec3 = vec3(v_POLY_subtract2_subtract.xy, 0.0);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec3ToVec4_1\n\tvec4 v_POLY_vec3ToVec4_1_vec4 = vec4(v_POLY_vec2ToVec3_1_vec3.xyz, 0.0);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/colorCorrect1\n\tvec4 v_POLY_colorCorrect1_out = sRGBToLinear(v_POLY_vec3ToVec4_1_vec4);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec4ToVec3_1\n\tvec3 v_POLY_vec4ToVec3_1_vec3 = v_POLY_colorCorrect1_out.xyz;\n\t\n\t// /geo1/MAT/meshBasicBuilder1/output1\n\tdiffuseColor.xyz = v_POLY_vec4ToVec3_1_vec3;\n\n\n\n\n\t// INSERT BODY\n\t// the new body lines should be added before the alphatest_fragment\n\t// so that alpha is set before (which is really how it would be set if the alphamap_fragment above was used by the material node parameters)\n\n\t#include <alphatest_fragment>\n\n\t#include <logdepthbuf_fragment>\n\n\n\t// Higher precision equivalent of gl_FragCoord.z. This assumes depthRange has been left to its default values.\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), diffuseColor.a );\n\n\t#elif DEPTH_PACKING == 3201\n\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\n\t#endif\n\n}\n","customDistanceMaterial.vertex":"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n\n\n\n// /geo1/MAT/meshBasicBuilder1/globals1\nvarying vec2 v_POLY_globals1_uv;\n\n\n\n\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n// removed:\n//\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n// removed:\n//\t#include <begin_vertex>\n\n\n\n\t// /geo1/MAT/meshBasicBuilder1/globals1\n\tv_POLY_globals1_uv = vec2(uv);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/output1\n\tvec3 transformed = position;\n\tvec3 objectNormal = normal;\n\t#ifdef USE_TANGENT\n\t\tvec3 objectTangent = vec3( tangent.xyz );\n\t#endif\n\n\n\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}","customDistanceMaterial.fragment":"\n// INSERT DEFINES\n\n#define DISTANCE\n\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n\n#include <common>\n\n\n\n// /geo1/MAT/meshBasicBuilder1/colorCorrect1\n// from https://github.com/williammalo/hsluv-glsl\n/*\nHSLUV-GLSL v4.2\nHSLUV is a human-friendly alternative to HSL. ( http://www.hsluv.org )\nGLSL port by William Malo ( https://github.com/williammalo )\nPut this code in your fragment shader.\n*/\n\nvec3 hsluv_intersectLineLine(vec3 line1x, vec3 line1y, vec3 line2x, vec3 line2y) {\n\treturn (line1y - line2y) / (line2x - line1x);\n}\n\nvec3 hsluv_distanceFromPole(vec3 pointx,vec3 pointy) {\n\treturn sqrt(pointx*pointx + pointy*pointy);\n}\n\nvec3 hsluv_lengthOfRayUntilIntersect(float theta, vec3 x, vec3 y) {\n\tvec3 len = y / (sin(theta) - x * cos(theta));\n\tif (len.r < 0.0) {len.r=1000.0;}\n\tif (len.g < 0.0) {len.g=1000.0;}\n\tif (len.b < 0.0) {len.b=1000.0;}\n\treturn len;\n}\n\nfloat hsluv_maxSafeChromaForL(float L){\n\tmat3 m2 = mat3(\n\t\t 3.2409699419045214 ,-0.96924363628087983 , 0.055630079696993609,\n\t\t-1.5373831775700935 , 1.8759675015077207 ,-0.20397695888897657 ,\n\t\t-0.49861076029300328 , 0.041555057407175613, 1.0569715142428786 \n\t);\n\tfloat sub0 = L + 16.0;\n\tfloat sub1 = sub0 * sub0 * sub0 * .000000641;\n\tfloat sub2 = sub1 > 0.0088564516790356308 ? sub1 : L / 903.2962962962963;\n\n\tvec3 top1 = (284517.0 * m2[0] - 94839.0 * m2[2]) * sub2;\n\tvec3 bottom = (632260.0 * m2[2] - 126452.0 * m2[1]) * sub2;\n\tvec3 top2 = (838422.0 * m2[2] + 769860.0 * m2[1] + 731718.0 * m2[0]) * L * sub2;\n\n\tvec3 bounds0x = top1 / bottom;\n\tvec3 bounds0y = top2 / bottom;\n\n\tvec3 bounds1x = top1 / (bottom+126452.0);\n\tvec3 bounds1y = (top2-769860.0*L) / (bottom+126452.0);\n\n\tvec3 xs0 = hsluv_intersectLineLine(bounds0x, bounds0y, -1.0/bounds0x, vec3(0.0) );\n\tvec3 xs1 = hsluv_intersectLineLine(bounds1x, bounds1y, -1.0/bounds1x, vec3(0.0) );\n\n\tvec3 lengths0 = hsluv_distanceFromPole( xs0, bounds0y + xs0 * bounds0x );\n\tvec3 lengths1 = hsluv_distanceFromPole( xs1, bounds1y + xs1 * bounds1x );\n\n\treturn min(lengths0.r,\n\t\t\tmin(lengths1.r,\n\t\t\tmin(lengths0.g,\n\t\t\tmin(lengths1.g,\n\t\t\tmin(lengths0.b,\n\t\t\t\tlengths1.b)))));\n}\n\nfloat hsluv_maxChromaForLH(float L, float H) {\n\n\tfloat hrad = radians(H);\n\n\tmat3 m2 = mat3(\n\t\t 3.2409699419045214 ,-0.96924363628087983 , 0.055630079696993609,\n\t\t-1.5373831775700935 , 1.8759675015077207 ,-0.20397695888897657 ,\n\t\t-0.49861076029300328 , 0.041555057407175613, 1.0569715142428786 \n\t);\n\tfloat sub1 = pow(L + 16.0, 3.0) / 1560896.0;\n\tfloat sub2 = sub1 > 0.0088564516790356308 ? sub1 : L / 903.2962962962963;\n\n\tvec3 top1 = (284517.0 * m2[0] - 94839.0 * m2[2]) * sub2;\n\tvec3 bottom = (632260.0 * m2[2] - 126452.0 * m2[1]) * sub2;\n\tvec3 top2 = (838422.0 * m2[2] + 769860.0 * m2[1] + 731718.0 * m2[0]) * L * sub2;\n\n\tvec3 bound0x = top1 / bottom;\n\tvec3 bound0y = top2 / bottom;\n\n\tvec3 bound1x = top1 / (bottom+126452.0);\n\tvec3 bound1y = (top2-769860.0*L) / (bottom+126452.0);\n\n\tvec3 lengths0 = hsluv_lengthOfRayUntilIntersect(hrad, bound0x, bound0y );\n\tvec3 lengths1 = hsluv_lengthOfRayUntilIntersect(hrad, bound1x, bound1y );\n\n\treturn min(lengths0.r,\n\t\t\tmin(lengths1.r,\n\t\t\tmin(lengths0.g,\n\t\t\tmin(lengths1.g,\n\t\t\tmin(lengths0.b,\n\t\t\t\tlengths1.b)))));\n}\n\nfloat hsluv_fromLinear(float c) {\n\treturn c <= 0.0031308 ? 12.92 * c : 1.055 * pow(c, 1.0 / 2.4) - 0.055;\n}\nvec3 hsluv_fromLinear(vec3 c) {\n\treturn vec3( hsluv_fromLinear(c.r), hsluv_fromLinear(c.g), hsluv_fromLinear(c.b) );\n}\n\nfloat hsluv_toLinear(float c) {\n\treturn c > 0.04045 ? pow((c + 0.055) / (1.0 + 0.055), 2.4) : c / 12.92;\n}\n\nvec3 hsluv_toLinear(vec3 c) {\n\treturn vec3( hsluv_toLinear(c.r), hsluv_toLinear(c.g), hsluv_toLinear(c.b) );\n}\n\nfloat hsluv_yToL(float Y){\n\treturn Y <= 0.0088564516790356308 ? Y * 903.2962962962963 : 116.0 * pow(Y, 1.0 / 3.0) - 16.0;\n}\n\nfloat hsluv_lToY(float L) {\n\treturn L <= 8.0 ? L / 903.2962962962963 : pow((L + 16.0) / 116.0, 3.0);\n}\n\nvec3 xyzToRgb(vec3 tuple) {\n\tconst mat3 m = mat3( \n\t\t3.2409699419045214 ,-1.5373831775700935 ,-0.49861076029300328 ,\n\t\t-0.96924363628087983 , 1.8759675015077207 , 0.041555057407175613,\n\t\t0.055630079696993609,-0.20397695888897657, 1.0569715142428786 );\n\t\n\treturn hsluv_fromLinear(tuple*m);\n}\n\nvec3 rgbToXyz(vec3 tuple) {\n\tconst mat3 m = mat3(\n\t\t0.41239079926595948 , 0.35758433938387796, 0.18048078840183429 ,\n\t\t0.21263900587151036 , 0.71516867876775593, 0.072192315360733715,\n\t\t0.019330818715591851, 0.11919477979462599, 0.95053215224966058 \n\t);\n\treturn hsluv_toLinear(tuple) * m;\n}\n\nvec3 xyzToLuv(vec3 tuple){\n\tfloat X = tuple.x;\n\tfloat Y = tuple.y;\n\tfloat Z = tuple.z;\n\n\tfloat L = hsluv_yToL(Y);\n\t\n\tfloat div = 1./dot(tuple,vec3(1,15,3)); \n\n\treturn vec3(\n\t\t1.,\n\t\t(52. * (X*div) - 2.57179),\n\t\t(117.* (Y*div) - 6.08816)\n\t) * L;\n}\n\n\nvec3 luvToXyz(vec3 tuple) {\n\tfloat L = tuple.x;\n\n\tfloat U = tuple.y / (13.0 * L) + 0.19783000664283681;\n\tfloat V = tuple.z / (13.0 * L) + 0.468319994938791;\n\n\tfloat Y = hsluv_lToY(L);\n\tfloat X = 2.25 * U * Y / V;\n\tfloat Z = (3./V - 5.)*Y - (X/3.);\n\n\treturn vec3(X, Y, Z);\n}\n\nvec3 luvToLch(vec3 tuple) {\n\tfloat L = tuple.x;\n\tfloat U = tuple.y;\n\tfloat V = tuple.z;\n\n\tfloat C = length(tuple.yz);\n\tfloat H = degrees(atan(V,U));\n\tif (H < 0.0) {\n\t\tH = 360.0 + H;\n\t}\n\t\n\treturn vec3(L, C, H);\n}\n\nvec3 lchToLuv(vec3 tuple) {\n\tfloat hrad = radians(tuple.b);\n\treturn vec3(\n\t\ttuple.r,\n\t\tcos(hrad) * tuple.g,\n\t\tsin(hrad) * tuple.g\n\t);\n}\n\nvec3 hsluvToLch(vec3 tuple) {\n\ttuple.g *= hsluv_maxChromaForLH(tuple.b, tuple.r) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToHsluv(vec3 tuple) {\n\ttuple.g /= hsluv_maxChromaForLH(tuple.r, tuple.b) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 hpluvToLch(vec3 tuple) {\n\ttuple.g *= hsluv_maxSafeChromaForL(tuple.b) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToHpluv(vec3 tuple) {\n\ttuple.g /= hsluv_maxSafeChromaForL(tuple.r) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToRgb(vec3 tuple) {\n\treturn xyzToRgb(luvToXyz(lchToLuv(tuple)));\n}\n\nvec3 rgbToLch(vec3 tuple) {\n\treturn luvToLch(xyzToLuv(rgbToXyz(tuple)));\n}\n\nvec3 hsluvToRgb(vec3 tuple) {\n\treturn lchToRgb(hsluvToLch(tuple));\n}\n\nvec3 rgbToHsluv(vec3 tuple) {\n\treturn lchToHsluv(rgbToLch(tuple));\n}\n\nvec3 hpluvToRgb(vec3 tuple) {\n\treturn lchToRgb(hpluvToLch(tuple));\n}\n\nvec3 rgbToHpluv(vec3 tuple) {\n\treturn lchToHpluv(rgbToLch(tuple));\n}\n\nvec3 luvToRgb(vec3 tuple){\n\treturn xyzToRgb(luvToXyz(tuple));\n}\n\n// allow vec4's\nvec4 xyzToRgb(vec4 c) {return vec4( xyzToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToXyz(vec4 c) {return vec4( rgbToXyz( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 xyzToLuv(vec4 c) {return vec4( xyzToLuv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToXyz(vec4 c) {return vec4( luvToXyz( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToLch(vec4 c) {return vec4( luvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToLuv(vec4 c) {return vec4( lchToLuv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hsluvToLch(vec4 c) {return vec4( hsluvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToHsluv(vec4 c) {return vec4( lchToHsluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hpluvToLch(vec4 c) {return vec4( hpluvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToHpluv(vec4 c) {return vec4( lchToHpluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToRgb(vec4 c) {return vec4( lchToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToLch(vec4 c) {return vec4( rgbToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hsluvToRgb(vec4 c) {return vec4( hsluvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToHsluv(vec4 c) {return vec4( rgbToHsluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hpluvToRgb(vec4 c) {return vec4( hpluvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToHpluv(vec4 c) {return vec4( rgbToHpluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToRgb(vec4 c) {return vec4( luvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\n// allow 3 floats\nvec3 xyzToRgb(float x, float y, float z) {return xyzToRgb( vec3(x,y,z) );}\nvec3 rgbToXyz(float x, float y, float z) {return rgbToXyz( vec3(x,y,z) );}\nvec3 xyzToLuv(float x, float y, float z) {return xyzToLuv( vec3(x,y,z) );}\nvec3 luvToXyz(float x, float y, float z) {return luvToXyz( vec3(x,y,z) );}\nvec3 luvToLch(float x, float y, float z) {return luvToLch( vec3(x,y,z) );}\nvec3 lchToLuv(float x, float y, float z) {return lchToLuv( vec3(x,y,z) );}\nvec3 hsluvToLch(float x, float y, float z) {return hsluvToLch( vec3(x,y,z) );}\nvec3 lchToHsluv(float x, float y, float z) {return lchToHsluv( vec3(x,y,z) );}\nvec3 hpluvToLch(float x, float y, float z) {return hpluvToLch( vec3(x,y,z) );}\nvec3 lchToHpluv(float x, float y, float z) {return lchToHpluv( vec3(x,y,z) );}\nvec3 lchToRgb(float x, float y, float z) {return lchToRgb( vec3(x,y,z) );}\nvec3 rgbToLch(float x, float y, float z) {return rgbToLch( vec3(x,y,z) );}\nvec3 hsluvToRgb(float x, float y, float z) {return hsluvToRgb( vec3(x,y,z) );}\nvec3 rgbToHsluv(float x, float y, float z) {return rgbToHsluv( vec3(x,y,z) );}\nvec3 hpluvToRgb(float x, float y, float z) {return hpluvToRgb( vec3(x,y,z) );}\nvec3 rgbToHpluv(float x, float y, float z) {return rgbToHpluv( vec3(x,y,z) );}\nvec3 luvToRgb(float x, float y, float z) {return luvToRgb( vec3(x,y,z) );}\n// allow 4 floats\nvec4 xyzToRgb(float x, float y, float z, float a) {return xyzToRgb( vec4(x,y,z,a) );}\nvec4 rgbToXyz(float x, float y, float z, float a) {return rgbToXyz( vec4(x,y,z,a) );}\nvec4 xyzToLuv(float x, float y, float z, float a) {return xyzToLuv( vec4(x,y,z,a) );}\nvec4 luvToXyz(float x, float y, float z, float a) {return luvToXyz( vec4(x,y,z,a) );}\nvec4 luvToLch(float x, float y, float z, float a) {return luvToLch( vec4(x,y,z,a) );}\nvec4 lchToLuv(float x, float y, float z, float a) {return lchToLuv( vec4(x,y,z,a) );}\nvec4 hsluvToLch(float x, float y, float z, float a) {return hsluvToLch( vec4(x,y,z,a) );}\nvec4 lchToHsluv(float x, float y, float z, float a) {return lchToHsluv( vec4(x,y,z,a) );}\nvec4 hpluvToLch(float x, float y, float z, float a) {return hpluvToLch( vec4(x,y,z,a) );}\nvec4 lchToHpluv(float x, float y, float z, float a) {return lchToHpluv( vec4(x,y,z,a) );}\nvec4 lchToRgb(float x, float y, float z, float a) {return lchToRgb( vec4(x,y,z,a) );}\nvec4 rgbToLch(float x, float y, float z, float a) {return rgbToLch( vec4(x,y,z,a) );}\nvec4 hsluvToRgb(float x, float y, float z, float a) {return hsluvToRgb( vec4(x,y,z,a) );}\nvec4 rgbToHslul(float x, float y, float z, float a) {return rgbToHsluv( vec4(x,y,z,a) );}\nvec4 hpluvToRgb(float x, float y, float z, float a) {return hpluvToRgb( vec4(x,y,z,a) );}\nvec4 rgbToHpluv(float x, float y, float z, float a) {return rgbToHpluv( vec4(x,y,z,a) );}\nvec4 luvToRgb(float x, float y, float z, float a) {return luvToRgb( vec4(x,y,z,a) );}\n\n/*\nEND HSLUV-GLSL\n*/\n\n\n// from https://gist.github.com/mattatz/44f081cac87e2f7c8980\n// converted to glsl by gui@polygonjs.com\n// and made function names consistent with the ones above\n/*\n * Conversion between RGB and LAB colorspace.\n * Import from flowabs glsl program : https://code.google.com/p/flowabs/source/browse/glsl/?r=f36cbdcf7790a28d90f09e2cf89ec9a64911f138\n */\n\n\n\nvec3 xyzToLab( vec3 c ) {\n\tvec3 n = c / vec3(95.047, 100, 108.883);\n\tvec3 v;\n\tv.x = ( n.x > 0.008856 ) ? pow( n.x, 1.0 / 3.0 ) : ( 7.787 * n.x ) + ( 16.0 / 116.0 );\n\tv.y = ( n.y > 0.008856 ) ? pow( n.y, 1.0 / 3.0 ) : ( 7.787 * n.y ) + ( 16.0 / 116.0 );\n\tv.z = ( n.z > 0.008856 ) ? pow( n.z, 1.0 / 3.0 ) : ( 7.787 * n.z ) + ( 16.0 / 116.0 );\n\treturn vec3(( 116.0 * v.y ) - 16.0, 500.0 * ( v.x - v.y ), 200.0 * ( v.y - v.z ));\n}\n\nvec3 rgbToLab( vec3 c ) {\n\tvec3 lab = xyzToLab( rgbToXyz( c ) );\n\treturn vec3( lab.x / 100.0, 0.5 + 0.5 * ( lab.y / 127.0 ), 0.5 + 0.5 * ( lab.z / 127.0 ));\n}\n\nvec3 labToXyz( vec3 c ) {\n\tfloat fy = ( c.x + 16.0 ) / 116.0;\n\tfloat fx = c.y / 500.0 + fy;\n\tfloat fz = fy - c.z / 200.0;\n\treturn vec3(\n\t\t 95.047 * (( fx > 0.206897 ) ? fx * fx * fx : ( fx - 16.0 / 116.0 ) / 7.787),\n\t\t100.000 * (( fy > 0.206897 ) ? fy * fy * fy : ( fy - 16.0 / 116.0 ) / 7.787),\n\t\t108.883 * (( fz > 0.206897 ) ? fz * fz * fz : ( fz - 16.0 / 116.0 ) / 7.787)\n\t);\n}\n\n\n\nvec3 labToRgb( vec3 c ) {\n\treturn xyzToRgb( labToXyz( vec3(100.0 * c.x, 2.0 * 127.0 * (c.y - 0.5), 2.0 * 127.0 * (c.z - 0.5)) ) );\n}\n\n// adapted from\n// THREEjs math/Color.js\nfloat sRGBToLinear( float c ) {\n\treturn ( c < 0.04045 ) ? c * 0.0773993808 : pow( c * 0.9478672986 + 0.0521327014, 2.4 );\n}\nvec3 sRGBToLinear( vec3 c ) {\n\treturn vec3( sRGBToLinear(c.r), sRGBToLinear(c.g), sRGBToLinear(c.b) );\n}\nvec4 sRGBToLinear( vec4 c ) {\n\treturn vec4( sRGBToLinear(c.r), sRGBToLinear(c.g), sRGBToLinear(c.b), c.a );\n}\n\n\n\n\n\n\n\n// /geo1/MAT/meshBasicBuilder1/globals1\nvarying vec2 v_POLY_globals1_uv;\n\n\n\n\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main () {\n\n\t#include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4( 1.0 );\n\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\n\n\n\t// /geo1/MAT/meshBasicBuilder1/subtract2\n\tvec2 v_POLY_subtract2_subtract = (v_POLY_globals1_uv - vec2(0.5, 0.5));\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec2ToVec3_1\n\tvec3 v_POLY_vec2ToVec3_1_vec3 = vec3(v_POLY_subtract2_subtract.xy, 0.0);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec3ToVec4_1\n\tvec4 v_POLY_vec3ToVec4_1_vec4 = vec4(v_POLY_vec2ToVec3_1_vec3.xyz, 0.0);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/colorCorrect1\n\tvec4 v_POLY_colorCorrect1_out = sRGBToLinear(v_POLY_vec3ToVec4_1_vec4);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec4ToVec3_1\n\tvec3 v_POLY_vec4ToVec3_1_vec3 = v_POLY_colorCorrect1_out.xyz;\n\t\n\t// /geo1/MAT/meshBasicBuilder1/output1\n\tdiffuseColor.xyz = v_POLY_vec4ToVec3_1_vec3;\n\n\n\n\n\t// INSERT BODY\n\n\t#include <alphatest_fragment>\n\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist ); // clamp to [ 0, 1 ]\n\n\tgl_FragColor = packDepthToRGBA( dist );\n\n}\n","customDepthDOFMaterial.vertex":"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n\n\n\n// /geo1/MAT/meshBasicBuilder1/globals1\nvarying vec2 v_POLY_globals1_uv;\n\n\n\n\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n// removed:\n//\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n// removed:\n//\t#include <begin_vertex>\n\n\n\n\t// /geo1/MAT/meshBasicBuilder1/globals1\n\tv_POLY_globals1_uv = vec2(uv);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/output1\n\tvec3 transformed = position;\n\tvec3 objectNormal = normal;\n\t#ifdef USE_TANGENT\n\t\tvec3 objectTangent = vec3( tangent.xyz );\n\t#endif\n\n\n\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}","customDepthDOFMaterial.fragment":"\n// INSERT DEFINES\n\n\n#if DEPTH_PACKING == 3200\n\n\tuniform float opacity;\n\n#endif\n\n#include <common>\n\n\n\n// /geo1/MAT/meshBasicBuilder1/colorCorrect1\n// from https://github.com/williammalo/hsluv-glsl\n/*\nHSLUV-GLSL v4.2\nHSLUV is a human-friendly alternative to HSL. ( http://www.hsluv.org )\nGLSL port by William Malo ( https://github.com/williammalo )\nPut this code in your fragment shader.\n*/\n\nvec3 hsluv_intersectLineLine(vec3 line1x, vec3 line1y, vec3 line2x, vec3 line2y) {\n\treturn (line1y - line2y) / (line2x - line1x);\n}\n\nvec3 hsluv_distanceFromPole(vec3 pointx,vec3 pointy) {\n\treturn sqrt(pointx*pointx + pointy*pointy);\n}\n\nvec3 hsluv_lengthOfRayUntilIntersect(float theta, vec3 x, vec3 y) {\n\tvec3 len = y / (sin(theta) - x * cos(theta));\n\tif (len.r < 0.0) {len.r=1000.0;}\n\tif (len.g < 0.0) {len.g=1000.0;}\n\tif (len.b < 0.0) {len.b=1000.0;}\n\treturn len;\n}\n\nfloat hsluv_maxSafeChromaForL(float L){\n\tmat3 m2 = mat3(\n\t\t 3.2409699419045214 ,-0.96924363628087983 , 0.055630079696993609,\n\t\t-1.5373831775700935 , 1.8759675015077207 ,-0.20397695888897657 ,\n\t\t-0.49861076029300328 , 0.041555057407175613, 1.0569715142428786 \n\t);\n\tfloat sub0 = L + 16.0;\n\tfloat sub1 = sub0 * sub0 * sub0 * .000000641;\n\tfloat sub2 = sub1 > 0.0088564516790356308 ? sub1 : L / 903.2962962962963;\n\n\tvec3 top1 = (284517.0 * m2[0] - 94839.0 * m2[2]) * sub2;\n\tvec3 bottom = (632260.0 * m2[2] - 126452.0 * m2[1]) * sub2;\n\tvec3 top2 = (838422.0 * m2[2] + 769860.0 * m2[1] + 731718.0 * m2[0]) * L * sub2;\n\n\tvec3 bounds0x = top1 / bottom;\n\tvec3 bounds0y = top2 / bottom;\n\n\tvec3 bounds1x = top1 / (bottom+126452.0);\n\tvec3 bounds1y = (top2-769860.0*L) / (bottom+126452.0);\n\n\tvec3 xs0 = hsluv_intersectLineLine(bounds0x, bounds0y, -1.0/bounds0x, vec3(0.0) );\n\tvec3 xs1 = hsluv_intersectLineLine(bounds1x, bounds1y, -1.0/bounds1x, vec3(0.0) );\n\n\tvec3 lengths0 = hsluv_distanceFromPole( xs0, bounds0y + xs0 * bounds0x );\n\tvec3 lengths1 = hsluv_distanceFromPole( xs1, bounds1y + xs1 * bounds1x );\n\n\treturn min(lengths0.r,\n\t\t\tmin(lengths1.r,\n\t\t\tmin(lengths0.g,\n\t\t\tmin(lengths1.g,\n\t\t\tmin(lengths0.b,\n\t\t\t\tlengths1.b)))));\n}\n\nfloat hsluv_maxChromaForLH(float L, float H) {\n\n\tfloat hrad = radians(H);\n\n\tmat3 m2 = mat3(\n\t\t 3.2409699419045214 ,-0.96924363628087983 , 0.055630079696993609,\n\t\t-1.5373831775700935 , 1.8759675015077207 ,-0.20397695888897657 ,\n\t\t-0.49861076029300328 , 0.041555057407175613, 1.0569715142428786 \n\t);\n\tfloat sub1 = pow(L + 16.0, 3.0) / 1560896.0;\n\tfloat sub2 = sub1 > 0.0088564516790356308 ? sub1 : L / 903.2962962962963;\n\n\tvec3 top1 = (284517.0 * m2[0] - 94839.0 * m2[2]) * sub2;\n\tvec3 bottom = (632260.0 * m2[2] - 126452.0 * m2[1]) * sub2;\n\tvec3 top2 = (838422.0 * m2[2] + 769860.0 * m2[1] + 731718.0 * m2[0]) * L * sub2;\n\n\tvec3 bound0x = top1 / bottom;\n\tvec3 bound0y = top2 / bottom;\n\n\tvec3 bound1x = top1 / (bottom+126452.0);\n\tvec3 bound1y = (top2-769860.0*L) / (bottom+126452.0);\n\n\tvec3 lengths0 = hsluv_lengthOfRayUntilIntersect(hrad, bound0x, bound0y );\n\tvec3 lengths1 = hsluv_lengthOfRayUntilIntersect(hrad, bound1x, bound1y );\n\n\treturn min(lengths0.r,\n\t\t\tmin(lengths1.r,\n\t\t\tmin(lengths0.g,\n\t\t\tmin(lengths1.g,\n\t\t\tmin(lengths0.b,\n\t\t\t\tlengths1.b)))));\n}\n\nfloat hsluv_fromLinear(float c) {\n\treturn c <= 0.0031308 ? 12.92 * c : 1.055 * pow(c, 1.0 / 2.4) - 0.055;\n}\nvec3 hsluv_fromLinear(vec3 c) {\n\treturn vec3( hsluv_fromLinear(c.r), hsluv_fromLinear(c.g), hsluv_fromLinear(c.b) );\n}\n\nfloat hsluv_toLinear(float c) {\n\treturn c > 0.04045 ? pow((c + 0.055) / (1.0 + 0.055), 2.4) : c / 12.92;\n}\n\nvec3 hsluv_toLinear(vec3 c) {\n\treturn vec3( hsluv_toLinear(c.r), hsluv_toLinear(c.g), hsluv_toLinear(c.b) );\n}\n\nfloat hsluv_yToL(float Y){\n\treturn Y <= 0.0088564516790356308 ? Y * 903.2962962962963 : 116.0 * pow(Y, 1.0 / 3.0) - 16.0;\n}\n\nfloat hsluv_lToY(float L) {\n\treturn L <= 8.0 ? L / 903.2962962962963 : pow((L + 16.0) / 116.0, 3.0);\n}\n\nvec3 xyzToRgb(vec3 tuple) {\n\tconst mat3 m = mat3( \n\t\t3.2409699419045214 ,-1.5373831775700935 ,-0.49861076029300328 ,\n\t\t-0.96924363628087983 , 1.8759675015077207 , 0.041555057407175613,\n\t\t0.055630079696993609,-0.20397695888897657, 1.0569715142428786 );\n\t\n\treturn hsluv_fromLinear(tuple*m);\n}\n\nvec3 rgbToXyz(vec3 tuple) {\n\tconst mat3 m = mat3(\n\t\t0.41239079926595948 , 0.35758433938387796, 0.18048078840183429 ,\n\t\t0.21263900587151036 , 0.71516867876775593, 0.072192315360733715,\n\t\t0.019330818715591851, 0.11919477979462599, 0.95053215224966058 \n\t);\n\treturn hsluv_toLinear(tuple) * m;\n}\n\nvec3 xyzToLuv(vec3 tuple){\n\tfloat X = tuple.x;\n\tfloat Y = tuple.y;\n\tfloat Z = tuple.z;\n\n\tfloat L = hsluv_yToL(Y);\n\t\n\tfloat div = 1./dot(tuple,vec3(1,15,3)); \n\n\treturn vec3(\n\t\t1.,\n\t\t(52. * (X*div) - 2.57179),\n\t\t(117.* (Y*div) - 6.08816)\n\t) * L;\n}\n\n\nvec3 luvToXyz(vec3 tuple) {\n\tfloat L = tuple.x;\n\n\tfloat U = tuple.y / (13.0 * L) + 0.19783000664283681;\n\tfloat V = tuple.z / (13.0 * L) + 0.468319994938791;\n\n\tfloat Y = hsluv_lToY(L);\n\tfloat X = 2.25 * U * Y / V;\n\tfloat Z = (3./V - 5.)*Y - (X/3.);\n\n\treturn vec3(X, Y, Z);\n}\n\nvec3 luvToLch(vec3 tuple) {\n\tfloat L = tuple.x;\n\tfloat U = tuple.y;\n\tfloat V = tuple.z;\n\n\tfloat C = length(tuple.yz);\n\tfloat H = degrees(atan(V,U));\n\tif (H < 0.0) {\n\t\tH = 360.0 + H;\n\t}\n\t\n\treturn vec3(L, C, H);\n}\n\nvec3 lchToLuv(vec3 tuple) {\n\tfloat hrad = radians(tuple.b);\n\treturn vec3(\n\t\ttuple.r,\n\t\tcos(hrad) * tuple.g,\n\t\tsin(hrad) * tuple.g\n\t);\n}\n\nvec3 hsluvToLch(vec3 tuple) {\n\ttuple.g *= hsluv_maxChromaForLH(tuple.b, tuple.r) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToHsluv(vec3 tuple) {\n\ttuple.g /= hsluv_maxChromaForLH(tuple.r, tuple.b) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 hpluvToLch(vec3 tuple) {\n\ttuple.g *= hsluv_maxSafeChromaForL(tuple.b) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToHpluv(vec3 tuple) {\n\ttuple.g /= hsluv_maxSafeChromaForL(tuple.r) * .01;\n\treturn tuple.bgr;\n}\n\nvec3 lchToRgb(vec3 tuple) {\n\treturn xyzToRgb(luvToXyz(lchToLuv(tuple)));\n}\n\nvec3 rgbToLch(vec3 tuple) {\n\treturn luvToLch(xyzToLuv(rgbToXyz(tuple)));\n}\n\nvec3 hsluvToRgb(vec3 tuple) {\n\treturn lchToRgb(hsluvToLch(tuple));\n}\n\nvec3 rgbToHsluv(vec3 tuple) {\n\treturn lchToHsluv(rgbToLch(tuple));\n}\n\nvec3 hpluvToRgb(vec3 tuple) {\n\treturn lchToRgb(hpluvToLch(tuple));\n}\n\nvec3 rgbToHpluv(vec3 tuple) {\n\treturn lchToHpluv(rgbToLch(tuple));\n}\n\nvec3 luvToRgb(vec3 tuple){\n\treturn xyzToRgb(luvToXyz(tuple));\n}\n\n// allow vec4's\nvec4 xyzToRgb(vec4 c) {return vec4( xyzToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToXyz(vec4 c) {return vec4( rgbToXyz( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 xyzToLuv(vec4 c) {return vec4( xyzToLuv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToXyz(vec4 c) {return vec4( luvToXyz( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToLch(vec4 c) {return vec4( luvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToLuv(vec4 c) {return vec4( lchToLuv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hsluvToLch(vec4 c) {return vec4( hsluvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToHsluv(vec4 c) {return vec4( lchToHsluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hpluvToLch(vec4 c) {return vec4( hpluvToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToHpluv(vec4 c) {return vec4( lchToHpluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 lchToRgb(vec4 c) {return vec4( lchToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToLch(vec4 c) {return vec4( rgbToLch( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hsluvToRgb(vec4 c) {return vec4( hsluvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToHsluv(vec4 c) {return vec4( rgbToHsluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 hpluvToRgb(vec4 c) {return vec4( hpluvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 rgbToHpluv(vec4 c) {return vec4( rgbToHpluv( vec3(c.x,c.y,c.z) ), c.a);}\nvec4 luvToRgb(vec4 c) {return vec4( luvToRgb( vec3(c.x,c.y,c.z) ), c.a);}\n// allow 3 floats\nvec3 xyzToRgb(float x, float y, float z) {return xyzToRgb( vec3(x,y,z) );}\nvec3 rgbToXyz(float x, float y, float z) {return rgbToXyz( vec3(x,y,z) );}\nvec3 xyzToLuv(float x, float y, float z) {return xyzToLuv( vec3(x,y,z) );}\nvec3 luvToXyz(float x, float y, float z) {return luvToXyz( vec3(x,y,z) );}\nvec3 luvToLch(float x, float y, float z) {return luvToLch( vec3(x,y,z) );}\nvec3 lchToLuv(float x, float y, float z) {return lchToLuv( vec3(x,y,z) );}\nvec3 hsluvToLch(float x, float y, float z) {return hsluvToLch( vec3(x,y,z) );}\nvec3 lchToHsluv(float x, float y, float z) {return lchToHsluv( vec3(x,y,z) );}\nvec3 hpluvToLch(float x, float y, float z) {return hpluvToLch( vec3(x,y,z) );}\nvec3 lchToHpluv(float x, float y, float z) {return lchToHpluv( vec3(x,y,z) );}\nvec3 lchToRgb(float x, float y, float z) {return lchToRgb( vec3(x,y,z) );}\nvec3 rgbToLch(float x, float y, float z) {return rgbToLch( vec3(x,y,z) );}\nvec3 hsluvToRgb(float x, float y, float z) {return hsluvToRgb( vec3(x,y,z) );}\nvec3 rgbToHsluv(float x, float y, float z) {return rgbToHsluv( vec3(x,y,z) );}\nvec3 hpluvToRgb(float x, float y, float z) {return hpluvToRgb( vec3(x,y,z) );}\nvec3 rgbToHpluv(float x, float y, float z) {return rgbToHpluv( vec3(x,y,z) );}\nvec3 luvToRgb(float x, float y, float z) {return luvToRgb( vec3(x,y,z) );}\n// allow 4 floats\nvec4 xyzToRgb(float x, float y, float z, float a) {return xyzToRgb( vec4(x,y,z,a) );}\nvec4 rgbToXyz(float x, float y, float z, float a) {return rgbToXyz( vec4(x,y,z,a) );}\nvec4 xyzToLuv(float x, float y, float z, float a) {return xyzToLuv( vec4(x,y,z,a) );}\nvec4 luvToXyz(float x, float y, float z, float a) {return luvToXyz( vec4(x,y,z,a) );}\nvec4 luvToLch(float x, float y, float z, float a) {return luvToLch( vec4(x,y,z,a) );}\nvec4 lchToLuv(float x, float y, float z, float a) {return lchToLuv( vec4(x,y,z,a) );}\nvec4 hsluvToLch(float x, float y, float z, float a) {return hsluvToLch( vec4(x,y,z,a) );}\nvec4 lchToHsluv(float x, float y, float z, float a) {return lchToHsluv( vec4(x,y,z,a) );}\nvec4 hpluvToLch(float x, float y, float z, float a) {return hpluvToLch( vec4(x,y,z,a) );}\nvec4 lchToHpluv(float x, float y, float z, float a) {return lchToHpluv( vec4(x,y,z,a) );}\nvec4 lchToRgb(float x, float y, float z, float a) {return lchToRgb( vec4(x,y,z,a) );}\nvec4 rgbToLch(float x, float y, float z, float a) {return rgbToLch( vec4(x,y,z,a) );}\nvec4 hsluvToRgb(float x, float y, float z, float a) {return hsluvToRgb( vec4(x,y,z,a) );}\nvec4 rgbToHslul(float x, float y, float z, float a) {return rgbToHsluv( vec4(x,y,z,a) );}\nvec4 hpluvToRgb(float x, float y, float z, float a) {return hpluvToRgb( vec4(x,y,z,a) );}\nvec4 rgbToHpluv(float x, float y, float z, float a) {return rgbToHpluv( vec4(x,y,z,a) );}\nvec4 luvToRgb(float x, float y, float z, float a) {return luvToRgb( vec4(x,y,z,a) );}\n\n/*\nEND HSLUV-GLSL\n*/\n\n\n// from https://gist.github.com/mattatz/44f081cac87e2f7c8980\n// converted to glsl by gui@polygonjs.com\n// and made function names consistent with the ones above\n/*\n * Conversion between RGB and LAB colorspace.\n * Import from flowabs glsl program : https://code.google.com/p/flowabs/source/browse/glsl/?r=f36cbdcf7790a28d90f09e2cf89ec9a64911f138\n */\n\n\n\nvec3 xyzToLab( vec3 c ) {\n\tvec3 n = c / vec3(95.047, 100, 108.883);\n\tvec3 v;\n\tv.x = ( n.x > 0.008856 ) ? pow( n.x, 1.0 / 3.0 ) : ( 7.787 * n.x ) + ( 16.0 / 116.0 );\n\tv.y = ( n.y > 0.008856 ) ? pow( n.y, 1.0 / 3.0 ) : ( 7.787 * n.y ) + ( 16.0 / 116.0 );\n\tv.z = ( n.z > 0.008856 ) ? pow( n.z, 1.0 / 3.0 ) : ( 7.787 * n.z ) + ( 16.0 / 116.0 );\n\treturn vec3(( 116.0 * v.y ) - 16.0, 500.0 * ( v.x - v.y ), 200.0 * ( v.y - v.z ));\n}\n\nvec3 rgbToLab( vec3 c ) {\n\tvec3 lab = xyzToLab( rgbToXyz( c ) );\n\treturn vec3( lab.x / 100.0, 0.5 + 0.5 * ( lab.y / 127.0 ), 0.5 + 0.5 * ( lab.z / 127.0 ));\n}\n\nvec3 labToXyz( vec3 c ) {\n\tfloat fy = ( c.x + 16.0 ) / 116.0;\n\tfloat fx = c.y / 500.0 + fy;\n\tfloat fz = fy - c.z / 200.0;\n\treturn vec3(\n\t\t 95.047 * (( fx > 0.206897 ) ? fx * fx * fx : ( fx - 16.0 / 116.0 ) / 7.787),\n\t\t100.000 * (( fy > 0.206897 ) ? fy * fy * fy : ( fy - 16.0 / 116.0 ) / 7.787),\n\t\t108.883 * (( fz > 0.206897 ) ? fz * fz * fz : ( fz - 16.0 / 116.0 ) / 7.787)\n\t);\n}\n\n\n\nvec3 labToRgb( vec3 c ) {\n\treturn xyzToRgb( labToXyz( vec3(100.0 * c.x, 2.0 * 127.0 * (c.y - 0.5), 2.0 * 127.0 * (c.z - 0.5)) ) );\n}\n\n// adapted from\n// THREEjs math/Color.js\nfloat sRGBToLinear( float c ) {\n\treturn ( c < 0.04045 ) ? c * 0.0773993808 : pow( c * 0.9478672986 + 0.0521327014, 2.4 );\n}\nvec3 sRGBToLinear( vec3 c ) {\n\treturn vec3( sRGBToLinear(c.r), sRGBToLinear(c.g), sRGBToLinear(c.b) );\n}\nvec4 sRGBToLinear( vec4 c ) {\n\treturn vec4( sRGBToLinear(c.r), sRGBToLinear(c.g), sRGBToLinear(c.b), c.a );\n}\n\n\n\n\n\n\n\n// /geo1/MAT/meshBasicBuilder1/globals1\nvarying vec2 v_POLY_globals1_uv;\n\n\n\n\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvarying vec2 vHighPrecisionZW;\n\nvoid main() {\n\n\t#include <clipping_planes_fragment>\n\n\tvec4 diffuseColor = vec4( 1.0 );\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tdiffuseColor.a = opacity;\n\n\t#endif\n\n\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\n\n\n\t// /geo1/MAT/meshBasicBuilder1/subtract2\n\tvec2 v_POLY_subtract2_subtract = (v_POLY_globals1_uv - vec2(0.5, 0.5));\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec2ToVec3_1\n\tvec3 v_POLY_vec2ToVec3_1_vec3 = vec3(v_POLY_subtract2_subtract.xy, 0.0);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec3ToVec4_1\n\tvec4 v_POLY_vec3ToVec4_1_vec4 = vec4(v_POLY_vec2ToVec3_1_vec3.xyz, 0.0);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/colorCorrect1\n\tvec4 v_POLY_colorCorrect1_out = sRGBToLinear(v_POLY_vec3ToVec4_1_vec4);\n\t\n\t// /geo1/MAT/meshBasicBuilder1/vec4ToVec3_1\n\tvec3 v_POLY_vec4ToVec3_1_vec3 = v_POLY_colorCorrect1_out.xyz;\n\t\n\t// /geo1/MAT/meshBasicBuilder1/output1\n\tdiffuseColor.xyz = v_POLY_vec4ToVec3_1_vec3;\n\n\n\n\n\t// INSERT BODY\n\t// the new body lines should be added before the alphatest_fragment\n\t// so that alpha is set before (which is really how it would be set if the alphamap_fragment above was used by the material node parameters)\n\n\t#include <alphatest_fragment>\n\n\t#include <logdepthbuf_fragment>\n\n\n\t// Higher precision equivalent of gl_FragCoord.z. This assumes depthRange has been left to its default values.\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), diffuseColor.a );\n\n\t#elif DEPTH_PACKING == 3201\n\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\n\t#endif\n\n}\n"}},"jsFunctionBodies":{}}
Code editor
{"multiple_panel":{"split_ratio":0.5,"split_panel0":{"split_ratio":0.5543217692883486,"split_panel0":{"panelTypes":["viewer"],"currentPanelIndex":0,"panel_data":{"camera":"/cameras/cameras:sopGroup/perspectiveCamera1","isViewerInitLayoutData":true,"linkIndex":1,"overlayedNetwork":{"allowed":false,"displayed":false}}},"split_panel1":{"panelTypes":["params"],"currentPanelIndex":0,"panel_data":{"active_folder":392,"linkIndex":1}},"split_mode":"vertical"},"split_panel1":{"panelTypes":["network","params","viewer"],"currentPanelIndex":0,"panel_data":{"camera":{"position":{"x":-149.05297258917093,"y":-271.68106351895847},"zoom":0.7192221069335931},"history":{"2":{"position":{"x":-127.23709817345446,"y":70.54961652487995},"zoom":1.0222221069335933},"36":{"position":{"x":130.37228858252482,"y":-547.4355329613236},"zoom":0.7192221069335931},"195":{"position":{"x":50,"y":-300},"zoom":1.0222221069335933},"386":{"position":{"x":50,"y":150},"zoom":0.7192221069335931},"389":{"position":{"x":-149.05297258917093,"y":-271.68106351895847},"zoom":0.7192221069335931},"980":{"position":{"x":200,"y":-275},"zoom":1.0222221069335933},"1093":{"position":{"x":18.695648643334593,"y":86.41303630677339},"zoom":1.0222221069335933},"1096":{"position":{"x":-149.05297258917093,"y":-271.68106351895847},"zoom":0.7192221069335931},"1460":{"position":{"x":25,"y":-125},"zoom":1.0222221069335933},"1617":{"position":{"x":-38.15217821593596,"y":-96.8478370096836},"zoom":1.0222221069335933}},"paramsDisplayed":false,"linkIndex":1}},"split_mode":"horizontal"},"currentNodes":["/geo1/MAT/meshBasicBuilder1","/","/","/","/","/","/","/"],"navigationHistory":{"nodePaths":{"1":["/geo1/MAT","/geo1/MAT/meshBasicBuilder1","/geo1/MAT","/geo1","/","/cameras","/cameras/cameraRenderer1","/cameras","/","/geo1","/geo1/MAT","/geo1/MAT/meshBasicBuilder1","/geo1/MAT","/geo1","/","/cameras","/","/geo1","/geo1/MAT","/geo1/MAT/meshBasicBuilder1"],"2":["/"],"3":["/"],"4":["/"],"5":["/"],"6":["/"],"7":["/"],"8":["/"]},"index":{"1":19,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0}},"fullscreenPanelId":null,"saveOptions":{"checkRemoteAssetsUse":true,"minimizeFilesCount":false},"paramsModal":[{"nodePath":"/cameras/cameraRenderer1/WebGLRenderer1","style":{"top":594,"left":1057.5,"width":600,"height":576.6}}]}
Used nodes
cop/envMap;cop/image;cop/imageEXR;event/cameraOrbitControls;mat/meshBasicBuilder;obj/copNetwork;obj/geo;rop/WebGLRenderer;sop/cameraControls;sop/cameraRenderer;sop/hemisphereLight;sop/material;sop/materialsNetwork;sop/merge;sop/perspectiveCamera;sop/plane;sop/planeHelper;sop/polarTransform;sop/spotLight
Used operations
Used modules
Used assemblers
GL_MESH_BASIC
Used integrations
[]
Used assets
Nodes map
{"/geo1":"obj/geo","/geo1/plane1":"sop/plane","/geo1/material1":"sop/material","/geo1/MAT":"sop/materialsNetwork","/geo1/MAT/meshBasicBuilder1":"mat/meshBasicBuilder","/COP":"obj/copNetwork","/COP/envMap":"cop/envMap","/COP/imageEnv":"cop/imageEXR","/COP/image1":"cop/image","/lights":"obj/geo","/lights/hemisphereLight1":"sop/hemisphereLight","/lights/spotLight1":"sop/spotLight","/lights/polarTransform1":"sop/polarTransform","/lights/merge1":"sop/merge","/cameras":"obj/geo","/cameras/perspectiveCamera1":"sop/perspectiveCamera","/cameras/cameraControls1":"sop/cameraControls","/cameras/cameraControls1/cameraOrbitControls1":"event/cameraOrbitControls","/cameras/cameraRenderer1":"sop/cameraRenderer","/cameras/cameraRenderer1/WebGLRenderer1":"rop/WebGLRenderer","/geo2":"obj/geo","/geo2/planeHelper1":"sop/planeHelper"}
Js version
Editor version
Engine version
Logout
0%
There was a problem displaying your scene:
view scene source