Page 1 of 2

embree+OSL+alembic

Posted: Tue Apr 17, 2012 10:42 am
by stefan
Not much of rendering algorithms to see in here, more as an engineering exercise I connected embree, OSL (+OpenImageIO) and Alembic. The Octopus is a sample file from Alembic, its surface is an OSL shader and the velvet cloth is from embree's crown demo scene. My plan is to turn this into a more full featured renderer, adding differentials, MIS, motion blur, etc. Don't pay too much attention to the fps, this is a laptop from 2007.
Untitled.jpg

Re: embree+OSL+alembic

Posted: Tue Apr 17, 2012 9:28 pm
by beason
Wow, that's a lot faster than my path tracer.

Re: embree+OSL+alembic

Posted: Tue Apr 17, 2012 10:41 pm
by spectral
Nice OSL shader, is it one of the OSL distribution ? Can you share ?

Thanks

Re: embree+OSL+alembic

Posted: Wed Apr 18, 2012 6:49 am
by stefan
The shader is really very simple, it's just using turbulence to blend between diffuse and phong:

Code: Select all

#include "nodes.h"
surface
defaultShader
    [[ string description = "default material" ]]
(
    float Kd = 1
        [[  string description = "Diffuse scaling",
            float UImin = 0, float UIsoftmax = 1 ]],
    color Cs = 1
        [[  string description = "Base color",
            float UImin = 0, float UImax = 1 ]]
  )
{
	color mixture = turbulence(P * 0.04, 8);
	Ci = Kd * Cs * diffuse(N) * mixture + (1-mixture) * phong(N, 13);
}

Re: embree+OSL+alembic

Posted: Wed Apr 18, 2012 10:13 am
by apaffy
Nice image and great performance! How easy is it to integrate OSL into a project? I currently have my own extremely basic shader/closure system, but I would be interested in checking out OSL if it is simple to set up.

And more random question: it seems that the main target of OSL is x86, has anyone had a go at porting the shading and/or closure runtime to a GPU, and willing to share any thoughts?

Re: embree+OSL+alembic

Posted: Wed Apr 18, 2012 11:57 am
by stefan
apaffy wrote:Nice image and great performance! How easy is it to integrate OSL into a project? I currently have my own extremely basic shader/closure system, but I would be interested in checking out OSL if it is simple to set up.
OSL is pretty easy to integrate. Depending on your OS, getting all the dependencies in order is a challenge, it's fairly simple with a Unix package manager, but trickier if you're on Windows or want to do a dependency free build on OS X (which mine is).
OSL's use of shaders and BSDFs actually fits nicely on embree's material/BSDF structures. I guess we're all just copying PBRT these days :)

Re: embree+OSL+alembic

Posted: Wed Apr 18, 2012 5:13 pm
by spectral
Thanks for the shader, you're right it is quite simple but beautiful,

Will you open-source it ? It will be great to have a ".exe" renderer based on OSL... as reference :-)

Re: embree+OSL+alembic

Posted: Thu Apr 19, 2012 5:13 pm
by stefan
I have no plans for publishing it at this point - it's still full of half-broken or incomplete features and hacks. But I'll be happy to answer any questions about integrating OSL (can't say much about Alembic, I only have poly mesh import working so far, am still figuring out the rest).
Doesn't Blender's Cycles support OSL? That should be a nice reference.

Re: embree+OSL+alembic

Posted: Thu Apr 19, 2012 5:44 pm
by spectral
Thanks,

Not sure that Cycles support OSL yet, it sounds that (correct me please if I'm wrong) that the only one to (partially) support OSL is Spectral Studio (and available for download). The reason I ask this is that I will be interested to find a "downloadable" renderer, even if simple that support the OSL implementation of Sony (Spectral Studio has its own back-end for CPU and GPU support).

Thx

Re: embree+OSL+alembic

Posted: Thu Apr 19, 2012 6:07 pm
by stefan
If you're on Mac OS X, I can provide you with a binary, as long as you don't hold me accountable for any bugs in it ;)
I wouldn't call it a reference implementation, since I'm not supporting displacement/bump shaders and there's something wrong with transmitted rays too.