jim c Posted February 19, 2015 Share Posted February 19, 2015 I'm fiddling with a shader , basing it on an article here (http://www.msawtell.com/research/carpaint/carpaint.shtml) with RenderMan code (the actual shader is http://www.msawtell.com/research/carpaint/carpaint_complex.sl_13_2_8.html). I notice that if I but both a trace node and a gather node (VOP) in a simple shade the time to render HUGELY plummets. Is this normal, or am I using these two nodes incorrectly? This is the first time I've ever played with something like this so I wouldn't be surprised if I've done something utterly stupid. If I disable one of the nodes (either the gather vop or trace vop) then it renders right away. The reason for using the vgather vop is that I'm assuming that it's the houdini equivalent of the rendermans gather("illuminance", P, reflect(I, nf), samplecone, samples, "surface:Ci", hitc) function. Attached is a simple file that demos this . vgather-trace-test.hipnc Quote Link to comment Share on other sites More sharing options...
jim c Posted February 20, 2015 Author Share Posted February 20, 2015 Another test, the second gather sends a micro poly or raytrace render to it's knees if the second gather is uncommented. surfacemyshader1() { vector diffC = {1,0,0}; vector n = normalize(N); diffC *= diffuse( n ); vector nf = frontface(n, I); float fr = abs(dot(n,normalize(I))); vector rDir = reflect(I, nf); vector i = normalize(-I); vector cumC = {0,0,0}; float hitCount = 0; vector hitC; gather( P, rDir, "Cf", hitC, "raystyle","reflect","angle", 0.1, "samples", 1, "variancevar", "Cf" ) { cumC += hitC; hitCount += 1; } else { hitCount += 1; } //cumC /= hitCount; vector reflC = cumC; vector refrC = 0;/* cumC = 0; hitCount = 0; gather( P, rDir, "Cf", hitC, "raystyle","refract","angle", 0.2, "samples", 1, "variancevar", "Cf" ) { cumC += hitC; hitCount += 1; } else { hitCount += 1; } refrC = cumC;*/ Cf = reflC + refrC + diffC; } Quote Link to comment Share on other sites More sharing options...
Serg Posted February 21, 2015 Share Posted February 21, 2015 Hi, I don't see why you should have to go anywhere near those functions to replicate the results of those shaders. IMO you are much better off staying with BSDF workflow, in just about every way. Especially the env light look up. This will be nicely importance sampled if you use BSDF. As far as I can tell, that shader amounts to layering a metalic reflection BSDF's over a diffuse BSDF (the mix value represents metal particle vs paint substrate), and a sharp clear coat mixed over this using Fresnel as a mask. If you use mix nodes as opposed to add's etc you should retain energy conservation. The tricky thing is the flake, there are various ways. One I have used (you can find examples of it here somewhere), is to use voronoise to generate random vector patches... then multiply this by some factor (cell ID plugged into a random + power and/or fit range is a neat way to control the sparsity of the flake), add this vector to global N, normalize, plug into nN of metal layer. The apparent roughness will increase depending on the magnitude of the flake vector. iirc I also used Is Front Face to negate the vector if it pointed into the surface. This stuff will buzz like hell as you move away from surface because its not anti aliased noise (and not antialiasable afaik), but you can get around this by using Shading Area fitted to some range that allows you to blend between the `flaked` layer and another that has perceptually the same roughness, so that at a distance the flake disappears and is replaced with regular soft reflections. Quote Link to comment Share on other sites More sharing options...
jim c Posted February 21, 2015 Author Share Posted February 21, 2015 OK thanks, I guess I just naively assumed that when going from Renderman to mantra I could (or should?) use roughly the same functions. Now the only catch with using a BSDF workflow, is that it forces you to use PBR, is that correct? Again, thanks for the detailed answer! Quote Link to comment Share on other sites More sharing options...
eetu Posted February 22, 2015 Share Posted February 22, 2015 OK thanks, I guess I just naively assumed that when going from Renderman to mantra I could (or should?) use roughly the same functions. That might have been true in 2008 when that article was written, but it's a different world now 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.