Jump to content

Instancing with Redshift (@instancepath is too slow!) am I missing something?


Recommended Posts

Hi all, 

First of all, please let me know if somebody else asked this question and got an answer, I looked for an answer here and didn't find any, someone has asked on SideFX forum but nobody answered.  

anyway, I have a scene with hundreds of thousands of points in it that I wanna render as instances. It works fine when I render with Mantra, the @instancepath attrib works just fine, and it does work with Redshift too but it's very slow and it just freezes when the number of points goes up, even 1000 points would take forever to render with RS. So I was wondering if I'm missing something. 

 

Thank you,

E

Link to comment
Share on other sites

I haven't worked with instances in a version newer than 18.0 Redshift and Houdini, however the last time I tried I was under the impression that Mantra and Redshift used different instancing attribute names. One used instancepath and one used instancefile, I think Mantra uses instancepath and Redshift uses instancefile. Could this be of any use? Because I would have thought that the final point count after instancing would matter a lot less if they are all instanced since it just reads the same file from disk. Also just to have asked, are you trying to instance a .rs file or a .bgeo file? Because I believe that Redshift prefers to instance .rs files over .bgeo files.

Link to comment
Share on other sites

Also, if you are just instancing spheres, try leveraging Redshifts render as particles instead. No geometry needed.

I don't think Redshift uses a special attribute. I always used @instance and that seemed to work. If you do have a .rs file (which is recommended) then use @instancefile to target it on the disk, but don't specify both attributes.

Here some code from one of my instancers.

string subnet = chs("../subnet_source");	// Numbered variants inside subnet.
int max = chi("../item_max");			// Variant count.
float rnd_seed = ch("../rnd_seed");

// Select random item
int item_num = int(fit01(rand(@ptnum+rnd_seed),1,max));
s@instance =sprintf("%s%02d",subnet,item_num);

// Apply random rotations
float randRot_Y = fit01(rand(@ptnum + rnd_seed+3),0,360);
@orient = quaternion(maketransform(@N,@up));
vector4 rotate_Y = quaternion(radians(randRot_Y),{0,1,0});
@orient = qmultiply(@orient, rotate_Y);

// Apply random size
f@pscale = fit01(rand(@ptnum+rnd_seed+10),0.75,3.0)*ch("../size_mult");

 

Edited by Atom
Link to comment
Share on other sites

On 4/10/2021 at 4:45 AM, underscoreus said:

I haven't worked with instances in a version newer than 18.0 Redshift and Houdini, however the last time I tried I was under the impression that Mantra and Redshift used different instancing attribute names. One used instancepath and one used instancefile, I think Mantra uses instancepath and Redshift uses instancefile. Could this be of any use? Because I would have thought that the final point count after instancing would matter a lot less if they are all instanced since it just reads the same file from disk. Also just to have asked, are you trying to instance a .rs file or a .bgeo file? Because I believe that Redshift prefers to instance .rs files over .bgeo files.

Thank you for your answer. I've tried both instancepath and instancefile, I didn't have any luck with instancefile, instancepath works but it's very slow. 
I am using bgeo but I'll try .rs too. Thanks. 

Link to comment
Share on other sites

On 4/10/2021 at 9:09 AM, Atom said:

Also, if you are just instancing spheres, try leveraging Redshifts render as particles instead. No geometry needed.

I don't think Redshift uses a special attribute. I always used @instance and that seemed to work. If you do have a .rs file (which is recommended) then use @instancefile to target it on the disk, but don't specify both attributes.

Here some code from one of my instancers.


string subnet = chs("../subnet_source");	// Numbered variants inside subnet.
int max = chi("../item_max");			// Variant count.
float rnd_seed = ch("../rnd_seed");

// Select random item
int item_num = int(fit01(rand(@ptnum+rnd_seed),1,max));
s@instance =sprintf("%s%02d",subnet,item_num);

// Apply random rotations
float randRot_Y = fit01(rand(@ptnum + rnd_seed+3),0,360);
@orient = quaternion(maketransform(@N,@up));
vector4 rotate_Y = quaternion(radians(randRot_Y),{0,1,0});
@orient = qmultiply(@orient, rotate_Y);

// Apply random size
f@pscale = fit01(rand(@ptnum+rnd_seed+10),0.75,3.0)*ch("../size_mult");

 

Thank you. I'll give .rs a try. I tried instancefile with bgeo and didn't get anything so the problem could be bgeo. 
 

Link to comment
Share on other sites

Yeah, definitely use .rs  instead of bgeo if you want to do the instancing at rendertime.  (use the redshift proxy rop). I attached an old example of doing it this way, should still work. (FYI the redshift tab may not have all the latest updates though since I created this a while ago)   

Alternatively, I find it easier to do instancing with redshift using the packed prim workflow with the copy to points sop. 

Create i@variant on both sides of the copy, so no stamping is needed.

Turn on "piece attribute" in copy node

Turn on "pack and instance" in the copy node

Up at /obj level,  on the geometry object you're going to render, which contains the packed prims: Redshift Tab > instancing > tick on "instance SOP level packed prims"

rs_proxy_instance.hiplc

Edited by loudsubs
  • Like 1
  • Thanks 1
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...