zoki Posted April 18, 2007 Share Posted April 18, 2007 hi I have alpha mask/channel and in it of course I have areas of white on black background what would be easiest way to color each area with random flat color? I thought puting alpha in cops >find edges>trace sop>randomize primitive color>render again There must be some other solution without going to sops? z Quote Link to comment Share on other sites More sharing options...
MADjestic Posted April 18, 2007 Share Posted April 18, 2007 hiI have alpha mask/channel and in it of course I have areas of white on black background what would be easiest way to color each area with random flat color? I thought puting alpha in cops >find edges>trace sop>randomize primitive color>render again There must be some other solution without going to sops? z Use your alpha as a mask in VOPs maybe? Quote Link to comment Share on other sites More sharing options...
zoki Posted April 18, 2007 Author Share Posted April 18, 2007 yes , but how will I define regions in vops so it will know each patch one random color? z Quote Link to comment Share on other sites More sharing options...
flowerdealer Posted April 18, 2007 Share Posted April 18, 2007 Hi, just off the top of my mind I think you could assign the alpha to texture in a shop, and then use the tex, pic or picni function inside a color or a property or attribute node to select only the point or primitives that fall inside the alpha, group the points by proximity (or by some other clever expression), and then assign a random color to each group. I don't have houdini right now so I can't say specifically how, but I think it could be possible. Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted April 18, 2007 Share Posted April 18, 2007 How about doing it in reverse? Start with regular patches of solid random colors, then use noise to distort them (in both space and intensity). Quote Link to comment Share on other sites More sharing options...
zoki Posted April 18, 2007 Author Share Posted April 18, 2007 yes this would be possible in "generic" case except that my mask is defined/painted layer and I want to randomize its patches! I cant change patches shape in fact I must stay as true as possible to their size /outline thanks z Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted April 18, 2007 Share Posted April 18, 2007 except that my mask is defined/painted layer and I want to randomize its patches! It would seem that flowerdealer's approach would be your best bet, then. Have you tried it? I may be misunderstanding, but since you know that the data needs to become little islands of random solid colors, *and* you're "painting" or generating the alpha mask yourself, then it would seem that you have complete control: that you could generate the random colors from the start and bypass the "map-greyscale-to-colors" stage, no? Quote Link to comment Share on other sites More sharing options...
zoki Posted April 18, 2007 Author Share Posted April 18, 2007 I have matte painting and I painted mask for windows because some windows are in actual geometry and some are just painted and reprojected to low poly geom. so from this painted frame which represents all glass surfaces in city I need to randomly colorize them for tweaking reflection pass in comp before I painted them manualy and it takes hours I am sure there must be elegant procedural way of doing this so far I traced my mask with trace sop and using point sop I rand$PR color so each primitive is different I forgot how do I pass color from point sop/add color to render? I didnt use it for a while and I know I saw this somewhere? so this is one solution and this being houdini there must be another also, right? thanks z Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted April 18, 2007 Share Posted April 18, 2007 so from this painted frame which represents all glass surfaces in city I need to randomly colorize them for tweaking reflection pass in comp This is a quick sketch of flowerdealer's idea... easier to sketch an example than to type an explanation randcols.hip Would that method work? Quote Link to comment Share on other sites More sharing options...
zoki Posted April 18, 2007 Author Share Posted April 18, 2007 (edited) it looks ok but how do I make this color cels conform to my drawing /layout to get rid of this celular look and make them color each area each area must have just one color not be split into two or more though z Edited April 18, 2007 by zoki Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted April 18, 2007 Share Posted April 18, 2007 it looks okbut how do I make this color cels conform to my drawing /layout to get rid of this celular look and make them color each area each area must have just one color not be split into two or more though z Please look at the hip file. If the areas are continuous, they'll be assigned the same random color (as per connectivity). I had to use *something* since I don't have your image, so I chose the cellular noise for demonstration purposes... I realize that's not what your image looks like. Quote Link to comment Share on other sites More sharing options...
sibarrick Posted April 18, 2007 Share Posted April 18, 2007 I forgot how do I pass color from point sop/add color to render? Just make the name of your attribute the same as the colour parameter for your shader. So in this case use an attribute sop to rename your point (or primitive) Cd colour to diff (or whatever your shader uses to define the colour of the windows) Quote Link to comment Share on other sites More sharing options...
zoki Posted April 19, 2007 Author Share Posted April 19, 2007 (edited) I will try both out thanks a lot as always great help! z Edited April 19, 2007 by zoki Quote Link to comment Share on other sites More sharing options...
zoki Posted April 19, 2007 Author Share Posted April 19, 2007 Hi I tried both versions and one with trace and geometry is faster and more accurate! In Mario's version bottleneck is grid resolution because if you have some areas with just few pixels in your map you need to hace grid with over 1000 columns to get detail out But other problem I have is how to match render view so it aligns excactly with source image in cops? Traced geometry gets placed into origin so if I set my resolution in camera to fit resolution of image being traced it is still in center. I need to match my camera or traced geometry to fit precisely back onto traced plate? z Quote Link to comment Share on other sites More sharing options...
Mario Marengo Posted April 19, 2007 Share Posted April 19, 2007 I need to match my camera or traced geometry to fit precisely back onto traced plate? Set your camera to "Orthographic", with "Translate" = {0,0,1} and all other transformations at default. Then set its "Ortho Width" to 1 and its resolution to match your image's resolution. If you render your traced geometry from this camera (and assuming you don't do any weird transformations in SOPs), then it should match your original "Alpha" image... at least in theory... Also note that if you move the final multiplication in my example (the last point SOP in the chain) to the shader (i.e: multiply by the alpha image in the shader, not in SOPs), then you can probably get away with having a lot less points. In any case, this is a one-time expense, right? Additionally, the trace sop works with a threshold... meaning that it will likely miss antialiased edges in the source image (or eat into them a bit), so if you're using the trace method, it would probably be wise to trace against an un-premultiplied version of your alpha image, and then re-multiply either in the shader or in COPs. Good luck! Quote Link to comment Share on other sites More sharing options...
zoki Posted April 19, 2007 Author Share Posted April 19, 2007 cool mario , thank you for help I will try this out so far I managed to shrink with this method work time from 6hours to 2minutes and am quite pleased with results z 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.