Render splines using Cycles hair primitives
This is a Cycles modification that allows you to skip meshing splines entirely and render them as hair. Needless to say, with this method you can render lots of them. Hello large scale graphs! This feature is primarily intented for CPU rendering because GPUs don't have access to enough memory for large-scale rendering and Cycles isn't an out-of-core renderer.
- Splines to hair: render all splines within a curve object as hair in one click in the UI, also easily scriptable.
- Radius variation: splines are rendered with their radii so this is more than simple tapering hair.
- Spline interpolation: all curve types are supported. Two interpolations may occur and affect hair, see Usage below.
- Per-spline material: supported. You need to add the materials to the curve object and then set the material_index of each spline.
- Two custom values on spline points:
value, two floats. This takes 8 bytes extra per spline point in memory but gives you the ability to modulate your shaders based on these values as they're available in
- Extra HairInfo slots:
Custom Key Data,
Custom Value Data
[Only for custom key-value data] Warning When you save .blend files with this version, do not save them with another version of Blender or custom values will be lost! You've been warned.
How to use it?
You need to compile Blender with these sources. You need to have git installed on your system or skip step 1 and download sources from github. Make sure you have python3.7+ installed as this is required by Blender 2.8.
In your console run the following commands (valid for Linux/MacOS/Windows):
git clone git://github.com/nantille/blender_28_mod
If everything compiles fine (fingers crossed!), you will have a new Blender executable in relative path
The path to the blender executable is given at the end of the compilation.
When the above steps produce an error relative to locale and addons, follow these steps:
git remote set-url origin git://git.blender.org/blender.git
git submodule sync
git submodule update --init --recursive
git submodule foreach git checkout master
git submodule foreach git pull --rebase origin master
git remote set-url origin https://github.com/nantille/blender_28_mod.git
If you would like to compile Blender with the latest sources published by Blender Institute,
you can try rebasing with the following command:
git pull --rebase http://git.blender.org/blender.git master
If after rebasing you get a compilation error such as missing libraries, run again
If you have a Cmake Error mentioning
Python executable missing and you have Python installed, you probably have the wrong version. Blender 2.8 requires Python 3.7+.
This is a modification for Blender 2.8+.
- Open this custom version of Blender 2.8.
- Select Cycles as render engine.
- Select or add a curve object on the scene.
Object Datapanel at the bottom, enable
Render as Hair.
- Make sure that in panel
Geometry, the option
Use Hairis enabled.
- Tweak options under
Use Hair, set
Hair != beveled curves
Please note that when a spline is rendered as a hair primitive, it has no mesh and so all meshing related features like
bevel_depth will be ignored. Cyclic curves are not supported though this could be added easily.
- Copy-paste or import the code of
- At the bottom of the script, tweak how many splines you want to have generated.
- Run the script. If you generate large number of splines, like 1 million, it will easily take 15 minutes.
- Add a material and play with HairInfo.Intercept, HairInfo.Key and HairInfo.Value
None at the moment. Don't hesitate to report any issue you see.