I've been busy with Disney/Pixar's Woodville Art Challenge and one of my mini-sub-challenges has been to build a forest of custom conifer trees for it.
I thought to generate the needles using Hair Generate.
So, I got my fbx tree (coming from Blender) inside Houdini 17.5 and first processed the primitive needles to get single segment polylines instead.
I bet there must be a more optimal way to do that, but given my limited VEX knowledge. I kinda put together this in a wrangle. Do you think I can skip the foreach block? It must be possible to write that directly inside the wrangle…
vector pos0, pos1, norm0, norm1;
int pts[] = primpoints(0, 0);
int count = len(pts);
foreach(int pt; pts)
{
if(pt != @ptnum)
{
if(pt%2==0)
{
int line = addprim(0, "polyline");
addvertex(0, line, @ptnum);
addvertex(0, line, pt/2);
}
pos0 = point(0, "P", 0);
pos1 = point(0, "P", 1);
norm0 = pos1 - pos0;
norm1 = pos0 - pos1;
setpointattrib(0, "N", 0, norm0, "set");
setpointattrib(0, "N", 1, -norm1, "set");
}
removeprim(0,0,1);
}
So that wrangle in the foreach block takes a while to cook… like 9 min.
Anyway, moving on. I wrote out the resulting single segment polylines to disk.
In an empty scene, I used the cached polylines as guides for a Guide Groom and then tick marked Render Guides on the Hair Generate. It worked.
(A thanks to paristopolus from Renderman's forum for the proper Renderman setup here).
Next, I cached out the Guide Groom.
Then, I read the cached file and copied it to 4 points. This is to test if potentially a forest could be built that way with groom data.
Then, I cached the copies.
Then, I loaded them back and referenced them inside a duplicate of the original Hair Generate as a Groom Source file.
Would you say that's a viable method? Would it work for a whole forest? Is it efficient?
So far time-to-first-pixel is very fast. Each tree has upwards of 1.2 million needles.