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
getting wirecolour from objects and applying it to particles
-
Pete
- Posts: 118
- Joined: 16 Jun 2009, 07:28
-
Hirazi Blue
- Administrator
- Posts: 5113
- Joined: 04 Jun 2009, 10:15
Re: getting wirecolour from objects and applying it to particles
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... ;)
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!
-
Pete
- Posts: 118
- Joined: 16 Jun 2009, 07:28
Re: getting wirecolour from objects and applying it to particles
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.
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.
-
Hirazi Blue
- Administrator
- Posts: 5113
- Joined: 04 Jun 2009, 10:15
Re: getting wirecolour from objects and applying it to particles
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
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.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.
-
Pete
- Posts: 118
- Joined: 16 Jun 2009, 07:28
Re: getting wirecolour from objects and applying it to particles
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...
So leo, how would I do that? Sorry, I haven't really messed with arrays much...
-
Hirazi Blue
- Administrator
- Posts: 5113
- Joined: 04 Jun 2009, 10:15
Re: getting wirecolour from objects and applying it to particles
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...
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...
Stay safe, sane & healthy!
-
Leo
- Posts: 128
- Joined: 04 Jun 2009, 15:06
Re: getting wirecolour from objects and applying it to particles
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...
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.