Convert vertex map to polygon selection


#1

Hi there,

I am looking for a way to use vertex maps with TP Matterwaves.
As the vertex map shader isn’t evaluated by Matterwaves,
I thought maybe there’s a way to convert vertex map content
into a polygonselection tag so I could emit particles based on
the polygonselection. The vertex map is dynamic and changes
over time, any ideas? :slight_smile: Thanks in advance.

(By the way, it would be awesome to have a dynamic translator,
which can translate between vertex maps, point selections and
polygon selection instantly. There’s an old plugin called
Tag Manager which does that, but not live&dynamic.)


#2

I think baking out the shader as a series of image files is your best option.
Cheers
Björn


#3

Thanks Srek, what a pity :slight_smile:
Is this because the live conversion would
result in a performance hit or would be
very complicated?


#4

If you convert a weightmap to a selection you loose all possible shades since a selection tag only knows selected or not. The main problem however is that the order of execution simply does not allow for this.


#5

I have ended up trying to use the Vertex Map Shader with a Birth Type set to Texture a few times myself to no avail.

So wanting to convert the map to a poly selection is an obvious choice, ye.
Loosing all shades wouldn’t be the problem, since all you need for selecting Polygons is Booles anyway and it’s simple to turn the Weightmap Values into Booles.
But then the question is indeed, what do you feed that into ?

you need to render a vertex map in a texture as well to be able to see it.
thanks for clearing up that it just can’t be done, björn.

d


#6

Points with weights > 0 can be stored as a point selection, which can in turn be converted to a poly selection and stored in a tag.
This example uses a morphed vertex map to drive texture assignment and PMatterWaves particle emission.

As pointed out by Srek, this doesn't allow for different shades to be taken into account so I'm not sure how useful this approach would be. An interesting exercise anyway.

#7

How awesome is that!
You don’t know how big the favor is you’ve done here, Darter.
Thank you very much!

Here’s a setup I did with your coffee solution, the vertex map is driven
by a plain effector with a spline source in the falloff tab. The polygon selection
drives the clones and the particles. The vertex map also restricts a jiggle deformer,
the result invites to more exploration :slight_smile:
http://dl.dropbox.com/u/28253825/VertexMapsToPolySelection_yader.c4d


#8

No worries typografschaft, I’m glad to see the expression being used to such good effect. It makes sense now that I can see what you were doing. That’s an ingenious setup, I’ve learned a lot getting my head around it. I think your approach to driving Vertex Map values could have many uses.

I've updated the expression with User Data links for the vertex map and poly tags to make it easier to reuse.

#9

very clever, david.
there’s great stuff to be done with this concept.

about the coffee :
It’s interesting how you loop through the points of each polygon to decide if it needs to get selected or not.

Now, I was wondering; all polys need to be quads for this setup to work.
I imagine, if I wanted to use this with a mesh that has tris and ngons, all this would take is another “for loop” to get the pointcount for each poly and compare that variable with your “found” variable, right ?

I got stuck at this part.

if(bs->IsSelected(poly->d)) found++;

Do I just put extra lines in there in case there are more points ( poly->e and f and g ,…) ?
Doesn’t seem to behave though, and of course that’s completely due to me being a coffee dummie.

could you give me a quick hint in the right direction ?
Would make this so much more flexible if it works with every single polygon you throw at it.

cheers,
d


#10

Interesting stuff guys, thanks for the tips!

cheers
Tim


#11

It’s been an interesting learning exercise for sure, Tim.

 Thanks for your interest douwe. It's working fine with Ngons and tris in all the tests I've done here. 
 
 As poly->c and poly->d are the same for triangles, this index is just counted twice and the test works. I figured there wouldn't be much difference in overhead between doing this and testing for tris first. The test works for Ngons as they're comprised of quads and tris at a lower level.

#12

thanks for this extra essential bit of insight, david.
All tests with ngons and tris appeared to be working fine here as well, also with more complex shapes.
It just didn’t seem to be logical from what’s happening in the code. “if(found == 4)”

I learnt a lot today.
thanks david, thanks derya.

d


#13

Thanks for taking the time to test and confirm this, it’s good to know that it’s working reliably in other situations.


#14

Following your code and succesfully copy&pasting I added a Treshold UserData
to the coffee tag, so one can determine at which weight value polygons are
actually selected.
I hope it’s ok with you Darter?
http://dl.dropbox.com/u/28253825/VMapsToPolySelect.c4d

It’s amazing what one can do with a couple of lines of code,
I’m impressed to say at least :wink:


#15

yihaa, derya !!

this concept really is impressive.
been playing with PSurfacePosition,
and with your Moselector setup to turn this “vertex map/polygon selection” into a Moselection.

this treshold makes it even cooler.


#16

No problem, that’s a good enhancement. I’m having fun animating the threshold already.

One small thing, could you please correct the spelling of ‘Treshold’ to ‘Threshold’ in the User Data and code?


#17

:slight_smile: Sounds nice, so one can affect specific clones based on the Vertex/polySelection, I think the concept of translating polygon/point selections, mograph selections and vertex maps on the fly can lead to crazy stuff, maybe one of the plugin guru’s around here needs a challenge? :wink:

@Darter: typos has been corrected, the link in my post above has the new file.


#18

Thanks to this technique I was able to get nice collision dust from these tank tracks via the vertex-map output from the collision deformer.

Before I read this thread I was faced with the need for a tp-collision node set for EACH link of the tank tracks.

The problem is that when the collision deformer is cached it no longer updates/outputs the vertex map?? any ideas? so close and yet so far… :frowning:


#19

maybe i misunderstand you,
but a quick reproduction seems to be working :

jpg : http://www.mediafire.com/?7sh3q5hb0ekjab3

c4d : http://www.mediafire.com/?hg7poknwc32ug95
(calculate the cache + press play)

good luck,
d

sorry for the mediafire links, due to attachment limit.


#20

your file has exactly same issue, the vertex map becomes static after caching, at least on my pc it does.

your file actually demonstrates the problem really well.