PDA

View Full Version : Shadow Transparency & Diffuse value relationship


MJV
06-05-2006, 07:28 AM
Thought I would share another interesting finding on transparency in XSI. Probably most people would expect that shadow transparency and material transparency are directly related. As it turns out, this is not entirely true. The Diffuse value of the material, even when inactive, impacts the shadow in a dramatic way. The illustration below shows a default geometry sphere with a green transparency enabled. With a raytraced shadow we would expect to see a semi opaque green shadow. However, this is not the case. The diffuse value of the material is making the shadow completely opaque with no transparency at all. Also of interest, the diffuse value is not perfect black, and the light intensity is very high, yet the shadow is still completely opaque. Furthermore, if you turn off the diffuse value, the shadow is unchanged. This shows that the diffuse value affects the shadow even when inactive.

On the surface this may seem like slipshod engineering, but ironically there is an advantage in that, if you know of this, you now have the ability (completely undocumented AFAIK) of being able to control the intensity of the shadow with the diffuse setting. Of course, this is probably only valuable if you are in fact not using the diffuse for anything else. Whether or not this behavior was intentional, it's no doubt beyond difficult to change now because of legacy issues.

http://www.mvpny.com/XSITranparencyShadowMV1.jpg

MJV
06-05-2006, 08:08 AM
Another interesting rule: Reflection trumps transparency. A material where transparency and reflection are both 100% will show reflection and no transparency. In Cinema 4D, the reverse is true.

gent_k
06-05-2006, 08:51 AM
Another interesting rule: Reflection trumps transparency. A material where transparency and reflection are both 100% will show reflection and no transparency. In Cinema 4D, the reverse is true.

Hi again. So which one do you think is correct?
Lets say you have a glass, and its 10% reflective and you have some reflection but you see through it, and then you turn up reflection all the way up, what do you expect it to do? Unless you have some type of fresnel effect it should behave as a fully reflective glass shouldn't it? (i.e. you won't see through it)
I'm really surprised at C4d's behavior, as I can assure you that coming from max most other renderers are the same.
It makes sense to you doesn't it? :argh:

MJV
06-05-2006, 09:21 AM
Hi again. So which one do you think is correct?
Lets say you have a glass, and its 10% reflective and you have some reflection but you see through it, and then you turn up reflection all the way up, what do you expect it to do? Unless you have some type of fresnel effect it should behave as a fully reflective glass shouldn't it? (i.e. you won't see through it)
I'm really surprised at C4d's behavior, as I can assure you that coming from max most other renderers are the same.
It makes sense to you doesn't it? :argh:

I was merely noting the behavior, as a bonus tidbit to other readers with Cinema 4D experience. They are mirror image solutions of one another, neither one more correct than the other.

Anyway, you seem hostel. Is it because in my previous post I uncovered an error in how transparency is subtracted from diffusion and educated future readers on possible solutions and workarounds? No disrespect intended, but I would think you at least would be happy to have learned that your suggested solution to use black as transparent and while opaque was completely wrong. We are all here to learn and share.

gent_k
06-05-2006, 10:30 AM
Sorry for being 'hostel', but my suggestion for the invert thing was assuming that you were using a default scene, and I think I mentioned that in that case the diffuse value is a default high grey. You had a screenshot of a sphere on a black background, with no shadows etc. and obviously my suggestion of using a black diffuse value (on about 3 posts) would only turn up a blank render.

Anyway, sorry for being hostel again. But you yourself could try being somewhat less arrogant too, as not everything that doesn't behave the way you're used to in your previous application, is automatically incorrect.

So on to something more constructive, here are some tests related to the first post:
http://img217.imageshack.us/img217/9636/Clip_2.th.jpg (http://img217.imageshack.us/my.php?image=Clip_2.jpg)
http://img217.imageshack.us/img217/33/Clip.th.jpg (http://img217.imageshack.us/my.php?image=Clip.jpg)
http://img217.imageshack.us/img217/9829/Clip_3.th.jpg (http://img217.imageshack.us/my.php?image=Clip_3.jpg)
http://img217.imageshack.us/img217/3789/Clip_5.th.jpg (http://img217.imageshack.us/my.php?image=Clip_5.jpg)
http://img217.imageshack.us/img217/7598/Clip_4.th.jpg (http://img217.imageshack.us/my.php?image=Clip_4.jpg)

as you see, the intensity of the first and second one is the same, so looks like in the example you posted everything seems to be OK, and raising the value a little more would produce green shadows.

so here's the question, how do you get a result like the fifth one in c4d if the diffuse value doesn't have an impact on the transparent shadow?

wurp
06-05-2006, 11:40 AM
once you get into shading a bit more you will realize that using the default phongshader for everything is not a good idea, for example I rarely use the reflection parameter in the phongshader, instead I build my own tree with a custom reflectionshader, same with transparency etc, it takes longer to setup but in the end you get more flexibility...

also note that the reflections are being mixed in by default in xsi, in c4d and in most other apps they are added (a+b), if you want this behavior in xsi you have to build your own tree with mixers and math nodes...

MJV
06-05-2006, 12:06 PM
once you get into shading a bit more you will realize that using the default phongshader for everything is not a good idea, for example I rarely use the reflection parameter in the phongshader, instead I build my own tree with a custom reflectionshader, same with transparency etc, it takes longer to setup but in the end you get more flexibility...

also note that the reflections are being mixed in by default in xsi, in c4d and in most other apps they are added (a+b), if you want this behavior in xsi you have to build your own tree with mixers and math nodes...

Actually, I have to correct you there. They are mixed in C4D, better than in XSI imo, and you have the option of adding instead. That said, I trust you on the power and advisability of building your own tree in XSI. I love that you can bypass the phong transparency for example. As you said I'm only just discovering a lot of this stuff but I can see that the potential for control in XSI exceeds that of C4D. My goal is to see and prove how great MR can be, but that doesn't mean I'm going to gloss over problems I as I find them. Learning a renderers weaknesses seems just as important to me as learning its strengths.

wurp
06-05-2006, 09:14 PM
really? I just tried in the c4d demo here and if I make a material 100% reflective the diffuse parameter still has an impact, just like it would if you used add mode...

if it was a mix having 100% reflectivity would disable the diffuse parameter

also a "mix" is always a mix, at least if you stick to the definition of it

Actually, I have to correct you there. They are mixed in C4D, better than in XSI imo, and you have the option of adding instead. That said, I trust you on the power and advisability of building your own tree in XSI. I love that you can bypass the phong transparency for example. As you said I'm only just discovering a lot of this stuff but I can see that the potential for control in XSI exceeds that of C4D. My goal is to see and prove how great MR can be, but that doesn't mean I'm going to gloss over problems I as I find them. Learning a renderers weaknesses seems just as important to me as learning its strengths.

MJV
06-05-2006, 09:46 PM
really? I just tried in the c4d demo here and if I make a material 100% reflective the diffuse parameter still has an impact, just like it would if you used add mode...

if it was a mix having 100% reflectivity would disable the diffuse parameter

also a "mix" is always a mix, at least if you stick to the definition of it

You're right, it doesn't mix reflection. I was referring to the transparency channel which does mix, and does it without inverting the color in the process. It then has an option for whether you want to use add instead, so mix doesn't always have to be mix. :) I will say again that I'm not prepared to argue that Cinema 4D offers more control. I do however find it a bit annoying that in the XSI mix, reflection trumps transparency. Quite often you want transparency and reflection to add up to 100 either way. It's simple with Cinema, you just use the transparency you want and turn reflection to 100%. You can do the opposite with XSI, use the reflection you want and then set transparency to 100%. The drawback with this method is that it leaves your shadows not working with incidence for example. To fix shadows you have to set incidence on the transparency, but then the reflection incidence mixes on top of that and it become a bit of a pain. You can set up an invert node but if you're using color in the transparency you'll have to remove it in the reflection. It would be a little easier imo if transparency trumped reflection.

MJV
06-05-2006, 09:51 PM
Also Wurp. Can you tell me how I would go about bypassing the transparency and refection channels of the Phong node? The material node has a direct input for shadow but I don't see any direct inputs for transparency and reflection. You mentioned before a custom node. Could you explain a little about that or tell me where to look? Thanks.

gent_k
06-05-2006, 10:13 PM
Many shaders like the mib_glossy_reflecion and others have a base_material slot where you plug the phong(or other) in, and then connect this to the material node.

wurp
06-06-2006, 10:25 AM
I usually end up using the sprite or transparency node in the raytracing section (nodes->raytracing) and use it at the end of the network since the phongnode sits somewhere in the middle and its transparency would not work correctly since I would have other nodes after it that would also affect transparency..

If you want to override the transparency of the shadow you can use the "simple_shadow" node under the Illumination section and plug that into the shadow port...

For reflections Im using the mib_glossy_reflection, its fast for glossy reflections but can also be used for normal reflections, it doesnt come with xsi so you'll have to do a search either here or on xsibase as I cant remember the link now.

The way Im using it I take the phongnode, plug that into a mix2colors Base_color port, then I take the mib_glossy_reflection and plug that into the color1 port and set the mixer to add mode, and the weight to 1.0

in the reflectionshader you can then control the intensity, it also has the ability to do correct freznel falloff...


The workflow in xsi might seem a bit "hacky" coming from for example c4d, if you wanted a similar workflow in xsi you'd have to write an "ubershader" that has everything in it and that would always return correct shadows and all but then youd loose the whole point of having a nodebased material system..

hope this helps



Also Wurp. Can you tell me how I would go about bypassing the transparency and refection channels of the Phong node? The material node has a direct input for shadow but I don't see any direct inputs for transparency and reflection. You mentioned before a custom node. Could you explain a little about that or tell me where to look? Thanks.

MJV
06-06-2006, 04:33 PM
Thanks wurp, and gent_k, I'll have a look around for that mib glossy shader. Thanks for the detailed response. Much appreciated.

BTW wurp, what have done with my 64 1/2 mustang? ;)

wurp
06-06-2006, 04:53 PM
Put a new radiator hose onit'

That'll be 150$ so I hope you know how to wash dishes or shovel shit cuz' yer gonna have to work this off bud....



BTW wurp, what have done with my 64 1/2 mustang? ;)

MJV
06-06-2006, 09:33 PM
Put a new radiator hose onit'

That'll be 150$ so I hope you know how to wash dishes or shovel shit cuz' yer gonna have to work this off bud....

LOL. That fits perfectly with the day I'm having...

Sbowling
06-07-2006, 05:55 AM
Another interesting rule: Reflection trumps transparency. A material where transparency and reflection are both 100% will show reflection and no transparency. In Cinema 4D, the reverse is true.

This is the way it should work and the way it works in just about every renderer I've ever used (I don't remember this being a issue in C4D, but I didn't use it very long). Transparency should never override reflections in a realistic render. Being able to do this for "artistic reasons" may be nice, but I doubt it would be that usefull.

Imagine a world where glass wasn't reflective. It would be completely invisible, unless it was dirty. :eek:

MJV
06-07-2006, 09:24 AM
This is the way it should work and the way it works in just about every renderer I've ever used (I don't remember this being a issue in C4D, but I didn't use it very long). Transparency should never override reflections in a realistic render. Being able to do this for "artistic reasons" may be nice, but I doubt it would be that usefull.

Imagine a world where glass wasn't reflective. It would be completely invisible, unless it was dirty. :eek:

Sbowling, I don't think you're understanding the nature of the discussion here. There is something called the 100% rule. A surface's reflective, transparent and diffuse values can never return more than 100% energy and still appear realistic. If something could be both 100% reflective and 100% transparent at the same time then it would be returning more energy than it's receiving. That is why raytracers typically mix these values. In the C4D case, where a surface is transparent, reflection is subtracted. In MR, the opposite is done. Where a surface is reflective, transparency is subtracted. They're two sides of the same coin. However, given a choice, I find that the C4D method is slightly more convenient because it's easier to set reflection to full and have transparency attenuate it than the other way around. The reason is shadows. Shadows see transparency, not reflection. When you set up a transparent fresnel effect on a surface you get fresnel shadowing, which is the best caustics fake you can achieve short of using caustics. This means you need only to set up your fresnel effect with transparency to get good shadows, good reflection (refection is returned in opaque areas) and good transparency. Because MR does it the other way around, you need to set up the fresnel effect with reflection instead of transparency. But this leaves the shadows without any fresnel effect. If you then set up a fresnel effect on the transparency to fix the shadows, you're using fresnel twice and thus leaving some areas not returning 100%. Ok, so that can be addressed with an inversion node you say, but that leaves the little problem of how to adjust for inversion of color in the case of colored glass. In the grand scheme of things it might seem like a very minor issue, and I'm sure difficult to follow unless you've actually had the experience of approaching the issue from both sides, but it is nonetheless slightly more convenient to have transparency trump reflection. That is not to say that the node based tree in XSI doesn't ultimately offer a lot of user control, only that I'd prefer it if transparency trumped reflection instead of the other way around because it would then be slightly easier to achieve fresnel shadows and 100% surfaces with less setup.

CGTalk Moderation
06-07-2006, 09:24 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.