getting wirecolour from objects and applying it to particles

Discussions about SOFTIMAGEs© Interactive Creative Environment©
User avatar
Pete
Posts: 118
Joined: 16 Jun 2009, 07:28

getting wirecolour from objects and applying it to particles

Post by Pete » 08 Sep 2009, 03:17

Hi there,
Just wondering if there'd be a way to set a particle's colour to be the same as the wirecolour of an object it is within (or near).
I'm having a bit of trouble working out how to get and set data for this...
Thanks
Pete

User avatar
Hirazi Blue
Administrator
Posts: 5113
Joined: 04 Jun 2009, 10:15

Re: getting wirecolour from objects and applying it to particles

Post by Hirazi Blue » 08 Sep 2009, 09:23

It's actually quite simple (and a little bit strange)

To get the wireframe color of an object the first instinct would be to Get Data from "myobj.display.wirecolor", this results in a Color output, however it gives the wrong result. If you however get the RGB Data separately, i.e.
Get Data - myobj.display.wirecolorr
Get Data - myobj.display.wirecolorb
Get Data - myobj.display.wirecolorg
and plug their results into an RGBA to Color, leaving the A slot empty, obviously, it does work...

A now for the strange bit: if you want to set the color of a wireframe from your ICE Tree you can use a Set Data on the "myobj.display.wirecolor" and feed it Color Data directly... ;)
Stay safe, sane & healthy!

User avatar
Pete
Posts: 118
Joined: 16 Jun 2009, 07:28

Re: getting wirecolour from objects and applying it to particles

Post by Pete » 08 Sep 2009, 09:33

Hehe,
Thanks for that but I'm trying to grab the colour from a number of objects (inside a group) so using get data on a specific object might not work.

User avatar
Hirazi Blue
Administrator
Posts: 5113
Joined: 04 Jun 2009, 10:15

Re: getting wirecolour from objects and applying it to particles

Post by Hirazi Blue » 08 Sep 2009, 09:36

So maybe you should have stated that more clearly in your question?
Stay safe, sane & healthy!

Leo
Posts: 128
Joined: 04 Jun 2009, 15:06

Re: getting wirecolour from objects and applying it to particles

Post by Leo » 08 Sep 2009, 10:10

Pete wrote:Hehe,
Thanks for that but I'm trying to grab the colour from a number of objects (inside a group) so using get data on a specific object might not work.
I don't have XSI here right now but if groups have this parameter then you will be able to grab it as an array.

User avatar
Pete
Posts: 118
Joined: 16 Jun 2009, 07:28

Re: getting wirecolour from objects and applying it to particles

Post by Pete » 08 Sep 2009, 10:24

Sorry Hirazi, didn't mean to send you down the wrong there mate.

So leo, how would I do that? Sorry, I haven't really messed with arrays much...

User avatar
Hirazi Blue
Administrator
Posts: 5113
Joined: 04 Jun 2009, 10:15

Re: getting wirecolour from objects and applying it to particles

Post by Hirazi Blue » 08 Sep 2009, 11:42

No problem of course... ;)
I am very interested in Leo's solution as I have played around with the problem a bit and was unable to come up with a solution of my own... :D
Stay safe, sane & healthy!

Leo
Posts: 128
Joined: 04 Jun 2009, 15:06

Re: getting wirecolour from objects and applying it to particles

Post by Leo » 08 Sep 2009, 11:58

very busy right now

Edit:
We basically check the distances between the particles and the objects. Then we use the index (the position within the array) of the lowest distance as a key to select the proper value in the array. The reason that this works is that the array of positions from the group is sorted the same way the array of colors from the group is.

btw. you are right Hirazi it really doesn't work with just the color.... curious...
You do not have the required permissions to view the files attached to this post.