Page 1 of 2

Cinema 4D Shader Support

Posted: Thu Nov 15, 2012 4:29 am
by forgeflow
I'm messing around with the latest build of Cindigo, and was really excited to discover that there is now support for Cinema 4D's noise and procedural shaders. My excitement abated somewhat when I discovered that none of the shaders that require surface normal information work. This would include useful shaders like fresnel, falloff, and ambient occlusion. So that was kind of a bummer. Fresnel in particular is a very important effect - it would be great if Indigo had some internal way of interpreting a C4D Fresnel gradient. Fresnel effects just can't be baked into a texture map, so there is no easy work-around for this.

I also noticed that an Indigo menu appears in the shader list. Selecting "Indigo/Indigo ISL Shader" while in an Indigo Material produced the following error:
Screen Shot 2012-11-14 at 10.24.24 AM.png
error generated when using an Indigo ISL Shader in an Indigo material.
This error doesn't show up when using the Indigo ISL Shader in a Cinema 4D material.

Cinema 4D Shader Support

Posted: Thu Nov 15, 2012 8:28 am
by zeitmeister
I am longing for Fresnel support for a very long time, too.
About AO: you could try to bake it seperately in C4D.

Re: Cinema 4D Shader Support

Posted: Thu Nov 15, 2012 11:30 am
by CTZn
AO could be emulated with a grey clay render of an uniform environment with a suitable tonemapping. Burning the image out would be like reducing the AO distance, though it might be more appropriate to work later on the EXR output..

Re: Cinema 4D Shader Support

Posted: Thu Nov 15, 2012 11:54 am
by Zom-B
forgeflow wrote:I also noticed that an Indigo menu appears in the shader list. Selecting "Indigo/Indigo ISL Shader" while in an Indigo Material produced the following error:
Screen Shot 2012-11-14 at 10.24.24 AM.png
This error doesn't show up when using the Indigo ISL Shader in a Cinema 4D material.
That is because you load up the ISL Shader that is empty.... the empty code free shader generates that error while C4D tries to render a preview of the material.

Simply past the following code into the code window if you click the shader once to get some fresnel style of effect:

Code: Select all

def eval(vec3 pos) vec3 :
                  lerp(
                    vec3(0.9, 0.2, 0.2),
 					vec3(0.5, 0.5, 0.1),
                    maxCosTheta()
                   )

Re: Cinema 4D Shader Support

Posted: Thu Nov 15, 2012 2:21 pm
by forgeflow
Simply past the following code into the code window if you click the shader once to get some fresnel style of effect:
I tried it with this: (should be from black at the edge to almost white):

Code: Select all

def eval(vec3 pos) vec3 :
lerp(
    vec3(0,0,0),
    vec3(0.9,0.9,0.9),
    maxCosTheta()
    )
Result:
kerbleh.png
The effect is there... but pretty subtle. Most of that code is mumbo jumbo to me... but I suspect that it's black on the side facing away the camera, and I'm just seeing it creeping around the edge. Is there a way to make the effect more pronounced (like doubling maxCosTheta() or something?) I tried some stuff but all I got was errors.

I also tried this:

Code: Select all

def eval(vec3 pos) vec3 :
lerp(
    vec3(-0.9,-0.9,-0.9),
    vec3(0.9,0.9,0.9),
    maxCosTheta()
    )
Which produced this weird result:
kerbleh2.png
The transition is oddly abrupt, and the effect isn't visible at all in the portion illuminated by bounce light from the floor.

Re: Cinema 4D Shader Support

Posted: Thu Nov 15, 2012 8:27 pm
by Zom-B
hey forgeflow,

yes, that is no real fresnel we do here, but some coloring based on normal direction :/
Access to a real Fresnel output would be indeed great for many effects.

I used fresnel also a lot in my C4D shaders (and still do) but for Indigo I actually learned to work with the physical based materials, so using Fresnel would harm that physical correctness in most cases...

But lets see what the new material stuff brings that will come during 3.6 betas, maybe we get lucky :)

Re: Cinema 4D Shader Support

Posted: Fri Nov 16, 2012 2:56 am
by Mor4us
if you're staying with physical material setup I actually can't see any need (with few exceptions) for a fresnel...

Re: Cinema 4D Shader Support

Posted: Fri Nov 16, 2012 7:17 am
by forgeflow
if you're staying with physical material setup I actually can't see any need (with few exceptions) for a fresnel...
But what you are saying there is that I can't have both. If I want physical accuracy in the lighting of my scene, I have to relinquish artistic control over it. That either I get full control over my shaders and their appearance in the final render, or I get material and light-field accuracy but I have to live with whatever I get because it's "accurate". I don't believe this has to be an either/or situation.

I'm not joining a religion - I just want a better rendering engine.

Example: I've done renders of outdoor objects, and while it might be technically "correct" that some of the shadows are filled with bounced light from other objects, the fidelity of the details on the object itself might suffer as a result. So there's two cures - become a lighting director and fiddle around with the lighting forever to get the right contrast in those problem areas, or tweak the material setup so it gets a little darker at oblique angles, or use ambient occlusion to add a bit more contrast to high detail areas. With Indigo, I'm short a couple of tools in my toolkit. I think that's understandable that I'd want to keep them while gaining all of the other advantages of using it.

Re: Cinema 4D Shader Support

Posted: Fri Nov 16, 2012 9:02 am
by OnoSendai
Hi Forgeflow,
We will be re-introducing the 'fresnel-scale' parameter to the phong material soon, which might help you a bit. you can use it reduce Fresnel reflectance.

Re: Cinema 4D Shader Support

Posted: Fri Nov 16, 2012 11:02 am
by forgeflow
OnoSendai wrote:Hi Forgeflow,
We will be re-introducing the 'fresnel-scale' parameter to the phong material soon, which might help you a bit. you can use it reduce Fresnel reflectance.
Will it be a general shader (like the ISL noise or gradient shaders) that can be used in any texture channel, or is it an effect limited to the material reflectance?

Re: Cinema 4D Shader Support

Posted: Fri Nov 16, 2012 11:28 am
by OnoSendai
It's not a general shader, it's just a parameter for Phong.
You can drive it with a texture or ISL if you want though.

Re: Cinema 4D Shader Support

Posted: Fri Nov 16, 2012 12:18 pm
by Zom-B
forgeflow wrote:I'm not joining a religion - I just want a better rendering engine.
my lol of the day ^^

But actually its quite religious if you enter the "unbiased rendering" camp...
Artistic freedom is something you aim for, if you are not able to get your stuff done right the traditional way, by setting lights and choosing object position etc. the right way.

But since we are not in Victorian england anymore, I also would suggest that there should be possibilities for young and eager customers to get a result they aim for!!

I'm more of a follower of the religion in getting my s**t done right, in a way that it works without the help of Mr. Special Shader, but indeed that takes time, that not every project has!

Loooooooong Story short:
you can bake your (UV mapped) C4D Fresnel Shaders in C4D to a texture and use it as you did before!

Re: Cinema 4D Shader Support

Posted: Sun Nov 18, 2012 5:10 am
by forgeflow
Zom-B wrote:you can bake your (UV mapped) C4D Fresnel Shaders in C4D to a texture and use it as you did before!
Actually, you can't because the effect is view dependent. But anyway, I'll leave this argument for another day.

I have discovered a bug in Cindigo. Its very easy to reproduce:
Open up a new Cinema 4D document.
Create a new Indigo material.
In the color channel, select an ISL Gradient in the Texture Map selector.
Click on the gradient to edit it, and change it from 2D - U to 2D -V.
Wait a couple moments... bam, your Cinema 4D is now locked up.

This happens for me in Cinema 4D R13, on both my iMac at home running Snow Leopard, and my Mac Pro at work running Lion.

Cinema 4D Shader Support

Posted: Sun Nov 18, 2012 6:17 am
by zeitmeister
You can activate "use camera vector" in the material baking tag.
Won't work for animations and different camera angles, for sure.

Re: Cinema 4D Shader Support

Posted: Thu Nov 22, 2012 7:04 am
by forgeflow
So... what is different about what i am asking for, and the contents of this topic:
http://www.indigorenderer.com/forum/vie ... f=7&t=7505
Which was posted by Indigo developers back in 2009? Looks like frensel shading to me? Does this stuff work in Indigo now?