Announcement

Collapse
No announcement yet.

Black hole and strange emission glitches when using oil paint post process effect

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

    Black hole and strange emission glitches when using oil paint post process effect

    I've implemented an Oil Paint Post Process effect from this article and I run into some issues.

    1) The sky behaves... weird
    Click image for larger version

Name:	20200405-16_14_19Astronauta--Unreal-Editor.png
Views:	53
Size:	542.5 KB
ID:	1741793

    2) The emission materials also look strange
    Click image for larger version

Name:	20200405-16_16_01Astronauta--Unreal-Editor.png
Views:	25
Size:	270.7 KB
ID:	1741794

    Here is a post process code:
    Code:
    int TexIndex = 14;
    
     int intensityCount[10];
     float avgR[10];
     float avgG[10];
     float avgB[10];
    
    
     for (int iLevel = 0; iLevel < 10; iLevel++){
         intensityCount[iLevel] = 0;
         avgR[iLevel] = 0.0;
         avgG[iLevel] = 0.0;
         avgB[iLevel] = 0.0;
      }
    
    
     //COUNT INTENSITIES
     uv *= 0.5;
     for (int i = 0; i < radius; ++i)
     {
    int offsetI = -1 *(radius / 2) + i;
    float v = uv.y + offsetI * invSize.y;
    int temp = i * radius;
         for (int j = 0; j < radius; ++j)
        {
    int offsetJ = -(radius / 2) + j;
    float u = uv.x + offsetJ * invSize.x;
    float2 uvShifted = uv + float2(u, v);
    float3 tex = SceneTextureLookup(uvShifted, TexIndex, false);
    
    float currentIntensity = ((tex.r + tex.g + tex.b) / 3 * 10);
            intensityCount[currentIntensity]++;
            avgR[currentIntensity] += tex.r;
            avgG[currentIntensity] += tex.g;
            avgB[currentIntensity] += tex.b;
        }
      }
    
    
     float maxIntensity = 0;
     int maxIndex = 0;
    
     //FIND CORRECT MOST COMMON INTENSITY LEVEL
     for(int cLevel = 0; cLevel < 10; cLevel++){
         if(intensityCount[cLevel] > maxIntensity){
             maxIntensity = intensityCount[cLevel];
             maxIndex = cLevel;
         }
      }
    
     float newR = avgR[maxIndex] / maxIntensity;
     float newG = avgG[maxIndex] / maxIntensity;
     float newB = avgB[maxIndex] / maxIntensity;
    
     float4 res = float4(newR, newG, newB, 1.0);
    
     return res;
    Do you know what cas possibly cause it and for what should I look for to fix it? I have very limited knowledge about how this code works but with what I know, it shouldn't behave so strangely
Working...
X