diff --git a/index.html b/index.html index b0ed9b4..a59b1ce 100644 --- a/index.html +++ b/index.html @@ -111,7 +111,7 @@ uniform sampler2D uSampler; lcolor += diffuse * max(0., dot(N, LDir)) * LCol; //*SPECULAR LIGHTS ARE ADDED specularlight = specular * - max(0., pow(dot(2.*dot(N, LDir) * N - LDir, VDir),3.)) * LCol; + pow(max(0.,dot(2.*dot(N, LDir) * N - LDir, VDir)),3.) * LCol; // ROTATE THE TEXTURE OVER TIME. float angle = 0.4 * uTime; @@ -206,7 +206,7 @@ uniform sampler2D uSampler; lcolor += 1.2*diffuse * max(0., dot(N, LDir)) * LCol; specularlight = 0.3*specular * - max(0., pow(dot(2.*dot(N, LDir) * N - LDir, VDir),32.)) * LCol; + pow(max(0., dot(2.*dot(N, LDir) * N - LDir, VDir)),32.) * LCol; color = color * lcolor + specularlight; } @@ -247,12 +247,12 @@ that you are seeing now.

  • The specular light of the background wall is eliminated and the diffusion factor is reduced when the ray shooting from the background point towards the light source or from the background point towards the camera position intersect with the sphere.
  • -
  • I added basic interactions such as press 't' key to hide/show texture, click on the above canvas to pause/unpause animations. +
  • I added basic interactions such as press ctrl + 't' key to hide/show texture, click on the above canvas to pause/unpause animations. Just a proof of concept.
  • Finally, I made some small changes like changing R over time and refined the UI a little bit. I used Ace for code highlighting and autocompletion on the edit panel.
  • Comments begin with '//*' are added by me.
  • -
  • Repo from Github.
  • +
  • Repo on Github.
  • diff --git a/lib1.js b/lib1.js index 33a7345..0239dc7 100644 --- a/lib1.js +++ b/lib1.js @@ -77,7 +77,7 @@ function gl_start(canvas, vertexShader, fragmentShader) { // START WEB setTimeout(function () { try { - canvas.gl = canvas.getContext('experimental-webgl'); // Make sure WebGl is supported. IT WOULD BE GREAT TO USE WEBGL2 INSTEAD. + canvas.gl = canvas.getContext('webgl2'); // Make sure WebGl is supported. IT WOULD BE GREAT TO USE WEBGL2 INSTEAD. } catch (e) { throw 'Sorry, your browser does not support WebGL.'; } canvas.setShaders = function (vertexShader, fragmentShader) { // Add the vertex and fragment shaders: