import array import inlinecpp import numpy as np def output_planes_to_cook(cop_node): # This sample only modifies the color plane. return ("C",) def required_input_planes(cop_node, output_plane): # This sample requires the color and alpha planes from the first input. if output_plane == "C": return ("0", "C", "0", "A") return () def cook(cop_node, plane, resolution): assert(plane == "C") input = cop_node.inputs()[0] print(input.type()) xres = input.xRes() yres = input.yRes() print(xres,yres) # Get the color plane as an array. color = array.array("f", input.allPixelsAsString("C")) # Convert the color array into a NumPy array and reshape it into an image. np_color = np.array(color).reshape((xres, yres, 3)) # Separate the R, G, and B channels. r_channel = np_color[:, :, 0] g_channel = np_color[:, :, 1] b_channel = np_color[:, :, 2] # Perform an FFT on each channel. r_fft = np.fft.fft2(r_channel) g_fft = np.fft.fft2(g_channel) b_fft = np.fft.fft2(b_channel) # Combine the channels back into one array. fft_color = np.stack((r_fft, g_fft, b_fft), axis=-1) # Flatten the array and convert it back to a Python array. fft_color_flat = fft_color.flatten() color = array.array("f", fft_color_flat.real) # Use .real to get the real part of the complex numbers. # Set the pixels of the cooking plane with the FFT data. cop_node.setPixelsOfCookingPlaneFromString(color.tostring())
Found 857 posts.
Search results Show results as topic list.
Technical Discussion » COP: how to convert images to frequency domain?
- Soothsayer
- 858 posts
- Offline
You can make a Python COP asset and then get fft via numpy. I tried it myself but ran into a problem with getting the right resolution (it seems to default to 128 for some reason). Anyway, here's the buggy code and maybe it gets you started.
PDG/TOPs » Optimizing Python Script Execution in Houdini TOPs for Large Ranges
- Soothsayer
- 858 posts
- Offline
I'm working with a very large range of frames (tens of thousands), where a simple Python script processes each frame. I've noticed that running the script for each frame individually is much faster than processing multiple frames in parallel. This seems to be due to the overhead of loading Python libraries for each work item, which significantly adds up over time.
I'd like to optimize the workflow by running a chunk of work items sequentially within a single work item so that Python modules load only once, and then the script processes several frames before loading the modules again. However, I'm having trouble setting this up.
I would like to group, say, 10 work items together and run them sequentially as if they were one. So far, attempts at partitioning work items either end up processing chunks in sequence (with the loading overhead for each) or treating each work item separately, which brings me back to the original performance issue.
How do I approach this?
I'd like to optimize the workflow by running a chunk of work items sequentially within a single work item so that Python modules load only once, and then the script processes several frames before loading the modules again. However, I'm having trouble setting this up.
I would like to group, say, 10 work items together and run them sequentially as if they were one. So far, attempts at partitioning work items either end up processing chunks in sequence (with the loading overhead for each) or treating each work item separately, which brings me back to the original performance issue.
How do I approach this?
Edited by Soothsayer - April 21, 2024 04:30:29
Technical Discussion » Fit field-of-view to a BoundingBox
- Soothsayer
- 858 posts
- Offline
If you're interested, I had a similar problem and this solved it for me:
vector campos = chv('campos'); vector objectpos = chv('objectpos'); // Initial horizontal aperture float H_initial = 20.955; // Object size (A) and distance (R) from the camera float A = chf("object_size"); // Example channel referencing object size float R = distance(campos, objectpos); // Field of View (FOV) needed to fit the object at distance R float FOV_needed = 2 * atan(A / (2 * R)); // focal length to achieve the required FOV with the initial horizontal aperture @focal_length = H_initial / (2 * tan(FOV_needed / 2));
PDG/TOPs » Normalized wedge attribute
- Soothsayer
- 858 posts
- Offline
Technical Discussion » What's the reason for OpenCL Neighbor Search failing?
- Soothsayer
- 858 posts
- Offline
I have a grain sim where all grains completely vanish after a certain amount of frames. According to the docs disabling OpenCl Neighbor Search fixes that. It does but what's the reason for the failure in the first place? Memory doesn't seem to be the culprit. Can I keep the OpenCL goodness while avoiding the unpredictable vanishing problems?
Edited by Soothsayer - March 8, 2024 04:53:36
Solaris and Karma » "Render All Frames with a Single Process"
- Soothsayer
- 858 posts
- Offline
I think it avoids doing pre-render stuff for each frame again and again, regardless of whether they are animated or not, so that by switching it on it goes 'aha, all this stuff stays the same, cool cool'. It's like a postman who would stop at every house, switch off engine, lock doors, deliver, unlock doors, get in, wipe off some dirt, start the engine again, etc, vs getting out once and doing the round on foot for a while. As for downsides, I'm not sure but perhaps it avoids building up caches, general stability, and doing the whole sequence processing on every machine (if on farm).
Technical Discussion » Struggling with remapping attribs with large ranges?
- Soothsayer
- 858 posts
- Offline
In those cases I like to remap like so:
with f being a log parm and the scaling constant being for convenience.
@att = exp(-@att*a_scaling_constant*ch('f'));
with f being a log parm and the scaling constant being for convenience.
Edited by Soothsayer - Feb. 29, 2024 01:56:44
Houdini Lounge » Turn Edges into Curve
- Soothsayer
- 858 posts
- Offline
Konstantin MagnusNathan Apffel
Its hard to believe that these are the best solutions in Houdini for extracting a curve from an edge.
Houdini is a toolbox, not a toy.
That's why I like the pluralize function.
Technical Discussion » Create new flipbook without overwriting another?
- Soothsayer
- 858 posts
- Offline
Try the disconnect button on the top right. It looks like (*). There's apparently a shortcut too, Alt+Shift+I, but it doesn't work for me.
Solaris and Karma » Karma - Texture Baking
- Soothsayer
- 858 posts
- Offline
jsmackpablo_lukaszewicz
Sorry for a noob question but what is this Object ID thingy.
If instead of one pig head as in the example I would have two usd primitives pigHP and pigLP how do I tell which one is wich to the render rop? I need to mark them with some attribute with some fancy name?
Yes, the render geometry settings has Low, Cage, and High obj ID settings for correlating the primitives that are baked.
What are these ID settings? An integer, a string? Are they applied automatically and how do I find them? For example, if I have a cube and a sphere and I want a baked texture of only the sphere (but with the shadow cast from the cube, etc). Is it possible to set those ids?
Edited by Soothsayer - Feb. 22, 2024 11:02:46
Solaris and Karma » Refreshing .rat textures, how?
- Soothsayer
- 858 posts
- Offline
Solaris and Karma » Retrieving Pixel Data Pre-Save in USD Render ROP Husk Script
- Soothsayer
- 858 posts
- Offline
Using the USD Render ROP and its Husk Post Frame script, is it possible to access pixel data from the frame buffer before it gets saved to a file? I'd like to write some info about it into the exr metadata.
Edited by Soothsayer - Feb. 20, 2024 05:18:13
Technical Discussion » Clear ALL Houdini Cache?
- Soothsayer
- 858 posts
- Offline
Whenever this comes up in studios IT chuckles and says that Linux automatically releases memory and we're all mistaken, etc. Reading around tech forums and I get the same impression but anybody that has worked a decent amount in Houdini knows that in practice it really isn't the case and that caches do get 'filled up'. I'm curious to what's really going on!
Technical Discussion » solaris light linker seems a bit glitchy
- Soothsayer
- 858 posts
- Offline
I experience the same thing. I find the light linker not very usable. What other methods do people use?
Technical Discussion » [SOP] Best practice to fill in hole from alembic
- Soothsayer
- 858 posts
- Offline
Why does polyfill fail? This looks like it should work very well for this. I the geo weird in some way?
Edited by Soothsayer - Sept. 21, 2023 12:19:08
Houdini Lounge » Houdini and AI - what do we think?
- Soothsayer
- 858 posts
- Offline
Technical Discussion » Geometry Basics
- Soothsayer
- 858 posts
- Offline
I'd also say that you should be careful to see @ptnum as an index for points. @ptnum can change from frame to frame, or the ordering can sometimes change.
Houdini Lounge » AMD CPU and opencl
- Soothsayer
- 858 posts
- Offline
habernir
Soothsayer if you have amd cpu than opencl cpu should work out of the box in houdini.
i think the problem its not in houdini , so maybe the libraries are not installed in ubuntu and you need to install it
Any idea of what might be missing? I ran clinfo in a terminal and the cpu is not listed as an opencl device, only the gpu is. I have a ryzen 3950x, so that should work ok normally.
Houdini Lounge » AMD CPU and opencl
- Soothsayer
- 858 posts
- Offline
I've recently had to reinstall my OS, ubuntu, courtesy of nvidia drivers. Now I'm finding that opencl doesn't work anymore on Houdini. It is shown in houdini->edit->preferences but inspecting from a shell the cpu doesn't seem to be listed it as an opencl device at all!
Some internet sleuthing reveals the shocking information that AMD has abandoned support for opencl on their cpu so people revert to pocl or other things, with mixed results.
How do folks handle this? Some sop nodes require opencl (attribute blur I think?) and it is common as an option in dop nodes. Opencl on gpu can be tricky because of limited gpu memory.
Some internet sleuthing reveals the shocking information that AMD has abandoned support for opencl on their cpu so people revert to pocl or other things, with mixed results.
How do folks handle this? Some sop nodes require opencl (attribute blur I think?) and it is common as an option in dop nodes. Opencl on gpu can be tricky because of limited gpu memory.
Houdini Lounge » Houdini 20 Rumors
- Soothsayer
- 858 posts
- Offline
Personally I love the documentation, better than that of any other software I have used but maybe this is because I've used it for such a long time. Sometimes it's a bit inconsistent but I can live with that. Can somebody point me to some examples that illustrate the problem?
-
- Quick Links