Small Blender Things
Customizing Blender with Python and OSL
SuperHive summer sale last day
US Highway Shield Generator
After publishing the US Road Sign Generator I realized people might want a way to generate those highway shields that show the interstate numbers, so I created just that: All lightweight (both geometry and texture) and of course utilizing the common 'Highway Gothic' typeface.
SuperHive summer sale
Blender 5.2: Speeding up ImBuf access
In Blender 5.2, the ImBuf object now features a method that can be used as a context manager, yielding a Python memoryview object. This opens up a fast and convenient way to use an ImBuf to draw things using the blf module, and then copy the result to a Blender Image object's pixels attribute.
However, we cannot simply write:
with myimbuf.with_buffer() as mv:
myimage.pixels[:] = mv[:]This fails because Python's memoryview slice assignments have limitations when working with non-flat array configurations, which is what an Imbuf always is (width x height x color channels). Instead, we have to cast the memoryview to a flat array.
Furthermore, because either the source or the destination needs to be in a compatible byte format, we cannot cast a multidimensional float view directly to a flat float view in one go. We must resort to a rather inelegant double cast coupled with the foreach_set method:
myimage.pixels.foreach_set(mv.cast("b").cast("f"))This first casts everything to a flat array of bytes, then to a flat array of floats, what is what foreach_set expects.
It works, and both cast() and foreach_set() are highly performant (cast() does not even touch the data, just the metadata), but it does feel a bit clunky. This isn't Blender's fault, though—it has been a long-standing behavior regarding multidimensional array manipulation discussed on the Python Core Development Issue Tracker.
Note that we now have a fast way to move data from an ImBuf to an Image, but ImBuf objects aren't all that common: we can create one and write text into it with the functions in the blf module, but as far as I can tell the is currently no way to copy a framebuffer to an Image or an ImBuf, nor is there a way to use the gpu module directly to draw into an ImBuf, so quickly creating an Image still requires a laborious route that involves copying the data from the framebuffer pixel-by-pixel to the Image.
Hopefully framebuffers will get buffer protocol support in the future, but that's probably not an easy task as there the actual data lives on the GPU and needs to be transferred. So let's keep an eye on the dev logs. 😀
US Road Sign Generator
After publishing a few sets of US road signs, I went back a created a geometry nodes based road sign generator that can be used to generate the iconic green signs you see along highways in the US.
Configurable to up to three lines, will all sort of options and three different materials. All lightweight (both geometry and texture) and of course utilizing the common 'Highway Gothic' typeface.
US Road Signs - Warning Signs Roadwork
After publishing a set of general US road signs, I thought why not publish one with signs commonly seen around road works?



