Skip to main content
edited body
Source Link
Rich Sedman
  • 45.2k
  • 2
  • 109
  • 233

OSL itself doesn't provide any facilities to access files relative to the .blend file.

However, when passing a 'string' into an OSL script node, Blender automatically assumes that the string represents a filename. As with other filenames in Blender, prefixing the filename with '//' will indicate a path relative to the saved .blend file.

Therefore, in order to get the filepath to the .blend in an OSL shader simply add a 'string' input and set its value (witninwithin the node field) to '//'.

OSL itself doesn't provide any facilities to access files relative to the .blend file.

However, when passing a 'string' into an OSL script node, Blender automatically assumes that the string represents a filename. As with other filenames in Blender, prefixing the filename with '//' will indicate a path relative to the saved .blend file.

Therefore, in order to get the filepath to the .blend in an OSL shader simply add a 'string' input and set its value (witnin the node field) to '//'.

OSL itself doesn't provide any facilities to access files relative to the .blend file.

However, when passing a 'string' into an OSL script node, Blender automatically assumes that the string represents a filename. As with other filenames in Blender, prefixing the filename with '//' will indicate a path relative to the saved .blend file.

Therefore, in order to get the filepath to the .blend in an OSL shader simply add a 'string' input and set its value (within the node field) to '//'.

Source Link
Rich Sedman
  • 45.2k
  • 2
  • 109
  • 233

OSL itself doesn't provide any facilities to access files relative to the .blend file.

However, when passing a 'string' into an OSL script node, Blender automatically assumes that the string represents a filename. As with other filenames in Blender, prefixing the filename with '//' will indicate a path relative to the saved .blend file.

Therefore, in order to get the filepath to the .blend in an OSL shader simply add a 'string' input and set its value (witnin the node field) to '//'.