Announcement

Collapse
No announcement yet.

Adding a blur pass to materials

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Adding a blur pass to materials

    I'm currently working on an SSAO shader, but to finish it off I need to add a blur pass. I've already done the node, and this is the code:

    Code:
    int samples = 10;	
    float2 uv = ScreenAlignedUV(texcoords.xy);
    	
    float3 sum = float3(0.0,0.0,0.0);
    		
    for (int i = -samples; i < samples; i++) {
    for (int j = -samples; j < samples; j++) {
    sum += tex2D(SampleGoesHere, uv + float2(i, j) * (rad/float(samples))).xyz/ pow(float(samples) * 2.0, 2.0);
    }
    }
    	
    return float4(sum, 1.0);
    The problem here is that the code requires a sampler input in the tex2D function, but the output I'm getting from my previous node is a float4. Is there any way to convert the RGB values from my previous float into a sampler? Or even a way to skip the tex2D function altogether?

    Thanks for your time.

    #2
    Unfortunately it's not possible within the material editor only, this is a common issue when doing post process effects with the UDK.
    (On a side note, you should really look into a separable blur instead of doing it in one pass which can cause a major performance impact)

    There are ways to get this done but they require some work
    1. Scripted Textures
    2. Using Scene Capture Actors/RTT as described by Alexander Dracott in Vertex 2 (p.34)

    Comment


      #3
      maybe you can input custom texture into custom node, and make your previous manipulations until that vector4 in code?

      Comment


        #4
        Originally posted by mAlkAv!An View Post
        Unfortunately it's not possible within the material editor only, this is a common issue when doing post process effects with the UDK.
        (On a side note, you should really look into a separable blur instead of doing it in one pass which can cause a major performance impact)

        There are ways to get this done but they require some work
        1. Scripted Textures
        2. Using Scene Capture Actors/RTT as described by Alexander Dracott in Vertex 2 (p.34)
        Going to give Scripted Textures a go. Didn't even know they existed! I'll post up the results once I'm done.

        Comment

        Working...
        X