Where in cpp to tell Cycles to use simulation/deformation data, not base curve/mesh?

I’m updating a modification of Cycles to make curves renderable as hair and it works fine. The only thing missing is for Cycles to use the correctly evaluated curve objects, not the base curve data, eg. in a simulation with wind where curves are moved around.

Would somebody know where to tell Cycles to evaluate the curve object with its modifiers (in this case softbody sim), not just the base mesh? I’ve been looking at blender_object.cpp, blender_mesh.cpp, blender_util.h and mesh_convert.c but I have difficulties in grasping where is the actual copy of the curve data made.

Btw, I’m accessing later in blender_curves.cpp the curve splines data in a custom function similar to ObtainCacheParticleData like this : BL::Curve b_curve(b_ob->data());
I would like data() to be the deformed data here.

This is not supported by the API, as far as I know.

Personally I don’t think the current curves should be renderable as hair, the use case is quite different. We want to keep hair rendering fast without needing the quality or features needed for curve rendering. The intent is to introduce a new hair object type in the future, which would handle cases where you want to import hair from other applications without relying on the particle system.

1 Like

Thanks, it helps that you mention it. It’s fine in the end, simulation/modifiers can be applied to the curve data before rendering.

If you propose a better solution than the current one I made, I’m all for it. In the absence of a solution, I’ve got to use what I developed, which is perfectly tailored for the need of scientific visualization of brain cells but also for other uses. In that scenario, speed is of almost of no concern. Memory usage + loading time are the major issues with massive data models. I’m more interested in the quality of the shaders and the possibilities that Cycles offers. For speed, you might want to use OSPRay or Optix.

A new hair object would make sense only if the user could give points and radii just like you would for current splines. That said, it’s good news that you thought about the hair object, let’s see where it goes.

@brecht @nantille

The following may not apply to your use case, yet may still be useful.

When the Vulkan API is implemented, something like the following could also be implemented;

This could excelerate hair simulation in Blender.

@Dev1 This is quite interesting, thanks for the link!

1 Like