OSL Goodness

It just crashes when I do -_- I got the Diffuse Shader right off the svn, so it shouldn’t have any errors. I’m using the latest build for OSX10.6 from buildbot.

OSL is now available on all Operating Systems. Windows, Linux and Mac. Download builds from the buildbot and enjoy!
http://builder.blender.org/download/

(Note: For Windows, it’s svn 52386 and above. Also, no Mingw builds with OSL yet)

br1992: That should have been fixed. Try a build with revision 52374 and above.

You are 100% correct! The new build works perfectly! After so many failed attempts I figured I was doing something dumb… Thanks @DingTo

Arrrggh!

This is driving me mad. I so want to play with OSL. I have tried building and have even downloaded the latest build 52391 and whilst I 'm not getting any script compiling errors (on the node), there doesn’t seem to be anything happening. See attached pics of wireframe and yingyang scripts.
Am I missing something fundamental here. OSX 10.8.2 (using the 10.6 build).

Thx in advance (hoping to be able to play soon ;)). R



I seem to have the same problem as Jiggymoon, but under windows 7 (64bit build), none of the OSL shaders seem to work. Is this due to not having the OSL libraries or other missing files? (I would assume it then also wouldn’t be able to compile the nodes?)

delete message sorry

Have you set the shading system to Open Shading Language in render panel

Oh wow, I feel really stupid now. Thanks for the quick reply, works now.
I’ll go hide in a corner now somewhere :stuck_out_tongue:

2@phonybone
Hello. Thank you for your interest! I tried your code, it is good but not as cool as that old plugin (as i want)). For comparison:
https://dl.dropbox.com/u/34973756/blender/osl.jpeg (same like circles)
https://dl.dropbox.com/u/34973756/blender/osl.mp4 (animation with default settings)
https://dl.dropbox.com/u/34973756/blender/water.png (old plugin’s settings)
5 modes of plugin
https://dl.dropbox.com/u/34973756/blender/water-01-rain.mp4
https://dl.dropbox.com/u/34973756/blender/water-02-trails.mp4
https://dl.dropbox.com/u/34973756/blender/water-03-mix.mp4
https://dl.dropbox.com/u/34973756/blender/water-04-swirl.mp4
https://dl.dropbox.com/u/34973756/blender/water-05-drop.mp4
my old test
https://dl.dropbox.com/u/34973756/blender/waterTEX.mp4
Of course, it’s can be done with dynamic paint but… why not?

let’s do osl shader greater! (or tell me where to look for examples of code)

From the examples you linked, it seems that this plugin actually does a physical shallow water sim. AFAIK you can do that with dynamic paint too (never tried it), which should give you the same result and can be combined with other dynamic paint effects. (example: http://www.youtube.com/watch?v=vcFId-V9R48)

The OSL shader OTOH is purely random in placing the “drops” and uses a simplified model for the wave, without resorting to an underlying image to store the state of the water surface (displacement). This has both pros and cons, as outlined above (controlability, range of effects vs. speed, memory, scalability).

One could also easily combine both of these systems in a single resulting displacement texture: a randomized OSL-generated rain drop “background”, with a dynamic paint texture layered on top for localized detail, e.g. where an object disturbs the water surface.

Thx kgeogeo.

I’ll also be in the corner with Month. :wink:

I want to make a node that mixes two shaders depending on intensity, a value that can be set by the user. I specifically want this node to switch from a diffuse to a gloss shader when the intensity of light hitting the object is higher than the preset value. Of course, since I have negligible experience in computer science, I failed miserably… Help?

What I cannot understand is how I can access the rgb values of a shader…

This is not possible with OSL, you don’t have access to actual light color values, only the builtin closures. OSL separates BSDF’s and lighting, which is more limited but makes shaders automatically work with different GI rendering algorithms. Note also in reality this would not be known, it’s just reflecting one photon at a time.

So is there no way in osl to mix shaders like one would in BI using a color ramp?

nope (adding more characters so BA lets me post)

Oh :frowning: That’s a bit disappointing…

i got around to making a phong ramp shader; i realize it’s not terribly impressive, but i’m just getting my feet wet with the OSL spec. :slight_smile: i know i didn’t need to, but i made it with 8 specular colors just to see what it would look like. pretty neat!

i see now why programmable shading is so promising

[ATTACH=CONFIG]203640[/ATTACH]

i also modified the emission shader to use the blackbody color function, but i’m not entirely sure i see much of a difference between that and just using an RGB color instead.
[ATTACH=CONFIG]203645[/ATTACH]

It’s a simple converter from Blackbody-Temp to RGB, so no difference…

really? seems kinda useless to include a function like that then. the osl spec says, “The blackbody() function returns the blackbody emission (the incandescent glow of warm bodies) expected from a material of the given temperature in Kelvin, in units ofW /m2 . These are the appropriate units to multiply by emission() to have a physically-correct result.”