Jump to content

copy/stamp, alternative ways?


Recommended Posts

Hey! I'm looking into a way of doing this sort of abstract models, and I'm copy/stamping cubes on a grid, driving colors from a map and the height of the cubes (from another map + noise) is piped into a copy stamp, it works fine but I find it very slow when the number of copies rises too much, it takes roughly one minute to copy/stamp 1 million cubes. I noticed is not multi threaded so I wonder if there's a smarter/faster/better way of approaching this

cheers!

df9c23210a31ac41be9de2bd_rw_1920.jpg

Link to comment
Share on other sites

instance node

grid

scatter

Point Wrangel code/ make a path(plural) the your OBJ

int instNum = chi("instanceNum");
string instanceBase = chs("instancePathBase");
float random = rand(@ptnum + ch("seed"));

float baseRate = 0;
for( int i=1; i<=instNum; i++){
    baseRate += ch( concat("rate",itoa(i)) );
}

float instCurRate = 0;
string instancePath;
for( int i=1; i<=instNum; i++){
    float instRate = ch( concat("rate",itoa(i)) ) / baseRate;
    if(random > instCurRate && random <= instCurRate + instRate){
        instancePath = concat(instanceBase, chs( concat("instancePath",itoa(i)) ) );
    }
    instCurRate += instRate;
}
s@instance = instancePath;

 

Link to comment
Share on other sites

Here is the basic "fake" stamp that evolved after CopyToPoints nodes was released. If you run it, inside a FOREACH loop, you can reliably fetch attributes from point #0.

This image shows the standard point instancing technique, which is faster than the CopyToPoints, fake stamp. The main reason you might still want to use CopyToPoints, is if you are generating geometry that you need to export.

Untitled-1.jpg

ap_fake_stamp_090619.hiplc

Edited by Atom
Link to comment
Share on other sites

There's no need for any kind of copy stamping or for/each loops for this kind of thing, since the only difference between any of those copied boxes is the transformation matrix. You can pass template point attributes into the Copy SOP that describe the scale of each instance, and Copy does the rest. You can assign the color attribute after the fact; Mantra and Redshift (and probably most other renderers) can read the color attribute from the points and use this to drive the albedo of each instance. In the Mantra shaders this would be done just by enabling "Use Packed Color".

instances_no_stamping_toadstorm.hip

  • Like 4
Link to comment
Share on other sites

  • 2 months later...
On 9/6/2019 at 5:36 PM, toadstorm said:

There's no need for any kind of copy stamping or for/each loops for this kind of thing, since the only difference between any of those copied boxes is the transformation matrix. You can pass template point attributes into the Copy SOP that describe the scale of each instance, and Copy does the rest. You can assign the color attribute after the fact; Mantra and Redshift (and probably most other renderers) can read the color attribute from the points and use this to drive the albedo of each instance. In the Mantra shaders this would be done just by enabling "Use Packed Color".

instances_no_stamping_toadstorm.hip

Thanks very much for this!!!  I have been making those Lee Griggs style images in Cinema 4D and then in Houdini for awhile now...but my system got bogged down with all the geometry very quickly.....I was playing around with this last night and tried to build some stuff myself rather than just copying your file.....I can get it to copy cubes to the grid with no issue at all.....and then I used an attribute from map to color the cubes based on an image file......what I wanted to do is scale the cubes in the y direction based on the color of points on the grid.....I couldn't seem to make it work......any advice would be greatly appreciated!!! Thanks!

Link to comment
Share on other sites

Like what Henry said, you can just use your color as your y scale, if you set your point v@scale = set(1,1+@Cd.y*mult, 1); and when you copy boxes to your point, you can see the scale differences. No stamping, no loops needed.

If you wanna control the scale after the copy, you can also packed the copy geo and modify the primtive intrinsic "transform".

 

Link to comment
Share on other sites

Hey! I'm glad this thread is still useful!

first I want to say thanks to all the guys that came and helped almost 2 months ago. I finally managed to deliver the shots I was working on and I'm really happy with the result!

Dan, from my experience I would say that using color to drive Y scale is definitely the smarter way, I mean you paint/import/draw maps in color so you have a visual feedback of what is driving the height of the cubes, than convert color to the scale value as suggested by toadstorm! Purely from an artistic point of view, so very personal, I would suggest to not just use color to drive scale, but experiment with noises and other stuff, in my experience the most successful approach is to extract some features from the color map, and then add more informations to it to make it look more interesting and organic...but again this is very subjective

here's an example of my stuff, as you can see you can find some feature of the color in the height map as well, but then I added a lot more informations to make it look more interesting, well at least that was the plan ;)

scale.png

color.png

result.png

  • Like 1
Link to comment
Share on other sites

8 hours ago, nicoladanese said:

...shot_010_comp_v013_t000_0275.thumb.png.7beabcb504efa36a8f772110a9d13ab3.png

and this is one of the frame of the final result...roughly 1 billion cubes rendered!!!

That looks insane!!!  How much memory to render 1 billion cubes?? I've got 25 million in a scene and am using almost 15 GB....am I doing something wrong??  

Link to comment
Share on other sites

are you packing when you copy to points? My setup was sort of a matrioska (the russian dolls that gets smaller and smaller) so I packed one tile, then copy the packed tile to more tiles...that kept my memory low!

btw the image you see is rendered in 2 layers, foreground and background...

Link to comment
Share on other sites

3 hours ago, nicoladanese said:

are you packing when you copy to points? My setup was sort of a matrioska (the russian dolls that gets smaller and smaller) so I packed one tile, then copy the packed tile to more tiles...that kept my memory low!

btw the image you see is rendered in 2 layers, foreground and background...

I didn't do it that way....packing first...then copy to points....will give that a try!  Thanks! :-)

Link to comment
Share on other sites

  • 2 months later...

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...