Area :: Header
Interested in making Indie games?

Register for a Meet the Experts webinar with Digital-Tutors today!
Discussion Groups

ICE - Interactive Creative Environment

Reply
Member
rmawatson
Posts: 5
Registered: ‎06-27-2010

ICE Element Generator Context

41 Views, 1 Replies
05-07-2012 04:33 AM
Hello,

Hoping someone might be able to help me out, I have created an Element Generator Node with the SDK, that outputs 2 attributes, one of type Vector3 one of type Color4.

Both have been added to my ice node definition on plugin load with ICENodeDef::AddOutputPort()

Both ports output the the same length of data. If I create a blank ICE tree on a "particle cloud" primitive, run an AddPoint into the the Execute of my first ice tree port, and feed the Add Point with values from my vector3 attribute this works, I get my points appearing as expected in the viewport.

However I also want to be able to set the color of these points. I have attempted to use a Set Particle Color, plugged into my AddPoints "On Creation" Plug, and I have also tried on a seperate execute plug on the ICE Tree Node. But the Context of the source Color4 attribute "Per Generated Element", and the input required for the Set Particle Color is "Per Object or Point of pointcloud.pointcloud".

I can see that the problem is to do with the wrong context on the output of my color4 port, however I am unable to use any other context when ElementGenerator is used for any other port in the SDK - If I do the plugin wont load.

Does anyone have any advice on how I can wire this up in ICE, or if there is something I am overlooking in the SDK.

Cheers


-- Update --

The only way I have managed to get this to work is to have two of my loaders, on 2 seperate point clouds. On the Second point Cloud I take my Color output convert it to RGBA -> Put each of R G B into a Scalar to Vector 3, then plug this into an Add point.

I Now have 2 point clouds, one representing the acutal positions from my loader ,the other representing the Colors as positions,

I now have to go back to the first one, use a Get Data to get the Point Posiition of My "Color-Position" point cloud, switch the context, then convert this Vector back to Color and then Set Particle Color.

This seems totally crap, and means I have to have 2 point clouds to achive color on these points, there must be another way to do this.
Please use plain text.
Member
craig09x
Posts: 5
Registered: ‎08-03-2009

Re: ICE Element Generator Context

10-02-2012 03:53 PM in reply to: rmawatson
Managed to get multiple element-generator output ports to work by having a 'Build Array from Set' node. That seems to convert the "colour per generated element" into an "array of colour per object". Then feed the 'Build array from set' into a 'Select in Array' (where index is pointcloud.ID) to pull out an element. Then 'Set Data' works with the output of the 'Select in Array'.


Custom node (out pos) -> Add Point -------------------------------------------> (port1) IceTree
(out col) -> Build Array from Set -> Select in Array -> Set Data -> (port2)
^(index)
|
Get Data (self.ID) ------+
Please use plain text.