Jump to content
nicoladanese

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

Share this post


Link to post
Share on other sites

Maybe you could try point instancing. You transfer all your colors, height info etc. to drive your shader color and size attributes that will modify your cubes at rendering....

Share this post


Link to post
Share on other sites
28 minutes ago, srletak said:

Hey thanks! I didn't think about extruding primitives, definitely faster, the only problem is that this way you are limited on the shape of the geos, I think I need to have more control over the shape of the instanced geo

Share this post


Link to post
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;

 

Share this post


Link to post
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

Share this post


Link to post
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 3

Share this post


Link to post
Share on other sites

hey all! thanks for all the replies, I'll look into all of them asap, I've been busy trying to get outof a shitstorm of work lately ;) 

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites

something like this? i'm attaching an example file.

also, if you're coming from a C4D background... you might want to try MOPs. it uses a similar flow to Mograph... you could use Falloff from Texture and then the Transform Modifier to scale objects in Y in this particular case.

Untitled.png

height_from_luma.hip

  • Like 2

Share this post


Link to post
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".

 

Share this post


Link to post
Share on other sites

Thanks very much!!!!  That is exactly what I was looking for!!!!

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

  • Like 2

Share this post


Link to post
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??  

Share this post


Link to post
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...

Share this post


Link to post
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! :-)

Share this post


Link to post
Share on other sites

First try with this technique....9 million cubes......I included the the file.....I think there is more optimization that can be done!

20191124_1.thumb.jpg.b2da6546691e9c34b240bef40e4ffb2f.jpg

20191120_v2.hip

Edited by kuzy62
attached file

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×