4
$\begingroup$

I have a high resolution texture with only seven colors that I apply to a makehuman model and I want in my rendered result also just those seven colors (plus a black background).

So far I have tried to to deactivate MIP Map and Interpolation, and different filters with small filter sizes in the Image Sampling panel. However, the result is as depicted in the following image:

enter image description here

Further, I tried to deactivate the Anti-Aliasing in the Render options, but still I do not get the desired result:

enter image description here

You see that the color fades, especially on color borders. The rendered image is rather small (160x120), but also if I increase the dimension, the problem remains.

$\endgroup$
2
  • $\begingroup$ Are you using BI or cycles? $\endgroup$
    – gandalf3
    Commented Nov 19, 2013 at 19:54
  • $\begingroup$ In the current setup: BI. $\endgroup$
    – Masala
    Commented Nov 19, 2013 at 20:12

2 Answers 2

4
$\begingroup$

Deactivating AA and MipMap + Interpolation is the right thing to do. The filters are used with interpolation. The bigger the filter size the smoother the result becomes. But since you don't want any smoothness you should deactivate interpolation. That way you can forget about filters.

Nevertheless Blender seems to sample textures internally with some interpolation.

As a workaround you could use an image manipulation program like GIMP or Photoshop and reduce the colors there. In GIMP you can do it like this: Image > Mode > Indexed.

To automate this task for multiple images you can use BIMP. It is GIMP plugin which is probably already installed. You can find it in File > Batch Image Manipulation... You can use the filter called "gimp-image-convert-indexed"

$\endgroup$
5
  • $\begingroup$ Is there no way to deactivate this sampling? The GIMP solution is a bit cumbersome, especially if have a lot of images that I have to postprocess in this way. $\endgroup$
    – Masala
    Commented Nov 19, 2013 at 12:19
  • $\begingroup$ Maybe add a note about the Filter Size option as well? $\endgroup$
    – gandalf3
    Commented Nov 19, 2013 at 22:45
  • $\begingroup$ Do you mean the Filter Size option in the Image Sampling panel? There I have tried the smallest value, the largest value and this in combination with every filter - no luck. Also if I check the Minimum Filter Size the result is still not like I want it. $\endgroup$
    – Masala
    Commented Nov 20, 2013 at 7:06
  • $\begingroup$ I'm thinking a shadeless material would also help. $\endgroup$
    – sambler
    Commented Nov 20, 2013 at 9:39
  • 1
    $\begingroup$ I updated my answer for multiple image batch processing. $\endgroup$
    – Maccesch
    Commented Nov 21, 2013 at 11:50
2
$\begingroup$

You could try and make a node setup which quantizes the colors automatically, e.g:

enter image description here

Cycles

You could do this in cycles by using a mix shader to mix diffuse shaders based on your textures:

  1. Set up a material that uses black and white textures as to define which color of diffuse should be used where:

    enter image description here

  2. Set the number of samples to 1 in Render settings > Sampling:

    enter image description here

  3. Enable the Diffuse color pass in Render layers > Passes:

    enter image description here

  4. Use the Diffuse color pass as the output:

    enter image description here

As you can see, only the colors specified in the diffuse nodes are used.

$\endgroup$
7
  • $\begingroup$ I tried your approach and it does definitely restrict the colors in the output picture. Unfortunately I am somehow restricted in the colors. Further, and more problematic, at the borders I still get some other colors. $\endgroup$
    – Masala
    Commented Nov 20, 2013 at 8:56
  • $\begingroup$ @Masala You could try using an external batch image processor such as Image magick to do this. $\endgroup$
    – gandalf3
    Commented Nov 20, 2013 at 20:42
  • $\begingroup$ My current solution is to have n textures, render n times and then make a batch postprocessing with an external programm. The problem with this solution is, that the rendering process takes now of course n times longer. Is there a way to render an image with different textures in the compositor? $\endgroup$
    – Masala
    Commented Nov 21, 2013 at 6:54
  • $\begingroup$ @Masala I'm not sure what you mean.. Isn't that square one? $\endgroup$
    – gandalf3
    Commented Nov 21, 2013 at 21:52
  • $\begingroup$ Currently, I have a small Python script and one texture for one color. In the script I apply the i-th texture of n and then render the model in a loop (therefore, n renders). The question is, if it is possible to render the model just once, but apply different textures in the compositor, and have n different file output nodes. $\endgroup$
    – Masala
    Commented Nov 22, 2013 at 7:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .