<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">&gt;Probably it makes sense to include the fresnel in the Glossy BSDF node</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">&gt;itself yes, if it needs to depend on the specific BSDF normal.</span><br>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div style><span style="font-family:arial,sans-serif;font-size:13px">That&#39;s an option. Though I think it&#39;s a common issue for Refraction and Glass BSDFs. Anisotropic Ward BSDF doesn&#39;t even have fresnel term in theory that causes other issues.</span></div>
<div style><br></div><div style>For layering (in a long term I think) it would be nice to have this “Arbitrarily LayeredMicro-Facet Surfaces” by Weidlich and Wilkie. <a href="http://www.cg.tuwien.ac.at/research/publications/2007/weidlich_2007_almfs/weidlich_2007_almfs-paper.pdf">http://www.cg.tuwien.ac.at/research/publications/2007/weidlich_2007_almfs/weidlich_2007_almfs-paper.pdf</a></div>
<div style>Generalized coating that also has to work with proper microfacet normals. Mixing or Adding shaders can&#39;t do that. I think of those are really interleaving different materials in the same layer on micro level.<br>
</div><div style><br></div><div style>One way, I guess, to make layering work currently is to output Fresnel component from BSDF nodes themselves and then you it for Mixing when needed. Generally speaking you can&#39;t do stuff like mix( diffuse, specular, fresnel ). Yes, it guarantees that the energy is conserved, but it&#39;s too conservative. For plastics, for instance, one would do things like diffuse * Fresnel( at normal angle ) + specular * Fresnel( half angle ).</div>
<div style>Ashikhmin Shirley while using Fresnel( half angle ) for specular modifies diffuse in a different way which also doesn&#39;t always work. Not for all materials.<br></div><div style><br></div><div style>It looks to me that there is no good generalized solution for that. So it&#39;s up to an artist, which is ok.</div>
<div style><br></div><div style>So BSDFs output F and anyone can use it for mixing/weighting if they want to.</div><div style>Then the second question is how to handle metals there. Metals are colored at normal incidence and then get darker at some point and then get desaturated at 90 degrees.</div>
<div style>It could be a separate BSDF with more parameters just for metals.</div><div style>Or if instead of Fresnel they output partial Fresnel like pow( 1 - dot( n, h ), 5 ) or just simple microfacet facing (dot(n, h), then for dielectrics you would plug it first into MixRGB node with Color1=0.04 and Color2=1 which would correspond to IOR 1.5 and then you plug it into Mix Shader node.</div>
<div style>For metals you would plug that value into ColorRamp and get the desired effect there so you could do really advanced metals with spectral curves. That would require modification to Mix Shader node so it could mix channels separately but it already does it internally with Weight and SetWeight operations (in SVM).</div>
<div style>Then you can do really advanced artistic stuff along with realistic things. You can take n,k data and convert them into ramps like this:... (I attached examples of what you can generate from n,k data for aluminum, chromium, copper, gold, nikel). You can represent any metal like that.</div>
<div style><br></div><div style>Of course very few people would figure how to use it. But with some tutorial one could do a lot of fun cool.</div><div style><br></div><div style>Some render engines only give you IOR, or IOR + color of normal reflectance, or raw n,k data. But all of them are hard to control. Especially with n,k data. Most or real world metals are alloys and covered with oxides but ramps like that would give you more artistic control while being plausible.</div>
<div style><br></div><div style>Anyway, that&#39;s just an idea.</div><div style><br></div><div style>Alternatively, BSDFs might take another BSDF as an input that they cover, and then handle all that stuff inside.</div><div style>
<br></div><div style>Sorry for throwing so much stuff in here. I guess I&#39;ll think more about it over the weekend and maybe try this extra BSDF output thing.</div><div class="gmail_extra"><br></div><div class="gmail_extra">
- Dmitry<br><br><div class="gmail_quote">On Thu, May 30, 2013 at 6:17 PM, Brecht Van Lommel <span dir="ltr">&lt;<a href="mailto:brechtvanlommel@pandora.be" target="_blank">brechtvanlommel@pandora.be</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Dmitry,<br>
<div class="im"><br>
On Fri, May 31, 2013 at 12:43 AM, Dmitry Andreev &lt;<a href="mailto:andcoder@gmail.com">andcoder@gmail.com</a>&gt; wrote:<br>
&gt; I have local changes only for Glossy BSDF with GGX distribution but would<br>
&gt; like to generalize it to everything. The question is how to do it best<br>
&gt; within Cycles kernels and SVM (without side effects) ?<br>
&gt;<br>
&gt; I have/had a few ideas of how to do it best but some of them had side<br>
&gt; effects. The one that I am thinking of right now is that everything has<br>
&gt; basic IOR input, but you could plug a special advanced Fresnel node into it<br>
&gt; that would be evaluated withing closures themselves. That advanced node<br>
&gt; could have multiple options: 1. simple dielectric IOR, 2. spectral n,k data<br>
&gt; that could be pre-integrated into LUTs using standard CIE illuminant and<br>
&gt; standard CIE observer. It would look something similar to ColorRamp node.<br>
&gt; And add some presets there that could be easily generated from n,k<br>
&gt; databases.<br>
<br>
</div>Probably it makes sense to include the fresnel in the Glossy BSDF node<br>
itself yes, if it needs to depend on the specific BSDF normal.<br>
<div class="im"><br>
&gt; Another idea was to have closures leave something on stack like microfacet<br>
&gt; normal. So by default it would be average geometry/pixel normal, but it<br>
&gt; closure is microfacet based it would override that with H vector. Then<br>
&gt; Fresnel node that is connected to its output will use that. But this would<br>
&gt; not work with all the mixing and other stuff unless you plug that Fresnel<br>
&gt; node directly after the BSDF.<br>
<br>
</div>I don&#39;t think this woud work, node should be self contained and only<br>
pass data forward through node links.<br>
<br>
When we put the fresnel in the BSDF node, the main issue is how you<br>
mix / layer such BSDF&#39;s. I haven&#39;t figured out a design yet for more<br>
advanced layering of BSDF&#39;s. Maybe the BSDF node needs to output some<br>
mix / layer weight, or we need a new Layer Shader node, or something<br>
else entirely? What would need to be done is look at some layered BSDF<br>
models, write down the equations and figure out how we can split that<br>
in composable nodes.<br>
<br>
I&#39;m not familiar enough yet with this stuff to give good advice, would<br>
need to do a lot more reading and thinking for that. The design would<br>
have to fit in the OSL closure model, where the result of a shader<br>
evaluation is a linear combination of closures. If a linear<br>
combination is not possible then a special layering closure could be<br>
created too, which takes other closures as parameters but I&#39;m not sure<br>
if this will be needed.<br>
<br>
Brecht.<br>
_______________________________________________<br>
Bf-cycles mailing list<br>
<a href="mailto:Bf-cycles@blender.org">Bf-cycles@blender.org</a><br>
<a href="http://lists.blender.org/mailman/listinfo/bf-cycles" target="_blank">http://lists.blender.org/mailman/listinfo/bf-cycles</a><br>
</blockquote></div><br></div></div>