For those of you who are not familiar with which part of the Enterprise is the Impulse Engines, it's the red parts:

enter image description here
Google Images

The photo doesn't display it great, but it should help get the point across. The Impulse Engines are a multiple squat little hexagons separated by thin strips silverish, hull-colored strips. Each hexagon emits light and is a slightly different Saturation (think HSV color definition) of red. If this were a gif, you would see that the Saturation changes overtime for each hexagon, so it appears that they twinkle.

enter image description here

Seeing as I would love to not have to model each little hexagon and add a different material for each, I would love if someone could figure out a material that looks similar to these.

A .blend for you to play with:

  • 1
    $\begingroup$ Instead of assigning a different material to all of them, use a single material and a texture to control the intensity (or color). See this two related posts: blender.stackexchange.com/questions/47375/… and blender.stackexchange.com/questions/39508/… by changint the coordinates for the mapping (you can even use an emptpy to control the texture) you can easily make each one of them light up in different intensities or color. $\endgroup$
    – user1853
    Commented Oct 30, 2016 at 19:36
  • $\begingroup$ @cegaton I am familiar with these two posts. Thanks for reminding me of them. In fact, I was already thinking along the lines of one material (see my title). Do you know any posts that would provide for the lines between the hexagons? Or how to separate the colors into hexagons? Would you consider writing an answer? Thanks again. $\endgroup$
    – Shady Puck
    Commented Oct 30, 2016 at 19:41
  • $\begingroup$ You can create hexagons with the honeycomb addon blender.stackexchange.com/questions/40997/… $\endgroup$
    – user1853
    Commented Oct 30, 2016 at 19:45
  • $\begingroup$ @cegaton Sorry for being unclear. I meant purely with nodes for my material. $\endgroup$
    – Shady Puck
    Commented Oct 30, 2016 at 19:46
  • 1
    $\begingroup$ No worries - just thought I'd better let you know. I also had to tone down the subdivision surface modifier as I'm running on only 2gb memory and that was a bit high. Nice starship model :-) $\endgroup$ Commented Dec 4, 2016 at 21:41

3 Answers 3


This problem has been a really interesting one to work on. At the start I didn't think this would be possible with 'pure' Cycles nodes - without resorting to OSL - but was surprised to discover it is. I've certainly learned a lot along the way.

Here's the material :

Final Animated

Impulse Engines (not animated) (glare added in compositor)

And here's the node tree (click to enlarge) :

Full Material

The pattern can be generated by measuring the distance of each point being sampled to each of a number of fixed reference points in a similar way to how the Voronoi texture is produced. By carefully positioning the reference points we can generate a hexagonal pattern.

Starting with a single reference point (held in a Combine XYZ node), the vector between the reference point and the texture coordinate can be calculated simply by subtracting one from the other using a Subtract Vector Math node. This is passed into both inputs of a Dot Product Vector Math node to generate a scalar distance (actually 'distance squared').


This structure can be replicated for multiple reference points and the results of each combined using a Minimum node. This will effectively return the distance (squared) to the closest reference point.

Multiple points

Greater Than nodes can then be used to compare each individual output with this combined 'Minimum'. This will produce 3 outputs that will be '0' if the corresponding reference point is the closest, otherwise '1'. These values are also passed through Subtract nodes to invert their output. We now have two sets of 'mask' outputs - one set that's 0 if the corresponding reference point is the closest, another that is '1' if the corresponding reference point is closest.


To be able to control the edges of the cells (rather than having a gradient emanating from the centre) we need to be able to detect the boundary between one cell and the next. The boundary occurs at the point where the distance to one cell equates to the distance to the next closest cell. This can be achieved by determining the minimum distance to all of the reference points excluding the one we already know to be closest. Subtracting the closest distance from the next closest will give a measure of the distance to the cell boundary - this will be zero at the boundary (where the distance to each reference is the same) and increase as we move further towards the centre of a cell. For the first reference point we can do this as follows :


Note the multiplication by the mask - this is to ensure that each value is only used when the point being measured is closest to the corresponding reference point - the output will be zero outside the corresponding cell.

Replicate a similar structure for each of the other reference points - in each case this will need to combine the outputs from all reference point distances of the other reference points excluding the one corresponding to the 'current' one - which we know will be the actual minimum if the mask will include that point - ie, the first combines 2 and 3, the second 1 and 3, the third 1 and 2. Since each of the resultant outputs are masked to zero when the sample is outside its cell we can simply combine them all as shown :

Multiple Edges

To be able to colour the individual cells we need to be able to determine the vector coordinates of the corresponding reference point. Again we can use the masks to pick out the relevant value for the closest reference and these can be simply combined to produce a single vector. In this case, the 'anti-mask' (set to 0 where that reference point is closest, otherwise 1) is most useful as it can be used in a Multiply Colour node to multiply the vector by zero when it is not the closest, otherwise allow the vector through unchanged.

Cell Vector Colouring

For a hexagonal pattern we need to position the reference points in a grid representing the centres of the cells. By calculating only those reference points that are closest to the point being sampled we can re-use the above nodes to cover the whole texture space. This would technically be possible with only 3 reference points but becomes much simpler if we replicate the node structures to work with 5 cells at a time.

To position the cells, the 'grid' coordinates are determined by dividing the texture coordinate by the horizontal and vertical pitches (chosen as 1.5 and 0.866 to generate the correct spacing for regular hexagons) and rounded down to integers. Modulo 2 is used (which returns '0' for even rows and '1' for odd rows) to determine the Row Type and Column Type to allow alternating rows to shift across in the hexagonal pattern.


Once the location in the grid is known, the Generate Point Coordinates Frame calculates the locations of the "nearest" reference points. These are multiplied by the Horizontal and Vertical pitch to get coordinates that can be used with the current sample point to determine the distances. This can be illustrated as follows with the current sample point indicated in white with the 5 nearest cells shown :

Dynamic Reference Points

The cell border can be adjusted via the Edge Offset and Edge Power values. Larger Offset results in thicker borders to the cells while the Power affects the hardness of the cell edge. Negative values can give some interesting effects (eg, Offset = -0.5 with Power = 1.0 provides a quilted effect with soft borders, while a small positive Offset and Power 0 gives hard narrow lines between cells).

Edge Adjust quiltedline border

For the cell colours, a noise texture is used to generate a value between 0 and 1 based on the cell vector and this is multiplied up and passed through a Modulo 1 node to generate a (mostly) linear distribution. An Offset is added to allow it to be animated and the result passed through a further Modulo 1 so that the value wraps around at the edges of the 0 to 1 range. This is then passed through a colour ramp to generate the final shade for each cell. Using the cell coordinate as a basis for this colour generation ensures each cell is coloured consistently.


The maths used to manipulate the grid and dynamically position the reference points works fine with positive coordinates - so plain old 'Generated' coordinates should work well. However, switching to Object coordinates will result in negative values which upset the calculations. To work around this you need to increase the Location of the Mapping node to avoid the negative texture coordinates.

Blend file attached.

  • $\begingroup$ Amazing work! There is something that's bothering me. With bigger scale, for example 50, 50, 50, whole thing looks just like diagonal stripes going from left to right. Not so random. $\endgroup$
    – cgslav
    Commented Nov 20, 2016 at 22:06
  • $\begingroup$ Thanks :-) Just tweak the constants in the Multiply nodes in the top-right frame. Those are the random number generator 'seeds'. Alternativey, use a more sophisticated random number generator. $\endgroup$ Commented Nov 20, 2016 at 22:12
  • $\begingroup$ it's not my question, just an observation :) Honestly I don't understand 1/3 what's happening there. $\endgroup$
    – cgslav
    Commented Nov 20, 2016 at 22:16
  • 1
    $\begingroup$ Updated answer to include details of how this is achieved. $\endgroup$ Commented Dec 3, 2016 at 0:19
  • 1
    $\begingroup$ @RichSedman Truly unbelievable. This is so complex but works so well! I have not finished yet, but will send a picture when I do. This has helped me advance so much! $\endgroup$
    – Shady Puck
    Commented Jan 10, 2017 at 3:08

this is just a self contain version of the previous post.that should be easier for beginners with blender.

the node group


you can simulate this with textures, via nodes: Prepare several image files (better PNG because they can store transparecy) with the pattern you want (hexagons, squares,...). Those several images will need to be sequencial (change colour between them - example, you extract the frames from your hexagon's GIF file). After all PNG's are ready, you select the faces where you want these images to be applied, and while in Edit mode, press U to UV unwrap them. Unde UV Image Editor, Edit vertices and faces position to match as you want your image sequence. On nodes, instead of importing an ordinary image texture, you import an image sequence (these way you have control on lights on/lights off you made on your PNG files). You can also add an emission shader, and keyframe diffent values of strength in time, so it changes the intense of brightness of those lights. You might try with this node setup sample:enter image description here


You must log in to answer this question.

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