Technical

Computer grpahics

  1. Real world sky dome


    Another WebGL experiment with Three.js Real world sky dome lighting and shading: http://www.vill.ee/rig
    Not really finished (nothing ever is) but working features so far are:
    • Physically Based Atmosphere shader
    • Irradiance bake (using three.js IcosahedronGeometry for sampling directions)
    • Blurry reflections
    • Real world sun positioning with Google Maps
    • Cloud cover from Google Maps Weather Layer
    • ...

    And things I'm hoping to add
    • Google Maps WebGL buildings (possible?)
    • Moon and accurate stars
    • Fog, Rain, Snow from Google Weather
    • Cloud animation from Google Weather wind direction
    • Cloud lighting
    • Proper irradiance sampling
    • Sun directional light hack needs proper sampling too
    • Upload source code somewhere useful but currently can be sourced from vill.ee/rig/full.html

    Notes:
    • Bug in Three.js. When normal maps in use, cube reflection map coordinates are wrong. World normals are replaced with view normals and thats incorrect.
    • Only works in Chrome for some reason

    Libraries and source codes used:
    Three.js, Atmosphere Shader, snoise, SunCalc, dat.gui, Google Maps, jQuery, Raphaël

    Updated 05-07-2014 at 02:06 PM by Artur

    Tags: glsl, webgl Add / Edit Tags
    Categories
    Technical
  2. Romanesco broccoli pattern 2D shader


    photo: Romanesco broccoli

    I started playing with fractal shaders and in particularity I wanted to reproduce romanesco broccoli in SL. At first it was just a simple experiment but after each obstacle I got more persistent so eventually I discovered the world of calculus.
    I'm going to skip the theory part about phyllotaxis, Fibonacci etc and get straight to the shader math. Good site that explains it all is: http://www.math.smith.edu/phyllo/

    Most of the math was found on Wolfram and WikiPedia pages

    First off we need to convert our UVs from cartesian to polar coordinate system


    Code:
     r = sqrt( pow( x, 2 ) + pow( y, 2 ));

    Code:
    theta = atan( x, y) + PI;
    // Note that PI offset has been added for polar translation 
    // equation to work (for secondary florets)
    Next, Golden Angle for distribution pattern.


    Code:
    golden = PI*(3-sqrt(5));
    To draw a secondary florets or a circle on polar coordinates we can use polar translation equations


    Code:
    r2 = sqrt(r*r-2*r*r0*cos( theta-th0 )+r0*r0);
    ...

    Updated 08-26-2013 at 06:13 AM by Artur

    Categories
    Technical
  3. Houdini Cellular Automata

    Name:  cellanim_wide.gif
Views: 18565
Size:  159.3 KB

    I've translated Malcolm Kesson's Cellular Automata SL into a Houdini VOP RSL Network (no reason). You can find the original SL on his website: http://www.fundza.com/rman_shaders/cellular/index.html
    Main difference is that Houdini VOPs don't support Arrays so I used multiple connections and 8 texture calls instead of a for loop. Let me know if there is some better way of querying neigbours.
    Original shader cell size and count is dependant on micropolgyons and controlled by shading rate. I've set the shading rate to a very high value and the cell count is controlled by geometric subdivision instead. That meant I couldn't use random function for initialization so I replaced it with cellnoise shadeop.

    Name:  cellularNetworkSmall.png
Views: 18099
Size:  88.6 KB

    OTL library contains digital assets:
    • cellular - Object type digital asset
    • bake3d - shadeop for pointcloud baking
    • texture3D - shadeop for pointcloud reading
    • cellnoise - rendermans cellnoise function
    • cellular_automata - cellular.sl VOP node version. Just a direct implementation of the code. Not used for anything.


    Cellular is Object Type Digital Asset that contains shaders, geometry and ROPs for 'out of the box' test.



    Have fun.

    Updated 03-02-2012 at 12:59 AM by Artur

    Categories
    Technical
  4. Blurry pointcloud refractions with 3Delight


    While debugging some of my occlusion shaders, I've put together simple RIB and SL demonstrating two pass pointcloud based refractions using indirectdiffuse shadeop. It's a pretty old trick but never officially documented for some reason. First off, pointcloud baking shader:

    Code:
    surface simple_bake
    (
    	uniform float bake = 0;
    	uniform string ptc_file = "mybake.ptc";
    	uniform float ptc_interpolate = 0;
    	uniform float ptc_radiusscale = 1 
    )
    {
      normal Nn = normalize( N );
      if( bake != 0 )
      {
         bake3d( ptc_file, "", P, Nn, "_radiosity", Cs, "coordsystem", "world", "interpolate", ptc_interpolate, "radiusscale", ptc_radiusscale );
      }
      Ci = Cs;
    }
    Refraction shader
    Code:
    surface refractive
    (
    	uniform float  pointbased = 1;
    	uniform string ptc_file = "";
    	uniform string envmap = "";
    	uniform float  blur = 0.1;
    	uniform float  ior = 1.1
    )
    {
      vector In = normalize( I );
      normal Nn = normalize( N );
      vector Refr = refract ( In, Nn, ior );
      Ci = indirectdiffuse( P, Refr, 0, 
    			"pointbased", pointbased,
    			"filename", ptc_file,
    			"environmentmap", envmap,
    			"coneangle", blur,
    			"clamp",
    ...
  5. Short one

    Quick update on previous post. Found another awesome WebGL site dedicated to 3D fractals



    @ http://fractal.io/

    And a nice tutorial on snow shader for architectural visualization by Bertrand Benoit


    Updated 10-04-2011 at 01:08 AM by Artur

    Categories
    Technical
Page 1 of 2 1 2 LastLast