Jump to content

Point instance & random geometry?


DaJuice

Recommended Posts

Hello people, how's it going?

I've got a question. How can I get random geometry with point instancing? I know how it can be done with copy stamping, but using the Copy SOP is not memory efficient. I would like to instance 8 or so different models randomly onto roughly 500,000 points (I can break up the point groups if necessary) and I think point instancing is the only feasable way I could do that on my old box.

Any thoughts?

Link to comment
Share on other sites

Hey DaJuice,

Create 8 or more separate objects & name them the same so you'll get, for example, "foo1", "foo2"..."foo8". Next, in the object containing the particles, append a Point SOP at the end & under the Particle tab, set Instance to "Add Instance" & set the following: "/obj/foo`int(fit01(rand($PT+1541)*1.1,1,8))`" or any random expression you like.

One other thing to take note of is the "Point Instancing" check box under the Object's Render tab. Also, you might want to read this thread.

Cheers!

steven

  • Like 1
Link to comment
Share on other sites

Yeah - exactly what Steven said. You can also try this type of expression, which usually works fine.

/obj/mygeo`$PT%8`

This will cycle through your geometry instances, and looks fine if your points are randomly distributed. If you have trouble, pop up the SpreadSheet and inspect the "instance" attribute and make sure the names are resolved to existing object names successfully.

REMEMBER to point to a Geometry Object - pointing to a top-level HDA will not work.

  • Like 1
Link to comment
Share on other sites

Thank you guys, seems to work perfectly. :)

The only thing that has me worried is this bit from the wiki:

So if you're trying to instance tiny geometry 10k /100k times over then the data storage overhead in mantra will not be worth it.

In any case I don't think memory usage could be worse than trying to use copy stamping for the same situation.

Link to comment
Share on other sites

Well, the camera will definitly be moving, but you're right, I can still break it up into 5 or even more permanent groups and comp them together later. And here are the results from last night.

point_instance.jpg

It's 102400 points total, 6 unique objects, and 6 shaders. Memory usage at it's highest was about 350MB, not small but at least workable. I wonder what will happen once I stuff the points with a ****load of attributes. :unsure:

Thanks again folks.

Link to comment
Share on other sites

  • 2 years later...
Well, the camera will definitly be moving, but you're right, I can still break it up into 5 or even more permanent groups and comp them together later. And here are the results from last night.

point_instance.jpg

It's 102400 points total, 6 unique objects, and 6 shaders. Memory usage at it's highest was about 350MB, not small but at least workable. I wonder what will happen once I stuff the points with a ****load of attributes. :unsure:

Thanks again folks.

hello,

how do you get 6 different shaders with point instancing?

Is it possible to explain the workflow?

many thanks,

bern

Link to comment
Share on other sites

Hello,

thanks, but I'm doing this tutorial.

In the video they say:

"Stamp different shaders, by using stamp capabilities. However because you're stamping single points and just attributes, it's much much faster than stamping complete sets of geometry..."

They don't actually show how to stamp those different shaders. They only use one shader with random R and G colors.

How can I stamp different shaders, do I need to create an attribute and what expressions are used ?

thanks in advance,

bern

Link to comment
Share on other sites

For the whole stamping thing to work you need to have shader names that are similar.

v_supermat1

v_supermat2

v_supermat3

v_supermat4

etc..

In this file the shaders are stamped by using a shader path that uses a stamp expression:

../shopnet1/v_supermat`stamp("../copy1", "shadNum", 1")`

the stamp parameter:

shadNum: round(rand($PT)*3+1)

Thus returning 1-4 and allowing the stamp to select one of the available named shaders for

each point.

../shopnet1/v_supermat1

../shopnet1/v_supermat2

../shopnet1/v_supermat3 or

../shopnet1/v_supermat4

shaderstamp.hip

Link to comment
Share on other sites

For the whole stamping thing to work you need to have shader names that are similar.

v_supermat1

v_supermat2

v_supermat3

v_supermat4

etc..

In this file the shaders are stamped by using a shader path that uses a stamp expression:

../shopnet1/v_supermat`stamp("../copy1", "shadNum", 1")`

the stamp parameter:

shadNum: round(rand($PT)*3+1)

Thus returning 1-4 and allowing the stamp to select one of the available named shaders for

each point.

../shopnet1/v_supermat1

../shopnet1/v_supermat2

../shopnet1/v_supermat3 or

../shopnet1/v_supermat4

shaderstamp.hip

hello,

thanks Hammy... but in your example you're using actual geometry.

Would it also be possible with point instancing, without using the copy sop?

I think P. Bowmar refers in the video to do just that...

thanks again,

bern

Link to comment
Share on other sites

hello,

thanks Hammy... but in your example you're using actual geometry.

Would it also be possible with point instancing, without using the copy sop?

I think P. Bowmar refers in the video to do just that...

thanks again,

bern

Bernard,

Check this old thread for some ideas. Looks like I posted an example of point instancing at the end of it but it's a while ago now and I can't remember if it is exactly what you need here. I don't have time to check it myself right now (there's some scary Spider-man 3 supes breathing down my neck!!! OK not that scary but we want the movie to come out on time, right?) but take a look as it may help you. I also post an example of texture stamping in that thread as well. If I remember the technique is pretty similar in that you just name your textures or shaders with similar names (shader1, shader2, shader3, etc) and then randomise the index per instance to select amongst them.

Texture stramping and point instancing thread

If it helps you please post back here to say it is what you wanted and maybe post an example of your own.

John

P.S. I have a feeling if you dig through odForce there are more examples of this sort of thing. It's one of those topics that keeps coming up. EDIT - Just noticed I actually link to some more threads for further reading at the end of my post with the point instancing example. Here are the links again if they are useful

http://odforce.net/forum/index.php?showtopic=2319 EDIT AGAIN haha that's actually this thread isn't it!! Don't go round in circles!!

http://odforce.net/forum/index.php?showtopic=2276

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