Pixel Shader Tutorial
This pixel art shader has been causing quite a stir.
Learn more about it here: http://kushi.lv9.org/pixelartshader/index.html It’s in Japanese. Google Translate does a good job of turning it into English, but it’s not a perfect translation. This guide aims to show you how to use it. All credit to the creator, visit the website to learn about them, and their contact details.
The instructions are in Japanese. With online translating tools, this isn’t a big deal, but the program itself is quite hard to get started with, so let’s take a look at how to use it.
You’ll need:
- Pixel Shader v1.0.0
- Blender – I’m using 2.72b
- Windows – I’m using Windows 7
- Three button mouse helps
- Text editor.
First extract PixelArtShader_v1.0.0.zip. I use 7zip to extract zip files.
If you run “PixelArtShader_v1.0.0\PixelArtShader.exe” you’ll notice it flashes and closes. It’s actually doing a batch conversion and you’ll find a bunch of images “PixelArtShader_v1.0.0\dest”. Your new images should look like this
You’ve generated your first pixel art shader image.
Let’s say you want to adjust this.
The first step is to open “PixelArtShader_v1.0.0\config.teco” in a text editor. Here you can resolution, capture path, and the file being used to generate the images. Note that this is a .x file. It is not a regular DirectX file. You’ll need to install a plugin into Blender to export these. This plug in is provided.
Next open up “PixelArtShader_v1.0.0\sample1\config.teco” in a text editor. We’ll continue working with Sample 1.
First let’s look at the capture attribute. Using Google Translate this tells me “I want to rendering mode”.
capture true : batches the images to destination folder.
capture false : opens up a preview window. No images are saved.
Change capture to false.
Also uncomment camera_ignore_data and change its value to true.
Run PixelArtShader.exe again. You should get this window:
You can tumble around the objects using left click, middle click and right click + drag. Note, this does not save anything, just gives you a preview.
Find a camera position that suites you and note the CamPos in the top right corner. Note that in the samples config file there are two values for the camera, camera_pos(ition) and camera_lookat. This program doesn’t seem to give you both, so experiment with those values.
Part Two: Blender
Warning, I’m not a Blender user, I’m a Maya user. Please feel free to correct me on Blender specific terminology.
First, we’ll install the plugin.
Go to User Preferences.
Go to the Addons tab and click Install From File.
Choose “PixelArtShader_v1.0.0\Blender_plugin\io_export_pixel_art_shader.py” and press Install From File.
Under Categories choose User.
There should be a plugin called Import-Export: Pixel Art Shader Model Format. Click the checkbox on the very right side. You can now export custom .x files.
I’m going to edit the existing sample 1. Open “PixelArtShader_v1.0.0\sample1\src\sample1.blend” in Blender. Make some edits. I’m just duplicating some existing objects. Save the blend file and also choose file > export and choose .x. Over write “PixelArtShader_v1.0.0\sample1\sample1.x”
This isn’t framed right. In Blender I select the camera, press Numpad 0 to look through it. Adjust the view.
Note, to get the same image you see through the camera in blender, change the camera focal length here to the same as camera_fov_y in your .teco files.
This is the framing I’d like. Run the exe file again.
Here we see the framing in blender, with the output image.
Not exact. And the image sequence has no animation, but the Blender camera does. So far, I’m not sure how to use animated camera.
Let’s have a look at sample 4 that has an animated camera.
Edit “PixelArtShader_v1.0.0\config.teco”.
Comment out sample1 and uncomment sample4 like this:
// model_name "sample1\\sample1.x" // model_name "sample2\\sample2.x" // model_name "sample3\\sample3.x" model_name "sample4\\sample4.x"
So now we have a working animated camera. It seems the animation is on the camera_root node.
Here we see Andre from Super Lemonade Factory rendered with those two shaders.
And a turntable.
Those white glitches are coming from my gif program.
Editing palette.teco you can get different results.
Making your own custom materials and palettes
Step 1. You’ll need to enter the details of your palette into the file. This is very customizable but also very slow to enter values.
I have four slots set up, and it looks like this:
Double click “PixelArtShader_v1.0.0\toycar\src\MakePaletteTex.bat” to generate your “PixelArtShader_v1.0.0\toycar\palette.png” file. You can edit this file directly, but it may cause unexpected results.
I’ve decided to edit mine to look like this:
And now our result is:
But first let’s look at Blender and Materials.
There are some very important settings on your shader in Blender.
First of all, the hardness value should be an integer that matches up with the Material # that you specified in the palette.teco file.
The manual states you should have the Diffuse on Fresnel and the Specular always on Blinn.