Jump to content

attribfrommap creates interim values


Recommended Posts

Hi everyone, 

beginner Houdini user here, so sorry if it's an obvious question. 

My current finger exercise / idea is, to use a texture with areas in clear, distinct colors like (255,0,0) without anti aliasing. These are used to map the colors onto points which then are used to copy specific geometry onto them (buildings and city stuff in my example). 

cityCreate5.thumb.png.c15af5fee8000e48762d7bda6b06614b.png

This works for the most part, but to have more control over which color gets how many points I split my geometry into separate groups and use a separate scatter for each group (I tried the densitiy attribute before, but everything changing when I change one density value wasn't what I wanted) 
To achieve this I am using a partition SOP with group by Color. 
The weird thing is, that I'm not getting the expected number of groups (8 in my case as I'm using 8 colors) but more something around the lines of 200-700. 

houdini_BYtXirnY5v.png.928e6319680839bebadf6b29f1dbe073.png

Looking at the Cd values in the geometry spreadsheet shows me, that the values aren't all the correct values (they should be along the lines of 1,0,0 ) but there are interim values, small variations. This of course gets picked up by the partition node. 
Using an attribpaint SOP gives the expected result...but I would love to be able to draw the textures in external tools like Photoshop. Just nicer to edit the map.

 houdini_iRMlEDFBdQ.thumb.png.d8f135847cb8f081d887f350476ef5df.png

Does anyone have an idea how the interim values are created? I suppose it has something to do with the mapping / scaling of the texture / uv.. but I can't figure it out as everything I change, gives the same result (like the filter settings in the attribfrommap SOP). 
My node setup is like this: 

Grid -> size 16,9 (I tried different resolutions here too to no avail)
UVProject -> Orthographic, 16,16 (and rotated so it has the rotation of the grid)
attribfrommap -> Texturemap (a png, 3840 x 3840 px with the 16 by 9 area centered vertically on the map)
partition SOP -> Group by Color

houdini_pyLarYQq0p.png.eb4a71fbb351b82cfbc67243230b2dc0.png


For my easy test setup I added an attribute wrangle that checked the incoming color values against bordervalues and sets them to the closest correct value.

f@lowLimit = .3;
f@highLimit = .7;

if(@Cd.r > 0 && @Cd.r < @lowLimit) @Cd.r = set(0);
if(@Cd.r < 1 && @Cd.r > @highLimit) @Cd.r = set(1);  
if(@Cd.r < @highLimit && @Cd.r > @lowLimit) @Cd.r = set(.5); 


if(@Cd.g > 0 && @Cd.g < @lowLimit) @Cd.g = set(0);;
if(@Cd.g < 1 && @Cd.g > @highLimit) @Cd.g = set(1);;
if(@Cd.g < @highLimit && @Cd.g > @lowLimit) @Cd.g = set(0.5);; 


if(@Cd.b > 0 && @Cd.b < @lowLimit) @Cd.b = set(0);
if(@Cd.b < 1 && @Cd.b > @highLimit) @Cd.b = set(1);
if(@Cd.b < @highLimit && @Cd.b > @lowLimit) @Cd.b = set(0.5);

This works for my simple case at the moment. But if I was to add more colors the rounding wouldn't work anymore with all the interim values created. 

Can anyone explain why I get interim values even though the texture itself is not antialiased and in the right aspect ratio? I guess it has something to do with the texture stretching/mapping in houdini but is there a way to fix the problem?
Or a better way to achieve this result? 

I checked some posts in here but most of the proposed solutions I got to work for texture color to point color result in the same interim values

Thanks a lot for your help! 

Cheers, 
Daniel

Link to comment
Share on other sites

  • 4 weeks later...

As of today I still haven't figured out a good solution. 
If i promote the point Cd attribute to primitive the colors get sharper as expected, but  I still am having the inbetween colors. I suppose it has something to do with the UV Mapping? But no kind of filtering changes it (In PS I would say nearest Neighbour to avoid interpolated values)
So still interested in a solution if anybody can chime in :)

Cheers
Daniel  

Link to comment
Share on other sites

Hey anim, 

thanks for your hint! I just installed the daily build 18.0.449 and that did actually fix the problem
The interpolation when displaying the grid itself, still shows gradients between the colors, but using a point grid results in the right amount (8) groups for the partition node. 
Thanks for that :D I could have tried a long time with it being a "bug". 

I hoped the daily build would also fix my crashes on the fillet option in the polybevel node...but that still happens :D 

Thanks for your help! :)

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...