27
$\begingroup$

How would I be able to create a grill of sorts found on the front of some computer cases such as this one

$\endgroup$
5
  • $\begingroup$ You mean the grid in the front or the alveolus behind ? $\endgroup$
    – Aleph
    Commented Nov 3, 2015 at 20:21
  • $\begingroup$ Basically just the air filter grills you see on the front of computer cases. the very fine grill. at the front $\endgroup$
    – Rei
    Commented Nov 3, 2015 at 20:22
  • 1
    $\begingroup$ Looks like a lot of geometry. If you want to minimize your poly-count, You're probably better off creating a flat grid in an external program (Photoshop/Gimp) with holes of alpha = 0. Make it seamless. Apply as texture. Scale so the holes are small enough. $\endgroup$ Commented Nov 3, 2015 at 20:45
  • 1
    $\begingroup$ Unless that computer is hot enough to cook a steak on, it's a grille. $\endgroup$
    – Kevin
    Commented Nov 4, 2015 at 6:46
  • $\begingroup$ @Kevin I've personally never seen that variant before. It seems both spellings are applicable $\endgroup$
    – gandalf3
    Commented Nov 4, 2015 at 9:58

6 Answers 6

59
$\begingroup$

Here's a way to do this using modifiers:

  1. Add a circle (⇧ ShiftA> Mesh > Circle) and set the number of Vertices to 6 in the redo panel to make a hexagon:

enter image description here

Take note of the X dimension of the object. With the default radius of 1 it should be 1.732:

enter image description here

  1. Add an Array modifier with a relative offset of .5 and .75 to create a tile-able section with two offset hexagons:

enter image description here

  1. Add an array modifier to tile the object along the X axis.

Note the X dimension of the object now with the modifier. It should be equal to 1.5 * original_x (2.598 with the default radius):

enter image description here

Set the relative X offset of the array modifier to original_x / (1.5 * original_x), or .666...:

enter image description here

  1. Add yet another array modifier to tile the object along the Y axis, with a Y offset of .857, or (1.5 * original_y) / modified_y.

  2. Increase the Count of the last two array modifiers as desired:

enter image description here

  1. Now you have a wireframe, but it needs thickness. Switch to edit mode (↹ Tab), select all (A) and extrude (E). Cancel the transform part of the extrude (Esc) and scale down (S):

enter image description here

  1. Enable Merge on all the array modifiers.

  2. Add a solidify modifier (and optionally a bevel modifier):

enter image description here

In case you might want something more rounded, you can adjust the angle limit on the bevel modifier and toss a subsurf modifier on the end:

enter image description here

$\endgroup$
8
  • $\begingroup$ Nice technique ! (even if actually the initial question was about the grid from the front on the image, & not the "alveolus" one, which the edited title has overlapped :) - actually the "weaved" wasn't so bad to describe it) $\endgroup$
    – Aleph
    Commented Nov 4, 2015 at 1:11
  • $\begingroup$ @Aleph I'm not quite sure what grid you're referring to.. When I think of "weaved" I think of something like this, but I don't see anything quite like that in the OP's image. $\endgroup$
    – gandalf3
    Commented Nov 4, 2015 at 1:42
  • $\begingroup$ I don't know, maybe you're right, in fact there's two grids on the ref image, and the one front the front ground is so thin that I can't clearly see its shape. $\endgroup$
    – Aleph
    Commented Nov 4, 2015 at 9:46
  • $\begingroup$ @Aleph When zoomed in it looks to me distinctly hexagonal, with rather beveled bars. $\endgroup$
    – gandalf3
    Commented Nov 4, 2015 at 18:53
  • 2
    $\begingroup$ Excellent tutorial! Provides a lot of room for customisation. Note: On Blender 2.93 for the Solidify modifier, I had to choose the Complex instead of the Simple method to get there, otherwise I would have gotten uneven solidified edges. $\endgroup$ Commented Aug 26, 2021 at 11:55
29
$\begingroup$

Lazy me going for the shortcut again...

Enable add mesh extra objects (Access the system preferences with Ctrl Alt U):

enter image description here

Then just press ShiftA Add->Mesh->Extras->Honeycomb

enter image description here

And set the controls in the toolshelf to something that suits for your project.

enter image description here

enter image description here

$\endgroup$
24
$\begingroup$

EDIT : I just realised that I hadn't included the .blend file for this (I had intended to... why did nobody mention it ;-) ) making it a whole lot of effort to replicate it to use in your own projects!

Anyway, here it is :


I realise that there are already 4 answers to this question but they all address it by creating it as new geometry. I wanted to provide a different approach by using a procedural texture to give the appearance of the grill. In this way we only need to add a single plane - rather than geometry for each individual cell of the grill.

Here's the final result :

Final Result

This answer https://blender.stackexchange.com/a/67654/29586 developed a material that defined the cells of a regular hexagonal grid. It produces two outputs - a measure of the distance to the edge of a hexagonal 'cell' (used to drive the Strength of the Emission shader in the original solution) and the Vector coordinates of the centre of the corresponding cell (used as the input to a Noise Texture to generate colors of the cells in the original solution). The following Node Group takes this a stage further by also providing the distance to the centre of the cell, the distance to the centre of the next closest cell and the Vector coordinates of the next closest cell.

Node Group external Node Group internal

By using the Edge Distance to mix between a Transparent and Diffuse shader we can produce the following simple effect :

simple grid material simple grid

For a more convincing grid we need to add depth. For a ray to pass through the grill it would need to pass through the 'hole' at the surface and out the corresponding hole on the other side. The depth of the grill will determine how perpendicular the ray must be to be able to pass through the surface. To achieve this we can use two identical hexagonal grids - one to represent the 'top' surface of the grid and the second to represent the bottom surface of the grid. The path of each ray can then be determined by considering how it interacts with each of those grids.

edge view ray passing through

By 'sliding' the second grid to the side based on the angle of the ray and the depth of the grill we can simulate where it would be when the ray reaches the 'bottom' of the grid. In a 'real' grill the ray will only pass through if it is at a steep enough angle to pass through the top and bottom surfaces. The calculation of the position of the second grid can be done as shown below :

bottom grid offset calculation

There are two parts to this calculation. The first part (top row) determines the direction of the offset parallel to the surface. This is achieved with a pair of Cross Product nodes. The first combines the Incoming ray with the Normal to generate a ray parallel with the surface but at right-angles to the incoming ray. The second Cross Product flips it around the Normal again - by 90 degrees - so it is along the line of the incoming ray (but still parallel to the surface). The bottom row of the calculation determines the magnitude of the required offset based on the incoming angle (determines via the Dot Product with the Normal) and the set Thickness of the grill. The results of these branches are Multiplied together to give the required offset.

The following image shows the interesting regions based on where it strikes the top and bottom grids.

colored regions

The colors represent the following :

  1. White - The ray is close to a top cell 'edge' and so has hit the top surface of the grill
  2. Red - The passes through one cell on the surface but would be 'out' of a different cell - ie, it must have hit the side of a cell.
  3. Green - The ray is close to the cell 'edge' on exiting the grill and so has still hit the side of the cell (but almost got through)
  4. Blue - The ray enters through one cell and exits through the corresponding cell in the other grid - ie, it's passed all the way through.

Shading the White region with one material for the surface of the grill, Red and Green with another for the edges of each 'hole', and Blue as Transparent we get the following result :

simple hex grid with depth

The above material does produce more convincing results - especially in the way more oblique angles result in less light passing through the grill - but the surfaces are still 'flat'. To improve this further we can generate Normals based on where the grill is struck - ie, on an inside edge it will be angled parallel to the surface (perpendicular to the side of the 'cell') while on the top surface (the edge of a cell) it will be closer to the surface Normal. In addition, we can add a curve or bevel to the top surface of the cells.

To achieve this we can use the following material :

final material

Note the calculation of the Normal using a combination of the Cell Vector and 2nd Cell Vector to determine the direction of the Normal of the corresponding cell wall. The Vector Transform node is used to transform the calculated Normal (which will be in Object space) into World space as required for the Normal passed to the Shader.

And this produces the following results :

final results

The material can be used on more complicated shapes - although, as it stands, care needs to be taken since the calculated Normal for the inner edges and upper surface of the cells does not take the actual surface normal into account (I'm sure this could be improved by tweaking the calculation but haven't yet had the chance to look into it in much depth). However, it still produces reasonable results as shown with this 'wireframe' Suzanne.

suzanne_animated

Limitations

Note that the shading on the edges of the cells isn't perfect - it can produce odd results with thick grills when viewed at an oblique angle - where the calculated normal is miscalculated as the wrong edge. This is due to the 'second nearest' being the incorrect cell to use for the angle of the ray and is difficult to correct for as it is dependent on the 'depth' through the grill where the ray hits the side. The problem is illustrated by this image :

bad edges

The result is sufficient for this slight discrepancy to not be generally noticable but if anyone has any suggestions on a way to address this then please do let me know! One potential solution is to calculate the depth at the point the ray hit the cell and to position a third hex grid at that depth to determine which cell boundary is most relevant. However, this would have an impact on efficiency as the hex grid is already quite computationally intensive.

Another limitation is that currently the Normal calculation assumes that the surface is oriented in the X/Y plane. For more complicated surfaces (such as Suzanne), this is not always the case and the calculated normals may produce odd results (such as when viewed from behind). This is generally not noticable but can result in incorrect lighting and/or incorrect reflections - especially on the 'internal' surfaces of the cells. Also, this means it is not suitable to UV unwrapped meshes (stick to Generated or displaced Object coordinates).

Note also that nodes that generate the hexagon pattern require positive X/Y coordinates only. When using Object coordinates (or any other coordinates that could result in negative values), use a Mapping node to shift the coordinates a suitable amount to make sure they're always positive.

$\endgroup$
1
  • 1
    $\begingroup$ That is brilliant - I was looking for something like this a while back. Thanks! $\endgroup$ Commented Mar 16, 2021 at 17:17
1
$\begingroup$

Ok, one solution, for creating a simple grid. If you need a grid which will be filmed from close up, it'll need more tweaks. But for a quite simple one: create a Plane, Subdivide it once, select the center vertex.

enter image description here

Still in edit mode, hit Space, select Bevel, and fill the settings like in the image below:

enter image description here

Delete the faces selected:

enter image description here

Select all the inner vertices, and hit Space> To Sphere, to make it round shaped:

enter image description here

enter image description here

Now you have your basic hole shape. in Object mode apply 2 Array modifiers to it, one for the vertical repetition, one for the horizontal one

enter image description here

and you have your (simple) grid !

$\endgroup$
6
  • $\begingroup$ Using the bevel made no changes to the mesh at all $\endgroup$
    – Rei
    Commented Nov 3, 2015 at 20:48
  • $\begingroup$ you must be in edit mode, and then set up the config on the left panel, as it is shown on my 2nd image, surrounded in red. If my explanation has been helpful, feel free to accept the answer :) (blender.stackexchange.com/help/someone-answers) $\endgroup$
    – Aleph
    Commented Nov 3, 2015 at 21:00
  • $\begingroup$ Still nothing i dont even have the loop slide option $\endgroup$
    – Rei
    Commented Nov 3, 2015 at 21:05
  • $\begingroup$ wich version of blender? $\endgroup$
    – Aleph
    Commented Nov 3, 2015 at 21:29
  • $\begingroup$ Im using version 2.75 $\endgroup$
    – Rei
    Commented Nov 3, 2015 at 21:30
1
$\begingroup$

Using geometry nodes:

  1. Shift-A -> Mesh -> Extras -> Honeycomb

(make sure you have "extra objects" enabled in add-ons)

enter image description here

enter image description here

  1. Add a plane and a geometry modifier with this node setup:

enter image description here

  1. add a solidify modifier

enter image description here

result:

enter image description here

$\endgroup$
3
  • $\begingroup$ Honeycomb is not one of the base meshes of Blender. You should edit your answer to include instructions on how to add that into Blender. $\endgroup$
    – Diti
    Commented Jan 9 at 12:06
  • $\begingroup$ i updated my answer $\endgroup$
    – Chris
    Commented Jan 9 at 14:22
  • $\begingroup$ Thank you! It will be very useful for users of Kiwix (offline blender.stackexchange.com), for they can immediately implement your (good) solution without having to search (and struggle with Kiwix’s search)/troubleshoot why there is no honeycomb mesh by default! $\endgroup$
    – Diti
    Commented Jan 10 at 12:37
0
$\begingroup$

Here's what you can do:

Make a plane, subdivide (Simple subdivision)
Make a cylinder (or any shape you want to punch out of the plane)
Apply scale to both plane and cylinder
Make cylinder child of plane
Set plane to duplicate faces (serach for duplifaces)
Select plane
Press spacebar -> Make Duplicates Real
Select all objects that were created, Join them (spacebar -> Join)
Add Boolean Modifier (Difference) to plane, set it to subtract the "holes'" solid
Apply subdivision
Apply Boolean

$\endgroup$
2
  • 2
    $\begingroup$ How do i make the cylinder a child of the plane and how do i set it to duplicate faces? $\endgroup$
    – Rei
    Commented Nov 3, 2015 at 20:39
  • $\begingroup$ Switch to object properties (cube icon, in the same set where the modifiers tab is). To set a parent select Cylinder and then Plane in Object Mode and press Ctrl+P, or you have a "Parent" voice under the "Relation" dropdown. To duplicate faces you have a "Duplication" dropdown, where you can select wether to duplicate None, Frames, Verts, Faces or Group $\endgroup$
    – torels
    Commented Nov 3, 2015 at 22:55

You must log in to answer this question.

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