stu Posted May 7, 2006 Share Posted May 7, 2006 Hey all, I was wondering what the general consensus was regarding reflections and how they should contribute to surface colour. All of SESI's out-of-the-box shaders seem to take the additive approach: But I'm inclined to think that an over operation (based on the luminance of the reflection) produces a better result: I'd like to know what others think and if there is an altogether different method that I'm overlooking. Thoughts? Quote Link to comment Share on other sites More sharing options...
edward Posted May 7, 2006 Share Posted May 7, 2006 What does Advanced Renderman do? In theory, I thought light was additive? Quote Link to comment Share on other sites More sharing options...
stu Posted May 7, 2006 Author Share Posted May 7, 2006 In theory, I thought light was additive? 27327[/snapback] It is, but because the typical lighting model makes use of a diffuse colour component to introduce what is effectively a diffuse reflection from the environment, we have to make a decision about how non-diffuse reflections are introduced in unison with the "diffuse colour" cheat. The all additive approach only works if you set the diffuse component to 0 and introduce any and all colour to the surface through legitimate reflections, be they raytraced or environment mapped. If you look at the first image above, the additive reflection produced an impossible result - reflections that are brighter than the source. We could even extend this discussion to whether or not specular highlights (another reflection fake) should be handled as an "over" as well... Quote Link to comment Share on other sites More sharing options...
Jason Posted May 7, 2006 Share Posted May 7, 2006 I've had a similar conundrum recently and I was surprised to hear how much opinion versus fact there is out there; but my questions were slightly different to yours: When fresnel reflections ramp up toward the horizon (whether you use fresnel() or a less harsh, more controllable pow(dot(N,L))) should you attentuate the diffuse component down simultaneously too? i.e on the horizon have 100% reflections and 0% diffuse. Many books just do 100% diffuse + 100% reflection. My resultant opinion (seemed logical and one which I thought also looked the best) was this: If the surface is the type that has a thick clear substrate then I'd think that the fresnel transmission/reflection components [Kr and Kt=1/Kr] comes in effect and therefore none of the transmitted diffuse should come through the substrate, giving the effect I describe above. This would be true for plastics and things covered covered in thick varnishes - like car paint. However I do provide a slider for this "additiveness" just in case the user wants to mess with this effect. So far I still treat raw metals are differently - in the standard Advanced Renderman Companion way - which is 100% specular reflections (tinted by the Kd) + 100% diffuse, Edward's additive light approach. I don't think performing a compositing operation for reflections sounds right to me at all though although the effect might be interesting. Cheers, Jason Quote Link to comment Share on other sites More sharing options...
stu Posted May 7, 2006 Author Share Posted May 7, 2006 I agree that one should relatively reduce indirect diffuse contribution with the increase of direct reflection contribution. Philosophically they're doing the same thing (contributing light from the environment) but through different means. To retain both contributions to a sum of more than %100 would be physically inacurrate, wouldn't it? What do you think? Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted May 8, 2006 Share Posted May 8, 2006 I'm also of the opinion that it should be additive. I think the whole confusion comes from the way reflectance is traditionally split into "components" (amb, diff, spec refl, and mirror refl). This, IMHO, is what messes up the whole thing. We all know that it's all a single thing: reflected light. But then we (myself at any rate) always forget to treat it that way. Why do we often apply a BRDF (which includes Fresnel) to specular reflections, but not to mirror reflections? Why are specular reflections somehow different than other types? We all know they're not... but we usually treat them differently. If you interpret mirror reflections simply as light sources in the mirror direction, and treat them in the same way you would specular reflections, you actually get something that I think is a lot more realistic looking. Here's what I mean: Single light source (no cast shadows) on an almost mirror-like BRDF. This is a metallic (microfacet) BRDF with both diffuse and specular weighed by Fresnel. Here, the contributions from the mirror direction get "special treatment" in the sense that, unlike the rest of the solution, they simply get added (as in Stu's first example above). Now we add Fresnel weighing (as is the case for the rest of the BRDF) to the mirror reflections. This includes the color shift implicit in the Fresnel functions (in this case, the surface albedo is very low, so the Fresnel colour shift is toward the "dark side"). And finally, we modulate by the BRDF's distribution function itself (thereby applying the complete BRDF to the mirror reflections). This BRDF has a large spike at zero, which is why you don't see Fresnel dragging it down so far. But there's also shadowing and masking, so it's not linear. To me, this looks a lot more believable than the first image, and all I've done is to apply the BRDF to *all* contributions, not just specular reflections. I couldn't say with any certainty whether this is physically "correct", but it feels "right" at an intuitive level. In any case... this isn't an easy problem, despite appearances. It's pretty tough to "get it right", actually... IMHO, that is. P.S: This stuff is very nicely covered in Ashikhmin's Anisotropic Phong BRDF Model (a "standard" BRDF model by now I think, judging by the massive number of references to it) -- talks about the whole Fresnel-weighted diffuse, plus the balanced diffuse-specular levels. Well worth a read. Quote Link to comment Share on other sites More sharing options...
stu Posted May 8, 2006 Author Share Posted May 8, 2006 Hey Mario, great stuff. By affecting the mirror reflections by the same BRDF you've managed to negate the whole "diffuse reflection vs. mirror reflection" discontinuity issue aparent in most phong type surface shaders and treat all incoming light sources in a like manner. I completely agree that in this approach additive is the way to go. Nicely done. I believe that the lighting models we've all come to know and love over the past couple of decades are someday going to be replaced on a large scale by a more physically sound approach to shading for photorealsim with much more attention to concerns like energy decay, etc. Agree or disagree? Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted May 8, 2006 Share Posted May 8, 2006 I believe that the lighting models we've all come to know and love over the past couple of decades are someday going to be replaced on a large scale by a more physically sound approach to shading for photorealsim with much more attention to concerns like energy decay, etc.Agree or disagree? 27346[/snapback] Yes, I think I agree for the most part. The biggest caveat is that whatever models they are, they absolutely *have* to be completely flexible if they have any hopes of being used in typical CG production for entertainment (as opposed to research and academia) -- we CG people must be able to push and pull and stretch and warp any one of these models beyond recognition to satisfy a "look". If they can still remain "physically correct" and "plausible" after all that abuse, well then, that's great! What I think the great thing that all this physically based research (measured BRDFs and their various representation, etc) is bringing to our little corner of the world is a better overall understanding, which in some cases translates into new analytical models that actually have a hope of satisfying our crazy requirements. For example, Michael Ashikmhin (the same guy I mentioned above) has come up with a model that pretty much allows you to "draw" your own crazy distribution curve, is compact and fast, and still ends up with a BRDF that conforms to the usual physical constraints of reciprocity, energy conservation, etc, *and* can be easily fitted to measured data, so it can go both ways -- a long way from good'ol Phong, baby Here's the unpublished paper that describes his model. Pretty K3w1 stuff, and that's just one of the many new approaches being explored these days... very exciting. Quote Link to comment Share on other sites More sharing options...
symek Posted May 8, 2006 Share Posted May 8, 2006 Hi Mario, I'm lost. What is the BRDF in respect to VOPs? I mean I know what is BRDF in general (also from your great contribusion to odwiki), but I thought BRDF is calculated via lightning model in VOPs. But from what is written here my idea of BRDF has broked into pieces. I get the idea of treating diff and spec with fresnel also, and I do like that always what it comes from my compositing expirence but: "...Why do we often apply a BRDF (which includes Fresnel) to specular reflections, but not to mirror reflections? Why are specular reflections somehow different than other types?" somehow change my personal confidence of what I'm doing when I mult spec or diff by fres and add reflect previously mult by fres ro whatever.... When I take Lighting model Vop with turned off amb, diff, and keep just spec, do I retrieve spec contribusion of BRDF or not? thanks for clarifing things! cheers, SYmek. Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted May 8, 2006 Share Posted May 8, 2006 somehow change my personal confidence of what I'm doing when I mult spec or diff by fres and add reflect previously mult by fres ro whatever.... When I take Lighting model Vop with turned off amb, diff, and keep just spec, do I retrieve spec contribusion of BRDF or not? Yes, the LightingVOP can give you the accumulated result of applying a given BRDF to all the scoped lights in the hemisphere. As you say, if, for example, you set the model to "Phong" and set both "Ambient Color" and Diffuse Color" to {0,0,0} and "Specular Color" to {1,1,1}, then you get the local illumination at that point on the surface, weighted by the Phong BRDF. So yes, you're correct. VEX also makes available the actual BRDF functions (not in VOPs, I don't think). These are: phongBRDF(), blinnBRDF(), specularBRDF(), and diffuseBRDF(). Unfortunately, what I was talking about doesn't apply to those BRDFs (or rather, it's pointless with those models), because outgoing intensity from the mirror direction is always 1. i.e: reflected intensity from the mirror direction is constant. I was thinking of physically-based microfacet models like Cook-Torrence and the like which have a masking term that attenuates mirror reflections depending on incidence and exitance angles. Aside from all this though, the weighing should be done per-sample, and functions like reflectedlight() don't give you access to each sample. That's why there have been requests for a so-called "gather loop" in VEX/Mantra. Sorry if I confused the issue. Quote Link to comment Share on other sites More sharing options...
symek Posted May 8, 2006 Share Posted May 8, 2006 o great! it's always worthy to wait for your reply (and ask questions I'm affraid .) this paper you pointed out about anisotropic phong brdf model... on Figure 2. we have cylinder with apparent of brushed metal. Is it possible to acheive it in mantra with its native lighting models or code new one, and what about antialais of such brushed surface? You said that this model is almost standard nowadays. Does it mean that mantra anisotropic model keeps this model's guidelines? sorry, I know you are busy cheers, SY. Quote Link to comment Share on other sites More sharing options...
stu Posted May 8, 2006 Author Share Posted May 8, 2006 You can do anisotrpoic shading in VOPs with the standard lighting model VOP. Set the "Lighting Model" option to "Anisotropic Specular" and you can control the width of the specular highlight in each direction (u,v) independantly. This method relys on uv texture coordinates which are oriented in the direction that you want the highlight to travel in, however. There are more complicated (and robust) ways to do anisotropic shading, but I think that this is the most straightforward. If I were doing this I'd want to blur the incoming reflections in the same direction and by the same values as well. Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted May 8, 2006 Share Posted May 8, 2006 Yup. What Stu said. In response to your other question: no, VEX's built-in anisotropic model is not Ashkhmin's. I could be wrong, but it looks very much like Greg Ward Larson's anisotropic model -- which is a perfectly good model. In the bundled VEX implementation, the uv tangents are derived form *parametric* uv's, not texture uv's, so beware (look at the vop_anisotropic() function in $HH/vex/include/voplib.h and note that tanU and tanV are based on dPds and dPdt). If you want to use texture uv's, esp. on polygonal surfaces, have a look at this related thread. Quote Link to comment Share on other sites More sharing options...
symek Posted May 8, 2006 Share Posted May 8, 2006 yep, I know vex anisotropic and it's not what I need. That's why I'm interested in the mentioned paper. cheers, SY. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.