mrWolf Posted April 27, 2013 Share Posted April 27, 2013 I am trying to create a simple shader that maps the distance from an object to the red channel. I have a plane I assign the shader to. I have a torus converted to SDF. In the shader I convert P to world space, then use a "volume sample from file" to sample the rendered pixel from the SDF and feed the result to the red channel of my diffuse color. In order to specify the 'file', I use this code op:`opfullpath("/obj/geometry/OUT_SDF")` When I render i just get a black frame. The geometry is there cause i can see the alpha of the plane, but apparently nothing comes out from that "volume sample from file" node. I wonder if it's possible to fetch sdf data directly into a shader. I attached the hip file to illustrate my issue. p.s. I don't want to use an attribute transfer approach in SOP land cause I want to maintain the 'pixel' level resolution in my shader, and don't want to rely upon the resolution of my plane. Any idea ? proximity_shader_test.hip Quote Link to comment Share on other sites More sharing options...
anim Posted April 27, 2013 Share Posted April 27, 2013 you cannot use op: syntax with shader mantra will not find the path to the node so you need to export SDF volume to actual file and read that to shader Quote Link to comment Share on other sites More sharing options...
mrWolf Posted April 27, 2013 Author Share Posted April 27, 2013 you cannot use op: syntax with shader mantra will not find the path to the node so you need to export SDF volume to actual file and read that to shader Tomas, thank you for your answer. I did as you suggested and it works perfectly. It's a bit of a bummer we cant use op functions on shaders. Is there a reason for that ? Quote Link to comment Share on other sites More sharing options...
anim Posted April 27, 2013 Share Posted April 27, 2013 (edited) imagine you export IFD file for mantra, it doesn't contain your houdini network so the path to the node is meaningless, even if it knew which node it was it cannot cook the geometry the only other way would be if houdini included op: referenced geometry in the IFD which I don't think it's possible currently, that would be less efficient than keeping the geometry separated, especially if it's not time dependent, but still quite nice as it would not require user input EDIT: it is however possible to use op: syntax to reference COPs in shaders which actually includes the image in IFD Edited April 27, 2013 by anim Quote Link to comment Share on other sites More sharing options...
mrWolf Posted April 27, 2013 Author Share Posted April 27, 2013 That makes perfect sense. But still I'd have kept the functionality. I mean...it would be nice the following: if the string in the "file" parameter has an op command and there is actually a node to cook then Mantra should go ahead and wait for the result as it does for cops for instance. This would even maintain the compatibility with "sample volume from file" nodes in POP or SOP vex land, instead of just return the information zero (without even erroring out). If the string in the file field is an actual file, then better for everybody ! My philosophy in this case would be to keep the functionality as open as possible, and enforce the error reporting. imagine you export IFD file for mantra, it doesn't contain your houdini network so the path to the node is meaningless, even if it knew which node it was it cannot cook the geometry the only other way would be if houdini included op: referenced geometry in the IFD which I don't think it's possible currently, that would be less efficient than keeping the geometry separated, especially if it's not time dependent, but still quite nice as it would not require user input EDIT: it is however possible to use op: syntax to reference COPs in shaders which actually includes the image in IFD Quote Link to comment Share on other sites More sharing options...
symek Posted April 27, 2013 Share Posted April 27, 2013 It would be definitely possible to include any referenced geometry inside IFD file similarly to images, it is just not production wise. Half of the fields come from simulation, thus are already cached on disk, another come from sops and cook really slow, so they should be baked before ifd generation anyway. Plus, they are big, and big IFD is a secret evil, which bloats your network to depth in a least expected time (read deadline). The easiest answer isn't always the best one. Quote Link to comment Share on other sites More sharing options...
mrWolf Posted April 27, 2013 Author Share Posted April 27, 2013 Szymon, I am totally with you on this. I am not an expert in Mantra, I am just expressing my logic as a 'non expert' I didn't suggest to include any further data into the IFD. What I meant is that while in interactive mode, using the UI inside Houdini, it would be cool the keep the "op" functions working even from shaders, since from Houdini UI... Mantra can access all the nodes of the hip file. Now a question just popped in my mind... Is the scene converted to IFD on the fly even during a Houdini interactive render with Mantra ? Quote Link to comment Share on other sites More sharing options...
symek Posted April 28, 2013 Share Posted April 28, 2013 Is the scene converted to IFD on the fly even during a Houdini interactive render with Mantra ? Historically it was, but with a recently introduced optimization, Mantra can share geometry with Houdini in IPR mode, which along with a partial updates makes it snappier, but still IFD is a backbone of that process afaik. Quote Link to comment Share on other sites More sharing options...
mrWolf Posted April 29, 2013 Author Share Posted April 29, 2013 I see now ! Thank you for the explanation Szymon and Tomas, very much appreciated Historically it was, but with a recently introduced optimization, Mantra can share geometry with Houdini in IPR mode, which along with a partial updates makes it snappier, but still IFD is a backbone of that process afaik. 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.