# Advice for implementing a BSDF in Cycles

**URL:** <https://blenderartists.org/t/advice-for-implementing-a-bsdf-in-cycles/561665>\
**Category:** Beginning Blender Code and Development\
**Created:** [January 7, 2013, 9:06am UTC](https://blenderartists.org/t/advice-for-implementing-a-bsdf-in-cycles/561665 "2013-01-07T09:06:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![m9105826](https://blenderartists.org/user_avatar/blenderartists.org/m9105826/32/6760_2.png) [@m9105826](https://blenderartists.org/u/m9105826)\
**Post date:** [January 7, 2013, 9:06am UTC](https://blenderartists.org/t/advice-for-implementing-a-bsdf-in-cycles/561665/1 "2013-01-07T09:06:48Z")

</div>

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 [http://graphics.cs.williams.edu/jcgt/published/0001/01/01/paper.pdf](http://graphics.cs.williams.edu/jcgt/published/0001/01/01/paper.pdf)

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?

---

<div class="post-metadata">

**Author:** ![Uncle\_Entity](https://blenderartists.org/user_avatar/blenderartists.org/uncle_entity/32/8856_2.png) [@Uncle\_Entity](https://blenderartists.org/u/Uncle_Entity)\
**Post date:** [January 7, 2013, 9:38am UTC](https://blenderartists.org/t/advice-for-implementing-a-bsdf-in-cycles/561665/2 "2013-01-07T09:38:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![m9105826](https://blenderartists.org/user_avatar/blenderartists.org/m9105826/32/6760_2.png) [@m9105826](https://blenderartists.org/u/m9105826)\
**Post date:** [January 7, 2013, 11:13am UTC](https://blenderartists.org/t/advice-for-implementing-a-bsdf-in-cycles/561665/3 "2013-01-07T11:13:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Uncle\_Entity](https://blenderartists.org/user_avatar/blenderartists.org/uncle_entity/32/8856_2.png) [@Uncle\_Entity](https://blenderartists.org/u/Uncle_Entity)\
**Post date:** [January 8, 2013, 12:37pm UTC](https://blenderartists.org/t/advice-for-implementing-a-bsdf-in-cycles/561665/4 "2013-01-08T12:37:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![QwiglyDee](https://blenderartists.org/user_avatar/blenderartists.org/qwiglydee/32/630189_2.png) [@QwiglyDee](https://blenderartists.org/u/QwiglyDee)\
**Post date:** [February 12, 2013, 11:57am UTC](https://blenderartists.org/t/advice-for-implementing-a-bsdf-in-cycles/561665/5 "2013-02-12T11:57:05Z")

</div>

Have you any success so far?
