vmantra instancing

   7493   13   1
User Avatar
Member
176 posts
Joined: July 2005
Offline
I have a geo full of points, using instancing to create many a tv screen.
to clarify, I'll be refering the the “geo object” and the “points object”:

I made an attribute in the points object to use different pictures for each instance:

What if I have a primitive group in the geo object and thats the only group I want to inherit the attribute from the points object?

Lets say there are primitives grouped in the geo object… with using a copy method, I had previously made a primitive attribute in order to get this to work. Now that it is a point attribute in the points object, Im having lets say…slight difficulties :roll:
User Avatar
Member
387 posts
Joined: July 2005
Offline
Hey lynch_ppl,

I'm not sure I understand what you've just said, but here's some suggestions/ideas.

You can delete groups you don't want in the GROUP SOP (Select its Edit Tab, see down the bottom of the params). Just append a group sop to the sop you were exporting, name the groups you don't want, and export/reference that group sop.

You can use the ATTRIBUTE PROMOTE SOP to convert attributes between point and primative classes (keep in mind this is usually a weird and funky operation - the two classes often don't directly relate to each other, so you can't just do this blindly). Set the “original name” to “Cd” in the ATT PROMOTE SOP. Original Class is “primative” and leave the New Class as “Point”.

Then maybe use an ATTRIBUTE TRANSFER SOP to apply the attributes.

The Details View pane (type: Alt+4) is useful to see what's going on. It will display the point xor primative attributes for the currently selected sop.

I hope that helps,
ben.
''You're always doing this: reducing it to science. Why can't it be real?'' – Jackie Tyler
User Avatar
Member
176 posts
Joined: July 2005
Offline
Sorry about that…I will elaborate a little more…

basically when you are instancing, you are using points, so you are giving the points the attribute, then the primitives that are being instanced are inheriting the points' attributes at rendertime in the ifd….i think.

so i am trying to figure out how to control what attributes are being passed to the primitives at render time.

The problem is, there is no attributes on the primitive to promote…and I can't specify a group in the attribute create that is on the points geometry because there are no primitives there!

I think I may put together a simple file tomarrow and post it…
That may be easier for people to understand whats going on… :wink:
User Avatar
Member
2199 posts
Joined: July 2005
Online
I think I follow what you want, you don't want all the primitives in the instance object to inherit the same attribute from the points? is that correct?
The only way i can think of off the top of my head to get around it would be to split the objects being instanced up into parts and then have multiple sets of points to instance to, each set of points would be in the same place but with different attributes, then you would use more than one instance object and instance the different parts of each model to each set of points….. maybe…
The trick is finding just the right hammer for every screw
User Avatar
Member
176 posts
Joined: July 2005
Offline
Simon:
I think I follow what you want, you don't want all the primitives in the instance object to inherit the same attribute from the points? is that correct?
Thats exactly what I want…

Simon…the work around that you mentioned had crossed my mind…
but the problem is, that I cannot separate the object into pieces unfortunetly because I set it to render as Subdivision Surfaces, and if I delete any part, the whole geometry changes….which is why I was trying to control which attributes get passed to which primitive.
User Avatar
Member
7715 posts
Joined: July 2005
Offline
The latest Object Merge SOP has options to deal with the problem of extracting a portion of a subd model. When you give it a primitive group to merge out, turn on the Expand Group parameter. This will merge in an extra ring of primitives so that the subdivided result will be the same as before.
User Avatar
Member
176 posts
Joined: July 2005
Offline
Edward! That works great! Thats really good to know about the object merge SOP.

Although my problem is now solved, if anyone knows how to control passed attributes…I'm still interested in knowing!!!

….but I can use the solutions found here…
thanks Simon and Edward!
:wink:
User Avatar
Member
2199 posts
Joined: July 2005
Online
Hey Edward you might want to check out what the help says for that option, it appears to be wrong….

Also, want do you do about the overlap when rendering all the bits?
The trick is finding just the right hammer for every screw
User Avatar
Member
176 posts
Joined: July 2005
Offline
Hey you guys…here is a simplified file demonstating the instancing problem I am having. Notice the texture map is on the entire geometry.

Still wondering how one can have primitive groups inherit the same attribute with different values.

So in this example, it would be nice if one map_base would be “”, and the other could be a path to a picture considering you only want the screen group to inherit the vm_surface referencing a picture.

Attachments:
instanceProb.jpg (11.1 KB)
instance.hip (1.1 MB)

User Avatar
Member
176 posts
Joined: July 2005
Offline
I changed the uvproject in the tvs geometry from referencing only the tv screen group to all groups…

just to prove where the rim color is coming from.

Attachments:
UVjustscreen.jpg (4.0 KB)
UVall.jpg (5.6 KB)

User Avatar
Member
2199 posts
Joined: July 2005
Online
Surely if you use a decal shader that doesn't repeat and the uv's for the screen are in the range 0-1 and every where else the uv's are at -1 say then the texture should only turn up on the screen.

To deal with multiple textures and instancing though you could try something like this.
Write a shader that needs two parameters, the first one to define the group that the point is in and another one that is the path to the texture you want applied.
That way you are using the first parameter to mask where the second one gets used. Do you follow?
The trick is finding just the right hammer for every screw
User Avatar
Member
176 posts
Joined: July 2005
Offline
Simon…thanks for the reply…much appreciated.

How would you set the uv's to -1? I tryed using uvproject and setting a range of -1 to -1…not quite the best results…what uv sop is best for this?

I think I follow what you are saying about writing the shader that has parameters you could pass attributes to…I would apply the attributes to the geometry…and instead of having an attribute create describing the shader, have a shader SOP that would inherit the attributes?
User Avatar
Member
2199 posts
Joined: July 2005
Online
If you are using UV project everything outside of the projection area should be outside the range of 0-1 anyway. But you can always manually add the values with a point or attribute create sop and a group.

With regard to the shader yes you would be creating an attribute on the geometry that partitions it up, and that would be common to all your instances, then the instances would also get an attribute that sets the path to the texture map. I have to admit I've never tried overriding a string parameter in vex (as far as I remember) so it might not work, but its the only other suggestion i can think of at the moment.
The trick is finding just the right hammer for every screw
User Avatar
Member
176 posts
Joined: July 2005
Offline
the first method hasnt worked….yet
I will end up exploring the second method more…but my initial attempts proved i will need more time.

for the groups I didnt want the projection on:
I set the uv attribute to
-1 -1 -1, vertex class, float size of 3…
any ideas?
  • Quick Links