Collecting curve normals in geometry nodes?

I’m using geometry nodes to turn arbitrary curves into octopus tentacles, and I’m pretty happy with the resulting geometry so far.

Now I’m trying to add shading, and one of the things I want to do is shade the underside of the tentacle with a lighter color than the topside, as you can see in this reference:

I’m having a hard time figuring out how to do that, though! I believe I need to get information from the geometry nodes and pass it into the material, because by the time it’s just a mesh, it’s not clear what the underside is (considering that the tentacle can curve and twist in all directions). I know how to get information from geometry nodes to material nodes (thanks to @Chanfiroly answering my question on that), but I’m not sure how to collect the right information. I think what I want is to capture the normals of points along the original curve (before it’s been turned into a tentacle) and embed that in the geometry, so that I can then compare the normals of the geometry with it in the material editor.

Well, not the curve normals, exactly, but the “down” at any point in the curve. I’m using a cross-section for the curve that has a definite “down” (it’s flatter), so basically I want to know whichever direction that is facing at any point along the curve.

I already got this figured out for placing the suckers in the right orientation, but I’m having a harder time capturing the information for the material.

Here’s what I’m imagining for the material nodes:

… But I’m having trouble getting that information out of the geometry nodes. I believe curves themselves don’t have normals, but they do have tangents. I’m not sure how to convert a tangent to a normal (or an “underside vector”)… I assume I need rotate it 90° somehow, but how? Here is what I’ve got so far, just passing the tangent:

Another option would be to turn the curve into points and then somehow get their normals into the geometry, but that doesn’t seem to be working. I’ve tried this:

… And this:

… But neither produce any data.

So far I’ve got the closest with passing the tangent, but the results don’t reliably line up with the underside (as defined by the geometry), even when I rotate it around.

One thing: I know that tilt throws another curve (so to speak) into the problem, but I think I’ve got a pretty good handle on that… So far I just want to solve it without tilt in the curve.

Any suggestions on how to proceed? Thank you!

I got it working! At first I continued down the road described above, and found that what I was missing was the Transfer Attribute node. I converted the curve to instances, captured their rotation, turned them into point geometry and passed that back into my original tentacle via Transfer Attribute. It was a bit complicated but it worked, mostly… It still wasn’t perfectly registered with all of the twists and turns, but close enough.

Or so I thought, until I ran across this video!

In that video, he shows that you can just grab the Curve Parameter factor of the cross-section and pipe it through to the finished geometry! So simple, and now everything lines up perfectly!

Here are my nodes: