I found some related posts here in the forum but they were different cases, did not seem to help with this.
This is partially related to Clarisse but the math is done in Houdini so even if you are not familiar with Clarisse, please check if you could help me

Sorry about longish post but I wanted to give all info so you guys won't need to guess anything about what I am trying to do

I have a branch geometry (triangles, made by remesh) and then I want to copy needles on the surface but so that they slightly turn towards the end of the branch. Just simply imagine how fir or pine branch looks like, the needles are not sticking directly outwards, they turn to the end of branch. That is my goal.
But I will not do the copying in Houdini, I want to generate attribute(s) that can drive Clarisse scattering to rotate the needle instances towards the branch ends. But for that the math is still needed of course.
See the attached image, that is what I get without this in Clarisse. Not bad but too ‘messy’.
In theory I think (one) solution would be to modify the surface point normals (and create new attribute from that) so that they somehow are affected by the surface direction but I cannot figure out that ‘somehow’ part

The problem is that branches are not straight tubes, otherwise the direction would be towards the farthest point or something like that.
I have done some VEX but I'm still quite newbie with it so I hope this is even easy or at least doable. I'm still pretty sure VEX will be needed even though there are amazing nodes in Houdini.
I have attached a hip that has simple setup so ‘only’ thing needed is the turning of needles towards the branch end

Just for info:
This is part of my quite huge project where I make a Houdini batch tool that takes OnyxTree (great software and biologically accurate but old so cannot produce 15+ million poly trees and all branch levels are separate connected pieces) trees and rebuilds the geometry and UVs so that all branch joints are smooth so they can be watched quite closely. In addition to that I want to remove needles and leaves and instead have quaternion/vector attribute in *branch* geometry that I can use in Clarisse to drive scattering rotation so there will be no limits to number of needles/leaves and they can be adjusted dynamically there.
Best would be attribute that gives rotation for the instances so that they are otherwise sticking directly outwards the branch surface but in some angle towards the branch end. It sounds easy but at least for me it seems not.
The final result will be Alembic file where the branches have attributes for rotation of needle instances. Normals may be enough but if possible, maybe quaternion attribute would be better or both if possible

Note: The points the Scatter here produces are *not exported*, they are only used to create the attribute. The main problem is the math.
In Houdini process I have each branch part as separate connected piece (but not straight tube) and they have UV towards the end so that might be used to determine the direction somehow. And I have also calculated relative distance from Trunk for each branch (Bough, Branches1,2,3 to Twig tips, to control needle distribution in Clarisse) so that too could be used in this at least to know the direction somehow.
In final geometry the branch parts will be remeshed together but then Attribute Transfer can get those attributes back so for this it is enough to think each part as curvy tube, no branches inside a connected piece if that helps.
Also please make the solution as fast as possible, there are around 30000 branch parts to process in a tree

Can anyone please help me or is this too complicated to do even for Houdini?

Thank you very much!
Antti






