Announcement

Collapse
No announcement yet.

So Blurred glass material is impossible in Unreal Engine 4?

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

  • replied
    Unreal tells me that SceneColor lookups are only available when MaterialDomain = Surface.
    Yes, you could use SceneColor in a postprocess material in UE 4.8 but since 4.9 it is not possible anymore.
    Asking for this on these forums, it seems that there's a workaround to be able to use it again, requiring to download UE4 from Github, modify a little bit of source code and compile.
    See this post:
    https://forums.unrealengine.com/show...cess-materials
    I didn't already test it but it should work.

    Alternatively, of course, you can use a scenecapture with a rendertarget set to LDR instead of the scenecolor node.
    Last edited by EdWasHere; 01-13-2016, 03:38 PM.

    Leave a comment:


  • replied
    Originally posted by EdWasHere View Post
    Hi,
    I'm sorry but I don't use shader code with custom node so I can't help you for this.
    Hello, could you please elaborate on how you got your post process material to work? When I tried to reproduce your graph (post #12), Unreal tells me that SceneColor lookups are only available when MaterialDomain = Surface. How did you manage to get yours to work with a Post Process material?

    Many thanks.

    Leave a comment:


  • replied
    @devel.bmad: thanks! And sorry for the late reply.
    I didn't test it on mac but there's no reason it shouldn't work.
    I was pretty busy last weeks so i didn't make any progress on this project. But now I'm working on it again.
    Will I release it? I don't know.
    If I ever release it, users would need to download ue4 from Gitbuh and compile it themselves as you need to add code in source to make it work. I'm not sure a lot of people would be interested by this as it is not really "user friendly".

    Leave a comment:


  • replied
    @EdWasHere: Great work, is this working also on mac? (sm4?) Any update about when are you going to release this?

    Leave a comment:


  • replied
    Is that a scene? I really need some frosted glass. I was reading through this thread but can't seem to get it to work or get results like this. How'd you get it?

    Leave a comment:


  • replied
    For those who can't figure out how to actually use this material, remember to set parameters Distance to around 0.01 and distance and radial steps to around 20

    Leave a comment:


  • replied
    Hi,
    I'm sorry but I don't use shader code with custom node so I can't help you for this.

    Leave a comment:


  • replied
    Here is mu setup for blurred glass material but it does not work so far. Could you check if I am missing something?

    Click image for larger version

Name:	GlassBlur.png
Views:	2
Size:	358.3 KB
ID:	1091214

    Click image for larger version

Name:	GlassBlur_details.png
Views:	2
Size:	41.5 KB
ID:	1091215

    Code:
    Custom Material Expression:
    float3 CurColor;
    float2 BaseUV = MaterialFloat2(ScreenAlignedPosition(Parameters.ScreenPosition).xy);
    float2 NewUV = BaseUV;
    float StepSize = Distance / (int) DistanceSteps;
    float CurDistance;
    float2 CurOffset;
    float TwoPi = 6.283185;
    float Substep;
    float2 ScenePixels=View.RenderTargetSize*BaseUV;
    ScenePixels+=View.TemporalAAParams.r;
    float2 RandomSamp = ((uint)(ScenePixels.x) + 2 * (uint)(ScenePixels.y)) % 5;
    RandomSamp+=TempAARandom+Texture2DSample(Tex,TexSampler,ScenePixels);
    RandomSamp/=6;
    RandomSamp-=0.5;
    RandomSamp*=TempAARandom;
    
    int i;
    if (DistanceSteps<1)
    {
    return DecodeSceneColorForMaterialNode(NewUV);
    }
    else
    {
    while ( i < (int) DistanceSteps)
    {
    
    CurDistance += StepSize;
    for (int j = 0; j < (int) RadialSteps; j++)
    {
    Substep++;
    CurOffset.x = cos(TwoPi*((RandomSamp+Substep) / RadialSteps));
    CurOffset.y = sin(TwoPi*((RandomSamp+Substep) / RadialSteps));
    CurOffset *=DistanceMask;
    NewUV.x = BaseUV.x + (CurOffset.x * (CurDistance));
    NewUV.y = BaseUV.y + (CurOffset.y * (CurDistance));
    CurColor += DecodeSceneColorForMaterialNode(NewUV);
    }
    Substep+=0.618;
    i++;
    }
    CurColor = CurColor / ((int)DistanceSteps*(int)RadialSteps);
    return CurColor;
    }
    Last edited by TheJamsh; 07-11-2017, 06:17 AM. Reason: code tags

    Leave a comment:


  • replied
    Originally posted by RyanB View Post
    It can be done but requires looking up several copies of the SceneColor node and offsetting them and then averaging them. This technique is a bit slow though. It is probably possible to do something better in code like use one of the downresed buffers for bloom. I asked BrianK about this and the reason it isn't done already is that the bloom buffers are from the previous frame and have to be reprojected with camera movement. This means when there is a camera cut there will be no information for one frame. And when rotating the camera quickly you would see weird behavior on the edge of the screen that revealed new parts of the blurred image. I wouldn't expect an epic solution to this anytime soon as a result of these issues but maybe one day.
    How do you access these buffers?

    Leave a comment:


  • replied
    @meian : A nice mirror shader ? Yes, that's something i'm working on.
    @wilkes : Interesting. Id like to know it too !

    Leave a comment:


  • replied
    Did anyone see this? https://youtu.be/xkDBzt0_ZMU?t=48

    At around 0:48 they have a steamed up piece of glass with what appears to be a mask dictating how blurred the background is. Does anyone know how this was accomplished?

    Leave a comment:


  • replied
    I guess that your next challenge will be a nice mirror shader

    allez release ce materiaux sur le store que j'achette ├ža desuite

    Leave a comment:


  • replied
    It doesn't work with SSS.
    Basically, it's just about combining 2 or 3 renders of the same scene, using camera player and scenecapture components.

    Leave a comment:


  • replied
    This looks awesome , i wonder does it work with SSS.
    i tried to create those graphs , and it didnt work, i hope some one share shaders here , i mean just copy paste Graphs text.

    Leave a comment:


  • replied
    Still experimenting...
    Here is a W.I.P.
    Trying to make glasses blending their colours, specular highlights and refractions, which wasn't the case in the previous videos.

    Last edited by EdWasHere; 08-24-2015, 11:03 PM.

    Leave a comment:

Working...
X