Reflection visibility on the other objects

Maxon Cinema 4D (Export script developed by abstrax, Integrated Plugin developed by aoktar)

Moderators: ChrisHekman, aoktar

calus
Licensed Customer
Posts: 1308
Joined: Sat May 22, 2010 9:31 am
Location: Paris

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 182 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)
Pascal ANDRE
simowlabrim
Licensed Customer
Posts: 11
Joined: Sun Jun 10, 2018 9:17 am

wow, you did it man!!! I did not try it yet, but I know that it will run just fine, thank you so much.
frankmci
Licensed Customer
Posts: 917
Joined: Fri May 26, 2017 2:00 pm
Location: Washington DC

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

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

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.
Attachments
RayTypeOSL_Reflect.Luma.orbx
(3.54 MiB) Downloaded 183 times
Animation Technical Director - Washington DC
calus
Licensed Customer
Posts: 1308
Joined: Sat May 22, 2010 9:31 am
Location: Paris

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

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!
Animation Technical Director - Washington DC
pandayoghurt
Licensed Customer
Posts: 25
Joined: Sun Jan 25, 2015 5:42 pm
Location: UK
Contact:

Is there a way to hide an OSL texture from the reflections/specular of one material but show in another? Thanks
THREADRIPPER, 32GB RAM, 3080ti Win 10 64, C4D R2023.2.2, OCTANE 2023.1 BETA3 R4
glennsmooth
Licensed Customer
Posts: 3
Joined: Sat Apr 11, 2015 1:18 pm

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

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.
Animation Technical Director - Washington DC
Post Reply

Return to “Maxon Cinema 4D”