Halloween Costume ideas 2015
Articles by "grid"
@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

Decided to have a look at another RSL code and convert it to OSL. This time, it is the infamous POLKA DOTS style!

Shall we dance, Renderman Teapot?

Porting RSL Disk to OSL Disk

Yayoi Kusama's style of dots...

/*
SOURCE:
http://nccastaff.bournemouth.ac.uk/jmacey/Renderman/slides/RendermanShaders1.pdf

Ported by Jimmy Gunawan @ Blender Sushi 2013

*/

shader Disk(
    point center = point (0.5, 0.5, 0.0),
    float fuzz = 0.025,
    float Radius = 0.5,
    float RepeatS = 5,
    float RepeatT = 5,
    color ColorA = color(1,0,0),
    color ColorB = color(0,1,0),
    point Vector = P,
    output color Col_Out = color(0.2)
)

{
    float x = Vector[0];
    float y = Vector[1];
    
    float s = x;
    float t = y;

    float ss = mod(s*RepeatS, 1);
    float tt = mod(t*RepeatT, 1);
    
    point here = point (ss, tt, 0);
    float dist = distance(center, here);
    float inDisk = 1 - smoothstep(Radius/2.0 - fuzz, Radius/2.0+fuzz, dist);
    
    Col_Out = mix(ColorA, ColorB, inDisk);

}

This simple Texture has some neat adjustable attributes such as "fuzz" aka "Blurriness":

Blurriness seems to be the effect of function smoothstep().

This disk shader also repeats in grid fashion and stretch the Disks based on the Surface span:


This procedural 2D texture is applicable to 3D objects, but it stretches as expected:

SNIPPET: Sharp Banding vs Fuzzy Blurry Smooth Blend

I studied the PDF documentation from Jon Macey on RSL and found useful information regarding smoothstep() that I think needed to be translated to OSL. I believe this is covered in previous posts, but not as straightforward. We can basically create blending that is either SHARP or SMOOTH.

SHARP BLEND

shader bands(
    color C1 = color(1,0,0),
    color C2 = color(0,1,0),
    float begin = 0.3,
    float end = 0.6,
    float Orient = 0,
    output color Col_Out = color(0.2)

)

{
    float s = P[0];
    float t = P[1];
    color Ct;
    float inTop;
    if(Orient==0)
        inTop = smoothstep(begin, end, s);
    else
        inTop = smoothstep(begin, end, t);
        
    Ct = mix(C1, C2, inTop);    
    
    Col_Out = Ct;
}


That is a FLIP-FLOP effect, basically. If TRUE, color the pixel with Color A, if FALSE, color the pixel with Color B. Hence the SHARP EDGE with no blending.

SMOOTH BLEND
shader bands(
    color C1 = color(1,0,0),
    color C2 = color(0,1,0),
    float begin = 0.3,
    float end = 0.6,
    float Orient = 0,
    output color Col_Out = color(0.2)

)

{
    float s = P[0];
    float t = P[1];
    color Ct;
    float inTop;
    if(Orient==0)
        inTop = smoothstep(begin, end, s);
    else
        inTop = smoothstep(begin, end, t);
        
    Ct = mix(C1, C2, inTop);    
    
    Col_Out = Ct;
}


In many of the OSL codes previously written, you may noticed that SMOOTH BLEND is also given for free by using sin()or cos() wave functions. And to make it sharp blend, we use step(), floor(), ceil(), round() functions. So in sine or cosine style, we go from smooth to sharp, which is the opposite of above.

Apart from giving SMOOTH BLEND for free, sin()or cos()are also introducing REPETITION. REPETITION itself is more closely related to mod()function.

Two colors that are placed really close (blend "begin" and "end" values) will introduce SHARP BLEND also.

Don't you think the usage of Math Functions in low level Computer Graphic (in context of OSL Shader Writing) are both weird and fun? And that is just the basic.

LAYERING TEXTURES USING NODES

We can piggy back this OSL texture using Cycles nodes, non procedural way of layering.

This resembles pattern of certain brand of EXPENSIVE LUXURY bags.



Would be nice to be able to Offset the texture like this in X and Y, so I decided to play around with the code a bit. This is the fun part.

OFFSET TEST 1

shader Disk(
    point center = point (0.5, 0.5, 0.0),
    float fuzz = 0.025,
    float Radius = 0.5,
    float RepeatS = 5,
    float RepeatT = 5,
    color ColorA = color(1,0,0),
    color ColorB = color(0,1,0),
    point Vector = P,
    output color Col_Out = color(0.2)
)

{
    float x = Vector[0];
    float y = Vector[1];
    
    float s = x;
    float t = y;

    float ss = mod(s*RepeatS, 1);
    float tt = mod(t*RepeatT, 1);
    
    point here = point (ss+0.5, tt, 0);
    float dist = distance(center, here);
    float inDisk = 1 - smoothstep(Radius/2.0 - fuzz, Radius/2.0+fuzz, dist);
    
    Col_Out = mix(ColorA, ColorB, inDisk);

}

Wrong adjustment, but interesting. Almost fish/snake like but no stagger or overlap.

OFFSET TEST 2

This is more correct in term of Offsetting the texture in X or/and Y.

shader Disk(
    point center = point (0.5, 0.5, 0.0),
    float fuzz = 0.025,
    float Radius = 0.5,
    float RepeatS = 5,
    float RepeatT = 5,
    color ColorA = color(1,0,0),
    color ColorB = color(0,1,0),
    float OffsetX = 0.0,
    float OffsetY = 0.0,
    point Vector = P,
    output color Col_Out = color(0.2)
)

{
    float x = Vector[0];
    float y = Vector[1];
    
    float s = x;
    float t = y;

    float ss = mod(s*RepeatS + OffsetX, 1);
    float tt = mod(t*RepeatT + OffsetY, 1);
    
    point here = point (ss, tt, 0);
    float dist = distance(center, here);
    float inDisk = 1 - smoothstep(Radius/2.0 - fuzz, Radius/2.0+fuzz, dist);
    
    Col_Out = mix(ColorA, ColorB, inDisk);

}
Fake 3D-ish effect, only look right from this angle.
If we keep layering the dots, we can get some interesting effects, feel free to do that yourself.


Remember we can always do something simple like overlaying this OSL Disk Grid on top of an image. I always name the variables Color A and Color B, but Color A can simple be the Base Color.


If we use OSL Disk as Factor for Mix Shader Transparency...





ADD NOISE NODE

Sometimes out of curiosity, I plug the Noise Cycle node or other noise to the OSL node. We can easily get weird alien texture like below:



Or maybe plug it like this?



Do you see the purple rabbit?
The interesting thing here is that by mixing Noise into Vector, we get 3D vector wrapping for free... I think.


MORE MAGICS OF DISKS


I am quite surprised that Grid of Circles are apparently quite magical....




Probably we can push Circles a bit so that it creates some kind of basic Islamic Geometry Patterns.



Not sure when texture become a bit too much, this is Magical + Voronoi + OSL Disk:




ANY QUESTIONS?

Moreover, some questions already appear:

Picture property of PMOXY, one of screen app for iPad.
  • Can we actually use some functions here to create simple GRID TILE function that we can use to repeats some of the Texture Pattern we made?
  • How do we translate 2D Texture like DISK/POLKA DOTS above into 3D Textures?
  • Can we make textures that is more psychedelic? Like above.
  • I want OUTLINE on the Disks, how?
  • Instead of GRID, can we STAGGER the pattern?

SPIRAL... how to create SPIRAL?

I asked my old friend, Nitz Saputra, he said:

"I tried using MATLAB to plot something."

For 2D spiral:
a = 0: 3*pi/100 : 6*pi;  %Vector
x = a.*cos(a);
y = a.*sin(a);
plot(x,y)
 
For 3D spiral:
a = 0: 3*pi/100 : 6*pi; %vector
x = cos(a);
y = sin(a);
z = a;
plot3(x,y,z)

Maybe it is possible to have function like that in OSL... I am not 100% sure the different. There are many kind of SPIRAL as well.

OSL: Better Line

Still from Jon Macey's codes, I ported some of the RSL into OSL.

I need to add this here, this is probably a better function for LINE.

/*
    SOURCE: http://nccastaff.bournemouth.ac.uk/jmacey/Renderman/ 
*/

shader Lines (
    color LineColor = color(1,0,0),
    color MixColor = color(1,1,1),
    float fuzz = 0.025,
    float LineSize = 0.1,
    float Orient = 0,
    float offset = 0.5,
    output color Col_Out = color(0.2)
)

{
    color Ct;
    float s = P[0];
    float t = P[1];
    
    // we care about texturing only
    float inTop;
    float dist;
    
    if(Orient==0)
        dist = abs(t-offset);
    else
        dist = abs(s-offset);
    
    float inLine;
    
    inTop = 1 - smoothstep(LineSize/2.0 - fuzz, LineSize/2.0+fuzz, dist);
    
    Ct = mix(MixColor, LineColor, inTop);
    Col_Out = Ct;
    
}

OSL: User Custom Lines

Line between 2 Points. Interesting, but I do not quite got this one. I changed ptlined() function from RSL to distance(pointA, pointB, pointC) of OSL. Not sure if this is right.

shader UserLines(
    color LineColor = color(1,0,0),
    float LineSize = 0.01,
    point P1 = point (0.1,0.7,0),
    point P2 = point (0.7,0.7,0),
    float fuzz = 0.025,
    output color Col_Out = color(0.2)
)


{
    color Ct;
    float s = P[0];
    float t = P[1];
    point Here = point(s,t,0);
    float dist = distance(P1, P2, Here);
    float inLine = 1-smoothstep(LineSize/2.0 - fuzz, LineSize/2.0 +fuzz, dist);
    Ct = mix(Ct, LineColor, inLine);
    
    Col_Out = Ct;

}



REFERENCES


http://accad.osu.edu/~smay/RManNotes/RegularPatterns/txtr_coords.html
http://renderman.pixar.com/resources/current/rps/rslFunctions.html
http://openshadinglanguage.googlecode.com/svn-history/r901/trunk/src/doc/languagespec.tex

During my course of research and exploration of Python and Blender Python (BPY), I heard a strange term coined few times: LIST COMPREHENSION. This term was heard by me the first time via Taisuke Tanimura. He said, this is what makes Python pretty "awesome".

Well, thanks to him, I actually started using it too.

LIST COMPREHENSION
List Comprehension is something crazy (I reckon) that you can do in Python. A little bit like inception, where you can put Loop and Expression and Iteration, within another Loop and Expression, and so on, where the end result is just a LIST that you need.

We can take analogy of a Basket Full of Fruits:
1. We want to filter the basket and get type of Apple, Banana, and Oranges.
2. Continue to filter those fruits are already ripe and certain size (big).
3. Then we take those fruits and separate them into 3 different basket, for each type.

Basically the List Comprehension is the shortening of FOR, IF, etc LOOPS into a single [LONG SENTENCES or STATEMENT] that will form a usable LIST for further processing. The List itself is still LIVE, meaning it will always process what happens previously.

As long, we don't go too crazy with List Comprehension, the code will be still readable and the compactness of the code might be preferable.

I mentioned how LISTING OBJECTS in 3D is the first important step to do something useful. I will write further about it.

Just follow along, hopefully you will get some kind of understanding of it by the end. We will go deeper and deeper by the end of this writing.

BLENDER PYTHON (BPY) AND PYTHON PROGRAMMING LANGUAGE
I am still relatively new to Python and Blender Python.

The way I can understand those two together (excuse me if I am wrong):
"Blender Python (BPY) is a collection of Library and Dictionary of Components and Operations, etc, that can be used and put together to create YOUR own functions and tools, using Python language."
Currently, I won't be touching Blender Game Python Programming yet, because it is another whole different world. I still have a list of beginner Python books to read to understand the language a little better. But I don't want to just learn the Python language, I want to apply it inside Blender or other 3D programs.

I am sometimes having this question: "Am I really learning Python programming concept or Blender Python?". I guess the answer is both.

For non-programmer background like me, to start to understand programming and Python language, it is a lot fun to do it inside Blender.

For me, the really cool thing both with Blender & Python Combo of learning is that ANYONE can just go to a Public Library, use the available computer that has decent Internet, download Blender ZIP then right away I can do both 3D Programming in Blender and do some 3D things.

I actually encourage such way of thinking.

Enough babbling, let's power up Blender and do some Python.

LIST AND SELECT CERTAIN TYPE *
I created 6 boring primitive objects:


In previous post, most of my Python script doodles work by expecting user to select some objects. We cannot always do this.

Often we want the script to just select objects via script as further specified by user, it could be:

  • Select By Name or List of Names
  • Select By Type
  • Select By Other Criteria
I will select those 6 objects in 3D scene and do below:

# Create Variable named selected objects and add bpy.context.selected_objects into it

import bpy

selected_objects = bpy.context.selected_objects
print(selected_objects)


Fine, nothing new, right?

Now, I actually just want Blender to spit out the NAME of every object I selected, not list starting with bpy.data.objects.

LIST THE NAMES OF SELECTED OBJECTS*

https://gist.github.com/enzyme69/5229868

# NORMAL STYLE
import bpy

selected_objects = bpy.context.selected_objects
obNameList = []

for item in selected_objects:
    obNameList.append(item.name) #append each name into list

print(obNameList)

# LIST COMPREHENSION STYLE
print([item.name for item in selected_objects])


# RESULT
# ['Icosphere', 'Cylinder', 'Cone', 'Torus', 'Suzanne', 'Cube']



I will now deselect everything in the scene using Python:

bpy.ops.object.select_all(action='DESELECT')


Alright, now that I have just the name of objects in the scene, I want to be able to select them using their names. How would we do that?

SELECT BY NAME*

import bpy

obNameList = ['Icosphere', 'Cylinder', 'Cone', 'Torus', 'Suzanne', 'Cube']

objects = bpy.data.objects

for name in obNameList:
    objects[name].select = True

That script above select each of 6 boring primitive objects by their names. Fantastic. We can also specify few names to be selected and it will work.

From what we know in Blender and in 3D packages in general, we usually have "selected objects" and a single "active object". Active object is usually the last object being selected and highlighted by yellow color, while the rest will be orange color.

While we did give a bunch list of objects for Blender to select, we do not always get the correct "active object". How do we do that?



SPECIFY "AN ACTIVE OBJECT" FOR SELECTED OBJECTS*

import bpy

obNameList = ['Icosphere', 'Cylinder', 'Cone', 'Torus', 'Suzanne', 'Cube']

objects = bpy.data.objects

for name in obNameList:
    objects[name].select = True
    
myActive = 'Suzanne'

bpy.context.scene.objects.active = bpy.data.objects[myActive]




UPDATE 2013.03.29
I don't know if the Blender Python Built-In  function below is still exist or not, but just now I checked it, the function is not there. Maybe we can just use Select By Pattern (see down below).
bpy.ops.object.select_name

Read:
http://blenderartists.org/forum/showthread.php?187565-bpy-ops-object-select_name-doesn-t-work


SPECIAL: QUICK SELECT INPUT AND OUTPUT

I read a little bit about Python File Open and File Write. We basically can easily tell Python to output whatever we can print as readable TXT file.

Let say we have some objects in the scene and we like to save it out as "Quick Select Set" for Blender. We can have script like below that can Save Out the Name of Selected Objects as a file.




Selected Objects --> Write Data Out


# NORMAL STYLE
import bpy

selected_objects = bpy.context.selected_objects
obNameList = []

for item in selected_objects:
    obNameList.append(item.name) #append each name into list


### WRITING FILE ###

outfile = open('selectMe.txt', 'w')

outfile.write("\n".join(obNameList))

outfile.close



On the other hand, we can now reuse the script so that we can select Object by Name specified from file outside Blender.

Open Data In --> Select Objects

### READING FILE ###

infile = open('selectMe.txt', 'r')

listAll = infile.read()

infile.close()

# Split lines back into normal flat List
mySelectList = listAll.split()


### BLENDER SELECT FROM LIST ###

import bpy

# Deselect any selected objects first

bpy.ops.object.select_all(action='DESELECT')

obNameList = mySelectList

objects = bpy.data.objects

for name in obNameList:
    objects[name].select = True


My scripts above are pretty rough, but I guess I will refine it further in the future. For now, you can quickly save out LIST of Selected Objects and import back the list and tell Blender to do quick select.




SELECT BY SPECIFIC LIST OF NAMES, USING A CUSTOM FUNCTION*
Ok, we now should know how to select object by names, but there seems to be a lot of work, don't you think? We cannot expect user to write all above every time they wanted to select objects.

We need to simplify the script above and turn it into FUNCTION.

Python function is defined like this:

def (argument):
    {do something with argument provided}
    return {output}

With that knowledge, we can simply create a Python function for "selecting objects by name" so that users can simply run the function whenever they want to select object or objects.

An example for such function is below:

import bpy

def select(objects, replace = True, active=''):
    '''
    Blender select objects by name ala Maya
    '''

    if isinstance(objects, str):
       # convert a string to list
       objects=list([objects])

    else:
       print('It is a list already')

    if replace:
       bpy.ops.object.select_all(action='DESELECT')

  
    for item in objects:

       ob = bpy.data.objects.get(item)
       ob.select = True
       
    if (active==''):
        active = objects[-1]
    else:
        active = active

    bpy.context.scene.objects.active = bpy.data.objects[active]
            

Once we declare a function, we can use it like below and re-use it multiple time as we like.

# EXAMPLE 1:
select('Torus', replace=True)

# EXAMPLE 2:
select(['Suzanne', 'Cube'], replace = False)

# EXAMPLE 3:
select(['Torus', 'Icosphere', 'Suzanne'], replace = True, active = 'Icosphere')


Notice that you need to specify List of String or A String to be selected.

The function I created above is pretty rough and it does not have 100% error checking, but it does the job and I think it is okey as quick example.

I will have the final version later on.

SELECT BY FILTERED NAME (using Python 'fnmatch' module) *
Imagine if we have the 6 boring primitive objects above and then we have actually some useful objects named:
- Sphere.001
- Sphere.002
- Sphere.003
- Sphere.004
- Sphere.005
- and so on.

How do we able to select things like that? Would not it be nice if we can tell Blender to: "Select objects that with this pattern "Sphere.*".

Can we do that? Yes, we can. Python can do it. Python has a special module called "fnmatch" that we can import and use, this allowing us to do wildcard filter by name.
How to select those Sphere using Python?


import bpy
import fnmatch

# Get All Meshes Objects
objects = bpy.data.objects

## NORMAL STYLE

# Get Names of All Meshes as a List of Strings
myList = [objects[i].name for i in range(len(objects))]

# Use fnmatch to filter the name
newList = fnmatch.filter(myList, 'Cube.*')

print(newList)

for item in newList:
    bpy.data.objects[item].select = True


## LIST COMPREHENSION STYLE
myListX = fnmatch.filter( [objects [i].name for i in range(len(objects ))] , 'Sphere.*')

for item in myListX:
    bpy.data.objects[item].select = True


UPDATE 2013.03.29
SELECT BY PATTERN (Built In Blender Python Function)
I found out that apparently you can already do select object with filter, by using Select By Pattern:

bpy.ops.object.select_pattern(extend=False, pattern="Cube*", case_sensitive=False)


FILTER THE LIST FURTHER USING SLICE, ENUMERATE, ETC*

I want to push it a little further with this by adding extra layer of filtering. For example, based on the "Filtered List Using Wildcard" above, what if we like to further select just sliced of them?

We can use the SLICE method for LIST.

import bpy
import fnmatch

# Get All Meshes Objects
objects = bpy.data.objects

### LIST COMPREHENSION STYLE
myListX = fnmatch.filter( [objects [i].name for i in range(len(objects ))] , 'Sphere.*')

myListXSlice = myListX[0:5]

for item in myListXSlice:
    bpy.data.objects[item].select = True

Further LIST processing can be done to the List of Strings to order and re-order them.


Anyways, long story short, the FINAL INCEPTION may look something like below:

import bpy
import fnmatch

objects = bpy.data.objects

test = [ item for item in list(enumerate( [x for x in fnmatch.filter( [objects[i].name for i in range(len(objects))] , 'Sphere*')] )) if item[0]<5 ]

print(test)

Try changing 'Sphere*' with other wildcard search and then the expression at the very back with other type of expression. I enumerate the LIST so that it is possible to randomize the list order etc. Just in case we want to do more with it.

THE WHOLE "INCEPTION" LIST COMPREHENSION THING:
All above subheading with (*) asterisk is important to understand the whole thing.

1. List objects in the scene (can be filtered further if it is a mesh or camera, etc)
2. Further filter the name list using wildcard, if matches, continue pass it on to next filter.
3. Turn the Filtered List into a Sortable List
4. Do something with the order of the list.

All packed into a single line to represent LIST.

For example of list above:
[ item for item in list(enumerate( [x for x in fnmatch.filter( [objects[i].name for i in range(len(objects))] , 'Sphere*')] )) if item[0]<5 ]

[ Get every item in list [ For every item that matches word 'Sphere*' [Get the name of objects in the scene with particular type ] if that item is less than 5]

When packed like that, it feels complex at a glance. We probably don't ever need to do that kind of complex List Comprehension, but we can do that. It's like a layer within layer within another layer and so on.


NOW THE INCEPTION PUZZLE:
Imagine a bottle full of hundreds of objects, and we need to filter and select a bunch of Monkeys in Red, Green, Blue colored Material only.

And what if we want to put Red Monkeys inside Green Monkeys inside Blue Monkeys?

Can we do that using Python?


BLENDER SUSHI SCRIPT: Arrange Selected Objects In XY Flat 2D Grid Layout


BEFORE


AFTER



import bpy
'''
Arrange selected objects in specified grid space

'''

def arrangeIn2DGrid(width=10, height=10, spread=2):

# Get List of Selected Objects
myObjects = bpy.context.selected_objects

if(myObjects):
print('Please select some objects')

totalGrid = width * height

if(len(myObjects) > totalGrid):
print('You need to specify bigger grid for your objects')

coords = []

for x in range(0,width):
for z in range(0,height):
coords.append([x,z])

# For every object in list, place each one in order into provided coordinates
for number, object in enumerate(myObjects):
object.location = coords[number][0] * spread, coords[number][1] * spread , 0.0


arrangeIn2DGrid(spread = 9)








BONUS UPDATE: Script to Import Pixel Art as Vertex Color Cubes

Since you manage to read up to here, below is an updated version to Pixel Art Script from the other day.

The script is still not fully optimized in term of processing large data, but below script will indeed color each Pixel Cube with Vertex Color 'Col' layer and will link every Pixel Cube into a Single Material only.

So, this is very useful if you want to change the Material to Cycle Render and you want to turn all into Glossy or Glass.

Remember to apply the script only to small Pixel Art image, under 128 x 128 pixel size. Any bigger and the script will take too long time. Wait until I optimize it further.

NOTE: If the script is taking too long time, you simply CTRL+C to halt the script.

BLENDER SUSHI SCRIPT: Pixel Art Import as 3D Cubes With Vertex Color



import bpy

D = bpy.data

# Specify your image here, open it inside Blender Image Editor panel
image_file = 'suzanne_pixel.png'
img = D.images[image_file]
pixels = list(img.pixels)
grouped_list = [pixels[ipx:ipx+4] for ipx in range(0, len(pixels), 4)]

# Get width and height of image (in pixel)
w = width = img.size[0]
h = height = img.size[1]
print("------LENGTH------")
print( len(img.pixels)//4)
print("------PIXEL------")
print(pixels)
print("---GROUPED-PIXEL---")
print(len(grouped_list))

# Create LIST of GRID XY value
rowColList=[]
for i in range(height):
for j in range(width):
rowColList.append(i)
rowColList.append(j)

# SPLIT the LIST of XY
origList = rowColList
splitList = [origList[i:i+2] for i in range(0,len(origList),2)]

# Create a single material that respect Vertex Color
mat = bpy.data.materials.new('PixelVertexColorMat')
mat.use_vertex_color_paint = True
mat.use_vertex_color_light = True

for number in range(len(grouped_list)):
# separate RGBA into each own variables
r = grouped_list[number][0]
g = grouped_list[number][1]
b = grouped_list[number][2]
a = grouped_list[number][3]
# separate XY coordinate
x=splitList[number][0]
y=splitList[number][1]
# create cube at location XY
bpy.ops.mesh.primitive_cube_add(location=(x-width/2, y-width/2, 0))
selectedObject = bpy.context.selected_objects
selectedObject[0].name = 'pixelcube.%s' % number
selectedObject[0].scale = 0.45, 0.45, 0.45
mesh = selectedObject[0]
bpy.context.object.data.materials.append(mat)
# ADD VERTEX COLOR SNIPPET
# Create Vertex Color Layer for each selected meshes
# bpy.context.selected_objects[0].data.vertex_colors
mesh.data.vertex_colors.new()
# Get Total Length of Vertex Colors for each selected meshes
# len(bpy.context.selected_objects[0].data.vertex_colors[0].data)
totalVertCol = len(mesh.data.vertex_colors[0].data)
# Iterate over every mesh vertex color and give it a single colour
for i in range(totalVertCol):
mesh.data.vertex_colors[0].data[i].color = r, g, b
# Print the progress
print ('PixelCube {number} created at:'.format(number=number), x, y, ', with RGB color', r, g, b)



Hatsune Miku Pixel Art



MKRdezign

Contact Form

Name

Email *

Message *

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