Page 2 of 2

Re: OSL | Raytype = Magic

Posted: Thu Jun 14, 2018 2:27 pm
by milanm
Thanks Frank!

Ok guys I think Material Previews are to be blamed for CUDA errors. I had them disabled after working on a project and they were off while I was working on that scene with animated lights. After turning them on I can now see the same CUDA error after frame 5! Apologies for that. :oops:

Could you please try disabling both of these two options in Live Viewer before opening the scene and see if that fixes anything?
MatPrev.jpg
MatPrev.jpg (55.66 KiB) Viewed 9216 times

UPDATE: In the meantime, this issue was fixed in the latest 4.00 XB3 released a few hours ago! No more CUDA errors with material previews on here! That's our Ahmet ladies and gentlemen! In retrospect, these are uncharted territories, we're breaking new ground here in terms of how C4DOctane can be used so some turbulence was to be expected along our flight I guess. (and I'm probably the king of bad puns) ;)

Regards
Milan

Re: OSL | Raytype = Magic

Posted: Mon Jun 18, 2018 2:03 pm
by frankmci
milanm wrote: Could you please try disabling both of these two options in Live Viewer before opening the scene and see if that fixes anything?
Milan,
Yup, that fixed, or at least disabled the problem. I can now move past frame five and everything keeps working/rendering. I'll have to see if it's just been the previews causing my instability issues working with OSL/3.08.1 in C4D. Thanks for digging further into it!

This Raytype trick could let us use more of those tried 'n true, quick 'n dirty render tricks that have made biased renders fast and flexible over the years, while still having the render power of Octane. It's been hard to get some of our animation team's old dogs to embrace Octane's unbiased engine.

- Frank

Re: OSL | Raytype = Magic

Posted: Thu Jul 05, 2018 4:45 pm
by aoktar
frankmci wrote:
milanm wrote: Could you please try disabling both of these two options in Live Viewer before opening the scene and see if that fixes anything?
Milan,
Yup, that fixed, or at least disabled the problem. I can now move past frame five and everything keeps working/rendering. I'll have to see if it's just been the previews causing my instability issues working with OSL/3.08.1 in C4D. Thanks for digging further into it!

This Raytype trick could let us use more of those tried 'n true, quick 'n dirty render tricks that have made biased renders fast and flexible over the years, while still having the render power of Octane. It's been hard to get some of our animation team's old dogs to embrace Octane's unbiased engine.

- Frank
It looks like a crash in material previews. Which is as a crash comes from SDK. Let me know if it's still crashing while not having Live Viewer renders. Or with disabled previews.

Re: OSL | Raytype = Magic

Posted: Sun Nov 18, 2018 3:23 am
by milanm
Here's a quick and dirty example of how Raytype can be used to switch between two different environment maps. Basically, that will allow you to use a different HDRI for refractions/reflections and even diffuse light.

When I experimented with this for the first time, I think I reached a point where I had about 5-6 different HDR maps for different things reflected or refracted in other things and, at that point, I completely lost track of what was reflected/refracted/visible where and what reflection is showing what diffuse HDRI... (taking a breath) So. Hopefully, that gives you an idea about the possibilities here...

Oh, did I mention that all of those maps can be fully procedurally generated OSL 'light studios'? Yup.

Usage:
Here Raytype OSL is used to control the 'Amount' value of MixTexture. Depending on what type of ray hits the Env. map, MixTexture will show one HDR map or the other.

Here's a quick demo.


C4D file:
RaytypeEnvironmentC4D.zip
(3.65 MiB) Downloaded 473 times
ORBX:
RaytypeEnvironment.orbx
(3.8 MiB) Downloaded 437 times
Cheers
Milan

Re: OSL | Raytype = Magic

Posted: Tue Nov 20, 2018 7:34 am
by Studio21
Thats awesome! thx millan!

Re: OSL | Raytype = Magic

Posted: Tue Nov 20, 2018 11:08 pm
by frankmci
Milan, the things you do make my head hurt, but in a good way. :)

It's too bad we can't see Environmental texture node networks in the Node Editor. Am I reading the youtube vid correctly, in that you are doing the equivalent of this? I've applied it as a full material to some geometry as a more tangible implementation of the Octane Sky object in hopes of getting a more intuitive understanding of what's going on.

Thanks again for sharing your experiments in OSL.

Re: OSL | Raytype = Magic

Posted: Wed Nov 21, 2018 8:44 am
by milanm
frankmci wrote:It's too bad we can't see Environmental texture node networks in the Node Editor
Amen to that. :roll:

Sorry about the headache! Yes, that's exactly the setup I used in the video, If we pretend that the purple emission node is the environment texture input, of course.

My setup is actually more complicated than it should be but I did it that way for three reasons:
  • To better show how this works in Live Viewer.
  • To show that, no matter how complex/simple the node setup is, it is just a click away once you save it in the content browser.
  • To show that complex setups can be used there instead of just HDR maps.
Edit: Using OSL directly instead of MixTexture should work (and it works just fine in the Standalone) but after doing some more testing, it seams there might be a corner case where it might cause a cuda crash in C4D so it's best to use the setup as it is in the video and the node graph in the post above.

Also, it would be interesting to try this setup on emissive geometry and combine that with light include/exclude in V4. I didn't test that yet but it should work in theory.

Cheers
Milan

Re: OSL | Raytype = Magic

Posted: Wed Nov 21, 2018 12:24 pm
by KeeWe
I wonder if all this OSL stuff make it one time into the renderer itself to give us a standardized workflow and UID.

Obviously theres so much potential in OSL but to fully utilize it as a designer, for me it has to be build in.

In this particular cas it would be awesome to simply have one sky object with several HDRi slots right away.

Re: OSL | Raytype = Magic

Posted: Sat Jan 12, 2019 7:00 pm
by Kalua
This script is really good! But I noticed is not working properly in V 2018.1
Anyone could confirm a weird behavior and perhaps upgrade it's code?
Cheers!

Re: OSL | Raytype = Magic

Posted: Wed Dec 08, 2021 5:59 am
by amitvb89
This script has stop working in octane 2021.1-R4 update for CINEMA 4D, can someone help me with this?