Hello. Yes, I have had a license for many years but continue to learn. I am still using H13 but this may also apply to principled shaders in H18.
What I would like to do is take a Material that is rendered across thousands of frames (animated material) and convert that into Primitive Colors or Point Colors so that I can group them according to an expression, grouping only the colors of the primitives or points that I desire, deleting most of the unneeded geometry. The material is currently placed after a UV Project SOP and applied with a Material SOP.
How can I do this? I tried searching and found a post that seemed to ask for the reverse either here or on odforce though I didn't quite understand the workflow in the post.
Any help is greatly appreciated. Thanks, Rene
Convert Shop Material attribute to CD (color) attribute?
12958 15 1- markerline
- Member
- 245 posts
- Joined: 9月 2008
- Offline
- blackpixel
- Member
- 182 posts
- Joined: 4月 2009
- Offline
If I understand you correctly, then you want to pre-process your geometry before it goes into rendering, based on something that the shader outputs?
I'm not sure there is a direct (or easy) way to evaluate the material in SOP context.
Some workaround ideas:
1. Pre-render the whole thing in low resolution, and low settings so it outputs the attribute you want to use as a mask.
Then project UVs from the camera back onto the geometry and use the rendering as a texture in a PointSOP / Wrangle.
2. If it's one of the basic projection methods you're using (ortho, polar, cylindrical) you could also bake the shader to a low resolution texture sequence on simple geometry, depending on the type. Orthographic -> Grid; Polar -> Sphere etc. If you then apply that texture to your geometry it should more or less look similar aside from anything related to light and shading, then mask your prims and points with the color or any AOVs.
This is also a pre-render, but if you have heavy geometry it might be faster.
3. Replicate the important parts of the shader, (noises etc) that you want to use for masking in a Point VOP and reference the animated parameters from the material. You'd need to keep it up to date though. Or wrap it in an HDA that works in the material and sop context with all the important logic inside, then reference animated parms.
There are some caveats if you're using P or N directly in the shader, because they are not in object space.
I'm not sure there is a direct (or easy) way to evaluate the material in SOP context.
Some workaround ideas:
1. Pre-render the whole thing in low resolution, and low settings so it outputs the attribute you want to use as a mask.
Then project UVs from the camera back onto the geometry and use the rendering as a texture in a PointSOP / Wrangle.
2. If it's one of the basic projection methods you're using (ortho, polar, cylindrical) you could also bake the shader to a low resolution texture sequence on simple geometry, depending on the type. Orthographic -> Grid; Polar -> Sphere etc. If you then apply that texture to your geometry it should more or less look similar aside from anything related to light and shading, then mask your prims and points with the color or any AOVs.
This is also a pre-render, but if you have heavy geometry it might be faster.
3. Replicate the important parts of the shader, (noises etc) that you want to use for masking in a Point VOP and reference the animated parameters from the material. You'd need to keep it up to date though. Or wrap it in an HDA that works in the material and sop context with all the important logic inside, then reference animated parms.
There are some caveats if you're using P or N directly in the shader, because they are not in object space.
- markerline
- Member
- 245 posts
- Joined: 9月 2008
- Offline
blackpixel
1. Pre-render the whole thing in low resolution, and low settings so it outputs the attribute you want to use as a mask.
Then project UVs from the camera back onto the geometry and use the rendering as a texture in a PointSOP / Wrangle.
hi and thank you for your response with some ideas. I am actually doing something like this. I am using a “tex()” expression in a Primitive SOP to read the colors of the texture directly onto the Primitives of the Grid. However the geometry of the primitive has to be so dense in order to read the colors accurately (I am using a screen recording and need to capture info from the recording/animated material as geometry based on colors, if that makes sense), but because it is so dense this method takes eons to cook. I have over 7000 frames of animated material/texture to read and process in a ROP output and it has taken over 24 hours so far and is only 60 percent done rendering. I am not even sure if the geometry in my ROP will work for what I would like. This is why I was hoping to magically convert the texture to point or prim colors easily.
Unfortunately I would also have to search deep for some tuts on how to use a Point Wrangle the way you describe with uv's. I have seen some of Rohan Dalvi's tuts and hope to be able to find more. Houdini is harder than it was before Attributes/VEX became the mainstay of workflows.
- blackpixel
- Member
- 182 posts
- Joined: 4月 2009
- Offline
- markerline
- Member
- 245 posts
- Joined: 9月 2008
- Offline
Hi. unfortunately this doesn't work as i cannot group the primitives after applying the attribute. the texture from the attribute wrangle is not baked in. zero primitives are grouped.
I have shown the way I use the Primitive SOP to apply the texture and the red from the Houdini logo is somewhat orange showing the yellow grouping interaction with the colors of the logo.
I have shown the way I use the Primitive SOP to apply the texture and the red from the Houdini logo is somewhat orange showing the yellow grouping interaction with the colors of the logo.
- markerline
- Member
- 245 posts
- Joined: 9月 2008
- Offline
- blackpixel
- Member
- 182 posts
- Joined: 4月 2009
- Offline
- markerline
- Member
- 245 posts
- Joined: 9月 2008
- Offline
- markerline
- Member
- 245 posts
- Joined: 9月 2008
- Offline
- markerline
- Member
- 245 posts
- Joined: 9月 2008
- Offline
- tamte
- Member
- 8766 posts
- Joined: 7月 2007
- Offline
markerlinenot that important as you'd never use @Frame as a filepath expression (as opposed to in VEX snippets where the syntax of @Frame came from), but if you must now it's capital F and you have to enclose it in ticks as an expression, so something simple like this:
i see $F still works but i think it is important to know how to use “frame”
file.$F.exr
would become this: file.`@Frame`.exr
, and we are not even talking about padding like $F4
Edited by tamte - 2020年5月8日 03:38:09
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- markerline
- Member
- 245 posts
- Joined: 9月 2008
- Offline
ok i got it!! i had tried to place the path string directly into the vex expression but i see you need to use “map” and place the path into the parameter interface separately. in H13 there is no quick shortcut button to create parameters based on ch strings in the expression. so i had to click the gear icon.
- blackpixel
- Member
- 182 posts
- Joined: 4月 2009
- Offline
- markerline
- Member
- 245 posts
- Joined: 9月 2008
- Offline
it is rendering at 10 frames per 39 seconds whereas before each individual frame was taking over 1 minute to render a single bgeo file. and there is more data in these new frames as well as I have selected a slightly different set of color ranges and deleted based on the new group expression. i thank you immensely for your help! blackpixel and tamte
- markerline
- Member
- 245 posts
- Joined: 9月 2008
- Offline
- pbowdidge
- Member
- 2 posts
- Joined: 6月 2020
- Offline
blackpixel
Aaah, ok! If it's just a texture you need, then it's super easy and fast with VEX: Point VOP, (simple) Wrangle or Attribute from Map.
( see attached hip )
If writing code is not your thing, then you can comfortably stay node based in VOPs.
That little bit of VEX worked a treat. Much appreciated.
-
- Quick Links