Last active
August 29, 2015 14:00
-
-
Save hiko9lock/11342282 to your computer and use it in GitHub Desktop.
ShaderFX Custom Code sample for Maya 2015, maya LT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// You may add new struct outputs, function inputs and adjust code in the function. | |
// Function name and output struct should match 'Function Name' attribute on node. | |
// Available preprocessor definitions: SFX_HLSL_3, SFX_HLSL_5, SFX_GLSL_1_2, SFX_GLSL_4, SFX_CGFX_3, _MAYA_, _3DSMAX_, SFX_SWATCH | |
// You can use SFX_TEXTURE[n] or SFX_SAMPLER[n] to refer to texture inputs so you do not have to hardcode their names | |
struct CustomCode1245Output | |
{ | |
float3 color; | |
}; | |
CustomCode1245Output CustomCode1245Func( float2 UV ) | |
{ | |
CustomCode1245Output OUT; | |
float3 output= float3(0.0, 0.0, 0.0); | |
float dist= 0.004; | |
int radius= 4; | |
for( int i= -radius; i< radius; i++ ) { | |
for( int j= -radius; j< radius; j++ ) { | |
output+= tex2D( SFX_SAMPLER0, UV+float2(i*dist, j*dist)).xyz; | |
} | |
} | |
OUT.color= (output/((radius+1)*(radius+1))); | |
return OUT; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment