Halloween Costume ideas 2015
Articles by "tile"
@dorothiar #arttips #interview 101 2 Column Template 2012 mentee 2013 2013 mentee 2014 2014 mentee 2014 Portfolio Winner 2014 SCBWI Portfolio Mentorship Winner 2015 mentee 3 Column Template 360 3d 3d print 3d printing 3delight 8bit Abbey McCulloch abstract acryla gouache acrylic action addon adobe Adobe Flash CS3 Adobe Illustrator Advanced Tutorials advection Advertising advice Agata Wierzbicka agents airplane Al Wiseman ALA Alan E. Cober Alan Lee Alex Ross Alexandra Compain-Tissier Alexandra Lekias Alexandra Levasseur Alexandre Korobov Alexis Winter algorithm alien ALT Amelie Hegardt Amit Shimoni amusement an Ana Aranda analog Andrea Hrjnak Andrea Hrnjak andrea offermann andreaoffermann andreazuill Andy Musser Angela DiTerlizzi Angelika Peißker animal logic animals animation animation nodes anime anisculpt Anja Kroencke Anna Higgie Anna Jensen Anna McKay Annabel Briens AnneBerry Anneke Krull Annu Kilpeläinen anstudy anthology António Soares ar arduino area armature arrange array array modifier arrow art art director art directors Art is fun! art reps art tools Artaksiniya arthictecture arthur rackham artists artwork ase Ashlyn Anstee Asian aspiring asset atom attribute attribute transfer audio Audrey Kawasaki augmented reality aurasma Aurelius Battaglia author illustrator automatic automation Autumn Whitehurst avatar Avrom Yanovsky AW14/15 award awards Babeth Lafon Babies baboon Baby Love Background background color bacteria bake baking ball Bamboo banner Banner images banner making Barbara Dziadosz barcode basic bbox beads beats Bec Winnel beginner Bel Johnstone Ben Denison Bernie Fuchs Berto Martinez Beth Krush better photos bge Bijou Karman Bike biscuit bishop black and white black and white art Blair Breitenstein blam blender blender game engine blender3d blending Blinkie Blinky blob blocks Blog Tips blogger Blogging Friends blogs Blonde blur effect in pixlr and photoshop blur images and pictures bmesh bmesh viewer bolognaragazziaward bombing bone bone modeling bones book book launch books boomerang bottle bounding box bowl bpy brian eno brian ormiston Brian Sanders brian won brick bridge Bridget Davies bright Brooke Boynton Hughes build modifier building burns business Buttons bvh cage Caitlin Shearer caldecott calibration camera camera settings camera tips Candle capcom card career Carole Wilmet cartoony Cassandra Rhodin cast Catherine Campbell Cecilia Carlstedt cell center pivot centipede cg cg photography chair challenge Chanel changin color in pixlr changing color chaos character Character Bible character development charcoal charles Charlie Dot Charlie Hebdo Children children's book illustration chocolate Christina Drejenstam christina forshay Christina K christinaforshay Christmas Cindy Derby circle circle dance city cityengine clock clones cloning cloth Cloud based clover CMYK Coco Chanel Cody and the Fountain of Happiness coffee collect collection Collections collision color color balance color cast color correction color mode color study colorful Commercial Use complexity component compositing composition computational thinking computer concept art Condensed Posts conference connect connect the dot connection Connie Lim Conrad Roset constrain constrast contagion content Contest contracts control converter copy copyright Corinna Luyken count Courtney Brims crack Craft craftsmanship Craig & Karl creative creativity creature cricket Cristina Garcia Martin critic criticism critique Crop Crop Tool cross section crowd csv cubism curve curve modifier custom Custom Blog Design Custom Blog Design Tutorial Custom Blog Designers Custom Illustration custom properties Custom Signature custom xml cut cutting plane cycle cycles dae Damien Florébert Cuypers Dan Hillier dance Daniel Egnéus Daniel Segrove Danny Roberts Daren Newman Dasha Tolstikova data data path David Blossom david diaz David Shrigley David Stone Martin Dean Hardscrabble Debbie debbie ohi debbieohi deform deformer degrees deleting background in pixler demo demoscene desaturation of images design design by numbers design process Design Tips dictionaries dictionary Different Text Writing in Pixlr digital digital paint Digital Scrapbook Freebies Digital Scrapbooking disk distance distractions distribute diversion DIY DIY Contest Dolf Veenvliet Doll Doll Bones dolls domino domino effect doodle Doodles door doraemon Doris Jackson Dorothia Rohner dots dpi draw drawing drill driven driver drivers dual versions dummy duplicate duplicates duplication dupliframe dvd dynamic dynamic paint dynamic text E Simms Campbell Easy easy pixlr Easy Tutorials Ed Graham Ed Vebell editing editing photos editors education effect effects ego Eleanor Dalton electric Elia Fernández eliza wheeler Elizabeth Mayville elizawheeler Emily Forgot Emma Zanelli emoticon happy-face Emotional storytelling empathetic characters empty entoforms envy epicycloid EPS Illustration Epson scanner erasers Erin Armstrong Erin Petson erinoshea ernest shepard Esra Roise euler evaluate line Eveline Tarunadjaja evenly spacing vertex event everywhere door exhibition Expandable Posts experiments explode exploded view export expression extrude eye eye color in pixlr eye trick eyeball face rig facial expressions facial setup factory Faiyaz Jafri Families fashion illustration fashion week fcurve feature Featured Fee Harding Feedback fence Fernanda Guedes fibonacci Fifi Lapin file File Types Finalists Finding Nemo fire fix photos Flash Tutorials flicker flip flip flop floor flop flow flower Flowers fnmatch focal point follow up font Fontaine Anderson Fonts food footage For Sale force form formula fractal fracture frame Frames Francois Berthoud Frank Bellamy Frank Furlong Franklin McMahon freckles Fred Steffen FrederiqueBertrand Free for Commercial Use Free for Personal Use Free Stock Photography Free transform tool Freebies Frenchillustration Fritz Siebel frosted mylar fruit ninja Fumi Mini Nakamura Fun function futurism FW2017 fx Gabriel Moreno Gabriella Ibarra game game animation gameart gamma gangnam style Garance Doré Gary Fernandéz gel medium generate generative generator geometric geometry Gerald Lazare Géraldine Georges GIF Gildo Medina Girl Giuseppe Castellano Giveaway glorar goals golden ratio google google docs Google Tools Grant Young graph graphite graphite transfer grease pencil grid group group node growth Gucci Guest Guil Godier gustave dore hair handbook Harper's Bazaar harpercollins Harvey Schmidt Haute Couture head Headers heat map Helena Hauss hexagon hexagonal grid Hiroshi Mizuno Hiroshi Tanabe Holiday Holly Black homology honeycomb hook horror houdini how to how to blur a face or an object in pixlr How to change eye color how to delete an object how to desaturate an image how to edit a image in pixlr how to erase an object how to fix red eye problem how to fix red eyes in pixlt How to fix the parts in pixlr in photoshop How to make a banner in pixlr How to overlap the nevus how to remove a object How to remove an object in pixlr how to remove red eyes How to Remove the Background of an Image in Pixlr How to remove the parts that you don't want in pixlr and photoshop how to replace color How to write a Patterned Text in Pixlr how-to Hsiao-Ron Cheng hsv hue humor Hyshil I love illustration magazine idea ideas Igor+André illusion illustrating illustration illustration board Illustration Books Illustration Intensive Illustration Now! Fashion illustration process Illustrations Illustrative Berlin illustrator Illustrator Intensive Illustrator Tutorials iloveillustration magazine image ediditing lessons Image Ready image sequences image theft imaginative import import text import vertex color improving photos inbetween index visualizer Info Ingrid Bockting ink inktober input Inspiration inspirational quotes install instance instance switching intensive interaction Intermediate Tutorials internet interoperability interpolation intersect intersect edges intersecting intersection interview introduction invoke subprogram io ipad Irana Doucer Isabella Hemmersbach islam islamic iteration Izzie Klingels Jack Hearne Jack Tremblay James Dignan James Gurney japanese Jason Brooks Jean Kim Jeanne Detallante Jen and Chris Creed Photography jen betton Jen Rofé Jenny Mörtsell Jeremy Combot Jeslyn Kate Jesse Auersalo Jessica Jessica Lanan jessicalanan jewellery jewelry jiggle Jim Schaeffing Joe Bowler Joe Cleary Joe Isom Joe Krush Johanna Goodman john maeda John Vernon Lord joint Jordan Sondler JPEG JPG jpop juana martinez-neal juanamartinezneal Judge Judit Garcia Talavera Judith van den Hoek Judy Byron Schachner Jules Julien Julian Beever Julie Verhoeven Jump Break Tool JW Anderson K-Fai Steele Kaethe Butcher Kareem Iliya karel zeman Kate van Harreveld Kathrin Kuhn Kathryn Ault Noble Kathryn Noble Katie Kath kdtree Kei Meguro Kelly Beeman Kelly Light Kelly Smith kelly sonnack Kelly Thompson keyframe keyframing kidlit kidlitartists kimberlygee Kirkus Review Kisoo Chai Kodak Konstantin Kakanias Korean illustration Kotaro Chiba Kozue Himi Kremos Ksenia Finogeeva KT Smail kuler Kustaa Saksi Lanan Laptop larry gritz lasso tool latte lattice Laura Callaghan Laura Laine Lauren Rille layer layering Layla Holzer layout leaf learning learning blender LED Leendert meets Ingrid lego length Leonard Starr lessons levels LFW A/W 14 liangzhu liero lightbox lighting lightning Lina Bodén Lina Ekstrand Linda Dorn line line connect line drawing lines Links Linky Love Linn Olofsdotter Lionel Gilbert Lisa Anchin Lisa Billvik Lisa Krannichfeld lisaanchin lisbeth zwerger Liselotte Watkins list list comprehension List First Last listing locator lofting logo Logo Design Lola Dupré London Fashion Week loop looping loops looptools Lorraine Fox lossless lossy lost weekend lostweekend lotte reininger Louis Glanzman louis vuitton Luciana Rondolini luciograph LULU* lv Lynnie Zulu Mac macgyver macouno maeda Magda Antoniuk magic Magnus Voll Mathiassen mailing mailings maker Makiko Sugawa making banners Malika Favre MAMP mandala manga map map range maplelam mapping Marcel George Maren Esdar Margot Macé Margot van Huijkelom Maribeth Olson Marie El-Ahmar Marilyn Conover Marina Esmeraldo Marine Marbleindex mario Marlies Niemeijer Marsha Riti Martha Rago Martin Krusche Martine Johanna mask masking material materials math matrix matrix apply matryoshka Matt Baker matte medium Matthew Woodson maya maze mdd Meagan Morrison measure megaman Megan Hess Meizhen Xu Mel Crawford memory mentee mentees mentors mentorship program Mercer Mayer Meridth McKean Gimbel mesh mesh cutter meshlab Meta Tags metal gear rising Meyoko Mia Overgaard Micca mice Michael Sanderson Michela Picchi middle grade midi miku Milan milipede minidom Minima Mio Matsumoto mirror cut Misc Miss Blackbirdy miss maple's seeds Miss Take Mitchell Hooks mixamo mixing Mobile Apps mocap mod model modeling modifier modular modulation modulus mold molecule molly idle Molly Ruttan Molly Ruttan Illustration money monitors monkey mono-zero monster monster university morph morpher mosaic mosquito motion motion capture motion capture mouse motion trail moto360 mountain muji Muriel Wood Murray Tinkelman mushroom Music and Podcasts My dead pony Nadia Flower Naiad Einsel Naja Conrad-Hansen Natalie Brockett Natalie Foss nathan vegdahl nautilus Nav Bar navigation needle-felting negotiating Neil Boyle neon nescbwi14 nested New Blogger Questions New Blogger Template Tutorials new user pixlr new year new york New York Fashion week Newbery nicholas nicholas bishop Nicholas Hong Niki Pilkington Niso Ramponi nla No Software node node-based nodebox noise non linear animation Non-Web Font normal Noumeda Carbone npr number NURBS NYFW object object color change object info octopus offset Ola Volo Olaf Hayek old formats opaque projector open movie open shading language open source openshadinglanguage opensoundcontrol optical organization origami original art show Ornaments osc Oscar Schlienger osipa osl outline outliner output Pages paint paint weight painting painting on illustration board painting on wood painting with movie painting with numbers Pair pandas panorama Paper paper lantern parabola parametric parent parenting particle particle info node particles pat david Pat Zietlow Miller pattern Patterned Text Paul Faassen Paul X. Johnson Paula Sanz Caballero PC pdb pebbles pencil Pencil Sketch pencils Penguin perfume perlin Peter Helck Photo CD.8B photo editing software Photo Reference Photobucket photographing art Photographs photography photomerge photoshop Photoshop Brushes Photoshop CS3 Photoshop elements photoshop pixlr desaturaion Photoshop tips Photoshop Tutorials Picture Book Builders picture books Pierre Louis Mascia Piet Paris Pietari Posti pingpong pinnochio pipes pixar pixel pixel art pixel generator pixlr Pixlr advanced Pixlr blog pixlr desaturate keep a colorful part pixlr editting pixlr express Pixlr forum Pixlr free transform Pixlr Lesson Pixlr lessons Pixlr mobile Pixlr resizing images pixlr shortcuts Pixlr tools pixlr tutorial pixlr tutorial with pictures Pixlr Tutorials pixlr white black pixlr.com plant plot plotting ply PNG PNG Illustration podcast point point color pointilism polka dots polyCut polygon Pomme Chan pop-overs portfolio Portfolio award portfolio showcase portfolio-advice portrait position Post Dividers postcard poster Posting pot powdered graphite powerhousemuseum Prada presentation print printmaking Prize procedular procedural process processing programming projection Promotion property prototype PSD psy publishing pulse puppet puppetry pydriver pydrivers pyhandler pyhandlers pyramide python quad quick select set quick tips qumarion Rabbit Moon Rachel Ryle radians radius ramp random random motion randomization randomize range float raspi Ray Houlihan reading reading XML READY-TO-WEAR realflow Rebecca Clarke rebecca dautremer Rebecka Skog rebuild recursive recursivedrawing red eye remove reducing glare reference referencing release remesh modifier remix removal remove remove red eyes remove unwanted objects Removing backgroung render rendering renderman repeat repeater repeating replace replacement replacing color representation rerouter resample resampling research Resizing image resolutions retopology retro review revolve rgb rib Ricardo Fumanal Richard Scarry rig rigging rigify Rikke Jorgensen ring ripple roadkill Robert Heindel Robert J. Lee Robert McCloskey Robert Shore Roberta Zeta Robin Rosenthal robot robotic rocks Rodolfo Montalvo Roller Coaster rotation Rousseau rsl Rubin Pfeffer ruler tool Russ Mills russian rut S/S14 S/S15 S/S16 Sabine Pieper sadako Saftey Pins Sainte Maria Sale Sam Weber Sanda Suy Sandy Kossin santoso Sara Andreasson Sara Singh Sarah Jacoby saturation artist tools scan scanners scanning scatter scbwi SCBWI 2015 mentee SCBWI conference scbwi germany SCBWI mentorship scbwi-la scratch scratchboards screensaver screw screw modifier script scrub sculpting seamless Seamless Patterns Search Engines select by material select by name select by type SEO sequence series set keyframe set keyframes shader shading shadow Shannon Stirnweis shape grammars shape key shapekeys shapes shards shatter Sheilah Beckett shell ship shipping shipwright Shoes SHOWstudio shuffle Sid Barron Sidebar Titles Signature Silja Goetz silkworm Simon and Schuster Simon Varela simple simplicity simulation sine Site Engine Optimization Sjoukje Bierma sketch Sketches sketching skin skin modifier skinning slice slicing slides sloth slow parent smoke smoothstep SN snake Sneek Peek snippet Snow Snow White Snowflakes soccerball social media Social Media Buttons Social Networking society of illustrators Society6 soft body softbody Sonia Menti sound sound wave space spaceship sparta special spider spiderman spiderweb spin spiral Spiros Halaris Spiros Halaris x Urban Decay spline Spot Healing Tool spreadsheet SS16 stack stacking stair stamp Stan Galli star starfish stencyl step Steven G. Dobson still Stina Persson stone stones storytelling strand strand info strands street art string stripes structure studies studio style stylistic summary Summary Posts Summer sun supplies surface Susan Farrington suzanne Suzanne Kaufman sverchok swatch switch sydney system table table of contents take out background Tal Drori tangent tangled Taschen teaching teapot Template Templates tentacle Tess Jacobson Tex Avery text text editor Text Formats Text Styles in Pixlr texture texturing The Cartorialist The Grudge Keeper The Purple Book thinker1 Thomas B. Sawyer thread TIFF tile tilecam tiling time time code Tina Berning Tina Kugler tips tips for artists Toby Neilan Tom Baxter Tom Bjarnason tombow tomie depaola tool tools topology tower Tracy Turnbull Train transfer drawing transferring sketch transform transformation transit travel triangle wave Tricia Springstubb trigger tris tristan lock tube tubes Tutorials twitter type tool typeface typography unbake unity3d universal unquad utah uv valentine Valentino Valerie Servais vanilla variable variation variety vase vector vectorized Velwyn Yossy venus Veronica Ballart Lilja vertex vertex color vertex group vertex paint vertex weight VFX Victoria Boysen video Videos viewer Vintage virtual virtual studio visualization vivid vividfestival VOGUE volumetric voronoi Vote voxel voxelated voxelation walking teapot Walter Einsel wand tool water soluble graphite watercolor wav wave we need diverse books web webbing Week Themes weight welcome Wendy magazine Wendy Plovmand what casues red eyes What is Pixlr Wherever You Go Wide Awake Bear wiggle Will Davies Winner Winnie Fitch Winnie Truong Winter wire wired wireframe wolfram Woman wood woodwork wool wooly wordpress work workflow World writing writing XML www.pixlr.com XML YA yayoi kusama Yelena Bryksenkova yoda Yoko Furusho Yuliya zaha hadid zen zsphere

Hexagon Tiles basic is not so basic.

Nothing quite original in this post, I am just trying to make sense of this Hexagon Tile Shader which originally was written by Larry Gritz.
http://www.renderman.org/RMR/Shaders/LGShaders/

Which then I found out at Blender Forum, already translated by Charlie:
http://blenderartists.org/forum/showthread.php?270332-OSL-Goodness&p=2253925&viewfull=1#post2253925

The original RSL for Hexagon Tile has extra additional layer of texture that is not really related to the hexagon tiling (stain and scuff). So, I stripped those out.



I made a slight modification and I am commenting out some more of the code, so that the shader goes back to the very basic.

OSL HEXAGON TILE



CODE: (with all the commented out codes)
/*
SHADER HISTORY 20140205

1. 
Originally written by Larry Gritz
http://www.renderman.org/RMR/Shaders/LGShaders/

2. 
Modified by Charlie as posted here:
http://blenderartists.org/forum/showthread.php?270332-OSL-Goodness/page9

3. 
Jimmy Gunawan of Blender Sushi (me) decided to study this shader...
Stripped out to the basic of the procedural texture only. Without Closure.

*/

//////////

/*
 * {converted/hacked to OSL from http://www.renderman.org/RMR/Shaders/LGShaders/LGHexTile.sl}
 * hextile.sl -- surface shader for hexagonal tiles in st space
 *
 * DESCRIPTION
 *       This surface shader operates in s-t space and gives a pattern of
 *    hexagonal tiles, similar to that found as floor patterns in public
 *    places and such.
 *       The basic pattern is a hexagona
 l tiling, with a little bit of
 *    color variation from tile to tile.  On top of that is some staining
 *    (presumably due to water or something), which darkens the tile or
 *    mortar underneath it.  Finally, there is scuffing due to people's
 *    shoes, which really only affects the tile part not the mortar part.
 *
 *
 * PARAMTERS
 *    Ka, Kd, Ks, roughness, specularcolor - work just like plastic
 *    tilecolor - the color of the tiles
 *    mortarcolor - the color of the mortar (space between the tiles)
 *    tileradius - the "radius" (in s-t units) of a single tile
 *    mortarwidth - the width of the mortar (in s-t units)
 *    tilevary - the color variance from tile to tile
 *
 * ANTIALIASING
 *    Some rudimentary antialiasing is performed on the borders between
 *    tile and mortar.
 *
 * HINTS & APPLICATIONS
 *    If all of the default parameters are used, the tiles look just like
 *    the floors in the public areas of the Washington DC subway system.
 *
 * AUTHOR: written by Larry Gritz, 1994
 *
 * HISTORY:
 *    15 Feb 1994 -- written by lg
 *
 * last modified 15 Feb 94 by Larry Gritz
 */

shader
LGHexTile (
    point Pos = P,
    //float Ka = .5,
    float Kd = .5,
    //float Ks = .2,
    //float roughness = .1,
    //color specularcolor = 1,
    color tilecolor = color(.55,0,0),
    color mortarcolor = color(.5,.5,.5),
    float tileradius = 0.2,
    float mortarwidth = 0.02,
    float tilevary = 0.15,
    float stretchH = 1.0,
    float stretchV = 1.0,
    //float scuffing = 0.5,
    //float stains = 0.4,
    //float stainfrequency = 2,
    //float scufffrequency = 4,
    //color scuffcolor = color (.05,.05,.05),
    //output closure color Closure = diffuse(N),
    int Seed = 41,
    output color Col = color(1,0,0)
)
{
    #define snoise(x) (2*noise(x)-1)
    #define snoise2(x,y) (2*noise((x),(y))-1)
    #define MINFILTERWIDTH 1.0e-7
    #define M_SQRT3 1.7320508 /* sqrt(3) */
    
    point Nf;
    color Ct, Ctile;
    float tilewidth;
    float ss, tt;
    float ttile, stile;
    float x, y;
    float mortar;
    float swidth, twidth, sfuzz, tfuzz, fuzzmax;
    float mw2, mw2srt3;
    float tileindex;
    float stain, scuff;
    float ks;

    float s = Pos[0] * stretchH;
    float t = Pos[1] * stretchV;

    swidth = abs(Dx(s)) + abs(Dy(s));
    twidth = abs(Dx(t)) + abs(Dy(t));
    sfuzz = .5 * swidth; // blurred lines
    tfuzz = .5 * twidth; // blurred lines
    fuzzmax = max(sfuzz, tfuzz);
    //Nf = N;

    tilewidth = tileradius * M_SQRT3;  
    tt = mod (t, 1.5*tileradius);
    
    ttile = floor(t/(1.5*tileradius));
    if (mod(ttile/2, 1) == 0.5)
       ss = s + tilewidth/2;
    else ss = s;
    
    stile = floor(ss / tilewidth);
    
    ss = mod(ss, tilewidth);
    mortar = 0;
    mw2 = mortarwidth/2;
    
    if (tt < tileradius) 
    {
      mortar =  1 - (smoothstep(mw2,mw2+sfuzz,ss) *
             (1 - smoothstep(tilewidth-mw2-sfuzz,tilewidth-mw2,ss)));
    }
    else 
    {
      x = tilewidth/2 - abs(ss - tilewidth/2);
      y = M_SQRT3 * (tt - tileradius);
      if (y > x) 
      {
      if (mod (ttile/2, 1) == 0.5)
          stile -= 1;
      ttile += 1;
      if (ss > tilewidth/2)
          stile += 1;
      }
      mw2srt3 = M_SQRT3*mw2;
      mortar = (smoothstep(x-mw2srt3-tfuzz, x-mw2srt3, y) *
            (1 - smoothstep(x+mw2srt3, x+mw2srt3+tfuzz, y)));
    }

    tileindex = stile + Seed * ttile;
    Ctile = tilecolor * (1 + tilevary * snoise(tileindex+0.5));

    //stain = stains * smoothstep (.5,1, noise(s*stainfrequency,t*stainfrequency));
    //scuff = scuffing * smoothstep (.6,1, noise(t*scufffrequency-90.26,s*scufffrequency+123.82));

    //ks = Ks * (1-scuff/2);
    //Ct = (1-stain) * mix(mix(Ctile, scuffcolor, scuff), mortarcolor, mortar);
    
    Ct = mix(Ctile, mortarcolor, mortar);

    //Nf = normalize(N); //no faceforward function
    //Closure = Ct*Kd*diffuse(Nf); //no aambient function
    //Closure += specularcolor*ks*microfacet_beckmann(Nf,roughness); 
    
    Col = Ct * Kd;
}

CODE: (cleaned up, but I need to ensure I leave credit and source information)
/*
SHADER HISTORY 20140205

1. 
Originally written by Larry Gritz
http://www.renderman.org/RMR/Shaders/LGShaders/

2. 
Modified by Charlie as posted here:
http://blenderartists.org/forum/showthread.php?270332-OSL-Goodness/page9

3. 
Jimmy Gunawan of Blender Sushi decided to study this shader...
Stripped out to the basic of the procedural texture only. Without Closure.

*/

//////////

/*
 * {converted/hacked to OSL from http://www.renderman.org/RMR/Shaders/LGShaders/LGHexTile.sl}
 * hextile.sl -- surface shader for hexagonal tiles in st space
 *
 * DESCRIPTION
 *       This surface shader operates in s-t space and gives a pattern of
 *    hexagonal tiles, similar to that found as floor patterns in public
 *    places and such.
 *       The basic pattern is a hexagona
 l tiling, with a little bit of
 *    color variation from tile to tile.  On top of that is some staining
 *    (presumably due to water or something), which darkens the tile or
 *    mortar underneath it.  Finally, there is scuffing due to people's
 *    shoes, which really only affects the tile part not the mortar part.
 *
 *
 * PARAMTERS
 *    Ka, Kd, Ks, roughness, specularcolor - work just like plastic
 *    tilecolor - the color of the tiles
 *    mortarcolor - the color of the mortar (space between the tiles)
 *    tileradius - the "radius" (in s-t units) of a single tile
 *    mortarwidth - the width of the mortar (in s-t units)
 *    tilevary - the color variance from tile to tile
 *
 * ANTIALIASING
 *    Some rudimentary antialiasing is performed on the borders between
 *    tile and mortar.
 *
 * HINTS & APPLICATIONS
 *    If all of the default parameters are used, the tiles look just like
 *    the floors in the public areas of the Washington DC subway system.
 *
 * AUTHOR: written by Larry Gritz, 1994
 *
 * HISTORY:
 *    15 Feb 1994 -- written by lg
 *
 * last modified 15 Feb 94 by Larry Gritz
 */

shader
LGHexTile (
    point Pos = P,
    float Kd = .5,
    color tilecolor = color(.55,0,0),
    color mortarcolor = color(.5,.5,.5),
    float tileradius = 0.2,
    float mortarwidth = 0.02,
    float tilevary = 0.15,
    float stretchH = 1.0,
    float stretchV = 1.0,
    int Seed = 41,
    output color Col = color(1,0,0)
)
{
    #define snoise(x) (2*noise(x)-1)
    #define snoise2(x,y) (2*noise((x),(y))-1)
    #define MINFILTERWIDTH 1.0e-7
    #define M_SQRT3 1.7320508 /* sqrt(3) */
    
    point Nf;
    color Ct, Ctile;
    float tilewidth;
    float ss, tt;
    float ttile, stile;
    float x, y;
    float mortar;
    float swidth, twidth, sfuzz, tfuzz, fuzzmax;
    float mw2, mw2srt3;
    float tileindex;
    float stain, scuff;
    float ks;

    float s = Pos[0] * stretchH;
    float t = Pos[1] * stretchV;

    swidth = abs(Dx(s)) + abs(Dy(s));
    twidth = abs(Dx(t)) + abs(Dy(t));
    sfuzz = .5 * swidth; // blurred lines
    tfuzz = .5 * twidth; // blurred lines
    fuzzmax = max(sfuzz, tfuzz);

    tilewidth = tileradius * M_SQRT3;  
    tt = mod (t, 1.5*tileradius);
    
    ttile = floor(t/(1.5*tileradius));
    if (mod(ttile/2, 1) == 0.5)
       ss = s + tilewidth/2;
    else ss = s;
    
    stile = floor(ss / tilewidth);
    
    ss = mod(ss, tilewidth);
    mortar = 0;
    mw2 = mortarwidth/2;
    
    if (tt < tileradius) 
    {
      mortar =  1 - (smoothstep(mw2,mw2+sfuzz,ss) *
             (1 - smoothstep(tilewidth-mw2-sfuzz,tilewidth-mw2,ss)));
    }
    else 
    {
      x = tilewidth/2 - abs(ss - tilewidth/2);
      y = M_SQRT3 * (tt - tileradius);
      if (y > x) 
      {
      if (mod (ttile/2, 1) == 0.5)
          stile -= 1;
      ttile += 1;
      if (ss > tilewidth/2)
          stile += 1;
      }
      mw2srt3 = M_SQRT3*mw2;
      mortar = (smoothstep(x-mw2srt3-tfuzz, x-mw2srt3, y) *
            (1 - smoothstep(x+mw2srt3, x+mw2srt3+tfuzz, y)));
    }

    tileindex = stile + Seed * ttile;
    Ctile = tilecolor * (1 + tilevary * snoise(tileindex+0.5));

    
    Ct = mix(Ctile, mortarcolor, mortar);
    
    // FINALLY...
    Col = Ct * Kd;
}

This Shader Writing business always seems really complicated when the code is revealed like above.

Actually if you take time to write the code line by line and try to see the result, it will be a bit easier to understand. Lots of cryptic Math formula in Shader writing, processing all kind of INPUT values.
  • mix()
  • max()
  • smoothstep()
  • abs()
  • etc...
For most basic shaders, we usually only use global variable P, which assigned to our own custom variable Pos. Of course there are many other Global Variables and values we can use.

INPUT
P (position of point of surface)

The output, we usually only care how it looks like.

OUTPUT
Col (our own custom variable)

What happened in between the INPUT P and OUTPUT Col is a lot of Math and computer graphics magics. Would be wise is to be able to observe step by step and see the resulting "color/image" texture line by line, simply by assigning it to the Col (our output).

The Math part is "hard", especially for non-Math person. Hard because of multifolds of problems.
A really good Math teacher can explain it well, but not always visually well.

TRY:
Go and YouTube search "Shader LIVE Coding" and see how the brain of good shader writers is working. I think they are not normal, they are amazing.

It is a rare to find someone with both VISUAL and MATH minded. Anyway, visualizing each step is a good start.

Not all values can be visualized as texture, some of them is just values, you can actually printing out the values. Read this:

SEEING CODE EVOLVES

CODE: (if we want to see how the texture evolving.... do not copy paste the code below)

shader
LGHexTile (
    point Pos = P,
    float Kd = .5,
    color tilecolor = color(.55,0,0),
    color mortarcolor = color(.5,.5,.5),
    float tileradius = 0.2,
    float mortarwidth = 0.02,
    float tilevary = 0.15,
    float stretchH = 1.0,
    float stretchV = 1.0,
    int Seed = 41,
    output color Col = color(1,0,0)
)
{
    #define snoise(x) (2*noise(x)-1)
    #define snoise2(x,y) (2*noise((x),(y))-1)
    #define MINFILTERWIDTH 1.0e-7
    #define M_SQRT3 1.7320508 /* sqrt(3) */
    
    point Nf;
    color Ct, Ctile;
    float tilewidth;
    float ss, tt;
    float ttile, stile;
    float x, y;
    float mortar;
    float swidth, twidth, sfuzz, tfuzz, fuzzmax;
    float mw2, mw2srt3;
    float tileindex;
    float stain, scuff;
    float ks;

    float s = Pos[0] * stretchH;
    float t = Pos[1] * stretchV;

    swidth = abs(Dx(s)) + abs(Dy(s));
    twidth = abs(Dx(t)) + abs(Dy(t));
    
    //Col = s;



    //Col = t;



    
    sfuzz = .5 * swidth; // blurred lines
    tfuzz = .5 * twidth; // blurred lines
    fuzzmax = max(sfuzz, tfuzz);
   
    
    tilewidth = tileradius * M_SQRT3;
    tt = mod (t, 1.5*tileradius);    
    //Col = tt;
Modulus function will repeat.

    
    ttile = floor(t/(1.5*tileradius));
    //Col = ttile;



    
    if (mod(ttile/2, 1) == 0.5)
       ss = s + tilewidth/2;
    else ss = s;
    
    //Col = ss;



    
    stile = floor(ss / tilewidth);
    //Col = stile;



    
    ss = mod(ss, tilewidth);
    mortar = 0;
    mw2 = mortarwidth/2;
    
    //Col = ss;


This is actually interesting, we get the STAGGER effect like BRICK TEXTURE.

    
    if (tt < tileradius) 
    {
    //Col = mortar;



      mortar =  1 - (smoothstep(mw2,mw2+sfuzz,ss) *
             (1 - smoothstep(tilewidth-mw2-sfuzz,tilewidth-mw2,ss)));

    //Col = mortar;

    }
    else 
    {
      x = tilewidth/2 - abs(ss - tilewidth/2);
      y = M_SQRT3 * (tt - tileradius);
      if (y > x) 
      {
      if (mod (ttile/2, 1) == 0.5)
          stile -= 1;
      ttile += 1;
      if (ss > tilewidth/2)
          stile += 1;
      }
      mw2srt3 = M_SQRT3*mw2;


      
      mortar = (smoothstep(x-mw2srt3-tfuzz, x-mw2srt3, y) *
            (1 - smoothstep(x+mw2srt3, x+mw2srt3+tfuzz, y)));
    }

    tileindex = stile + Seed * ttile;
    
    //Col = tileindex;


There is a bit of Math magic happening here that turns "brick" into hexagons.

    
    Ctile = tilecolor * (1 + tilevary * snoise(tileindex+0.5));

    //Col = mortar;



    
    Ct = mix(Ctile, mortarcolor, mortar);
    
    //Col = Ct * Kd;



}

MEANWHILE IN HOUDINI ...

In Houdini, there is a node called HEXTILE to generate hexagonal tile.



Blender can easily have this hexagonal tile texture as a built-in node as well like the nice Brick Texture node, but what would be nice for us is to understand how this texture tiling was created in the first place.

I tried digging down into the code in Houdini, but the code is hidden inside the #INCLUDE. I have to investigate this further... I am using Mac here and lots of files is inside package, I must check again on the Windows version.

Ok, basically Houdini's VEX Shader Programming Language is more similar to Renderman RSL. OSL is probably "simpler" and I think the nicest part of OSL is being easy to compile in Blender Cycles.

Anyway, if you are like me, always challenged to understand "complexity" and love "procedurality", use all the available tools. Houdini can be your best tool beside Blender.

You see below the difference between Shader Writing VS Node.




OpenGL Programming and such and such...

I am also looking into Shader Writing in Unity, which uses CG language where we need to think about Vertex Shader and Fragment (Pixel) Shader, which of course relates to OpenGL programming.

There is this nice intro video talking about OpenGL Shader Programming from SIGGRAPH 2013:
http://www.youtube.com/watch?v=T8gjVbn8VBk

Shader Writing is certainly something that one needs to study over a very long period of time. It is very abstract like Fractal.

It is unlike Game Programming or other kind of programming, it is simply bizarre. Looking at what people creates using codes is just mind-boggling:
https://www.shadertoy.com

I am still reading this invaluable book by Michel Anders, there is a really well written foundation on shader writing there.

REFERENCES AND INSPIRATIONS

I took a little walk around city of Bandung (West Java, Indonesia) and took some photos. This city that is an ex-Dutch colonization still shows the architecture from the past.








Anyway, writing shader is always a nice brain exercise, now back to Sverchok stuff :)

TILECAM ADD-ON

I stumbled into this cool Add-On for Blender called "Tilecam". Basically it sets your Blender camera to certain Ortographic view and with certain resolution so that when rendered you will end up with a seamless 2D tile-able pattern image.

This "Tilecam" add-on is potentially great for graphic design works.

Original link:

Video tutorial for "Tilecam"

User Guide for "Tilecam".

I tested the add on, it is quite straight forward. Basically you just need to arrange your 3D objects into grid and you just activate Blender "grid" snapping. We know that Blender "grid snap" is not really snapping to grid, it snaps to certain distance.

I tested it out with Blender Sushi "snail logo". This is a quick job when the logo is arranged in square grid pattern.


Resulting TILE.

If you feel challenged, maybe you can do further like adding randomization to your object.

This one below is when it is arranged in honeycomb grid pattern (I use Blender Particle and Instance here)


Resulting TILE.

BLAM ADD-ON


COINCIDENTALLY, the "Tilecam" add-on is from the same genius brain (Mr. Per Gantelius) that brings you Blender BLAM add-on.

At a quick glance, this is an add-on that aid you in matching 3D object into an image in perspective, for camera projection mapping setup.

https://github.com/stuffmatic/blam
https://vimeo.com/35421849
https://vimeo.com/35153437

I was originally was studying and researching about Camera Mapping, when I accidentally looked at BLAM. I remembered it was released some times ago. Not until today, I have a bit of time to look at BLAM closely.

BLAM and Blender Camera Projection Mapping is kind of closely related topic.

You might want to look at Blender Guru's Camera Mapping video tutorial. It is kind of one of the best video tutorial explaining Camera Mapping using Blender.
http://www.blenderguru.com/videos/camera-mapping/

Actually, it needs a bit of trial and error to understand this. You may be able to use BLAM to automatically setup the camera projection mapping. I still have to study it until I can summarize and simplify the steps.

Anyways, those are 2 add-ons you want to keep for future usages.

MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget