Page 1 of 1

OSL Doesnt work C4D R20 4.01.1-R2

Posted: Tue Feb 05, 2019 10:42 pm
by sethRichardson
As the title says not a single OSL texture works currently.

I have tried every single one in the preset folder, ones that work in standalone etc etc. Not one works in 4.01.1R2, they dont compile.

There seems to be info missing when working in the editor as well.

Re: OSL Doesnt work C4D R20 4.01.1-R2

Posted: Tue Feb 05, 2019 11:40 pm
by aoktar
You have to connect it to material.

Re: OSL Doesnt work C4D R20 4.01.1-R2

Posted: Tue Feb 05, 2019 11:43 pm
by frankmci
It's working fine for me under that configuration. Do you have your OSL nodes connected to a material? They won't compile as free-floating nodes.

Re: OSL Doesnt work C4D R20 4.01.1-R2

Posted: Wed Feb 06, 2019 12:53 am
by sethRichardson
aoktar wrote:You have to connect it to material.

My question I guess is how do I achieve something like a material switch like so many other engines have?

I need to swap between multiple materials on a single item and would rather not duplicate a ton of materials to do it and clutter my scene when it should be doable with nodes. This is clearly not attached to anything. Does this just flat not work in c4d only standalone?

Re: OSL Doesnt work C4D R20 4.01.1-R2

Posted: Wed Feb 06, 2019 1:13 am
by aoktar
You can't connect materials to osl scripts. It's a texture type. Why don't do that with xpresso or python scripts in C4D level?

Re: OSL Doesnt work C4D R20 4.01.1-R2

Posted: Thu Feb 07, 2019 7:44 pm
by frankmci
sethRichardson wrote:
aoktar wrote:You have to connect it to material.

My question I guess is how do I achieve something like a material switch like so many other engines have?

I need to swap between multiple materials on a single item and would rather not duplicate a ton of materials to do it and clutter my scene when it should be doable with nodes. This is clearly not attached to anything. Does this just flat not work in c4d only standalone?
As I understand it, the OSL compiler needs to "know" its output in order to compile, so no, it flat out will not compile unattached.

It's perhaps not the most elegant solution, but a Blend Material with the first slot left empty works pretty well as a simple material switch, although you will have to specifically build those materials as "Sub Materials." It can get a little complicated if you need to switch displacements, since that's a separate input.