Four Star value for ebook. Here are my four star OSL shaders.

As a newbie I bought the ebook Book: Open Shading Language for Blender, a practical primer. It is a four star value so thought I’d create four star OSL scripts. The scripts can be found at https://drive.google.com/open?id=0BwFQiTKfux0qemdlZFB1MTBhWUk&authuser=0


But I can’t figure out how to actually get the bump to work at all without crashing. Does anyone have an example of using bump either in the OSL or passing a value to a node? I would prefer something with a large easily viewable bump.
Thanks.

If I remember correctly, bump mapping isn’t supported with OSL at this point. Your options would be to bake the bump map as a separate texture and turn off OSL, or it’s possible that changing the normals of materials might do the trick.

AFAIK true displacement is not yet supported for any renderer, not just Cycles w. OSL.

bump mapping works (just plug it into the displacement socket of the output node) but for more control it is probably better to use a bump map node:


Note that the bump output of your OSL node should go into the ‘height’ socket of the bump node and that the ‘distance’ on the bump node might need to be set a a slightly smaller value than the default 0.1 if your texture contains a lot of small detail.

Dang. I’ve changed an osl to output a value for a bump, connected the output to the bump node, then the normal output from the bump to the BSDF but it does not seem to work for me. Are you willing to share the .blend and .osl? Thanks.

Sure check this. (I’ve made the .osl internal, so the .blend is all you need)

BTW: in your own file, did you check that the Open Shading Language option was checked? (Even in the latest versions of Blender this is not turned on by default. If you have OSL nodes it wont complain but these nodes will do nothing… If I am not sure about a bump texture I normally first plug it into a diffuse color socket to check that there actually is a pattern)

cheers,

– Michel.

Thanks. Got the file and will learn about the issue. My script in your .blend is not producing bumps so it is not the osl option. But I’m now thinking it might be the differences between using texture coordinates Object and Generated.

There were two issues (1) Wrong expectations about bump which needs displacement. (2) The difference between Texture Coordinates-> Object and Texture Coordinates-> Generated. I had been thinking that Generated coordinates were 0…1 but they are not.
Thanks.