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 2

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

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

×