Reflection visibility on the other objects

Forums: Reflection visibility on the other objects
Maxon Cinema 4D (Export script developed by abstrax, Integrated Plugin developed by aoktar)

Moderator: aoktar

Re: Reflection visibility on the other objects

Postby calus » Fri May 10, 2019 11:40 pm

calus Fri May 10, 2019 11:40 pm
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 124 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
calus
Licensed Customer
Licensed Customer
 
Posts: 1308
Joined: Sat May 22, 2010 9:31 am
Location: Paris

Re: Reflection visibility on the other objects

Postby simowlabrim » Sat May 11, 2019 11:28 pm

simowlabrim Sat May 11, 2019 11:28 pm
wow, you did it man!!! I did not try it yet, but I know that it will run just fine, thank you so much.
simowlabrim
Licensed Customer
Licensed Customer
 
Posts: 11
Joined: Sun Jun 10, 2018 9:17 am

Re: Reflection visibility on the other objects

Postby frankmci » Fri May 17, 2019 4:57 pm

frankmci Fri May 17, 2019 4:57 pm
@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?
Technical Director - C4D, Maya, AE, - Washington DC
frankmci
Licensed Customer
Licensed Customer
 
Posts: 814
Joined: Fri May 26, 2017 2:00 pm

Re: Reflection visibility on the other objects

Postby calus » Fri May 17, 2019 6:06 pm

calus Fri May 17, 2019 6:06 pm
"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
calus
Licensed Customer
Licensed Customer
 
Posts: 1308
Joined: Sat May 22, 2010 9:31 am
Location: Paris

Re: Reflection visibility on the other objects

Postby frankmci » Wed May 22, 2019 9:28 pm

frankmci Wed May 22, 2019 9:28 pm
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 120 times
Technical Director - C4D, Maya, AE, - Washington DC
frankmci
Licensed Customer
Licensed Customer
 
Posts: 814
Joined: Fri May 26, 2017 2:00 pm

Re: Reflection visibility on the other objects

Postby calus » Sun May 26, 2019 7:52 am

calus Sun May 26, 2019 7:52 am
@ 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
calus
Licensed Customer
Licensed Customer
 
Posts: 1308
Joined: Sat May 22, 2010 9:31 am
Location: Paris

Re: Reflection visibility on the other objects

Postby frankmci » Tue May 28, 2019 3:23 pm

frankmci Tue May 28, 2019 3:23 pm
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!
Technical Director - C4D, Maya, AE, - Washington DC
frankmci
Licensed Customer
Licensed Customer
 
Posts: 814
Joined: Fri May 26, 2017 2:00 pm

Re: Reflection visibility on the other objects

Postby pandayoghurt » Mon Sep 30, 2019 12:52 pm

pandayoghurt Mon Sep 30, 2019 12:52 pm
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
pandayoghurt
Licensed Customer
Licensed Customer
 
Posts: 25
Joined: Sun Jan 25, 2015 5:42 pm
Location: UK

Re: Reflection visibility on the other objects

Postby glennsmooth » Wed Apr 08, 2020 2:47 am

glennsmooth Wed Apr 08, 2020 2:47 am
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.
glennsmooth
Licensed Customer
Licensed Customer
 
Posts: 3
Joined: Sat Apr 11, 2015 1:18 pm

Re: Reflection visibility on the other objects

Postby frankmci » Wed Apr 08, 2020 2:41 pm

frankmci Wed Apr 08, 2020 2:41 pm
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.
Technical Director - C4D, Maya, AE, - Washington DC
frankmci
Licensed Customer
Licensed Customer
 
Posts: 814
Joined: Fri May 26, 2017 2:00 pm
Previous

Return to Maxon Cinema 4D


Who is online

Users browsing this forum: No registered users and 14 guests

Thu Mar 28, 2024 8:19 pm [ UTC ]