sebkaine Posted January 29, 2012 Share Posted January 29, 2012 (edited) Hi Guys ! I'm trying to create my own delux shaders in Mantra. Diffuse, Specular and reflection works as expected , but i have problems with my Refraction component. I can't see where is my mistake, but i'm sure things doesn't work as they should cause i test the same simple setup in mental ray and 3delight and i'm not getting a coherent result in Mantra. So if someone could help me to find my error, it would be nice ! I've attach a scene file. Thanks for your help ! Cheers ! refraction.hip Edited January 29, 2012 by sebkaine Quote Link to comment Share on other sites More sharing options...
symek Posted January 29, 2012 Share Posted January 29, 2012 (edited) Oh, looks like a trouble maker is a "Kt" parameter. If not provided by input, it should evaluate to fresnel-like falloff ramp, but apparently it doesn't*. If you connect a constant, should work. Best option, of course, is to use FresnelVOP, to compute both refract vector, and transmittance (kt) to be applied in TraceVOP. Also, seems like RefractLightVOP does work well. hope this helps, skk. edit: I meant RefractLightVOP of course... * - it actually does, but it doesn't make sense for refracted rays. Anyhow, own 'Kt' fixes this. Edited January 29, 2012 by SYmek Quote Link to comment Share on other sites More sharing options...
sebkaine Posted January 30, 2012 Author Share Posted January 30, 2012 (edited) Hi SYmek, Nice to see you on odForce ! Thanks a lot for your help , i plug a constant in the kt and it did fix the problems. your were talking about the fresnel VOP, basically its a combination of 4 nodes ? - refraction vector - transmission vector - refracted light - transmitted light and it automatically compensate the Reflection/Refraction Value ? i would have one other question , i don't get precisely what BSDF means. i'm pretty sure it has to deal with those new physically correct shader. for what i understand each shading component ( lambert, specular, refraction etc ... ) return a BSDF value, and when you make the addition of all those value you must be under or equal to 1. it help to respect the energy conservation rules ? i'm i correct ? Thanks again for your help ! cheers ! Edited January 30, 2012 by sebkaine Quote Link to comment Share on other sites More sharing options...
symek Posted January 30, 2012 Share Posted January 30, 2012 (edited) Hi SYmek, Nice to see you on odForce ! Thanks a lot for your help , i plug a constant in the kt and it did fix the problems. Nice to see you here! your were talking about the fresnel VOP, basically its a combination of 4 nodes ?- refraction vector - transmission vector - refracted light - transmitted light and it automatically compensate the Reflection/Refraction Value ? Yes, it wraps fresnel() vex function, which computes a transmission/reflection relation according to this equation. i would have one other question , i don't get precisely what BSDF means. i'm pretty sure it has to deal with those new physically correct shader. for what i understand each shading component ( lambert, specular, refraction etc ... ) return a BSDF value, and when you make the addition of all those value you must be under or equal to 1. it help to respect the energy conservation rules ? i'm i correct ? You're correct in that BSDF is a function describing different shading components, which can be manipulated with basic algebra (and converted to/from vectors). The switch between standard and PBR rendering is that in a latter one, illuminance integration is handled by these components internally, not explicitly in shaders. It bridges the gap between programmable engines and physical ray tracers. Afaik bsdfs don't handle energy conservation. It's computed post-process, by scaling its sum down to 1. take care, cheers! Edited January 30, 2012 by SYmek Quote Link to comment Share on other sites More sharing options...
sebkaine Posted January 30, 2012 Author Share Posted January 30, 2012 (edited) Thanks for your very detail answer SYmek ! all is now perfectly clear . There is still 2 point where i'm not certain : - when you pass the index of refraction to the refractionVOP or to the fresnel VOP. do you put directly the IOR you want for ex 1,333 or do you enter the air IOR divided by your IOR 1/1,333 - The last thing i'm not sure, is the normal vector you need to input in the refractionVOP or fresnelVOP. at the moment i use the faceForward normalized normal for refraction. i remember doing this in slim few years ago ... does it's correct , or maybe its not useful in Houdini ? thanks again ! Edited January 30, 2012 by sebkaine Quote Link to comment Share on other sites More sharing options...
symek Posted January 30, 2012 Share Posted January 30, 2012 (edited) - when you pass the index of refraction to the refractionVOP or to the fresnel VOP. do you put directly the IOR you want for ex 1,333 or do you enter the air IOR divided by your IOR 1/1,333 I believe it should be a ratio of outsideIOR/insideIOR, so 1/1.333 = 0.75 for water. - The last thing i'm not sure, is the normal vector you need to input in the refractionVOP or fresnelVOP. at the moment i use the faceForward normalized normal for refraction. i remember doing this in slim few years ago ... does it's correct , or maybe its not useful in Houdini ? I'm not entirely sure, but I think you shouldn't frontface() a normal for refracted rays (some people say it's a bad idea in any case), because refracted ray can hit a surface from backside also. Don't quote me on this, instead check out Mario's immortal thread about glass rendering cheers! skk. Edited January 30, 2012 by SYmek Quote Link to comment Share on other sites More sharing options...
sebkaine Posted January 30, 2012 Author Share Posted January 30, 2012 Cool ! the 1/1.33 was a source of error to me ! Thanks for the links very informative stuff ! again SYmek thanks for your help, it really helps ! Quote Link to comment Share on other sites More sharing options...
symek Posted January 30, 2012 Share Posted January 30, 2012 Cool ! the 1/1.33 was a source of error to me ! Yes, this is a known source of confusion for a long time, as it's exactly opposite from what people are used to. I should mention this earlier . The way as they (two IORs) are presented on a mantra surface in H11 thankfully clarifies things. Quote Link to comment Share on other sites More sharing options...
sebkaine Posted January 30, 2012 Author Share Posted January 30, 2012 Outch ! i was thinking that only my refraction shading component was not working, but i have one more problem. I feel like a fool ! in fact it is just the simple blinn specular that doesn't work as expected. I realize that i have black artefact and strange aliasing when i use the blinn component of a specularVOP. When i use the anisotropic component with the same U V roughness, i get what i would expect from my blinn. I'm pretty sure my network is correct, the only thing that could be missing is some uv infos ... As it looks so trivial i try to find some answers on Old Post and on sideFX forum but i find nothing related to my pb. I've created a simple scene that show the problem, so if you have any idea on how to solve this it would be great ! Cheers ! specular.hip Quote Link to comment Share on other sites More sharing options...
symek Posted January 30, 2012 Share Posted January 30, 2012 No worries, you should see me cursing Maya, when things go wrong because I don't know some detail In that case the problem is ray bias. You have here a special case of self shadowing with light rays close to horizon, which kind of exaggerates common errors coming from ray biasing. Enable "Bias Along Normal" and/or play with "Raytracing bias" value (both parm on a Shading tab on MantraROP). It should solve the problem. Quote Link to comment Share on other sites More sharing options...
edward Posted January 31, 2012 Share Posted January 31, 2012 No worries, you should see me cursing Maya, when things go wrong because I don't know some detail I've got a link for that: Quote Link to comment Share on other sites More sharing options...
sebkaine Posted January 31, 2012 Author Share Posted January 31, 2012 (edited) No worries, you should see me cursing Maya, when things go wrong because I don't know some detail i see what you mean ! the pbs is that in the Maya world solution rarely obey to rational laws, but are more base on mystical belive, incantation and luck ... and sometimes skills ... In that case the problem is ray bias. You have here a special case of self shadowing with light rays close to horizon, which kind of exaggerates common errors coming from ray biasing. Enable "Bias Along Normal" and/or play with "Raytracing bias" value (both parm on a Shading tab on MantraROP). It should solve the problem. Thanks a lot for your answer, i should have think about this ! I've use this Bias Stuff on Prman for computing shadow maps. It's an offset distance from the surface normal where the ray need to search for contact with object ? if i get it ? This kind of error is coming from precision error in the evaluation of object normal ? The problem is that it did solve the artefacts error , but not the hard edge aliasing error. I try to render the same setup with Mental Ray, 3Delight and Vray and when i compute my specular, i always get a smooth transition at the edges of the non lighted part of the object. In Mantra i get the same result with my anisotrpic shaders, with same UV roughness value. You can see that the transition are very soft. But with the blinn component i get this weird hard edges. And i don't know where it come from ? Maybe its the blinn implementation in Houdini and that i need to use the VEX blinn ? thanks again , and sorry for all those questions ! ps : Edmond great video ! But no keyboard where destroyed on this one , so i'm a bit disapointed ! Edited January 31, 2012 by sebkaine Quote Link to comment Share on other sites More sharing options...
symek Posted January 31, 2012 Share Posted January 31, 2012 (edited) I do think it's a very nature of a blinn(), at least in its original form (same as phong btw). In attached a scenes to compare ("type" parm on your shader): RISpec blinn, Vex blinn, and VEX with own illuminance() loop. They all do share the problem, I believe coming from dot(N,normalize(L+V)). Perhaps many implementation fix such issues silently, seems like VEX is pedantic here. I wouldn't be surprised if VEX Specular was basically a blinn model with some fixes like this one. hth, skk. RISpec on blinn: color specularbrdf( vector L, N, V; float roughness ) { vector H = normalize(L+V); return pow (max (0, N.H), 1/roughness); } My snippet: vector nff = normalize(frontface(N,I)); vector i = -normalize(I); // Standard VEX BLINN: if (type == 0) { $out = blinn(nff, i, $urough); } else { $out = 0; illuminance(P, nff, M_PI/2, LIGHT_SPECULAR) { vector nL = normalize(L); vector H = normalize(nL+i); shadow(Cl); /// Own blinn based on RISpec: if (type == 1) { $out += Cl * pow(max(0, dot(nff, H)), exp($urough)); //? } else /// VEX blinn in own illuminance: { $out += Cl * blinnBRDF(nL, nff, i, $urough); } } } $out *= $spec * $Ks; specular_skk.hip Edited January 31, 2012 by SYmek Quote Link to comment Share on other sites More sharing options...
sebkaine Posted January 31, 2012 Author Share Posted January 31, 2012 (edited) Thanks for taking the time to give me so precise and argumented answer SYmek ! So to sum up, The Blinn and Phong Model in the specularVOP follow the original implementation. This Hard Edge problem, is not a bug , and its not possible to get smooth aliasing at the edge with those 2 models. My goal is to recreate the SLIM specular shading component. This component is the same as the model use in maya, with Smooth transition at the edge. So if i want to replicate this correctly in houdini my only 2 options are to use : - The VEX specular model - The Anisotropic model by using the same U and V roughness to me the VEX models look finally to be the best way to achieve my goal ! Does my conclusion looks correct to you, or do you have a more elegant or simpler alternative to create my Specular Shading Component ! Thx again for all the help you give me, in my painful but very entertaining houdini beginings ! Edited January 31, 2012 by sebkaine Quote Link to comment Share on other sites More sharing options...
symek Posted January 31, 2012 Share Posted January 31, 2012 You could save a RSL code generated by Slim and post it here for inspection, but I'm rather positive, that VEX specular is a good re-implementation of blinn (by just comparing it results). Vex specular model is actually named as "specular()" in VEX, the same as specular() is a blinn model in RSL These are not "the only options" though, these are the two most obvious solutions. You can still look for a trouble-proofed blinn implementation and code it yourself! Quote Link to comment Share on other sites More sharing options...
sebkaine Posted February 1, 2012 Author Share Posted February 1, 2012 (edited) Well Thx SYmek, after some testing i've finally decided to stay with blinn component, i found the gradiant in highlights more subtle than the vex one. And for correting the hard edges pb , i use a remap on the output of the blinn to get a smooth gradiant. I have what i want so its cool ! Its a great pleasure to be back on a true rendering engine ! i really love Mantra. It is so close from renderman that i am wondering why big companies still use prman. Speed or Stability issue maybe ? For the moment i found Mantra really impressive ! Edited February 1, 2012 by sebkaine Quote Link to comment Share on other sites More sharing options...
symek Posted February 1, 2012 Share Posted February 1, 2012 I'm glad you managed it out. Well, reason for not peaking up Mantra are a few. Culture, its bind to Houdini, and small bits of missing parts, sometimes crucial, like lack of point based GI, fast SSS + many, many minors like basic bokehs, worse filtering, lack of decent byte stream interface, LOD, problems with runtime de-allocating memory etc. The thing is people didn't wanted next prman, but something new, and here it is Arnold. PBR in Mantra getting better and better with every realize (wait to test drive on H12!), but still being a part of Houdini package, it's a much harder starting position (in film industry) as a main hard-surface renderer. It has found its spot in vfx rendering, and I think it's used a lot here. Many smaller houses are using Mantra in all departments though (yes, as the only in its kind blend of Vray/Arnold and PRMan ). 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.