I want to save the 32-bit floating point values generated in a set of OSL procedural nodes to a bumpmap. Is there any way to finagle that?

Also, if it just can't be done, I'd like to get that out of the way.

  • 1
    $\begingroup$ I'm pretty sure this is the default behavior.. Make sure you are saving the baked image to format which supports floats (e.g. exr). $\endgroup$ – gandalf3 Apr 2 '15 at 6:10

There is currently no support for sending data from an OSL node to a file, values can only be passed into a nodetree used by cycles, which does mean that your OSL script can replace the image node you would use for a bumpmap.

By setting a float output value you pass your calculated height directly into the node setup to be used to alter the displacement or bump of the material.

shader myosl(output float Height = 0.0 )
    Height = sin(P[1] + 0.25);

enter image description here

While you probably don't want to use both displacement and normal adjustment, you may realize that you don't have to use a closure output in your script. You can calculate any value you want and integrate it in your nodes where you need it.

  • $\begingroup$ What bake type would I use to get a 32-bit bumpmap out of cycles? I need to get the data out of Blender, not just pretty pictures. $\endgroup$ – Colin Paddock Apr 2 '15 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.