OSL in VRay tips and tricks?

608 views
Skip to first unread message

Ben Houston

unread,
Feb 17, 2015, 9:29:12 AM2/17/15
to osl...@googlegroups.com
Hi all,

I'm looking to start experimenting with V-Ray's new TexOSL plugin for use in https://Clara.io.

Details on V-Ray's support of OSL here:


Does any tips or tricks or experiences working with OSL in V-Ray?  That is the best workflow for getting debugged shaders?  I haven't seen much discussion of OSL in V-Ray yet.

Is it possible to "include" one OSL file in another OSL file automatically?  Like the C preprocessor's #include statements?  What is the best way to organize libraries of OSL related files and avoid deduplication?

I was thinking the best way of working would be to have a simple *.vrscene somewhere that references the OSL shader files with a simple scene and then keep editing them while re-running "vray --sceneFile=myscene.vrscene" periodically to render the results.  Sort of the obvious simple answer I guess.

Best regards,
Ben Houston
http://clara.io - Online 3D Modeling and Rendering

vlado

unread,
Feb 17, 2015, 3:38:38 PM2/17/15
to osl...@googlegroups.com
I don't know how OSL shaders are generally debugged - I'm curious to know about that as well. OSL does have #include directives, from what I remember.

Other than that, you will be covering new land here - OSL is not a much-used feature yet. There are a couple of specialized shaders posted on the forum, but except for a few enthusiasts, V-Ray users are not typically known for their ability to write code :)

Best regards,
Vlado

Esteban Tovagliari

unread,
Feb 17, 2015, 6:35:27 PM2/17/15
to osl...@googlegroups.com
Hi,


Is it possible to "include" one OSL file in another OSL file automatically?  Like the C preprocessor's #include statements?  What is the best way to organize libraries of OSL related files and avoid deduplication?

The C preprocessor is run as part of compiling your shaders to oso files. I think in the latest versions of OSL boost wave is used as the preprocessor.
You can use #includes, #defines and all the usual preprocessor directives.

I don't know if it is the best way, but you can do the same thing you'd do with a C++ template library.  
Move common code to headers, and #include them in your osl files.

Est.

Reply all
Reply to author
Forward
0 new messages