Hi,

this is my first post in the forum and I would like to ask some advise of how to scale value of frame buffer that hook up to maya's render passes. I wrote the code using adskShaderSDK based on CustomPhong at the sample folder.

These three attributes: FrameBufferWriteOperation, FrameBufferWriteFlags and FrameBufferWriteFactor don't do anything inside the shader. Even though I tried to compile CustomPhong itself, I still could not get those attributes run properly.

Please take a look of the code below. That shader only has one color parameter as an input and write the output to the BEAUTY pass.

Code:
#include "adskShader.h"

struct rl_mr_colorParameters{
	miColor color;
	ADSK_BASE_SHADER_PARAMETERS;
};

const unsigned int rl_mr_color_VERSION = 1;
typedef ShaderHelper<rl_mr_colorParameters> BaseShaderHelperType;

class rl_mr_colorClass : public Material<rl_mr_colorParameters, BaseShaderHelperType, rl_mr_color_VERSION>
{
public:

	rl_mr_colorClass(miState *pState, rl_mr_colorParameters *params);
	~rl_mr_colorClass() {};

	static void init(miState *pState, rl_mr_colorParameters *params) {}
	static void exit(miState *pState, rl_mr_colorParameters *params) {}

	miBoolean operator()(miColor *result, miState *pState, rl_mr_colorParameters *params);

private:

	// short cut definition for base class
	typedef Material<rl_mr_colorParameters, BaseShaderHelperType, rl_mr_color_VERSION> MaterialBase;

};

rl_mr_colorClass::rl_mr_colorClass(miState *pState, rl_mr_colorParameters *params) :
Material<rl_mr_colorParameters, BaseShaderHelperType, rl_mr_color_VERSION>(pState, params){}


miBoolean rl_mr_colorClass::operator()(miColor *result, miState *pState, rl_mr_colorParameters *params)
{
	miState * &state = pState;

	// Setup framebuffers.
    PassTypeInfo* passTypeInfo;
    FrameBufferInfo* frameBufferInfo;
    unsigned int numberOfFrameBuffers = getFrameBufferInfo(state, passTypeInfo, frameBufferInfo);

 	// Fetch parameters.
	*result = *mi_eval_color(&params->color);
    if (numberOfFrameBuffers && MaterialBase::mFrameBufferWriteOperation)
		MaterialBase::writeToFrameBuffers(state, frameBufferInfo, passTypeInfo, *result, BEAUTY, false);   
	return(miTRUE);
}

// Use the EXPOSE macro to create Mental Ray compliant shader functions
//----------------------------------------------------------------------
EXPOSE(rl_mr_color, miColor, );
Code:
declare shader
	color "rl_mr_color" (
			color "color" default 1.0 1.0 1.0,
			integer			"FrameBufferWriteOperation" default 1, # add
			integer			"FrameBufferWriteFlags" default 0, # no flags
			scalar			"FrameBufferWriteFactor" default 1.0,
	)
	#: nodeid 321020
	version 1
	apply material
end declare
Did I miss something there? If anyone can share your thoughts, it will be very helpful.

Thanks,
Ricky