Skip to content

Instantly share code, notes, and snippets.

@hiko9lock
Last active August 29, 2015 14:00

Revisions

  1. hiko9lock revised this gist Apr 27, 2014. 1 changed file with 0 additions and 5 deletions.
    5 changes: 0 additions & 5 deletions SFX_hqCustomCodeTest
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,3 @@
    // 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;
  2. hiko9lock renamed this gist Apr 27, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. hiko9lock created this gist Apr 27, 2014.
    24 changes: 24 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    // 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;
    }