JJ FX Posted April 13, 2017 Share Posted April 13, 2017 (edited) Hi, So there is no default velocity pass in mantra. At least I cant see it. I added extra image plane, the v variable, but nothing renders out. Yeah I can colorize by velocity and render out, and this would be my veloctiy pass. But that needs additional rendering. And I dont have time to do additional renders now Can I render out velocity as one render? Edited April 13, 2017 by JJ FX Quote Link to comment Share on other sites More sharing options...
Mandrake0 Posted April 13, 2017 Share Posted April 13, 2017 Made a Example File hope it helps. I'm not a shader guy but this could be a solution for you. export_v_attribute.hipnc Quote Link to comment Share on other sites More sharing options...
Lcrs Posted April 13, 2017 Share Posted April 13, 2017 (edited) Always seemed odd that there's no simple way to do this. It's quite tricky to handle all cases but below is what I've been doing... // 2D motion vector output in absolute pixels, lewis@lewissaunders.com July 2018 // Paste this in an Inline Code VOP, enable "Expand Expressions in Code" // Connect a Bind set to "vel", type Vector, to the first input // Set Output 1 Name to "mv", type Vector // Connect the output to a Bind Export set to the name used in Mantra's image planes // Make sure motion blur is enabled on the ROP, even if "Allow Image Motion Blur" is not vector ndcv = toNDC(getblurP(1.0)) - toNDC(getblurP(0.0)); string engine; renderstate("renderer:renderengine", engine); if((engine == "raytrace" || engine == "pbrraytrace") && isbound("vel")) { // When rendering volumes in raytrace mode the getblurP() method doesn't work, but we do the best we can // It's correct for a static camera but there's no way to incorporate camera motion. For simple camera moves // the camera motion vectors can be added to this in comp before the blur is done... to get solid vectors // from a volume the density normally needs to be increased a lot anyway, and rendered as another pass, so // it might be better to just do that pass in micropoly mode :) vector p0 = getblurP(0.0); vector framev = vel / $FPS; vector camerav = vtransform("space:object", "space:camera", framev); ndcv = toNDC(p0 + camerav) - toNDC(p0); } vector res; renderstate("image:resolution", res); ndcv *= set(res.x, res.y, 0.0); \$mv = ndcv; http://lewisinthelandofmachines.tumblr.com/post/159532447318/houdini-2d-motion-vectors-from-mantra Edited July 6, 2018 by Lcrs updated code for H16.5 1 Quote Link to comment Share on other sites More sharing options...
Stevie Mac Posted February 7, 2020 Share Posted February 7, 2020 Hey Lewis I found your solution to Motion vector blur in Houdini & I was hoping you could help me out. I'm trying to get a Motion Vector AOV from Mantra for a pyro render So I want to get an AOV like this Looking at your post here I thought this might work but Houdini doesn't like the last bit \$mv = ndcv; The other way I'm trying is adding this to my pyro shader network. But I only get this Do you know a way to render out the AOV from Mantra? I know the game dev tools can do it but I want to render it out this way. Hope you can help Thanks Steve Quote Link to comment Share on other sites More sharing options...
Lcrs Posted February 8, 2020 Share Posted February 8, 2020 Hi! Attached a .hipnc showing motion vectors from a shelf fireball. Your example pic has the values adjusted to be between 0 and 1, where naturally the motion vectors will have a lot of negatives... might be an idea to do that after the render, you have to choose a min and max value and if you do it in the shader it's too easy to forget what you chose :-[ It looks like the vectors there have also been spread out past the edges of the object - you can't really do that in the shader either, it's more a comp thing. In the file I cranked the density hella up because semi-transparent volumes will average the motion vectors out otherwise, between the close to camera and far from camera voxels along each ray. Hope that makes sense! Ls_volumemotionvectors.hipnc Quote Link to comment Share on other sites More sharing options...
Stevie Mac Posted February 8, 2020 Share Posted February 8, 2020 Thanks for the speedy reply Lewis!!! It's working in the hip file so I'll try to make sense of that. I did try to break your code up into nodes in the shader but I'm not that clever with Houdini yet, but I do get the gist of what your code is doing. I think from using this output I can use the game dev tool to work out how to get what I need out in COP's (hopfully) Thanks mate! 1 Quote Link to comment Share on other sites More sharing options...
Lcrs Posted February 9, 2020 Share Posted February 9, 2020 Here's with the same thing as nodes - the workaround for raytrace mode is more nodes than it has any right to be, if you can render in micropoly mode you can ignore the second branch going into the switch VOP. Remember to disable preview/gradual refinement with the button above the render view when testing, it forces raytrace mode even if you select micropoly on the ROP... Ls_volumemotionvectorsnodes.hipnc 1 Quote Link to comment Share on other sites More sharing options...
Stevie Mac Posted February 10, 2020 Share Posted February 10, 2020 Thanks for the Nodes mate they helped understand it a lot easier & I think the reason mine didn't work was because I'm rendering using PBR not Micro PBR. So is there a node way to get this to work better with PBR? This is Micro PBR This is PBR. As you can see there's speckling which I'm guessing is due to out of range samples as it's not 0-1 (complete guess)? Thanks Steve Quote Link to comment Share on other sites More sharing options...
Lcrs Posted February 10, 2020 Share Posted February 10, 2020 Hmmmmm I'm guessing but I would try increasing volume step rate on the mantra ROP - try 1.0 - and then increase the stochastic samples, maybe 16 or just disable stochastic transparency altogether. If it's still not enough you could carefully increase volume filter width on the object's render/shading tab, or last resort mantra's pixel samples (if you have to go higher than 8x8 it usually means something else is wrong). Try disabling "Allow image motion blur" at the bottom of the mantra options too... Quote Link to comment Share on other sites More sharing options...
Stevie Mac Posted February 11, 2020 Share Posted February 11, 2020 Thanks Lewis! I tried all the different ways you said but none seemed to work. Even with the 8x8 pixel samples I got the same result below.... But by using 4x4 pixel samples & turning off stochastic transparency altogether I got this much better result... The render time has gone up but I tried adding stochastic transparency samples up to 4000 & still had no change. So with the 8x8 pixel samples not working I'm not sure if, like you said, there's something wrong? At least this way works, so thanks loads!! Steve Quote Link to comment Share on other sites More sharing options...
Andrea Posted February 12, 2020 Share Posted February 12, 2020 (edited) What if, before you export your parameter in the shader, you multiply it by "Of", which is one of the outputs from the volume model or the pyro shader core? Edited February 12, 2020 by Andrea typo Quote Link to comment Share on other sites More sharing options...
Stevie Mac Posted February 13, 2020 Share Posted February 13, 2020 Hey thanks Andrea!! Thats knocked 10 mins off the render time & got me what I need. So no need to turn off Stochastic Transparency whcih was giving me a good result but added 10 mins per frame so it wasn't really something I could go for. Adding the multiply with the 'Of' from the Pyro Shader Core like you said gave me this!! Thanks mate! Steve Quote Link to comment Share on other sites More sharing options...
Stevie Mac Posted February 13, 2020 Share Posted February 13, 2020 The only problem I have now is getting this To this in Houdini I've been using COPs all week but that is soo unstable crashing loads throughout the day As the colours are different I've no idea where to staret really. Any ideas? Thanks Steve Quote Link to comment Share on other sites More sharing options...
Andrea Posted February 13, 2020 Share Posted February 13, 2020 I can't help much here but ... What you are seeing from the Houdini pass is an RGB image and looks also clamped because of negative values that are not showing up. Probably you have them but the viewer is not showing them. Meanwhile the FumeFX picture you posted has just X-Y components (and looks like it's displaying the full range of values?) So.. is the velocity pass that you are exporting from Houdini the velocity pass converted to camera view? If yes it should be ok but I think you are not going to have the red-green values outside the volume. Quote Link to comment Share on other sites More sharing options...
Stevie Mac Posted February 13, 2020 Share Posted February 13, 2020 Thanks Andrea for the help. 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.