Advice for implementing a BSDF in Cycles

I’m looking for some advice for adding a BSDF to Cycles. I’m thinking of adding a dedicated hair BSDF based on the paper at

I’ve had success implementing a few shaders on my own toy raytracer, but every time I try to work on Blender/Cycles I immediately get a headache tearing my way through the code. What I’d like is some advice on where to begin on testing new shader code in Cycles. Would it be easiest to start by altering an existing BSDF?

The easiest way would be to look through the commit log and find one that adds a new bsdf to figure out all the files you have to change.

I’d imagine it would involve adding a new node type along with the actual cycles bsdf code itself.

My thoughts, at least for testing, are to just take an existing BSDF and start tweaking from there.

Well, yeah, that could work.

But getting it all working is a different story, there’s a bunch of files (something silly like 11) you have to modify just to add a new node + whatever you need to do to cycles so working from a ‘template’ is a lot easier.

Have you any success so far?