Page 1 of 2

OSL raytype contribution

PostPosted: Fri May 10, 2019 8:49 am
by calus
This is a super simple but very powerful Octane OSl texture shader,
kind of a "live compositing" node, allowing to precisely control the contribution of each ray type :
Plugged in the opacity of a material it allows to lower visibility or hide an object in reflection, refraction, AO ,shadow , diffuse or camera.
Or can be used for example, as "amount" attribute of a mix texture/ mix material node, or in emission texture, ect ...

raytype_contrib.zip
(410 Bytes) Downloaded 1345 times



> The blue sphere is not visible in reflection and refraction
octane_2019-05-11_01-03-50.png

Raytype_Contrib.orbx
(278.38 KiB) Downloaded 738 times




Code: Select all
shader raytype_contribution(
   float cam = 1 [[string label = "Camera", float min=0, float max=1]],
   float shad = 1 [[string label = "Shadow", float min=0, float max=1]],
   float AO = 1 [[string label = "Ambient occlusion", float min=0, float max=1]],
   float diff = 1 [[string label = "Diffuse", float min=0, float max=1]],
   float refl = 1 [[string label = "Reflection", float min=0, float max=1]],
   float refr = 1 [[string label = "Refraction", float min=0, float max=1]],
   output color c = 0
    )
{
    c = cam*raytype("camera") + shad*raytype("shadow") + AO*raytype("AO")
    + diff*raytype("diffuse") + refl*raytype("reflection") + refr*raytype("refraction");
}



EDIT: sorry there was a last minute bug in the script, this is fixed thanks to Milanm.
The shader seems to works just fine now.

Re: OSL raytype contribution

PostPosted: Sat May 11, 2019 7:49 pm
by frankmci
As much as I love Milan's RayType scripts, I've had very little success getting the animators I support to use them on their own. I think this one will be more intuitive for them, and resolve a lot of complaints they have about rendering with an unbiased engine. It will also save a lot of time setting up multi-pass renders and fixing things in the composite.

Many thanks!

Re: OSL raytype contribution

PostPosted: Sat May 11, 2019 9:46 pm
by calus
frankmci wrote:As much as I love Milan's RayType scripts, I've had very little success getting the animators I support to use them on their own. I think this one will be more intuitive for them, and resolve a lot of complaints they have about rendering with an unbiased engine. It will also save a lot of time setting up multi-pass renders and fixing things in the composite.

Indeed both scripts are complementary, Milan' raytype.osl is a switch between ray types, while this one is a modulator for each ray type.

Re: OSL raytype contribution

PostPosted: Tue May 14, 2019 12:32 pm
by frankmci
calus wrote:Indeed both scripts are complementary, Milan' raytype.osl is a switch between ray types, while this one is a modulator for each ray type.


Yes, indeed. I don't mean to belittle Milan's wonderful contributions! I've already put them to good use many times. While it's certainly possible to get the same functionality with his great tool, often a simple on/off is what the doctor ordered, greatly simplifying the compositing phase.

While a big part of my job is helping solve other people's problems, they're not always thrilled with the solutions I offer. There's something to be said for simplicity, especially when trying to introduce new things to people already under deadline pressures. :)

Many thanks to all those who put in the time and effort, then go the extra mile to share their expertise with the community!

Re: OSL raytype contribution

PostPosted: Wed Jun 05, 2019 11:11 pm
by fantome
Thanks for the great shader it is very useful for reflection pass.

I think i have encounter a bug with the refraction.
- take a bunch of sphere with specular shader
- put an environment
- activate reflection and refraction pass
- plug the osl node in opacity

When you set :
- reflection to 0 in osl node -> it works you get the exact same thing without object reflections
- refraction to 0 in osl node -> it doesn't work, in fact the environment position is not the same and it is inverted

Re: OSL raytype contribution

PostPosted: Wed Jun 19, 2019 3:56 pm
by Antoncromas
This is fantastic, thank you!

Re: OSL raytype contribution

PostPosted: Thu Jun 27, 2019 8:46 am
by HHbomb
Otoy team should make this node as native... :!:

Re: OSL raytype contribution

PostPosted: Thu Jun 27, 2019 9:14 am
by Goldorak
HHbomb wrote:Otoy team should make this node as native... :!:


Agreed

Re: OSL raytype contribution

PostPosted: Fri Jun 28, 2019 5:50 am
by HHbomb
Cool !! Thanks :mrgreen:

Re: OSL raytype contribution

PostPosted: Sat Jul 13, 2019 8:27 pm
by Iceman9
I like the shadow catcher as it currently is. So please don't eliminate the existing option, just add alternatives.