# Halftone pattern in Blender - Update

**URL:** <https://blenderartists.org/t/halftone-pattern-in-blender-update/1136023>\
**Category:** Materials and Textures\
**Created:** [November 27, 2018, 9:16pm UTC](https://blenderartists.org/t/halftone-pattern-in-blender-update/1136023 "2018-11-27T21:16:16Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![PierreSchiller](https://blenderartists.org/user_avatar/blenderartists.org/pierreschiller/32/1024999_2.png) [@PierreSchiller](https://blenderartists.org/u/PierreSchiller)\
**Post date:** [November 27, 2018, 9:16pm UTC](https://blenderartists.org/t/halftone-pattern-in-blender-update/1136023/1 "2018-11-27T21:16:16Z")

</div>

Hi. I just found out this:  
[https://forums.tigsource.com/index.php?PHPSESSID=gefqvt9ff14ck2dq7461ld2d33&topic=40832.msg1363742#msg1363742](https://forums.tigsource.com/index.php?PHPSESSID=gefqvt9ff14ck2dq7461ld2d33&topic=40832.msg1363742#msg1363742)

We´ve seen some pretty amazing tutorials on CG Cookie on how to do stylized pattern shaders.  
But this approach about fixing the pattern to the camera grabbed my attention.  
How could we translate this into Blender shading network? (Mapping with a “view at” camera?)  
Thanks.

---

<div class="post-metadata">

**Author:** ![cgCody](https://blenderartists.org/user_avatar/blenderartists.org/cgcody/32/530637_2.png) [@cgCody](https://blenderartists.org/u/cgCody)\
**Post date:** [November 27, 2018, 10:22pm UTC](https://blenderartists.org/t/halftone-pattern-in-blender-update/1136023/2 "2018-11-27T22:22:04Z")

</div>

Could be interesting to experiment with the idea. I think you could get some interesting effects with either the reflection tex co-ords, or maybe mapping the normals to the camera through a vector transform.

However, that’s not going to get you the pixelization at the edges of, and between, objects. So a better approach might be to render out a grayscale scene, then use compositing to map a bayer matrix to the different shade values.

---

<div class="post-metadata">

**Author:** ![cgCody](https://blenderartists.org/user_avatar/blenderartists.org/cgcody/32/530637_2.png) [@cgCody](https://blenderartists.org/u/cgCody)\
**Post date:** [November 29, 2018, 7:51am UTC](https://blenderartists.org/t/halftone-pattern-in-blender-update/1136023/3 "2018-11-29T07:51:44Z")

</div>

I’m not sure if you’re still interested in this, but I found it intriguing and had a little free time tonight. I only tested out the display portion so far, though the motion shouldn’t be too hard to work out following the same methodology in your link.

I started with compositing, which was dead simple. Then tried a shader only version just for kicks. The problem with going shader only (aside from what I said above) is that there is no way to take the shadow gradation into account. At least none that I can think of. Thus I used the ray length and AO to generate some usable values.

post processing:

 ![dither_post](https://blenderartists.org/uploads/default/original/4X/c/a/3/ca3b090ad1322b36929d1b45712daef3ec279443.jpeg)

shader only:

 ![dither_shader](https://blenderartists.org/uploads/default/original/4X/8/0/d/80d6cd5dbe158878ee5c9008b91311ab8753cc27.jpeg)

dither pattern used (scaled up)  
 ![dither_tile](https://blenderartists.org/uploads/default/original/4X/2/6/0/260c5793b454ad46cf111b41314c0a37c0a1edc2.png)

---

<div class="post-metadata">

**Author:** ![PierreSchiller](https://blenderartists.org/user_avatar/blenderartists.org/pierreschiller/32/1024999_2.png) [@PierreSchiller](https://blenderartists.org/u/PierreSchiller)\
**Post date:** [November 29, 2018, 10:59am UTC](https://blenderartists.org/t/halftone-pattern-in-blender-update/1136023/4 "2018-11-29T10:59:07Z")

</div>

W00 my mind!! This is superb! How is this not good?! It´s perfect!  
The first image is this effect done in the compositor, and the second image, is created at shader level, correct? OH my this is sweetness!  
Okay, just like the original link document mentioned, the problem is that the camera will move the pattern axis, and it somehow needs to be locked to the camera angle fov. That´s going to be interesting to setup.  
I have no clue right now. I´m on deadlines, but I´d love to try this setup urgently!  
Great work.  
I guess a Lightpath (Is Camera ray) using some fov math could solve the camera movement?

---

<div class="post-metadata">

**Author:** ![cgCody](https://blenderartists.org/user_avatar/blenderartists.org/cgcody/32/530637_2.png) [@cgCody](https://blenderartists.org/u/cgCody)\
**Post date:** [November 30, 2018, 1:13am UTC](https://blenderartists.org/t/halftone-pattern-in-blender-update/1136023/5 "2018-11-30T01:13:10Z")

</div>

hehe Thanks. It’s a fun little exercise.

> [@PierreSchiller](#):
>
> The first image is this effect done in the compositor, and the second image, is created at shader level, correct

Correct.

I’ll have to ponder on the movement a bit. For the shader only version, I’m thinking the camera angle/fov math explained in the link might work to just directly plug into window texture coordinates. As for the post version, I don’t think there’s a way to translate the texture in the compositor, so I’m thinking a second render pass with the pattern mapped to a sphere.

In the meantime, I experimented with some other dither patterns. I think the Bayer matrix still looks the coolest, though.

Bayer:

 ![ren_bayer](https://blenderartists.org/uploads/default/original/4X/c/f/9/cf93959cf387fbe1b9fd8a7f41834b9c35345ff9.png)

Blue noise:

 ![ren_blue](https://blenderartists.org/uploads/default/original/4X/a/1/0/a107979ba0a3d967636fbff183905d8444121bb1.png)

Halftone:

 ![ren_halftone](https://blenderartists.org/uploads/default/original/4X/1/6/d/16da2450dc70dd62c1918672ec4d44765fcc4fb4.png)

---

<div class="post-metadata">

**Author:** ![PierreSchiller](https://blenderartists.org/user_avatar/blenderartists.org/pierreschiller/32/1024999_2.png) [@PierreSchiller](https://blenderartists.org/u/PierreSchiller)\
**Post date:** [November 30, 2018, 9:27am UTC](https://blenderartists.org/t/halftone-pattern-in-blender-update/1136023/6 "2018-11-30T09:27:54Z")

</div>

yes, shader view dependant. Oh man! Awesome progress!!

---

<div class="post-metadata">

**Author:** ![cgCody](https://blenderartists.org/user_avatar/blenderartists.org/cgcody/32/530637_2.png) [@cgCody](https://blenderartists.org/u/cgCody)\
**Post date:** [December 2, 2018, 2:20am UTC](https://blenderartists.org/t/halftone-pattern-in-blender-update/1136023/7 "2018-12-02T02:20:21Z")

</div>

I was going to sit down and play with this some more, but I really gotta learn to stop procrastinating on my own projects! haha

Here are the tiles of the 3 patterns if you want to play around with them, David. Just use the mapping node to tile them to the render size. And I’d love to see an update in the thread if you find the time to come up with something interesting. 🙂

Bayer: ![bayer_tile](https://blenderartists.org/uploads/default/original/4X/0/7/8/0781c5cec223fd9d4e1aebd05a92df62e04bb478.png)  
Blue: ![blue_tile](https://blenderartists.org/uploads/default/original/4X/d/d/4/dd4407ff02174e64d3f23b561d499e92b6bd899d.png)  
Halftone: ![halftone_tile](https://blenderartists.org/uploads/default/original/4X/f/d/b/fdb2453dc3e6c143d91e6c6c5634fa0a8c9a8f09.png)

---

<div class="post-metadata">

**Author:** ![robnamnam](https://blenderartists.org/user_avatar/blenderartists.org/robnamnam/32/534549_2.png) [@robnamnam](https://blenderartists.org/u/robnamnam)\
**Post date:** [July 27, 2020, 9:57am UTC](https://blenderartists.org/t/halftone-pattern-in-blender-update/1136023/8 "2020-07-27T09:57:08Z")

</div>

Hey guys,  
I came across this thread, very inspiring, thank you.  
I wonder if any of you made any progress in understanding a way to take lighting and shadows into account at shader level.

---

<div class="post-metadata">

**Author:** ![lone\_noel](https://blenderartists.org/user_avatar/blenderartists.org/lone_noel/32/1034238_2.png) [@lone\_noel](https://blenderartists.org/u/lone_noel)\
**Post date:** [July 27, 2020, 2:27pm UTC](https://blenderartists.org/t/halftone-pattern-in-blender-update/1136023/9 "2020-07-27T14:27:48Z")

</div>

Do you mean as in translating the shadow on the object into the halftone pattern?

That can be done using the _Shader to RGB_ node in Eevee. You can see some examples in this thread:

> [@Experiments with NPR/Toon shading in Eevee](https://blenderartists.org/t/experiments-with-npr-toon-shading-in-eevee/1139213):
>
> I’d like to share some details about my humble npr shading experiments during the recent weekend challenge. smiley The concept is actually pretty simple, but it can yield quite interesting results. Note: These shaders can only work with Eevee cus “Shader to RGB” node is not supported by Cycles. Default diffuse shader for reference: Basic toon shader with predefined color stops: Procedural colors based on a light source: And finally noise texture …

---

<div class="post-metadata">

**Author:** ![robnamnam](https://blenderartists.org/user_avatar/blenderartists.org/robnamnam/32/534549_2.png) [@robnamnam](https://blenderartists.org/u/robnamnam)\
**Post date:** [July 27, 2020, 4:31pm UTC](https://blenderartists.org/t/halftone-pattern-in-blender-update/1136023/10 "2020-07-27T16:31:59Z")

</div>

Thanks a lot for pointing me there, very interesting study and answers pretty much my question. 😃

---

<div class="post-metadata">

**Author:** ![robnamnam](https://blenderartists.org/user_avatar/blenderartists.org/robnamnam/32/534549_2.png) [@robnamnam](https://blenderartists.org/u/robnamnam)\
**Post date:** [July 29, 2020, 10:46am UTC](https://blenderartists.org/t/halftone-pattern-in-blender-update/1136023/11 "2020-07-29T10:46:14Z")

</div>

I finally had some time to experiment further with this.  
Really interesting topic the one of the dithering and matrix color remap.  
I have a question about the technique showed by @cgCody  
From my understanding the value of grey should be processed and once assessed that they are greater than a certain value of grey, outputted as black or white following the bayer matrix. While rendering in cycles though, i notice that some of the “pixels” still are shaded grey (see reference)

 ![image](https://blenderartists.org/uploads/default/original/4X/b/d/f/bdf7d9543dfbe401d9c3a8344d6d3eb7d487a706.png)  
 ![image](https://blenderartists.org/uploads/default/original/4X/2/1/c/21c4e9ccc1d86443a4b5133e2e81962a8ceafa64.jpeg)  
 ![image](https://blenderartists.org/uploads/default/original/4X/e/3/d/e3debf2e48cd46c29c85bffc0541371cffa73782.png)

Does anybody have any idea bout this? for me would be very important that the output render would exclude anything outside the dual tone that i am targeting with the color ramp.

---

<div class="post-metadata">

**Author:** ![lone\_noel](https://blenderartists.org/user_avatar/blenderartists.org/lone_noel/32/1034238_2.png) [@lone\_noel](https://blenderartists.org/u/lone_noel)\
**Post date:** [July 29, 2020, 2:40pm UTC](https://blenderartists.org/t/halftone-pattern-in-blender-update/1136023/12 "2020-07-29T14:40:41Z")

</div>

At what resolution are you rendering? Especially compared to the dithering pattern you’re using.

When zooming in on your first image you can see that the pixels of the dithering pattern are not just one shade but are basically dithered themselves.

 ![Screenshot_20200729-161831~2](https://blenderartists.org/uploads/default/original/4X/8/1/d/81df603f600693561ea214bf644b14051a03b232.jpeg)

This probably happens because the Shader is evaluated for each pixel.

My first idea would be to render at a resolution so that every pixel in your dither pattern matches a pixel in your rendering and then upscale the image afterwards.  
You would loose the smooth silhouettes of the meta balls though, which would be kind of a shame.

One (pretty bad and roundabout) way to maybe keep the silhouettes could be to render the Shader without the dithering, pixelate it, map it onto the object using the window coordinates and then dither it. That could result in artifacts on the edges though.

EDIT: I’m positive the dithering while keeping the silhouette is possible with Eevee. Though Eevee doesn’t have the Light Path or Ambient Occlusion Node…  
I might experiment with this later, as it seems like an interesting problem.

EDIT 2: Turns out the shader that I thought was doing this in Eevee was actually just mixing different dither patterns based on the Value of the shader. That leads to cut off pixels, though. (If you use enough samples, I think your approach should converge to similar cut off pixels)

 ![](https://blenderartists.org/uploads/default/original/4X/6/0/9/6098bd2f1ce7a5fe7762447a1e3c66c2e213f020.png)  
Found it on [reddit](https://www.reddit.com/r/blender/comments/bkzkyx/pixel_shader_28_toon_pack_update_link_in/).

---

<div class="post-metadata">

**Author:** ![robnamnam](https://blenderartists.org/user_avatar/blenderartists.org/robnamnam/32/534549_2.png) [@robnamnam](https://blenderartists.org/u/robnamnam)\
**Post date:** [July 30, 2020, 6:16am UTC](https://blenderartists.org/t/halftone-pattern-in-blender-update/1136023/13 "2020-07-30T06:16:57Z")

</div>

> [@lone\_noel](#):
>
> EDIT: I’m positive the dithering while keeping the silhouette is possible with Eevee. Though Eevee doesn’t have the Light Path or Ambient Occlusion Node…  
> I might experiment with this later, as it seems like an interesting problem.

Yes, exactly my same conclusion. It kind of work with eevee, but some parts of the pattern interrupt abruptly + the AO node does not lead to any results. I am gonna experiment a bit with your first idea because besides loosing the smoothness of the MBs sounds like making a lot of sense!

Thanks for taking the time, keep you posted with updates!

---

<div class="post-metadata">

**Author:** ![Fatesailor](https://blenderartists.org/user_avatar/blenderartists.org/fatesailor/32/590_2.png) [@Fatesailor](https://blenderartists.org/u/Fatesailor)\
**Post date:** [December 21, 2020, 12:15pm UTC](https://blenderartists.org/t/halftone-pattern-in-blender-update/1136023/14 "2020-12-21T12:15:59Z")

</div>

I found this thread searcing for some way to produce hatching shading in Cycles. Very interesting discussion. The question that arises seeing such discussions, however, is why the developers do not implement a ‘shader to rgb’ like node for Cycles too.
