sebkaine Posted July 15, 2015 Share Posted July 15, 2015 (edited) Hi guys , I would like to know what would be the proper way to separate R, G, B channel of a BSDF. There is something that i find pretty weird : This shader vector nI = normalize(I); vector nN = normalize(N); float kr, kt; vector nr, nt; bsdf F; fresnel( nI, nN, 1.0/1.5, kr, kt, nr, nt ); F = specular(nt); Give me the test_ref.jpg outpout. everything is normal here ! But this shader #define RED {1,0,0} #define GREEN {0,1,0} #define BLUE {0,0,1} vector nI = normalize(I); vector nN = normalize(N); float kr, kt; vector nr, nt; bsdf F, Fr, Fg, Fb; fresnel( nI, nN, 1.0/1.5, kr, kt, nr, nt ); Fr = specular(nt) * RED; Fg = specular(nt) * GREEN; Fb = specular(nt) * BLUE; F = Fr + Fg + Fb; ... produce the test_channel.jpg outpout. I really don't understand what i am doing wrong here ? I should get the exact same result by recomposing my bsdf from each RGB channel, but it doesn't work ? if you have any idea on why and how to solve this , that would be great ! Thanks for your time ! Cheers E bsdf_channel.hip Edited July 15, 2015 by sebkaine Quote Link to comment Share on other sites More sharing options...
SSFX Posted July 16, 2015 Share Posted July 16, 2015 (edited) I don't have a solution for you, but I have some thoughts about what I've tested in your scene. I think what your seeing in the right picture is just sampling noise. You can see it decreased right away if you bump up the AA samples. You can also clearly see that it's getting noisier every time it gets down to another level of refraction. I think your shader is defining 3 different specular bsdf that will be sampled individually at render time. That would mean something in the background (could be a vex function similar to nextsample) is generating new samples (SID) on the fly to get a artifact free render. From what I understand, you would need a way to tell mantra to compute the bsdf once and then do your rgb splitting or compute the bsdf 3 time but with exactly the same samples. Sorry if this is not helping you out, it's just observations nothing more. BTW, I'm following what you doing in terms of shader RnD and it's really interesting. As soon as I get a better with shader writing, I'll try to help you out with this! Keep up the good work! Alex Edited July 16, 2015 by SSFX Quote Link to comment Share on other sites More sharing options...
sebkaine Posted July 16, 2015 Author Share Posted July 16, 2015 Thanks for your answer Alexandre, it's very helpful ! I think you are right the problem might be correlated to how mantra sample each BSDF. eetu give an potential explanation here : http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=16567 in fact RGB image are in reality not blend with the following operation : Y = 1 * R + 1 * G + 1 * B But by : Y = 0.2126 R + 0.7152 G + 0.0722 B If you look each channel of the image with the bug you can clearly see that it respect those proportion : G is clean R has some noise B has a lot of noise So i think like you said , in order to optimise sampling Mantra sample the image according to this principle. and thus when you combine each BSDF channel you have huge variation in noise sampling. In this particular case my motivation was to try to fake dispersion by using different ior for each channel and recombine them, so i would need to find a way to force mantra to evaluate each BSDF channel with the same sampling ! How you do that ? that's an other question ? Glad you find it useful, i'm also learning Mantra so lot of trial and error at the moment ! Cheers E Quote Link to comment Share on other sites More sharing options...
fathom Posted July 17, 2015 Share Posted July 17, 2015 yeah, definitely the different tints to your bsdf's are affecting the ray weights in the importance sampling. it's compounded in those specific areas because those areas are where the pig is self-refracting so only blue rays traced by blue rays will contribute any blue. not really sure there's a solution... Quote Link to comment Share on other sites More sharing options...
SSFX Posted July 17, 2015 Share Posted July 17, 2015 (edited) It's probably no the way to go. You probably already know about it, but there is a cool tread about spectral rendering. The code is pretty simple/compact and it works absolutely perfectly. The amount of noise is also very reasonable compared to other shader out there. http://forums.odforce.net/topic/6925-dispersion-bsdf/page-3 Edited July 17, 2015 by SSFX 1 Quote Link to comment Share on other sites More sharing options...
sebkaine Posted July 17, 2015 Author Share Posted July 17, 2015 (edited) Thanks for your answers guys ! before picking up a dispersion method, i was evaluating all the options : - oldschool tricks of offseting the ior per R G B channel - more physical approach i agree that mario shader is perfect , and it's the approach i have chosen. but it has 3 problem - it use getglobalraylevel() which is not working in PBR so you have to replace it by getraylevel() to make the level stuff work correctly - it doesn't handle rough glass so i use a phonglobe() instead - it compute dispersion for reflections which looks to be not the case in reality Edited July 17, 2015 by sebkaine Quote Link to comment Share on other sites More sharing options...
sebkaine Posted July 17, 2015 Author Share Posted July 17, 2015 (edited) here is a test without caustics, i'm starting to be happy with the result. the render time is less than 10 min so quite fast. i still have a doubt about computing dispersion for reflection, even if it's not physical i'm wondering if it will not help to blend smoothly area with dispersion, maybe this is why Mario put it in his initial shader ? not physical but smoother transition ? test_glass_disp.hip Edited July 17, 2015 by sebkaine Quote Link to comment Share on other sites More sharing options...
sebkaine Posted July 17, 2015 Author Share Posted July 17, 2015 well i did try with dispersion in reflection and it look weird ... here is a new test still under 10min/frame, with some additional tweak, i'm now pretty happy with the result glass_disp.hip 1 Quote Link to comment Share on other sites More sharing options...
alksndr Posted July 18, 2015 Share Posted July 18, 2015 So awesome, thanks for sharing your work. Do you have a crazy awesome computer? Its taking like an hour for me vs your 10 min. And I just tried one with caustics to see how this shader can work for like a pool and it got to 20% done after 30 min. Wish it was fast on mine Quote Link to comment Share on other sites More sharing options...
sebkaine Posted July 18, 2015 Author Share Posted July 18, 2015 (edited) well it was render at work so dual xeon ! i will try it on my i7 at home. - be careful to be in raytracing background in the env not direct lighting - you can lower min / max sample to 2 / 24 - in the shader you can lower samples to 7 i am now trying to experiment with caustics , but while i understand the process i am still fighting to understand what is the best approach to get Maxwell Like caustics ! for a swimming pool i would not use physical caustics , cause it can be fake pretty easily with a caustics maps done in after effects and reprojected Edited July 18, 2015 by sebkaine Quote Link to comment Share on other sites More sharing options...
fathom Posted July 19, 2015 Share Posted July 19, 2015 so i was thinking about this a bit and what you COULD do is to modify the vex pathtracer code to pick a wavelength for each ray it shoots out. attach the wavelength to the ray being traced and then if you wanted to spread your ior based on the incoming wavelength, you could do it in the shader by querying the ray. if you didn't care about the wavelength, then you trace as normal. then back in the pathtrace code, you modulate the resultant final color based on the wavelength. the importance sampling would still hold up since you're monkeying with the color AFTER all the rays have been cast. 1 Quote Link to comment Share on other sites More sharing options...
alksndr Posted July 19, 2015 Share Posted July 19, 2015 well it was render at work so dual xeon ! i will try it on my i7 at home. - be careful to be in raytracing background in the env not direct lighting - you can lower min / max sample to 2 / 24 - in the shader you can lower samples to 7 i am now trying to experiment with caustics , but while i understand the process i am still fighting to understand what is the best approach to get Maxwell Like caustics ! for a swimming pool i would not use physical caustics , cause it can be fake pretty easily with a caustics maps done in after effects and reprojected Ive tried those other settings and its not going well, i have an i7 too, trying to get a friend to render maybe its something with my comp! I see what you mean with the maxwell like caustics, in my case I need them real bcuz the pool will be moving (someone coming out of it) so there has to be that diff interaction and it seems to my eye like mantra caustics always come out a little soft n roundish..Not as angular as other software/life. Luxrender caustics look nice too. Looking forward to see what you get done and someday soon being able to help out! Quote Link to comment Share on other sites More sharing options...
anim Posted July 19, 2015 Share Posted July 19, 2015 ... i am now trying to experiment with caustics , but while i understand the process i am still fighting to understand what is the best approach to get Maxwell Like caustics ! ... well, you would probably want to use Bi-Directional pathtracing for that, which mantra doesn't support yet Quote Link to comment Share on other sites More sharing options...
sebkaine Posted July 19, 2015 Author Share Posted July 19, 2015 (edited) Ive tried those other settings and its not going well, i have an i7 too, trying to get a friend to render maybe its something with my comp! I see what you mean with the maxwell like caustics, in my case I need them real bcuz the pool will be moving (someone coming out of it) so there has to be that diff interaction and it seems to my eye like mantra caustics always come out a little soft n roundish..Not as angular as other software/life. Luxrender caustics look nice too. Looking forward to see what you get done and someday soon being able to help out! well keep in mind that caustics were nearly never used in production, and faking them cleverly can give great outpout ! Nemo was done at the time with nearly 90% of reyes if my memory is good so All caustics were cheats and hacks. RIS offer indeed bi-pathtracing. But if i were you i would download a maxwell render demo http://www.maxwellrender.com/try/suite throw your scene into maxwell be careful to never put reflectance above 242,242,242 and to keep your scale perfectly accurate, and see how it goes on a single frame, use this as a lighting reference , then try to replicate what you get from maxwell in mantra. I don't know if you have ever use it but it can't hurt you. as maxwell concept are copy a lot recently. if you want to find an efficient hack for your caustics it will be easier if you have a precise idea of what you want ! and Maxwell will give you that very fast ! when i will have some time i will send the pig models inside maxwell with caustics + dispersion just in order to show you the beauty of it. quality for glass and caustics in maxwell is stellar , Zeiss / Leica in your computer ! Edited July 19, 2015 by sebkaine Quote Link to comment Share on other sites More sharing options...
alksndr Posted July 20, 2015 Share Posted July 20, 2015 well keep in mind that caustics were nearly never used in production, and faking them cleverly can give great outpout ! Nemo was done at the time with nearly 90% of reyes if my memory is good so All caustics were cheats and hacks. RIS offer indeed bi-pathtracing. But if i were you i would download a maxwell render demo http://www.maxwellrender.com/try/suite throw your scene into maxwell be careful to never put reflectance above 242,242,242 and to keep your scale perfectly accurate, and see how it goes on a single frame, use this as a lighting reference , then try to replicate what you get from maxwell in mantra. I don't know if you have ever use it but it can't hurt you. as maxwell concept are copy a lot recently. if you want to find an efficient hack for your caustics it will be easier if you have a precise idea of what you want ! and Maxwell will give you that very fast ! when i will have some time i will send the pig models inside maxwell with caustics + dispersion just in order to show you the beauty of it. quality for glass and caustics in maxwell is stellar , Zeiss / Leica in your computer ! Hmm thats interesting, I will look into how I can fake it ! Thank you so much for this info. I just downloaded it, didn't know they had a plugin for houdini. I'm playing around with it now , I like this idea of using maxwell for reference for mantra. Thanks dude, thatll help a lot to have a sweet scene to learn from. I'm going through the beginner tuts and just trying to figure out the materials right now, its organized quite differently from the mantra surface Quote Link to comment Share on other sites More sharing options...
sebkaine Posted July 20, 2015 Author Share Posted July 20, 2015 the houdini pluggin is cool but not reliable in production imo. just use it for lookdev, if you want to use maxwell in production i'll go with maya plugin which is far more robust. check this : http://support.nextlimit.com/display/maxwelldocs/Before+you+begin http://support.nextlimit.com/display/maxwelldocs/Rendering+in+Maxwell http://support.nextlimit.com/display/maxwelldocs/The+BSDF the shader is great you just need to take the time to read the doc. only sss is a bit tricky to understand ! for caustics you have many stuff like this http://www.dualheights.se/caustics/ to generate 2d looping map in AE Quote Link to comment Share on other sites More sharing options...
sebkaine Posted July 20, 2015 Author Share Posted July 20, 2015 so i was thinking about this a bit and what you COULD do is to modify the vex pathtracer code to pick a wavelength for each ray it shoots out. attach the wavelength to the ray being traced and then if you wanted to spread your ior based on the incoming wavelength, you could do it in the shader by querying the ray. if you didn't care about the wavelength, then you trace as normal. then back in the pathtrace code, you modulate the resultant final color based on the wavelength. the importance sampling would still hold up since you're monkeying with the color AFTER all the rays have been cast. thanks for this Miles, i'm gonna dig this ! very interesting Quote Link to comment Share on other sites More sharing options...
alksndr Posted July 20, 2015 Share Posted July 20, 2015 the houdini pluggin is cool but not reliable in production imo. just use it for lookdev, if you want to use maxwell in production i'll go with maya plugin which is far more robust. check this : http://support.nextlimit.com/display/maxwelldocs/Before+you+begin http://support.nextlimit.com/display/maxwelldocs/Rendering+in+Maxwell http://support.nextlimit.com/display/maxwelldocs/The+BSDF the shader is great you just need to take the time to read the doc. only sss is a bit tricky to understand ! for caustics you have many stuff like this http://www.dualheights.se/caustics/ to generate 2d looping map in AE Yeah it was crashing like every minute but the maya one is rock solid, been pretty fun so far playing around with it but havent gotten anything super nice. I like the idea of rendering never being 'done' and just getting less and less noisey with time. The caustics do look pretty, I think its helping me with lookdeving that and also the base materials seem p nice and im trying to get it more like that in houdini. Thanks for telling me about it man. Sryfor going a lil off topic! Quote Link to comment Share on other sites More sharing options...
sebkaine Posted July 20, 2015 Author Share Posted July 20, 2015 (edited) the greatness of maxwell and unique feature is .mxi concept. - maxwell write temporary noisy image during the rendering, so you can start precomp and check error + send prez before the end of the rendering - the other killing feature is the fact that you can send a render at SL12 but if you realise you need more sample you can send to SL 17 without restarting the whole rendering. - the last killing feature which was copy recently by 3delight is the multilight, you can send your rendering and relight your image post computation no problem for going out of the tracks ! Edited July 20, 2015 by sebkaine 1 Quote Link to comment Share on other sites More sharing options...
anim Posted July 20, 2015 Share Posted July 20, 2015 ...- the last killing feature which was copy recently by 3delight is the multilight, you can send your rendering and relight your image post computation... worth to mention that Mantra has this feature as you can do per light(or per light category) exports 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.