Variables
calculators__blinn_phong_glsl
calculators__blinn_phong_glsl: "vec3 calculate_light(vec4 position, vec3 normal, vec3 lightPos, vec4 eyePos, vec3 specular, vec3 diffuse, float shiness, float idensity) {vec3 lightDir = normalize(lightPos - position.xyz);float lambortian = max(dot(lightDir, normal), 0.0);vec3 reflectDir = normalize(reflect(lightDir, normal));vec3 viewDir = normalize((eyePos - position).xyz);// replace R * V with N * Hvec3 H = (lightDir + viewDir) / length(lightDir + viewDir);float specularAngle = max(dot(H, normal), 0.0);vec3 specularColor = specular * pow(specularAngle, shiness);vec3 diffuseColor = diffuse * lambortian;return (diffuseColor + specularColor) * idensity;}vec3 calculate_spot_light(vec4 position, vec3 normal, vec3 lightPos, vec3 spotDir, vec4 eyePos, vec3 specular, vec3 diffuse, float shiness, float idensity) {vec3 lightDir = normalize(lightPos - position.xyz);float lambortian = max(dot(lightDir, normal), 0.0);vec3 reflectDir = normalize(reflect(lightDir, normal));vec3 viewDir = normalize((eyePos - position).xyz);// replace R * V with N * Hvec3 H = (lightDir + viewDir) / length(lightDir + viewDir);float specularAngle = max(dot(H, normal), 0.0);vec3 specularColor = specular * pow(specularAngle, shiness);vec3 diffuseColor = diffuse * lambortian;return (diffuseColor + specularColor) * idensity;}" = "vec3 calculate_light(vec4 position, vec3 normal, vec3 lightPos, vec4 eyePos, vec3 specular, vec3 diffuse, float shiness, float idensity) {vec3 lightDir = normalize(lightPos - position.xyz);float lambortian = max(dot(lightDir, normal), 0.0);vec3 reflectDir = normalize(reflect(lightDir, normal));vec3 viewDir = normalize((eyePos - position).xyz);// replace R * V with N * Hvec3 H = (lightDir + viewDir) / length(lightDir + viewDir);float specularAngle = max(dot(H, normal), 0.0);vec3 specularColor = specular * pow(specularAngle, shiness);vec3 diffuseColor = diffuse * lambortian;return (diffuseColor + specularColor) * idensity;}vec3 calculate_spot_light(vec4 position, vec3 normal, vec3 lightPos, vec3 spotDir, vec4 eyePos, vec3 specular, vec3 diffuse, float shiness, float idensity) {vec3 lightDir = normalize(lightPos - position.xyz);float lambortian = max(dot(lightDir, normal), 0.0);vec3 reflectDir = normalize(reflect(lightDir, normal));vec3 viewDir = normalize((eyePos - position).xyz);// replace R * V with N * Hvec3 H = (lightDir + viewDir) / length(lightDir + viewDir);float specularAngle = max(dot(H, normal), 0.0);vec3 specularColor = specular * pow(specularAngle, shiness);vec3 diffuseColor = diffuse * lambortian;return (diffuseColor + specularColor) * idensity;}"
calculators__linearlize_depth_glsl
calculators__linearlize_depth_glsl: "float linearlizeDepth(float far, float near, float depth) {float NDRDepth = depth * 2.0 + 1.0;;return 2.0 * near * far / (near + far - NDRDepth * (far - near));}" = "float linearlizeDepth(float far, float near, float depth) {float NDRDepth = depth * 2.0 + 1.0;;return 2.0 * near * far / (near + far - NDRDepth * (far - near));}"
calculators__phong_glsl
calculators__phong_glsl: "vec3 calculate_light(vec4 position, vec3 normal, vec4 lightPos, vec4 eyePos, vec3 specularLight, vec3 diffuseLight, float shiness, float idensity) {vec3 lightDir = normalize((lightPos - position).xyz);float lambortian = max(dot(lightDir, normal), 0.0);vec3 reflectDir = normalize(reflect(lightDir, normal));vec3 viewDir = normalize((eyePos - position).xyz);float specularAngle = max(dot(reflectDir, viewDir), 0.0);vec3 specularColor = specularLight * pow(specularAngle, shiness);vec3 diffuseColor = diffuse * lambortian;return (diffuseColor + specularColor) * idensity;}vec3 calculate_spot_light(vec4 position, vec3 normal, vec4 lightPos, vec4 eyePos, vec3 specularLight, vec3 diffuseLight, float shiness, float idensity) {vec3 lightDir = normalize((lightPos - position).xyz);float lambortian = max(dot(lightDir, normal), 0.0);vec3 reflectDir = normalize(reflect(lightDir, normal));vec3 viewDir = normalize((eyePos - position).xyz);float specularAngle = max(dot(reflectDir, viewDir), 0.0);vec3 specularColor = specularLight * pow(specularAngle, shiness);vec3 diffuseColor = diffuse * lambortian;return (diffuseColor + specularColor) * idensity;}" = "vec3 calculate_light(vec4 position, vec3 normal, vec4 lightPos, vec4 eyePos, vec3 specularLight, vec3 diffuseLight, float shiness, float idensity) {vec3 lightDir = normalize((lightPos - position).xyz);float lambortian = max(dot(lightDir, normal), 0.0);vec3 reflectDir = normalize(reflect(lightDir, normal));vec3 viewDir = normalize((eyePos - position).xyz);float specularAngle = max(dot(reflectDir, viewDir), 0.0);vec3 specularColor = specularLight * pow(specularAngle, shiness);vec3 diffuseColor = diffuse * lambortian;return (diffuseColor + specularColor) * idensity;}vec3 calculate_spot_light(vec4 position, vec3 normal, vec4 lightPos, vec4 eyePos, vec3 specularLight, vec3 diffuseLight, float shiness, float idensity) {vec3 lightDir = normalize((lightPos - position).xyz);float lambortian = max(dot(lightDir, normal), 0.0);vec3 reflectDir = normalize(reflect(lightDir, normal));vec3 viewDir = normalize((eyePos - position).xyz);float specularAngle = max(dot(reflectDir, viewDir), 0.0);vec3 specularColor = specularLight * pow(specularAngle, shiness);vec3 diffuseColor = diffuse * lambortian;return (diffuseColor + specularColor) * idensity;}"
debug
debug: boolean = true
definitions__light_glsl
definitions__light_glsl: "#ifdef OPEN_LIGHT // light declarationstruct Light {vec3 color;float idensity;vec3 position;};struct SpotLight {vec3 color;float idensity;vec3 direction;vec3 position;};#endif // light declaration" = "#ifdef OPEN_LIGHT // light declarationstruct Light {vec3 color;float idensity;vec3 position;};struct SpotLight {vec3 color;float idensity;vec3 direction;vec3 position;};#endif // light declaration"
env_map_vert
env_map_vert: "" = ""
interploters__deferred__geometry_frag
interploters__deferred__geometry_frag: "uniform vec3 ambient;#ifdef OPEN_LIGHTuniform vec4 eyePos;varying vec3 vNormal;varying vec4 vPosition;varying float vDepth;#endif#ifdef _MAIN_TEXTUREuniform sampler2D uMainTexture;varying vec2 vMainUV;#endif#ifdef _NORMAL_TEXTUREuniform sampler2D uNormalTexture;varying vec2 vNormalUV;#endifvoid main () {#ifdef OPEN_LIGHTvec3 normal = normalize(vNormal);// normal, position, color#ifdef _NORMAL_TEXTUREgl_FragData[0] = vec4(normalize(vNormal.xyz), 1.0);#elsegl_FragData[0] = vec4(normalize(vNormal.xyz), 1.0);#endifgl_FragData[1] = vPosition;#ifdef _MAIN_TEXTUREgl_FragData[2] = vec4(texture2D(uMainTexture, vMainUV).xyz + ambient, 1.0);#elsegl_FragData[2] = vec4(ambient, 1.0);#endif#endif}" = "uniform vec3 ambient;#ifdef OPEN_LIGHTuniform vec4 eyePos;varying vec3 vNormal;varying vec4 vPosition;varying float vDepth;#endif#ifdef _MAIN_TEXTUREuniform sampler2D uMainTexture;varying vec2 vMainUV;#endif#ifdef _NORMAL_TEXTUREuniform sampler2D uNormalTexture;varying vec2 vNormalUV;#endifvoid main () {#ifdef OPEN_LIGHTvec3 normal = normalize(vNormal);// normal, position, color#ifdef _NORMAL_TEXTUREgl_FragData[0] = vec4(normalize(vNormal.xyz), 1.0);#elsegl_FragData[0] = vec4(normalize(vNormal.xyz), 1.0);#endifgl_FragData[1] = vPosition;#ifdef _MAIN_TEXTUREgl_FragData[2] = vec4(texture2D(uMainTexture, vMainUV).xyz + ambient, 1.0);#elsegl_FragData[2] = vec4(ambient, 1.0);#endif#endif}"
interploters__deferred__geometry_vert
interploters__deferred__geometry_vert: "attribute vec3 position;uniform mat4 modelViewProjectionMatrix;#ifdef _MAIN_TEXTUREattribute vec2 aMainUV;varying vec2 vMainUV;#endif#ifdef OPEN_LIGHTuniform mat4 normalMatrix;attribute vec3 aNormal;varying vec3 vNormal;varying vec4 vPosition;varying float vDepth;#endifvoid main (){gl_Position = modelViewProjectionMatrix * vec4(position, 1.0);#ifdef OPEN_LIGHTvNormal = (normalMatrix * vec4(aNormal, 1.0)).xyz;vPosition = gl_Position;vDepth = gl_Position.z / gl_Position.w;#endif#ifdef _MAIN_TEXTUREvMainUV = aMainUV;#endif}" = "attribute vec3 position;uniform mat4 modelViewProjectionMatrix;#ifdef _MAIN_TEXTUREattribute vec2 aMainUV;varying vec2 vMainUV;#endif#ifdef OPEN_LIGHTuniform mat4 normalMatrix;attribute vec3 aNormal;varying vec3 vNormal;varying vec4 vPosition;varying float vDepth;#endifvoid main (){gl_Position = modelViewProjectionMatrix * vec4(position, 1.0);#ifdef OPEN_LIGHTvNormal = (normalMatrix * vec4(aNormal, 1.0)).xyz;vPosition = gl_Position;vDepth = gl_Position.z / gl_Position.w;#endif#ifdef _MAIN_TEXTUREvMainUV = aMainUV;#endif}"
interploters__depth_phong_frag
interploters__depth_phong_frag: "uniform vec3 ambient;uniform vec3 depthColor;uniform float cameraNear;uniform float cameraFar;uniform sampler2D uMainTexture;varying vec2 vMainUV;void main () {float originDepth = texture2D(uMainTexture, vMainUV).r;float linearDepth = linearlizeDepth(cameraFar, cameraNear, originDepth) / cameraFar;gl_FragColor = vec4(vec3(originDepth * 2.0 - 1.0), 1.0);}" = "uniform vec3 ambient;uniform vec3 depthColor;uniform float cameraNear;uniform float cameraFar;uniform sampler2D uMainTexture;varying vec2 vMainUV;void main () {float originDepth = texture2D(uMainTexture, vMainUV).r;float linearDepth = linearlizeDepth(cameraFar, cameraNear, originDepth) / cameraFar;gl_FragColor = vec4(vec3(originDepth * 2.0 - 1.0), 1.0);}"
interploters__depth_phong_vert
interploters__depth_phong_vert: "attribute vec3 position;uniform mat4 modelViewProjectionMatrix;attribute vec2 aMainUV;varying vec2 vMainUV;void main (){gl_Position = modelViewProjectionMatrix * vec4(position, 1.0);vMainUV = aMainUV;}" = "attribute vec3 position;uniform mat4 modelViewProjectionMatrix;attribute vec2 aMainUV;varying vec2 vMainUV;void main (){gl_Position = modelViewProjectionMatrix * vec4(position, 1.0);vMainUV = aMainUV;}"
interploters__gouraud_frag
interploters__gouraud_frag: "attribute vec3 position;uniform mat4 modelViewProjectionMatrix;void main() {textureColor = colorOrMainTexture(vMainUV);#ifdef OPEN_LIGHTtotalLighting = ambient;vec3 normal = normalize(vNormal);gl_FragColor = vec4(totalLighting, 1.0);#else#ifdef USE_COLORgl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);#endif#endif#ifdef _MAIN_TEXTUREgl_FragColor = gl_FragColor * textureColor;#endif#ifdef USE_COLORgl_FragColor = gl_FragColor * color;#endif}" = "attribute vec3 position;uniform mat4 modelViewProjectionMatrix;void main() {textureColor = colorOrMainTexture(vMainUV);#ifdef OPEN_LIGHTtotalLighting = ambient;vec3 normal = normalize(vNormal);gl_FragColor = vec4(totalLighting, 1.0);#else#ifdef USE_COLORgl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);#endif#endif#ifdef _MAIN_TEXTUREgl_FragColor = gl_FragColor * textureColor;#endif#ifdef USE_COLORgl_FragColor = gl_FragColor * color;#endif}"
interploters__gouraud_vert
interploters__gouraud_vert: "attribute vec3 position;uniform mat4 modelViewProjectionMatrix;attribute vec2 aMainUV;varying vec2 vMainUV;void main (){gl_Position = modelViewProjectionMatrix * vec4(position, 1.0);#ifdef OPEN_LIGHTvec3 normal = (normalMatrix * vec4(aNormal, 0.0)).xyz;totalLighting = ambient;normal = normalize(normal);for (int index = 0; index < LIGHT_NUM; index++) {totalLighting += calculate_light(gl_Position, normal, lights[index].position, eyePos, lights[index].specular, lights[index].diffuse, 4, lights[index].idensity);}vLightColor = totalLighting;#endif#ifdef _MAIN_TEXTUREvTextureCoord = aTextureCoord;#endif}" = "attribute vec3 position;uniform mat4 modelViewProjectionMatrix;attribute vec2 aMainUV;varying vec2 vMainUV;void main (){gl_Position = modelViewProjectionMatrix * vec4(position, 1.0);#ifdef OPEN_LIGHTvec3 normal = (normalMatrix * vec4(aNormal, 0.0)).xyz;totalLighting = ambient;normal = normalize(normal);for (int index = 0; index < LIGHT_NUM; index++) {totalLighting += calculate_light(gl_Position, normal, lights[index].position, eyePos, lights[index].specular, lights[index].diffuse, 4, lights[index].idensity);}vLightColor = totalLighting;#endif#ifdef _MAIN_TEXTUREvTextureCoord = aTextureCoord;#endif}"
interploters__phong_frag
interploters__phong_frag: "uniform vec3 ambient;uniform vec3 materialSpec;uniform float materialSpecExp;uniform vec3 materialDiff;uniform mat4 cameraInverseMatrix;#ifdef OPEN_LIGHTuniform vec4 eyePos;varying vec3 vNormal;varying vec4 vPosition;#endif#ifdef _MAIN_TEXTUREuniform sampler2D uMainTexture;varying vec2 vMainUV;#endif#ifdef _ENVIRONMENT_MAPuniform float reflectivity;uniform samplerCube uCubeTexture;#endifuniform Light lights[LIGHT_NUM];uniform SpotLight spotLights[LIGHT_NUM];void main () {#ifdef _MAIN_TEXTUREgl_FragColor = texture2D(uMainTexture, vMainUV);#elsegl_FragColor = vec4(1.0);#endifvec3 color;vec3 normal = normalize(vNormal);#ifdef OPEN_LIGHTvec3 totalLighting = ambient;for (int index = 0; index < LIGHT_NUM; index++) {totalLighting += calculate_light(vPosition,normal,lights[index].position,eyePos,materialSpec * lights[index].color,materialDiff * lights[index].color,materialSpecExp,lights[index].idensity);}color = totalLighting;#endif#ifdef _ENVIRONMENT_MAPvec3 worldPosition = (cameraInverseMatrix * vPosition).xyz;vec3 viewDir = worldPosition - eyePos.xyz;vec3 skyUV = reflect(-viewDir, vNormal);vec3 previous = color;color = mix(textureCube(uCubeTexture, skyUV).xyz, previous , 0.4);#endifgl_FragColor *= vec4(color, 1.0);}" = "uniform vec3 ambient;uniform vec3 materialSpec;uniform float materialSpecExp;uniform vec3 materialDiff;uniform mat4 cameraInverseMatrix;#ifdef OPEN_LIGHTuniform vec4 eyePos;varying vec3 vNormal;varying vec4 vPosition;#endif#ifdef _MAIN_TEXTUREuniform sampler2D uMainTexture;varying vec2 vMainUV;#endif#ifdef _ENVIRONMENT_MAPuniform float reflectivity;uniform samplerCube uCubeTexture;#endifuniform Light lights[LIGHT_NUM];uniform SpotLight spotLights[LIGHT_NUM];void main () {#ifdef _MAIN_TEXTUREgl_FragColor = texture2D(uMainTexture, vMainUV);#elsegl_FragColor = vec4(1.0);#endifvec3 color;vec3 normal = normalize(vNormal);#ifdef OPEN_LIGHTvec3 totalLighting = ambient;for (int index = 0; index < LIGHT_NUM; index++) {totalLighting += calculate_light(vPosition,normal,lights[index].position,eyePos,materialSpec * lights[index].color,materialDiff * lights[index].color,materialSpecExp,lights[index].idensity);}color = totalLighting;#endif#ifdef _ENVIRONMENT_MAPvec3 worldPosition = (cameraInverseMatrix * vPosition).xyz;vec3 viewDir = worldPosition - eyePos.xyz;vec3 skyUV = reflect(-viewDir, vNormal);vec3 previous = color;color = mix(textureCube(uCubeTexture, skyUV).xyz, previous , 0.4);#endifgl_FragColor *= vec4(color, 1.0);}"
interploters__phong_vert
interploters__phong_vert: "attribute vec3 position;uniform mat4 modelViewProjectionMatrix;#ifdef _MAIN_TEXTUREattribute vec2 aMainUV;varying vec2 vMainUV;#endifuniform mat4 normalMatrix;attribute vec3 aNormal;varying vec3 vNormal;varying vec4 vPosition;void main (){gl_Position = modelViewProjectionMatrix * vec4(position, 1.0);vNormal = (normalMatrix * vec4(aNormal, 1.0)).xyz;vPosition = gl_Position;#ifdef _MAIN_TEXTUREvMainUV = aMainUV;#endif}" = "attribute vec3 position;uniform mat4 modelViewProjectionMatrix;#ifdef _MAIN_TEXTUREattribute vec2 aMainUV;varying vec2 vMainUV;#endifuniform mat4 normalMatrix;attribute vec3 aNormal;varying vec3 vNormal;varying vec4 vPosition;void main (){gl_Position = modelViewProjectionMatrix * vec4(position, 1.0);vNormal = (normalMatrix * vec4(aNormal, 1.0)).xyz;vPosition = gl_Position;#ifdef _MAIN_TEXTUREvMainUV = aMainUV;#endif}"
interploters__skybox_frag
interploters__skybox_frag: "varying vec3 cubeUV;uniform samplerCube uCubeTexture;void main(){gl_FragColor = textureCube(uCubeTexture, cubeUV);}" = "varying vec3 cubeUV;uniform samplerCube uCubeTexture;void main(){gl_FragColor = textureCube(uCubeTexture, cubeUV);}"
interploters__skybox_vert
interploters__skybox_vert: "attribute vec3 position;uniform mat4 modelViewProjectionMatrix;varying vec3 cubeUV;void main (){vec4 mvp = modelViewProjectionMatrix * vec4(position, 1.0);cubeUV = position;gl_Position = mvp.xyww;}" = "attribute vec3 position;uniform mat4 modelViewProjectionMatrix;varying vec3 cubeUV;void main (){vec4 mvp = modelViewProjectionMatrix * vec4(position, 1.0);cubeUV = position;gl_Position = mvp.xyww;}"
resourcesCache
resourcesCache: object