Jump to content

Texture Stamping


jedijones

Recommended Posts

Hi all,

i have a simple particle system to represent confeti fallen into a stadium and i have instance a very simple gride to each point which has also a texture shader aplied with an alpha to cut out an shape. i want to know how to stamp different textures eg shape1, shape2, shape3 onto the particle sytem. i have tried to play around with adding a stamp expression into the image string so that it randomly selects a texture from disk but nothing. i just can not get my head around stamping and it seem so powerful.

Also when my particles hits the ground the collision is set to stop. how do i get the instance grids to impact at the edge not at the center point so i can create a soft flat landing?

thanks

jj :)

Link to comment
Share on other sites

Hi, I had a very similar problem, here is the answer:

random textures

hope this will help you out

hey the hip example was cool and useful but its not realy what i trying to do.

i want to stamp random textures from disk onto instanced geometry

eg

shape1

shape2

shape3

and so on

im sure i can use on shader and then stamp the file string sumhow!

i will keep playing

thanks for looking into my prob anyhow.

jj

Link to comment
Share on other sites

hey the hip example was cool and useful but its not realy what i trying to do.

i want to stamp random textures from disk onto instanced geometry

When instancing, I don't think that there are any unique values that can be passed to the shader per instance, which makes varying the shader per instance really not too easy.

It would be really pretty nice if the VEX "renderstate()" function allowed the shader to query some unique info about which instance it was bound to - even just a unique ID would be good. Maybe I should ask SESI about it...

Link to comment
Share on other sites

Also when my particles hits the ground the collision is set to stop. how do i get the instance grids to impact at the edge not at the center point so i can create a soft flat landing?

You can do this by adding the "Add Distance Attribute" on the Collision POP. With this you can use that as a multiplier on the angle of the particles, so the closer they get to the collision surface the closer they end up laying flat.

As far as offsetting the particle point of reference, you could use a Translate POP and offset it by half the size of your grid.

Hope this helps

confettiRotation_001.hipnc

Link to comment
Share on other sites

When instancing, I don't think that there are any unique values that can be passed to the shader per instance, which makes varying the shader per instance really not too easy.

What do you mean "per instance"? Isn't this done by varying shader string attributes on points?

Link to comment
Share on other sites

What do you mean "per instance"? Isn't this done by varying shader string attributes on points?

Unfortunately Mantra (or PrMan) won't propagate any attributes on the source instance points to the instance itself (which, I guess, would be the analog of the Attibute Stamping while CopyStamping for Mantra) - so all instances are absolutely identical with nothing to tell them apart.

All this yummy information about the instance is lost at the IFD generation stage, I believe.

Thinking about it more, I suppose it would be a two-step enhancement needed to (1) put this instance "meta-data" into the IFD for every instance, and (2) allow a function like renderstate() to probe this information. I'd love to be able to query instance attributes something like: renderstate("instanceAttribute:Cd", myCd );

Point Mark at this thread wontcha? ;)

Link to comment
Share on other sites

I'm not sure how this ability is needed for jedijone's problem. Isn't this just a matter of assigning random texture id's to the instance points which the shader then uses it to lookup each texture?

Ah yes, I think you're right. :blink: I was thinking more literally of a true instance in Mantra without reading up high enough in the thread to realize that he essentially can get away with CopyStamping while assigning a primitive string attribute to control the texturemap name.

Sorry for the diversion!

However! The notion of being able to vary true instances in some way inside of Mantra has been sorely needed for years and years. I'd still like to motivate for a solution similar to this since Mantra is currently unable to provide a solution in this arena right now. Renderman allows for custom attribute blocks - but I haven't tried using them myself; does anyone know if these can alleviate this problem?

Link to comment
Share on other sites

Hey Paul,

Here's an example of using copy stamping to apply random textures. I've used the butterfly textures that come with Houdini 8 but you can apply this technique to any set of textures if you name them similarly (texture1.pic, texture2.pic, texture3.pic, etc).

I haven't tried it here but you could probably get this to work without copy stamping by feeding the primitive number or $ID into the expression in the attribute create SOP. As long as each object has some attribute that uniquely identifies it you can modify the texture string name using something like the expression in the attribute create SOP.

If you have any questions let me know. You owe me an email anyway!! ;-)

Hope this helps.

john.

textureStamping.hip

Link to comment
Share on other sites

You can do this by adding the "Add Distance Attribute" on the Collision POP. With this you can use that as a multiplier on the angle of the particles, so the closer they get to the collision surface the closer they end up laying flat.

As far as offsetting the particle point of reference, you could use a Translate POP and offset it by half the size of your grid.

Hope this helps

Hi SpencerL,

thanks for the hip demo :)

Would it be possible to get the same effect only using a particle sop. Would i have to create 2 new atrributes "rot" and "dist" just like in the pop network?

jj

Link to comment
Share on other sites

Would it be possible to get the same effect only using a particle sop. Would i have to create 2 new atrributes "rot" and "dist" just like in the pop network?

Well, I am not really sure why you would want to do it using the particle SOP since you dont have a whole lot of control over the particles, but if thats what you need then in order to find how close the distance is from the collision plane you would have to create an attribute and use a pointdist( ) expression. Something like:

pointdist("../particle1", $PT, "../collision_plane", -1, 0)

and then fit that between 0 and 1. That will give you your muliplier. As far as creating rotation on the particles using SOPs, it would have to be sort of a hack by rotating the normals.

Link to comment
Share on other sites

Well, I am not really sure why you would want to do it using the particle SOP since you dont have a whole lot of control over the particles, but if thats what you need then in order to find how close the distance is from the collision plane you would have to create an attribute and use a pointdist( ) expression. Something like:

pointdist("../particle1", $PT, "../collision_plane", -1, 0)

and then fit that between 0 and 1. That will give you your muliplier. As far as creating rotation on the particles using SOPs, it would have to be sort of a hack by rotating the normals.

Hi SpencerL,

Well yes the particle sop is a little dated now but i cannot always get my hands on a hmaster license, i just want to do it in hselect then any changes i make to the particle system dont have to rely on me using hmaster. The work is not of a high prority like other stuff.

i could do it at home in hmaster but then i cannot tweak without using hmaster at work

i will give your advise ago

thanks for responding SpencerL :D

Link to comment
Share on other sites

Hey Paul,

Thanks for your mail. I see you wanted to try using point instancing with random textures. I thought I'd post one solution here rather than post direct in case it is useful to anyone else.

Note that there are a few other odForce threads related to this that would be worth reading also:

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

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

Cheers

john

texture_instance_v2.hip

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