Monday, March 25, 2013

Practical Color Matching

A friend posted this link on facebook recently. Its a really cool test. It got me thinking. its no wonder people have a hard time doing color matching. Its hard just to see that a color is in fact different, then to have decide why its different and compensate for it. Not to mention you then have to compensate for lighting, and finish (matte/gloss, etc.). So i dug up an old illustrator script that i wrote for a colleague. It helps do some of the heavy lifting for you when color matching for print. It makes new color chips based on your current selection in illustrator. Heres a brief video of it in action, with a special bonus at the end.




The color nazzis will say its evil because it uses the HSB color model to create the variations. But, the range of colors that are outside the hsb gamut is small.
It doesn't make sense to do something the hard way every time because its not going to work 10% of the time. Do it the easy way then if the color is out of gamut do it the hard way. You will save time in the long run by always doing it the easy way first. You just have to keep in mind that some colors are suspect to being out of the HSB gamut, and keep an eye out for them.

Okay, the script. The best way to operate it is by..
1) Opening a new document
2) Creating an object to hold the color you want to test.
3) Set the fill color of that object to the color you wish to test.
4) Set the document color mode to RGB if its not already.
5) Select the object and run the script.
You can skip steps 2 and 3 by copying an object from another file to make it easier, and if you forget step 4, the script will remind you.
Once you have run the script you will be given the option to adjust the amount of variation between swatches. The default of 10 might be too coarse for regular use but it works great for a demo :P
You can adjust it to get more or less variation between colors as needed.
Run it as many times as you need to fine tune your prints.


Here's the Script....
-------------------------

var docRef = activeDocument;
var sel = docRef.selection;
var ColorMode = docRef.documentColorSpace;
//alert(ColorMode);
var increment = prompt("Enter adjustment value/n0 = fine, 10=Coarse","10");

try{
 if(ColorMode != "DocumentColorSpace.RGB"){
  throw new Error("Document color mode must be set to RGB\nMenu: File > Document Color Mode > RGB Color");
 }
 if(sel[0].fillColor){
  var existingcolor = sel[0].fillColor;
 }else{
  throw new Error("You must select something");
 }
 if(isNaN(increment *1)){
  throw new Errow("Adjustment entered is not a number")
 }

var exR = existingcolor.red;
var exG = existingcolor.green;
var exB = existingcolor.blue;
var exHSV =  RGBtoHSV(exR,exG,exB);
var y=0;
var posy;

for(z=0; z<3; z++){
if(z==0){
   posy = 483;
   var zfill = ModHSV(exHSV, increment*-1, 0,0);
}else if(z==1){
   posy = 0;
   var zfill = ModHSV(exHSV, 0, 0, 0);
}else if(z==2){
   posy = -483;
   var zfill = ModHSV(exHSV, increment*1, 0,0);
}
for(x=0; x<=3; x++){
 //alert("new row "+x+", V="+exHSV[2])
 var xfill = ModHSV(zfill, 0, x*increment/100, 0);
 for(y=0; y<=3; y++){
  var yfill = ModHSV(xfill, 0, 0, y*increment*2.55);
  var swatchY = docRef.pathItems.rectangle(posy+0+(x*66), 0+(y*66), 48,48);
  swatchY.fillColor = HSVtoRGB(yfill); 
 }
}
for(x=0; x<=3; x++){
 //alert("new row "+x+", V="+exHSV[2])
 var xfill = ModHSV(zfill, 0, (x*increment/100)*-1, 0);
 for(y=0; y<=3; y++){
  var yfill = ModHSV(xfill, 0, 0, y*increment*2.55);
  var swatchY = docRef.pathItems.rectangle(posy+0+(x*66)*-1, 0+(y*66), 48,48);
  swatchY.fillColor = HSVtoRGB(yfill); 
 }
}
for(x=0; x<=3; x++){
 //alert("new row "+x+", V="+exHSV[2])
 var xfill = ModHSV(zfill, 0, (x*increment/100)*-1, 0);
 for(y=0; y<=3; y++){
  var yfill = ModHSV(xfill, 0, 0, (y*increment*2.55)*-1);
  var swatchY = docRef.pathItems.rectangle(posy+0+(x*66)*-1, 0+(y*66)*-1, 48,48);
  swatchY.fillColor = HSVtoRGB(yfill); 
 }
}
for(x=0; x<=3; x++){
 //alert("new row "+x+", V="+exHSV[2])
 var xfill = ModHSV(zfill, 0, x*increment/100, 0);
 for(y=0; y<=3; y++){
  var yfill = ModHSV(xfill, 0, 0, (y*increment*2.55)*-1);
  var swatchY = docRef.pathItems.rectangle(posy+0+(x*66), 0+(y*66)*-1, 48,48);
  swatchY.fillColor = HSVtoRGB(yfill); 
 }
}
}//end z loop
}catch(e){
 alert(e);
}


// - START RGBtoHSV - //
function RGBtoHSV(exR,exG,exB){
var HSVColor = new Array();
var cMin= myMin(exR,exG,exB);   
var V = myMax(exR,exG,exB);
var Delta = V - cMin;
var S, H; 
 // Calculate saturation: saturation is 0 if r, g and b are all 0
if( V== 0){
 S= 0;
 //alert("S=0")
}else{
 S = Delta / V;
 //alert("S="+S)
}
if(S== 0){
  H = 0
}else if(exR==V){
 H = 60 * (exG - exB) / Delta
 }else if(exG==V){
     H = 120 + 60 * (exB - exR) / Delta
 }else if(exB==V){
     H = 240 + 60 * (exR - exG) / Delta;
}else{
  alert("i don't know!")
}
 
 if(H < 0){
 H = H + 360
}
HSVColor[0] = H;
HSVColor[1] = S;
HSVColor[2] = V;
return HSVColor;
}
// -  end - //

// - START HSVtoRGB - //
function HSVtoRGB(HSVColor){
 var nRGBColor = new RGBColor();
 var V = HSVColor[2];
  //alert(V);
 var S = HSVColor[1];
  //alert(S); 
 var Hex = HSVColor[0]/60;
  //alert(HSVColor[0]+"/60="+Hex);
 var primclr = Math.floor(Hex);
  //alert(primclr);
 var secclr = Hex - primclr;
  //alert(secclr+"="+Hex+"-"+primclr);
 var a = (1-S)*V;
 var b = (1-(S*secclr))*V;
 var c = (1-(S*(1-secclr)))*V;
 //alert("ABC="+secclr+","+a+", "+b+", "+c) 
 //alert(primclr);
 switch(primclr){
  case 0:
   nRGBColor.red = V;
   nRGBColor.green = c;
   nRGBColor.blue = a;
   break;
  case 1:
   nRGBColor.red = b;
   nRGBColor.green = V;
   nRGBColor.blue = a;
   break;
  case 2:
   nRGBColor.red = a;
   nRGBColor.green = V;
   nRGBColor.blue = c;
   break;
  case 3:
   nRGBColor.red = a;
   nRGBColor.green = b;
   nRGBColor.blue = V;
   break;
  case 4:
   nRGBColor.red = c;
   nRGBColor.green = a;
   nRGBColor.blue = V;
   break;
  case 5:
   nRGBColor.red = V;
   nRGBColor.green = a;
   nRGBColor.blue = b;
   break;
  case 6:
   nRGBColor.red = V;
   nRGBColor.green = c;
   nRGBColor.blue = a;
   break;
 }
 return nRGBColor;
}
// - end - //

// START ModHSV - //
//ModHSV(exHSV, increment, (increment/100), (increment*2.549))
function ModHSV(xHSVColor, H, S, V){
 var nHSV = new Array();
 nHSV[0] = xHSVColor[0] + H;
 nHSV[1] = xHSVColor[1] + S;
 nHSV[2] = xHSVColor[2] + V;
 
 if(nHSV[0]>360 || nHSV[0]<0){
  if(nHSV[0]>360){
   nHSV[0] = nHSV[0]-360;
  }else if(nHSV[0]<0){
   nHSV[0] = nHSV[0]+360;
  }else{
  nHSV[0] = 0;
  }
 }
 if(nHSV[1] > 1 || nHSV[1] < 0){
  // set to gray
  nHSV[1] = 0;
  nHSV[2] = 204;
 }
 if(nHSV[2]>255 || nHSV[2]<0){
  nHSV[1] = 0;
  nHSV[2] = 204;
 }
 return nHSV;
}
// - end - //

function myMax(r,g,b){
  if (r >= g && r >= b){
   return r;
  }else if(g >= r && g >= b){
   return g;
  }else{
   return b;
  } 
}
// end

function myMin(a,b,c){
  if (a <= b && a <= c){
   return a;
  }else if(b <= a && b <= c){
   return b;
  }else{
   return c;
  } 
}
//end

Saturday, March 23, 2013

Hibernation

It's been 5 months or so since my last post. My daughter doesn't allow me to type while I'm feeding her anymore. So, posting has been difficult. Plus, it's not unusual for me to go into social hibernation during the winter as it is. I hate the cold and the snow and the shortage of sunlight. However durring those 5 months I haven't been inactive.
Shortly after my last post I stumbled upon a piece of software called "game editor". It's a standalone application for game development. It runs on windows but the games can be ported to iOS, Android, Mac, Linux, and PC. For a few years I've wanted to make an iOS game, but I simply can't afford to go out and buy a Mac. But, it looks like that limitation has been partially lifted. So, for the last 5 months in the slivers of spare time that I find, I've been developing a Zelda-esque Action RPG.
The software has predefined events and actions. But allows for a lot of custom programming in C. It's not without it's limitations. But, with all the areas for custom programming most things can be accomplished. The forum on the game editor website is very very helpful and friendly. Possibly the friendliest forum i've ever visited. I've never actually posted because most every question I've had had already been answered quite thoroughly.
At any rate. Level 1 should be ready to demo and bug test soon. The graphics are still only placeholders at the moment. I'm not exactly the best pixel artist.






Some day soon I will release a demo.
The bulk of the programming has been done. But, making the maps, cut scenes, and boss fights is tedious.
Not to mention the fact that my iphone crashed and i lost 4 months worth of notes that related to the games storyline... yet another delay.

Monday, September 17, 2012

3D Printed Woopa Monster


Inspired by The World of Magic game for the iPhone/Android by com2us. This little bugger wreaks havoc at the beach when your a nooby noob. I've run for my life and left others in the dust to be devoured by schools of these carnivorous finned nightmares.

Once you reach a level where they no longer pose a threat to you. You will find yourself looking back on them as a right of passage out of noobdom. Everyone worth their salt will face the hoards of woopas. The swarms of woopas. Spawing like rabbits. Just when you think you're safe, more are headed your way.

Now, they're spawning in 3D over at shapeways.
You can purchase them here

They will invade your home!

Check out my other items at www.shapeways.com/shops/rithstore
Enjoy!Rith

Friday, September 14, 2012

Dragonfly Prototype Has Arrived

Well, the prototype arrived, and it looks good. It just doesn't function. No fault of shapeways of course. This was round one, and there were bound to be design flaws with so many moving parts. I had high hopes, but it's not terribly surprising that it didn't work on the first print. Here's a few photos of the results.





Upon opening the box, I didn't see the problems that I had hoped to see. I saw a different set of problems. It was the set of problems that I pushed to the back of my mind and hoped I would not see.

It's form is currently at 100%, It's function is currently at 0%
So, if we do the math, that makes it about 50% complete.


In an older post, I mentioned that art can be a lot of experimentation. This was my first attempt at making my vision reality. It didn't work. So, now it's time to see what does work, what doesn't, and refine the design.

I'll try to hold onto my original vision as long as I can. But, that doesn't always work out. One of the hardest lessons I had to learn in art school was how to know when you're done. By that, I mean knowing the difference between what you want it to be, and what it want's to be. You can try and try and try to make it fit your vision and get it "just right". But, sometimes you have to let the art just be what it is. If it's 98% what you wanted it to be. Then it's a success. That last 2% will drive you mad if you let it. I still find this the hardest lesson. I have left so many things (mostly paintings) unfinished because I couldn't get them "just right" in my eyes..

Over the next few weeks. I'll be refining the design and keep posting my progress.
Starting with an evaluation of the failures.

I will note though, that the material is surprisingly strong for it's size and weight.
It's feather light, and in some places it's not  much thicker than a piece of card stock. But, it's pretty tough. I've handled it quite a bit, and none of the little pieces have broken.
It's a lot like handling a hamster or other tiny creature for the first time.
You feel like you're going to crush it's tiny body in your big clumsy hands. But, it's always comes out just fine.

Thanks for Reading!
Rith

Monday, September 10, 2012

Moving away from Cafepress

I recently found out that cafepress may not be the most ethical company to have produce custom Tees. Nor are they the cheapest or the fastest or have the best available print area. So, after a very brief stay with them I will be moving to skreened.com.
I was able to migrate my existing designs as well as add some new ones this evening.
The new store is located at www.skreened.com/rithstore.

Here's the latest novelty tee's that I have added.
I hope you enjoy them.
Thanks for reading!
Rith








Thursday, September 6, 2012

3D Printed Characters

I was thinking the other night.
Thinking about how I made a lot of friends, and have a lot of good memories of playing an MMORPG for the iphone, itouch, ipad.  It's called IMO The World of Magic. It's a fun Zelda like game of quests and monsters and PVP on the beach. I wish I still had time to play. But, things change, life happens.
So, here I am making a little homage to the game in my own way. I'm doing it by creating 3D interpretations of the little pixel sprites that you meet along the way. I made my first two this week.

~ Kooii ~ Level 1 Mob.
~ Dark Steel Sword ~ LVL 38 Weapon
As time goes on I would like to transform more of these 2D creatures and objects into 3D versions for the IMO community to scoop up and bring home if they like. These are rendered images.
The actual products would come in the colors and materials chosen when ordering. But, they can be hand painted once you receive them. These objects would be printed on 3D printer by a company called Shapeways. They offer a number of materials that you can have things printed in.
Check out my Shapeways store for these charms and more.

Before I go. I want to say that it was a tremendously fun game. It helped that I was in a great guild called Young on the Devilang server. Those guys were the best. It was a blast. The game is still being expanded today and is now available on the Android. Some of the people I played with over two years ago are still playing today and the guild still lives on. Look for a pro with a blue dragon mark. Tell them Rith says hi! :)




Sunday, September 2, 2012

Syd Barrett T's

It's rare that I find a shirt that I will wear that has printing on it.
I usually go for the standard white, gray or black T with nothing on it.
I thought that maybe I don't wear printed shirts because they're just not me. 
But, that's not the case. There's two shirts in my past that I wore to death. I loved them.
So, now I'm thinking I just have a hard time finding the right shirt for me. 
I'm just too picky I guess. So, with that in mind, I did up this shirt design today and put it on Skreened
I would absolutely wear this..



If you don't recognize the face. It's Syd Barrett of Pink Floyd.
I don't know if having this shirt printed violates any copyrights laws. 
I tried to do some searching, but everything I read had to do with images of people who were still alive.
In either case, if the image or Syd's likeness is copyrighted, I'll happily remove the shirt upon request.

A little history on Roger Keith "Syd" Barrett. He is best know as one of the founding members of Pink Floyd. Many credit him to be 'The' founding member, as he is credited with naming the band after two blues musicians Pink Anderson and Floyd Council. If you know that already you probably also know he suffered from  mental illness which was believed to be worsened by excessive use of hallucinogens. Many view him as one of the first casualties of the hallucinogen culture of the time.
He was not only one of the founding members of Pink Floyd, but also a Painter, and produced a few solo albums. The solo albums are still available, and are worth a listen if you like Floyd's early work. As for the surviving paintings. There doesn't appear to be a single respository for them. But, google will certainly get you plenty of results if you're interested in searching.

Thanks for reading!
Rith