Page 2 of 2

Re: Reflection visibility on the other objects

PostPosted: Fri May 10, 2019 11:40 pm
by calus
milanm wrote:All you have to do to fix the "issue" is remove the "/6". You don't need it. Also in my tests actually max() operation worked better than +.

Right, seems to be normalized automagically,
don't know why I added that /6 just before posting and without testing aparently haha, thanks Milan.

I don't see how to use max() function here,
but anyway addition seems to work just fine now and exactly as Simowlabrim expects :

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

Raytype_Contrib.orbx
(278.38 KiB) Downloaded 129 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");
}





milanm wrote:I have some normal mapping scripts to release that I've been working on for a while.

Nice, I'm waiting for this one !
(tried on my side but gave up)

Re: Reflection visibility on the other objects

PostPosted: Sat May 11, 2019 11:28 pm
by simowlabrim
wow, you did it man!!! I did not try it yet, but I know that it will run just fine, thank you so much.

Re: Reflection visibility on the other objects

PostPosted: Fri May 17, 2019 4:57 pm
by frankmci
@calus, @milanm, I noticed that the Reflection raytype does not prevent the specular highlight when used with an emissive material like so:

RayTypeReflections.jpg


Looking into the Octane OSL docs,

https://docs.otoy.com/osl/extras/

I also noticed that the Ray types are listed as:
camera - Camera ray
shadow - Shadow ray
AO - Ambient occlusion
diffuse - Diffuse
glossy, reflection - Specular reflection
refraction - Refraction

Thinking that perhaps I just needed to add another ray type to the the script, I duplicated all the "reflection" elements and changed them to "glossy".

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 gloss = 1 [[string label = “Glossy”, 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") + gloss*raytype(“glossy”) + refr*raytype("refraction");
}


Unfortunately, the editor/compiler doesn't recognize "Glossy" as legit, and it just results in a syntax error.

Am I barking up the wrong tree here?

Re: Reflection visibility on the other objects

PostPosted: Fri May 17, 2019 6:06 pm
by calus
"Glossy" is not another raytype but just a second name you can use instead of "Reflection".

Can you share your sample test scene as orbx ? then I can answer your more precisely.

Re: Reflection visibility on the other objects

PostPosted: Wed May 22, 2019 9:28 pm
by frankmci
calus wrote:"Glossy" is not another raytype but just a second name you can use instead of "Reflection".

Can you share your sample test scene as orbx ? then I can answer your more precisely.


Yeah, I figured it was the wrong tree.

Here's a simplified example of what I'm trying to correct/control. There's an emissive material visible in reflective surfaces. The Emissive material has raytype_contribution piped into the Opacity. Set the reflective surface material roughness to 0, and everything behaves as I would expect, with the OSL node controlling how the luminous object interacts with other lights and surfaces. Set the roughness of a reflective surface to anything positive, and you can see that the roughened/blurred aspect of the luminous surface's reflection still gets through. The only way to kill it is with the Camera rays.

I suspect there's something basic about the way raytype works that I'm misunderstanding.

Thanks for any suggestions.

Re: Reflection visibility on the other objects

PostPosted: Sun May 26, 2019 7:52 am
by calus
@ Frankmi, thanks for the sample scene,
I found both shaders Raytype_Contrib and RaytypeBlend only work as expected if the Texture Emission's Sample Rate is set to 0 (this makes the light source indirect).
The problem is even more obvious with diffuse raytype ....

Indeed you were right looking for missing raytypes,
direct_diffuse rays and direct_reflection rays seem to be included in the camera raytype instead of in reflection and diffuse raytypes :(

I need to compare with other renderers to see if it's a an Octane bug or the way it is supposed to work.

Re: Reflection visibility on the other objects

PostPosted: Tue May 28, 2019 3:23 pm
by frankmci
Thanks for looking into it. It's not serious problem, since unchecking the "visible on specular" box in the Texture Emission node will do pretty much what I'm after in my current project. It's just that raytype_contribution wasn't working the way I expected, and I thought I wasn't understanding it properly.

Thanks for your work on this and for sharing it with the community. It's a very useful tool to have in the toolbox!

Re: Reflection visibility on the other objects

PostPosted: Mon Sep 30, 2019 12:52 pm
by pandayoghurt
Is there a way to hide an OSL texture from the reflections/specular of one material but show in another? Thanks

Re: Reflection visibility on the other objects

PostPosted: Wed Apr 08, 2020 2:47 am
by glennsmooth
OSL works great for standard objects... but it seems if it's a self-illuminating one with a blackbody texture then all bets are off... nothing seems to hide it in reflections. I have a candle in front of a mirror that I want to illuminate the scene but I don't want the candle flame (geometry with emission on a texture) visible in the mirror.

Re: Reflection visibility on the other objects

PostPosted: Wed Apr 08, 2020 2:41 pm
by frankmci
glennsmooth wrote:OSL works great for standard objects... but it seems if it's a self-illuminating one with a blackbody texture then all bets are off... nothing seems to hide it in reflections. I have a candle in front of a mirror that I want to illuminate the scene but I don't want the candle flame (geometry with emission on a texture) visible in the mirror.


Yes, I think this is the same issue I posted about a year ago. As Calus said, the problem is that the direct_diffuse and dirrect_reflection rays are bundled with camera_rays. Sounds like your best bet is to render the visible flame as its own pass and comp it in only where you want it.