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

100% Made in Blender Pixel Art. No mouse, no 3D geometry, just keyboard and Python.

BLENDER BY NUMBERS
Inspired by John Maeda's Design By Numbers


INTRO NOTE, updated 2013.03.13

When starting this "Pixel Art in Blender", I did not think to go this far. I began by borrowing some info and script from Blender Scripting blog (by Dealga McArdle).

Later on as I go along in simplifying the script, I slowly starting to understand what his script is actually doing. I also started to look around everywhere for information to help me understand the process further.

I found this book below is helpful
"Introduction to Computing and Programming in Python - A Multimedia Approach" 
by Mark Guzdial and Barbara Ericson".
http://www.amazon.com/Introduction-Computing-Programming-Python-Edition/dp/0132923513/ref=dp_ob_title_bk/182-7879843-1920335

Similar example:
http://www.csse.monash.edu.au/~berndm/JMSS/python/tutorials/picture%20processing/

It is a basic Computer Science on Image Processing, but applicable for what we are doing: to be able to use Python to create and modify pixel.

For Blender artists with no interest with Python programming (yet!), you can use few scripts down below that allows you to:
  • Draw A Pixel 
  • Import Pixel Art and turn it into 3D
NOTE: There is also a Video Tutorial I just made today. Scroll down to the very bottom.

Being able to understand how a script works is definitely very rewarding, especially true for newbie Python coder like me. There are tons to discover and it is very exciting.

In near future, I am thinking to further extend this idea, until we are able to:
  • Modify the Color of Pixel using Image Processing Logic
  • Creating transition animation from one pixel to the next, frame by frame like in LED animation
  • How to render it out (save it to disk as well)
Thank you again to Dealga McArdle at Blender Scripting blog for wealth of information there waiting to be discover and John Maeda for truly inspiring way of thinking in simplicity and attention to details.



Continue with our Python journey ....

I was reading and studying some posts from this awesome Blender Scripting Blog by Dealga McArdle and there is one topic that is pretty interesting to me: "Pixels".
http://blenderscripting.blogspot.com.au/search/label/pixels

Dealga wrote and proposed on how we could tell Blender to draw pixels using Python. His example is quite clever and really open for interpretation. I did not get the whole thing yet, but they are interesting, especially the random pixel color it can generate.

I like to take his basic template on how to draw pixels and try to simplify further until we can draw a pixel.

I want to think in term of 2D Computer Graphics ala Design By Numbers (John Maeda) and Processing, and also NodeBox.

Basically let's explore this "Draw A Pixel" idea using Python.

DRAW PIXEL TEMPLATE 
Below is the basic template from Blender Scripting blog:


import bpy
import random

D = bpy.data

width = 10
height = 10

image_object = D.images.new(name='picOut', width=width, height=height)
num_pixels = len(image_object.pixels)

# draw a dot of pixel at certain position based on the number N
# N should not be bigger than (4 * width * height)
# value can be between 0.0 and 1.0

image_object.pixels[N] = 1.0 
image_object.pixels[245] = 1.0 

Let's trace the script above:

  • It tells Blender to create an image object, with the size of Width and Height specified. We use small number for now, like 10x10 grid, total number of 100 pixels.
  • The way it works, apparently the image object itself contain lookup information about Red, Green, Blue, Alpha color pixel value. Which means, for 100 pixels, we are getting the a total length of 400 slots in total (from num_pixels variable).
  • We can color the image object simply by putting a number in correspond to the R, G, B, A slot.


CREATING DRAW A PIXEL FUNCTION

Instead of relying to images.pixels[] function, I am thinking that we need to further break it into a function that is easier to comprehend.
I want to end up with function like this:

drawPixel(x,y, R, G, B, A)
x = coordinate pixel X
y = coordinate pixel Y
R = red value (0.0 - 0.1)
G = green value (0.0 - 0.1)
B = blue value (0.0 - 0.1)

drawPixel(i,j,value) # simplified version, greyscale output
i = coordinate pixel X
j = coordinate pixel Y
value = the value for RGBA

Let see how we can accomplish that.


PIXEL GRID
Firstly, we know that images.pixels[N] is the function we will be using to actually draw a pixel. But what we know is that the value N / the number that we specify, is an index number that is representing RGBA of the actual pixel of an image.

When we create 10 x 10 grid, we get 100 pixels. But inside the images.pixels, there are 400 index slots or 400 items. If we imagine it as a LIST, it will be something like this:

[ r, g, b, a, r, g, b, a, r, g, b, a, r, g, b, a, ..... ] for 100 times (because we have 100 pixels).

When we use the function images.pixels[N] as below:
images.pixels[6] = 1.0

That is basically telling Blender to draw a BLUE with value of 1.0 at Pixel Coordinate [1, 0] and mix it together with whatever value of RED, GREEN, ALPHA (default of 0.0).

How do I know that? From our understanding of LIST above.


(Inside Blender UV/Image Editor panel, if we LMB hold, we get information about that pixel. Above, we see information such as RGBA value and also the XY coordinate).

LIST TO MATRIX GRID



Before I got into the actual function to draw a pixel, I am researching all around on how to turn LIST into GRID ARRAY. Apparently, it is not ARRAY that I am really searching, I need a MATRIX, 2 Dimensional 2D Matrix to represent LIST as a GRID.

So, imagine we have a list  [r,g,b,a,r,g,b,a,r,g,b,a,r,g,b,a .... ] that we want to turn into matrix list [[r,g,b,a][r,g,b,a], [r,g,b,a].....]

Or imagine we have a list representing coordinate 10 x 10, but as a list [0,1,2,3,4,5,6,7,8,......, 99]. Total of 100 numbers.

That list will more useful if we turn it into something like below:
[[0,1,2,3,4,5,6,7,8,9], [10,11,12,13,14,15,16,17,18,19], .... and so on]

Which will be a more representative of (X, Y) grid. So that we can easily point the X and Y, and Python will turn that back into a number. I have few Python solutions that allow us to SPLIT a LIST into MATRIX.

FIRST SOLUTION
I got this awesome answer from Taisuke Tanimura which uses List Comprehension in Python:

##########################

# Taisuke Tanimura solution

r=1.0
g=1.0
b=1.0
a=1.0

origList = [r,g,b,a,r,g,b,a,r,g,b,a]
splitList = [origList[i:i+4] for i in range(0,len(origList),4)]

print (splitList)

##########################

SECOND SOLUTION 
My solution based on eHow solution

r=1.0
g=1.0
b=1.0
a=1.0

origList = [r,g,b,a,r,g,b,a,r,g,b,a]
splitList = []
splitEvery = 4

while origList != []:
    splitList.append(origList[:splitEvery])
    origList = origList[splitEvery:]
    
print (splitList)

##########################

THIRD SOLUTION 
To use NumPy, but I don't know exactly how. Google keeps pointing at NumPy.

NOTE:
While researching about List and Matrix, this is all basic stuff, I can imagine, but I found heaps of information about Python and how it can SLICE a LIST and also do the reverse like FLATTEN LIST within LIST or NESTED LIST into a single LIST. They are all new for me and very interesting.

[UPDATE 20130312: Understanding LIST & GRID]
Read further explanation by my mate, Nemui Kame regarding this kind of LIST and GRID to get a better understanding:
http://alittlegamecode.blogspot.com.au/2013/03/how-to-access-rgba-color-channel-via.html

Anyways, using the above method, we create a function below:


def grid(x,y):


# we have 10 x 10 grid, list will contain the total of it
origList = []

for i in range(width * height):
origList.append(i)

matrix = []

while
origList != []:
splitList.append(list[:width])
origList = list[width:]

return
splitList[y][x]



Taisuke's Method:


def grid(x,y):




origList = []

for i in range(width * height):
origList.append(i)

splitList = [origList[i:i+width] for i in range(0,len(origList),width)]



return splitList[y][x]


So, the function will return N number that actually represent X, Y grid coordinate. We can call it simply by using grid(x,y).

Cool. So the next thing we do is just to apply that into our next problem.

ADDING RED, GREEN, BLUE, ALPHA PATTERN INTO THE MATRIX
Since our pattern is [r,g,b,a, r, g, b, a, ....], my next quick hack solution is simply to do this:

N = red value
N + 1 = green value
N + 2 = blue value
N + 3 = alpha value

That will be how the whole list will be applicable to what we are doing.

BLENDER SUSHI SCRIPT: Draw Me A Pixel


import bpy
import random

D = bpy.data

width = 10
height = 10

image_object = D.images.new(name='picOut', width=width, height=height)
num_pixels = len(image_object.pixels)

def grid(x,y):
# we have 10 x 10 grid, list will contain total of it
origList = []

for i in range(width * height):
origList.append(i)

splitList = [origList[i:i+width] for i in range(0,len(origList),width)]

return splitList[y][x]

def drawPixel(x,y,value):

# multiplied by four because of r, g, b, a pattern
pixelNumber = grid(x,y) * 4

# this is a quick way to iterate
image_object.pixels[pixelNumber] = value
image_object.pixels[pixelNumber+1] = value
image_object.pixels[pixelNumber+2] = value
image_object.pixels[pixelNumber+3] = 1.0

print(pixelNumber)

# NOTE: number cannot go outside the range of image pixel width height

BLENDER SUSHI SCRIPT: Draw Me A Pixel - OPTIMIZED
AS SUGGESTED BY DEEN / updated 2013.03.13


import bpy
import random

D = bpy.data

width = 10
height = 10

image_object = D.images.new(name='picOut', width=width, height=height)
num_pixels = len(image_object.pixels)

def grid(x,y):
return x + width*y

def drawPixel(x,y,value):

# multiplied by four because of r, g, b, a pattern
pixelNumber = grid(x,y) * 4

# this is a quick way to iterate
image_object.pixels[pixelNumber] = value
image_object.pixels[pixelNumber+1] = value
image_object.pixels[pixelNumber+2] = value
image_object.pixels[pixelNumber+3] = 1.0




Thanks to DEEN in the comment below. Apparently we can get easier access to the Linear List from Matrix Grid XY by doing this: grid(x,y) = x + width*y

Much simpler. Why did not I think of that? I must have forgotten my Math!

However, doing it the long complicated way and the hard way, one learned how to SPLIT Linear List into Matrix and how to FLATTEN Matrix into List.


Keep in mind that the script will:
  • Create New Image and start fresh canvas each time you run the script. You can certainly change this behaviour and tell Blender to override the same image instead, but do keep track of your image Width and Height. Remember you cannot draw outside the dimension of your canvas.
  • Draw pixel on top of another pixel in sequences
Once above setup script is ran, we can simply call the function to draw a pixel by using drawPixel(x,y,value). Keep in mind your image dimension (width and height) and do not place the pixel outside the image canvas.

Each drawing will be processed top to bottom, and every pixel will be over-drawn by next pixel.


drawPixel(6,8, 1.0)
# this will draw pixel at X,Y coordinate (6,8) and as a value of 1.0 (RGBA).


Noise pattern.


Stripe of lines drawn pixel by pixel.


Lines with Random Greyscale values.


Using 100 x 100 pixel grid. 


It is starting to take a little longer to create, but still OK. The result is quite interesting.

For 1000 x 1000 grid, that will take quite a loooong time, but that is because this Python script to "Draw A Pixel" is not optimized. There must be a much better and faster way using Blender Python API.

More examples:

Using Width and Height as INPUT for the interaction



Using Random Module for colorful pixels





MARIO MUSHROOM PIXEL ART



Check the newly created image under Image Editor. There is probably a way to change the context and to update the Image Editor screen.


DRAWING PIXEL WITH COLOR (R, G, B, A)
For the colored Pixel, I added the code below:

def drawPixelColor(x,y,R,G,B):
    
    # multiplied by four because of r, g, b, a pattern
    pixelNumber = grid(x,y) * 4
    
    # this is a quick way to iterate
    image_object.pixels[pixelNumber] = R
    image_object.pixels[pixelNumber+1] = G
    image_object.pixels[pixelNumber+2] = B
    image_object.pixels[pixelNumber+3] = 1.0
    
    print(pixelNumber)

Below is the code to draw MARIO RED MUSHROOM, pixel by pixel. See if you can optimize this further.


### DRAW MARIO RED MUSHROOM ###


# draw white background
for i in range(16):
for j in range(16):
drawPixel(i,j,1.0)

# draw mushroom outline
for x in range(4,12): drawPixel(x,0,0.0)
for x in [3,12]: drawPixel(x,1,0.0)
for x in [2,13]: drawPixel(x,2,0.0)
for x in [2,6,9,13]: drawPixel(x,3,0.0)
for x in [1,2,3,6,9,12,13,14]: drawPixel(x,4,0.0)
for x in range(4,12): drawPixel(x,5,0.0)
for x in range(5,11): drawPixel(x,15,0.0)
for y in range(5,11): drawPixel(0,y,0.0)
for y in range(5,11): drawPixel(15,y,0.0)
for y in range(11,13): drawPixel(1,y,0.0)
for y in range(11,13): drawPixel(14,y,0.0)
drawPixel(2,13,0.0)
drawPixel(13,13,0.0)
for x in range(3,5): drawPixel(x,14,0.0)
for x in range(11,13): drawPixel(x,14,0.0)

# draw mushroom inside
for x in range(3,12):
drawPixelColor(x,6,1.0,0.0,0.0)
for x in range(3,12):
drawPixelColor(x,6,1.0,0.0,0.0)
drawPixelColor(14,6,1.0,0.0,0.0)
for x in [2,3,12,13,14]:
drawPixelColor(x,5,1.0,0.0,0.0)
for x in [3,4,9,10]:
drawPixelColor(x,7,1.0,0.0,0.0)
for x in [3,4,9,10]:
drawPixelColor(x,7,1.0,0.0,0.0)
for x in [2,3,10]:
drawPixelColor(x,8,1.0,0.0,0.0)
for x in [1,2,3,10,11,14]:
drawPixelColor(x,9,1.0,0.0,0.0)
for x in [1,2,3,10,11,12,13,14]:
drawPixelColor(x,10,1.0,0.0,0.0)
for x in [3,4,9,10]:
drawPixelColor(x,11,1.0,0.0,0.0)
for x in range(4,10):
drawPixelColor(x,12,1.0,0.0,0.0)
for x in range(5,9):
drawPixelColor(x,13,1.0,0.0,0.0)
for x in range(5,9):
drawPixelColor(x,14,1.0,0.0,0.0)





Try and  draw your own Pixel Art, pixel by pixel, using the code provided above and your understanding of Python. I guarantee that you will start to think further in term of making the code more efficient or how to draw faster.

Use small size Grid for now, for sake of simplicity. 100 x 100 is already quite big and the code can be slow. Try smaller grid size:
  • 10 x 10
  • 16 x 16
  • 32 x 32
  • 64 x 64

UPDATE 2013.03.14 / Saving Out The Image Files

So, you probably end up with some Pixel Art images now and want to save it? You can do that manually, but if you have many images, maybe we need Python.

Below is my attempt to write a script that will save all the Image Files: (that are currently open and displayed on Blender Image Editor)

BLENDER SUSHI SCRIPT: Save All Images



import bpy





allImages = bpy.data.images


filepath = 'C:/' # this is the root path where file will be saved





for image in allImages:


    image.save_render(filepath + image.name +'.png')


    print (filepath+image.name+'.jpg' + ' is saved!')



I figured out about the script and Python method to save the image file by using dir() on Blender Data Images object. I guess this is a good way to search for functions/methods inside an object. Surely Blender Python will have better documentation when it reaches Blender 3.0, but for now, I think this is the way to go apart from Google search or asking at the forum.




Gangnam Style 3D Pixel Art.

REMIX THE CODE 
Modify the code further and extend it as you pleased. As you may notice above, I actually do some modification by adding drawPixelColor() function. Of course the possibility is really endless.

Perhaps, you can create a  QR code in Blender, pixel by pixel?

Maybe you can sample a small Pixel Art that will then create a 3D Pixel Grid all with the correct material? Have someone done that? Very possible. In fact I will just do that now.

REVERSE THE CODE


Here, we are going to "reverse" the process. This is where the fun began.

So instead of Drawing A Pixel, the code below (which I again borrowed from Blender Scripting blog) will read whatever image pixel that you open in Blender (opened in Image Editor) and then take that data back into Blender as LIST and LIST MATRIX.

Inside Blender Image Editor, open up an image. In my case it is called 'mario_musroom.png', change that name with whatever image file you have.

import bpy
D = bpy.data

test_file = 'mario_mushroom.png'
img = D.images[test_file]
pixels = list(img.pixels)
grouped_list = [pixels[ipx:ipx+4] for ipx in range(0, len(pixels), 4)]

print("------LENGTH------")
print( len(img.pixels)//4) 
print("------PIXEL------")
print(pixels)
print("---GROUPED-PIXEL---")
print(grouped_list)
print(grouped_list[255])

Below is List of 4 x 256 Numbers, representing the pixel and RGBA values from the 16x16 Mario Mushroom image:



Below is Grouped Matrix List of 4 x 256 Numbers, representing the pixel and RGBA values from the 16x16 Mario Mushroom image:


What can you do with those data again then? Anything you can think of, actually.

You could manipulate the RGBA pixel color value and pass it back as new picture. Changing the color into greyscale, shifting the color value, create some variations of colors, and all kind of RGBA pixel color manipulation.

From Blender Scripting blog, Dealga suggested "firefly reduction" method, which is clever, kind of like "noise reduction" way of thinking.

We actually have good useful List of Array Matrix that can tell you the location of (X, Y) and also the R, G, B, A, so we can really filter that list and then tell Blender to create grid of xoxes with RGBA value. Although... I imagine many boxes with hundreds of materials will be quite heavy for Blender. Particle and Instance is probably better.

However, regardless of that, it is worth trying out just to further think in Python. 

Let see how we can draw some boxes using the above information...

I have a little help from here in term of applying Material to newly created Cube.

UPDATE 2013.04.09

BLENDER SUSHI X SCRIPT: Import Pixel Art and Create 3D Cubes (OPTIMIZED VERSION)

BIG thanks to MageOfTheForest for optimizing the script! 


import bpy

'''
This is an optimized version of Pixel to 3D Cubes script.

Credits to: mageoftheforest

Last update: April 9, 2013 at 2:08 AM

'''

# Specify your image here, open it inside Blender Image Editor panel
image_file = 'zelda_16_16.png'

img = bpy.data.images[image_file]
pixels = list(img.pixels)

# creates a 2 dimensional array from a 1 dimensional array
# by grouping r, g, b and a for each color
grouped_list = [pixels[ipx:ipx+4] for ipx in range(0, len(pixels), 4)]

# Get width and height of image (in pixel)
width = img.size[0]
height = img.size[1]

bpy.ops.mesh.primitive_cube_add()
obj = bpy.context.active_object
obj.scale = 0.5, 0.5, 0.5

mat = bpy.data.materials.new('pixelColor')
mat.diffuse_intensity = 1.0
mats = {}

for y in range(height):
for x in range(width):
# separate RGBA into each own variables
r = grouped_list[x + y * width][0]
g = grouped_list[x + y * width][1]
b = grouped_list[x + y * width][2]
a = grouped_list[x + y * width][3]

# create cube at location XY
# a new created mesh will always become the active object
copy = obj.copy()
copy.data = obj.data.copy()
copy.location = (x - width / 2, y - height / 2, 0)
copy.name = 'pixelcube.%s' % (x + y * width)

# add material with RGB color as sampled for every pixel
key = str(r) + str(g) + str(b) + str(a)

if key in mats:
copyMat = mats[key]
else:
mats[key] = copyMat = mat.copy()
copyMat.diffuse_color = (r,g,b)

copy.data.materials.append(copyMat)
bpy.context.scene.objects.link(copy)
print ('PixelCube {number} created at:'.format(number=x + y * width), x, y, ', with RGB color', r, g, b)

bpy.context.scene.objects.unlink(obj)
bpy.data.objects.remove(obj)

# Code for join all objects together
# Place the origin to the center and
# Remove all double vertices


'''
bpy.context.scene.objects.active = copy
bpy.ops.object.join()
bpy.ops.object.origin_set(type = 'ORIGIN_GEOMETRY')
bpy.ops.object.mode_set(mode = 'EDIT')
bpy.ops.mesh.remove_doubles()
bpy.ops.object.mode_set(mode = 'OBJECT')
'''

print('Finished')







Although I have not fully studied the optimized script in details, but above should work fine and a lot faster. The script procession will now continue running at full speed and does not slow down like below.

To do 256 x 256 grids, it will take few minutes instead of hours. Mind you, 256 x 256 = 65536 Cube with 65536 Materials. It will also consume around 1.6 GB of RAM. Not recommended.

You might also want to tweak the script above to apply color to a single material with Vertex Color Set, instead of Multiple Materials. Doing it this way is much more efficient and you can easily transfer it to Cycles.

Below is the original script to convert Pixel Art to 3D Cubes.

BLENDER SUSHI SCRIPT: Import Pixel Art and Create 3D Cubes

WARNING NOTE:
  • Use the script only on small Pixel Art ( 64x64 pixel is probably already big )
  • Toggle Blender System Console to see the progress printed out line by line.
  • I have not optimized the script, so 128 x 128 pixels will take a bit of time (few hours?). 1024 x 1024 pixel will probably take .... few days to complete. Do not try that.
  • Remember that you are creating total number of X x Y pixels. For 128 x 128 pixels, you will get 16384 boxes with 16384 materials! It is quite possible Blender may freeze run out of memory.
  • For pixel art with large dimension, it is better to use UV + texture and a single material after all. But for small pixel art, sometimes I prefer each box have its own material and color.
  • My Task Is: to optimize the script...
  • Will try Vertex Color option for more flexibility when using Cycles.

import bpy
D = bpy.data

# Specify your image here, open it inside Blender Image Editor panel
image_file = 'mario_mushroom.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)]

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

# add material with RGB color as sampled for every pixel
mat = bpy.data.materials.new('pixelColor')
mat.diffuse_color = (r,g,b)
mat.diffuse_shader = 'LAMBERT'
mat.diffuse_intensity = 1.0
#mat.emit=0.5

bpy.context.object.data.materials.append(mat)

print ('PixelCube {number} created at:'.format(number=number), x, y, ', with RGB color', r, g, b)






NOTE:
The actual sampling of image information in Blender is flipped horizontally, so maybe the resulting cube needs to be flipped manually. Or we can change the code to flip the axis.

Image is flipped when read back.
With this setup, we actually have Cubes for each pixel and each one of them is colored properly. We can apply Blender Rigid Body Dynamic to it like below if we like.
Of course you are not limited to 3D Cube shapes, you can also use other 3D Primitives or even Suzanne. Simply switch the Cube with other shapes and see how it looks.

NOTE:
Again I have not yet optimized the script further, unlike what Dealga has been exploring and get into conclusion on his website. So please do your own reading maybe you can improve the script yourself.
http://blenderscripting.blogspot.com.au/2012/08/adjusting-image-pixels-internally-in.html

Check also Dealga's script "Firefly Removal".

I will certainly do some updates whenever I understand something new.

ALTERNATIVE WAY TO RENDERING IT OUT
Use a number of array grid of boxes as you like and then color it using the Cycle material using Object Info Node. Doing it this way is the fastest to map the 2D texture. Using it this way, you get Pixel Colors that is more interpolated.





FURTHER STUDY: John Maeda's Publication, Processing, and NodeBox
Back to Pixel business, try if you could further enhance the code (if you do, please let me know and do give comments below), and make Draw functions such as below:
  • drawLine()
  • drawCircle()
  • drawSquare()
  • drawEllipse()
  • drawRectangle()
See how you would plug in function like Sine and deal with Float value when the grid is expecting Integer value. Things like that. Even I have no idea how to do it.

DEEN: (quoted from his nice suggestion on the Comments down below)
"... before investing time in creating drawLine, drawEllipse, etc, see if you can't use one of the existing Python image manipulation modules for that purpose, like PIL, or pyCairo, etc. I'm reasonably sure you can do drawing in PIL and then transfer the data to the Blender image pixel array in one go."

Perhaps you could further learn and expand this kind of idea using from awesome tools such as:
More Pixel stuff from Processing perspective:
Megaman rocks.

BONUS 2013.03.13 / Video Tutorial On How To Use The Scripts






PIXEL ART IN BLENDER, THE TRADITIONAL WAY...
If you prefer to do it in more traditional way, you can of course use Blender Paint mode. Remember to draw pixel art in a small canvas and a single pixel Brush. 





BONUS INSPIRATIONS

Rendering "pixel" look using Blender Freestyle and disabling Antialiasing by Peripheral Games:

Pixelated Animal Sculptures by Shawn Smith

Laura Bifano // PIXELATED

For more 3D Pixel and Voxel posts, search the particular topic at Blender Sushi.

FUTURE CHALLENGE FOR MYSELF AND YOU

Color Stippling Effects
http://www.joesfer.com/?p=149



The inception of Particle Info node.

I wrote a bit of Object Info node and Strand Info node not long ago. I think I should also write a quick post about Particle Info node.

There are already few great video tutorials out there touching on this topic of Particle Info node and Cycles, but anyway, I will just write this post just as a note for myself and hopefully can also be useful as quick reference fo you.

Particle Info node as first mentioned at Blender Developer Blog:
http://code.blender.org/index.php/2012/05/particle-info-node/

WHAT IS REALLY PARTICLE INFO NODE
Maya has this Particle Info node. Houdini also has this similar node. But, I personally think that Particle Info node in Blender is the most clear and simple in term of usage and application.

Similar to Object Info node and Strand Info node, Particle Info node is exposing specific data values and make it available for Look Development (Shading, Texturing, Lighting), and for our case, it is made for Cycles real time Material and Rendering.

Blender philosophy seems to be more toward procedurality, where are you are able to pass and manipulate data from one node to another node more easily.

Particle Info nodes is exposing and passing these data: index, age, lifetime, location, size, velocity, angular velocity, that we can use to Map or as Factor for other data.

THE BASIC SETUP
You need some familiarity of Blender Particles basic (emitter, instancing) and Blender Cycles node-based Material in order to understand this.

I am just going to show the basic, exploring this Particle Info node while writing notes for every useful finding.

My Particle setup for this is super basic, just the "Monkey Rain" setup with a single Suzanne monkey as a  instance copies:

That Suzanne monkey object selected is the INSTANCE object. The rest of monkey falling down is just a copy of that single monkey object.
Particle Info node will be used inside the Material for Suzanne (the master instance object).


PARTICLE INFO: Age and Lifetime + Color Ramp
Every single Particle has Age and Lifetime value. Age is calculated from the time a particle is born, while Lifetime is the how long Particle is set to live.

By default, when you create Particle System, the value is as below:

Lifetime = 50, meaning every particle will live up to 50 frames and then die. You can randomize the lifetime (Random) if you like a bit of variation.

Age will start from value of 0 when the Particle is born on a particular frame.

How can we use this value to affect Cycles Material? It is very straight forward, we just pass the data.

For many of our purpose, we will be using Color Ramp node.

This Color Ramp node is a handy little node that shows Color gradation, and when used with data output from Particle Info node as Factor, we can visualize the changes.

In order for Color Ramp to show value from beginning Color to end Color properly, we should always make sure that the Factor (Fac) value is normalized (0-1). So for our purpose, we use Math node, set to Divide) to divide Age with Lifetime.



So, with everything in default value, we have result as above. Particle Color Diffuse goes from Black to White from the time it is born until it die and disappear.

If we change the Color Ramp node value, we can see more clearly what is really happening.




PARTICLE INFO: Age and Lifetime + Mix Shader
With similar setup above, we can then do the same thing to Mix Shader. Let say, we like the Particle to fade from original material (for example Diffuse Shader) and become transparent (Transparent Shader) overtime. That can be done as easily as Color Ramp.



PARTICLE INFO RANDOM
For random color, looks like we can simply use Object Info node as a Factor for Color Ramp and this works for our Particle Instances which is nice.



PARTICLE INFO: Size + Color Ramp
Next thing we can pipe to Color Ramp is the Particle Size via Particle Info node. You probably understand this by now.

I first randomize the Size of Particle from the Blender Particle System Property:




PARTICLE INFO: Location + Color Ramp
Particle Location is an interesting one because it is a Vector XYZ value, which means it carries 3 different values depending on Particle Location.

When I pipe the value to Color Ramp anyway, it will show the gradation as expected.



With Location value, it is probably clearer if we use Grid Texture and see how the color is distributed for each Particle in 3D space:


With the same method we did for Object Info node, then we can pipe in the Location value output from Particle Info node to UV Image Texture, which gives us the LED grid that we are already familiar with.


If our Instance Object is simplified to a Cube, then we get something like below:


PARTICLE INFO: Location = Color

If Particle is static, the color will be Black (0,0,0 velocity value), but if they are moving or have velocity other than zero, you get color.

For example, apply Turbulance Force to the Particle System so that each Particle has some kind of Velocity value (also a type of Vector value, to depict direction velocity of Particle).



Alright, so this is all the basic that I can think of. Will look for more advance setup next time. I bet plenty of questions start to arise by knowing all this basics.

This should prepare us for future development Blender Particle Node system.

MKRdezign

Contact Form

Name

Email *

Message *

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