AnsweredAssumed Answered

Operation RPR_MATERIAL_NODE_OP_COMBINE of shader RPR_MATERIAL_NODE_ARITHMETIC

Question asked by shauser67 on Jun 8, 2020
Latest reply on Jun 19, 2020 by shauser67

Hello,

 

I am trying to use RPR_MATERIAL_NODE_ARITHMETIC for some advanced mathematical operations inside a node graph. My understanding after reading the documentation is that I can split a color in its components with RPR_MATERIAL_NODE_OP_SELECT_X (_Y, _Z) and combine these components back to a color with RPR_MATERIAL_NODE_OP_COMBINE. However, the latter operation doesn't work as expected:

 

rpr_material_node material_node = nullptr;

 

rprMaterialSystemCreateNode (material_system,
                                 RPR_MATERIAL_NODE_ARITHMETIC,
                                 &material_node));


rprMaterialNodeSetInputUByKey (material_node,
                                   RPR_MATERIAL_INPUT_OP,
                                   RPR_MATERIAL_NODE_OP_COMBINE));


rprMaterialNodeSetInputFByKey (material_node, RPR_MATERIAL_INPUT_COLOR0, 1.0f, 1.0f, 1.0f, 1.0f));
rprMaterialNodeSetInputFByKey (material_node, RPR_MATERIAL_INPUT_COLOR1,  0.8f, 0.8f, 0.8f, 1.0f));
rprMaterialNodeSetInputFByKey (material_node, RPR_MATERIAL_INPUT_COLOR2,  0.0f, 0.0f, 0.0f, 1.0f));

 

This should create a bright yellow color (1.0, 0.8, 0.0) = (COLOR0.r, COLOR1.g, COLOR2.b), but I am getting white with a purple tint.

 

I am using the latest release rpr 1.35.1.

 

Thanks for any help in advance.

Outcomes