Dynamic ceiling height display with Blender 3.0 Geometry Nodes

Blender 3.0 Do not use in production :) is right around the corner and with it the Geometry Nodes V2.0 project so I thought I'd revisit one pet peeve of mine : Dynamic ceiling height calculation and display.
Here's what we will be making today :

We'll use the Raycast node to determine the room height at a given point.
The scene tree will look like this :
One collection for the dimensions, one for the floor objects, and one for the ceiling objects.
Ideally the dimension object is a mesh object with no geometry (delete everything in edit mode or use the Add > Mesh > Single Vert > Object Origin Only after enabling the "Add Mesh - Extra Objects" addon).
The scene will look like this :

It doesn't matter where the dimension is located, as long as it is higher than the floor mesh object. We could make it work in any case but for now we'll keep the node tree as simple as possible.

  1. Instance a single vertex at the object dimension position :
    The Raycast node works with geometry so we need at least one vertex to calculate ceiling height. Don't forget to set the Object Info node mode to Relative or else all calculations will be done as if it was placed at world origin.

    In the modifier settings, set the object to the dimension object.

    Currently it's not possible to access the object holding the modifier in the GN tree so we use this technique to access its position. This is nice because the reference is automatically updated when we duplicate the dimension object.

  2. Project the dimension on the floor :

    First we instantiate the whole Floor collection so all the mesh objects are taken into consideration. We realize the instances because of technical reasons. The Raycast node will fire a ray downward (Ray Direction = (0, 0, -1)) as far as 100 meters. Don't forget to set the Collection mode to relative, for the same reason as the Object Info one. When and if it hits the Target Geometry, a number of attributes will be available and can be accessed at will. This is where the Geometry Nodes Fields overhaul shines. We just need to access the Hit Position to place our dimension on the floor exactly below the object original location. Here's a short clip were I instantiated a Suzanne on the point to show what's going on. Basically we recreated the Shrinkwrap modifier :

  3. Project the dimension on the ceiling :
    Now that we made sure the base point is on the floor, we'll project it upward until it hits the ceiling. Notice we changed the ray direction to UP (0, 0, +1).

  4. Capture the ceiling height :
    We're going to use another great feature of the fields in GN : The Capture Attribute node which lets us write a field attribute on a given mesh domain. We want to write the Hit Distance (aka the ceiling height) to each point of the mesh. Since we have only one vertex, we'll add only one attribute. We can see what's up inside the geometry data with a Viewer node. We'll see a bit later why this bit is important.

    We can see here that we have added an anonymous attribute with a float value, which happens to be our ceiling height at that particular point !

  5. Display the ceiling height in the viewport :
    Another great addition of the new GN project is Curve and Text support. We'll use nodes to convert the attribute into an actual Text object. Thankfully there is a Value to String node which will help us do exactly that. you'll notice though that the Value input has a round shape, not a diamond shape. This means it can't take fields attributes as an input, but regular values. We need to convert our Attribute to a value representing it. We'll use the Attribute Statistic node. We only have one value so we can either use the mean, median, sum, min or max outputs since they will all give the same result. This is really powerful, because this node tree could be refactored to output the ceiling height, not just at any given point, but as as a mean value by sampling points all around the room. But this is a bit more advanced. Next it's just a matter of adding the unit after the string we just extracted, then converting it to a Text object as curves, and filling the curves. And we're done !

Here's the whole tree for reference :

You can plug the group input to node values to easily change them in the modifier properties :

Tagged:
CadGirubasweinJanFBedsonAceNigelbruno_perdigaoMoultDarth_BlenderCoenand 3 others.

Comments

  • This would run in X-axis as well as on Y-axis ?
    going to 'topoligise' any import ? and recreate a 'clean' model from any 'unluckily'-build ifc ?

  • edited November 2021

    Yes it can be run in any arbitrary axis, and on any particular rotation using the Ray Direction input of the Raycast node. It basically emulates what you would do with a laser distance meter in real life. The only thing you have to make sure is to have geometry it can bounce back off in both directions to calculate the distance.
    However I don't think it is the right tool to reconstruct bad geometry, at least not used in that way. There are other handy tools that would be much more efficient and consistent to fix bad topology.

  • Nice to see that you found a use for the text nodes I've been developing. Let me know if there is something missing related to text nodes that could be useful in OSArch and I will consider adding support for it in 3.1. :)

    MoultGorgiousAceJesusbill
  • edited November 2021

    @erik85 Oh, nice !! Thanks for that, it's awesome :)
    Well the roadblock I'm hitting now I don't think can be solved that easily. Also, I intend on dropping this workflow once the drawing generation from BlenderBim gets fully supported so it may be going in the wrong direction.

    I'm exporting geometry to dxf and in the process, converting Blender Text objects to MText in Acad (pretty straightforward). We can add GN modifiers to Text objects which is cool, but there is no way to modify the actual, human legible text that's contained in the body of the text object. Since Text objects in Blender are fancy Curve objects, we can add splines and geometry but not actual characters.
    I'm pretty sure this goes against the design philosophy of GN but it would be really nice to have a way to modify a text object's body directly from GN so that the evaluated text object reflects the character changes.

    For instance here I modified the text's geometry :

    But of course the actual data's body attribute is used when evaluating the object so it doesn't export in acad :

    Some kind of Text > Body input node that can be plugged into a Capture Attribute node would be nice :) Although I don't even know if attributes support strings...

  • Attributes don't support strings (yet). In one of my first prototypes of the text nodes I used an int attribute to carry the UTF-32 characters. It's an interesting idea to somehow put them inside the data of the text object but it might not be so easy, as you mentioned. I think the problem is that the input to the GN modifier is already an evaluated version of the curve so it won't matter if the body is modified after that... But I will investigate.

    Gorgious
Sign In or Register to comment.