dbsmith
01-28-2008, 02:57 AM
Hey all,
Am trying to create a simple blur/kernel convolution node.
Input = color + integer value (eg 5)
Compute = blur it per-pixel by using the surrounding pixel's values eg kernel =
0.05 0.10 0.05
0.10 0.40 0.10
0.05 0.10 0.05
Output = color
Does the compute method work on a per pixel basis, or is it just called ONCE?
How can I access other pixels other than the current one im on?
//Rough pseudo-code:
MFloatVector resultColor;
MFloatVector & col = block.inputValue(aColor).asFloatVector();
int blur = block.inputValue(aBlurAmount).asInt();
//Get color values from around current pixel....
//This is pseudo-code, showing getting different pixels at different indices....
resultColor = resultColor[-1][-1]*0.05 + resultColor[0][-1]*0.1 + resultColor[1][-1]*0.05 .... etc....
// set ouput color attribute
MDataHandle outColorHandle = block.outputValue( aOutColor );
MFloatVector& outColor = outColorHandle.asFloatVector();
outColor = resultColor;
outColorHandle.setClean();
return MS::kSuccess;
Am trying to create a simple blur/kernel convolution node.
Input = color + integer value (eg 5)
Compute = blur it per-pixel by using the surrounding pixel's values eg kernel =
0.05 0.10 0.05
0.10 0.40 0.10
0.05 0.10 0.05
Output = color
Does the compute method work on a per pixel basis, or is it just called ONCE?
How can I access other pixels other than the current one im on?
//Rough pseudo-code:
MFloatVector resultColor;
MFloatVector & col = block.inputValue(aColor).asFloatVector();
int blur = block.inputValue(aBlurAmount).asInt();
//Get color values from around current pixel....
//This is pseudo-code, showing getting different pixels at different indices....
resultColor = resultColor[-1][-1]*0.05 + resultColor[0][-1]*0.1 + resultColor[1][-1]*0.05 .... etc....
// set ouput color attribute
MDataHandle outColorHandle = block.outputValue( aOutColor );
MFloatVector& outColor = outColorHandle.asFloatVector();
outColor = resultColor;
outColorHandle.setClean();
return MS::kSuccess;
