OSL raytype contribution

Post, discuss and share handy resources like textures, models and HDRI maps in this forum.
Forum rules
Please do not post any material that is copyrighted or restricted from public use in any way. OTOY NZ LTD and it's forum members are not liable for any copyright infringements on material in this forum. Please contact us if this is the case and we will remove the material in question.
calus
Licensed Customer
Posts: 1308
Joined: Sat May 22, 2010 9:31 am
Location: Paris

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 1593 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 927 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.
Pascal ANDRE
frankmci
Licensed Customer
Posts: 917
Joined: Fri May 26, 2017 2:00 pm
Location: Washington DC

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!
Animation Technical Director - Washington DC
calus
Licensed Customer
Posts: 1308
Joined: Sat May 22, 2010 9:31 am
Location: Paris

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.
Pascal ANDRE
frankmci
Licensed Customer
Posts: 917
Joined: Fri May 26, 2017 2:00 pm
Location: Washington DC

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!
Animation Technical Director - Washington DC
User avatar
fantome
Licensed Customer
Posts: 268
Joined: Wed Dec 16, 2015 3:38 pm

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
Antoncromas
Licensed Customer
Posts: 43
Joined: Fri Oct 05, 2018 3:53 pm

This is fantastic, thank you!
HHbomb
Licensed Customer
Posts: 1371
Joined: Wed Jun 30, 2010 8:45 pm
Contact:

Otoy team should make this node as native... :!:
YOKO Studio | win 10 64 | i7 5930K GTX 3090 | 3dsmax 2022.3 |
User avatar
Goldorak
OctaneRender Team
Posts: 2321
Joined: Sun Apr 22, 2012 8:09 pm
Contact:

HHbomb wrote:Otoy team should make this node as native... :!:
Agreed
HHbomb
Licensed Customer
Posts: 1371
Joined: Wed Jun 30, 2010 8:45 pm
Contact:

Cool !! Thanks :mrgreen:
YOKO Studio | win 10 64 | i7 5930K GTX 3090 | 3dsmax 2022.3 |
Iceman9
Licensed Customer
Posts: 217
Joined: Sun Jun 09, 2013 1:22 am

I like the shadow catcher as it currently is. So please don't eliminate the existing option, just add alternatives.
Post Reply

Return to “Resources and Sharing”