a41b Posted January 31, 2019 Share Posted January 31, 2019 (edited) I need to generate text in Houdini and render it so that the empty area outside the generated text is cropped. The saved image should only be the size that is needed to display the generated text and not the default canvas size of 1920x1080. I am using the Compositing context very infrequently, so I was wondering if there is an easy way to determine the size of the generated text automatically and control a Crop node with that information. Thanks. Edited January 31, 2019 by a41b Quote Link to comment Share on other sites More sharing options...
kleer001 Posted January 31, 2019 Share Posted January 31, 2019 I would alter the camera's resolution based on the bounding box of the text its self before rendering, if that's an option available to you. Quote Link to comment Share on other sites More sharing options...
a41b Posted February 1, 2019 Author Share Posted February 1, 2019 11 hours ago, kleer001 said: I would alter the camera's resolution based on the bounding box of the text its self before rendering, if that's an option available to you. That's one way I could do it in the OBJ context: Generate text geometry, position a camera and invoke Mantra. But is there a way to do it completely in the Compositing context? The IMG context also has a font node that can generate text, but it generates a default canvas of 1920x1080. I would need to determine the bounding box of the text somehow in the Compositing network and feed that information to the crop node. Unfortunately I am not familiar with the IMG network. I could not find something like a detail attribute that I could generate in a VopCop node (for storing the bounds of the colored text) and later in the network access this attribute in the Crop node. My way of thinking in the OBJ context does not work in the IMG context Quote Link to comment Share on other sites More sharing options...
Butachan Posted February 1, 2019 Share Posted February 1, 2019 I know you want to do it in the comp context but if the objective is to get a final image you may want to check this: http://www.sidefx.com/docs/houdini/ref/utils/iautocrop.html Hope it helps. Quote Link to comment Share on other sites More sharing options...
a41b Posted February 1, 2019 Author Share Posted February 1, 2019 1 hour ago, Butachan said: I know you want to do it in the comp context but if the objective is to get a final image you may want to check this: http://www.sidefx.com/docs/houdini/ref/utils/iautocrop.html Hope it helps. Thanks for the tip. Is there a way to call iautocrop from the "Post-Render Script" field in my ROP File Output node, which is attached at the end fo the network? Another solution that would work with the ROP would be to crop the image using python after it is written on disk. Quote Link to comment Share on other sites More sharing options...
kleer001 Posted February 1, 2019 Share Posted February 1, 2019 I'm pretty sure you're going to have to use the SOP context if you need this to be auto-magical. So, if you're stuck with the images and can't re-render them, I suggest using the Trace SOP to generate geo from your images and then bbox from there. Otherwise, if you're completely set on doing it entirely in COPs you'll probably need to do some VEX magic looking at every freaking pixel and write reams of code (10-20 lines?). Quote Link to comment Share on other sites More sharing options...
Butachan Posted February 2, 2019 Share Posted February 2, 2019 22 hours ago, a41b said: Thanks for the tip. Is there a way to call iautocrop from the "Post-Render Script" field in my ROP File Output node, which is attached at the end fo the network? Another solution that would work with the ROP would be to crop the image using python after it is written on disk. Sorry for the late answer... Well, I do not know, since I never have used this command, have in mind this is a stand alone tool, not a script. My guess is that there must be a way to create a python script to launch the tool. But I guess you will need to do that research yourself. It all comes down on how often you will need to do this, I run commands from Houdini Cmd Line constantly to run little tools, and it is just one line, so you can easily just make a txt file with the template you need to run. Quote Link to comment Share on other sites More sharing options...
a41b Posted February 8, 2019 Author Share Posted February 8, 2019 (edited) I found a quite elegant way to do that task without setting up a camera or cropping via a post processing script. 1. In the OBJ context: set up a Font node. 2. In the IMG context: set up a "Geometry" node (which renders SOPs along a world axis) and control the node's "Overide Size" Parameter via the bounding box of the Font node from the OBJ context. Edited February 8, 2019 by a41b Quote Link to comment Share on other sites More sharing options...
Butachan Posted February 8, 2019 Share Posted February 8, 2019 8 minutes ago, a41b said: I found a quite elegant way to do that task without setting up a camera or cropping via a post processing script. 1. In the OBJ context: set up a Font node. 2. In the IMG context: set up a "Geometry" node (which renders SOPs along a world axis) and control the node's "Overide Size" Parameter via the bounding box of the Font node from the OBJ context. Yes I thought about the geo node in cops aswell, but I just assumed you wanted the font through some interesting perspective view. Now that I think about it it is kind of sad this node do not have a camera input. That's why I offered the post script as a solution. Anyway, glad you found your solution Tim Quote Link to comment Share on other sites More sharing options...
malexander Posted February 8, 2019 Share Posted February 8, 2019 If you're using the Font COP, it generates a very small image inside a crop region on its own (Shift+LMB drag in the viewer to see it). If you export to a format that supports data windows like EXR or PIC, this will be preserved. 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.