Announcement

Collapse
No announcement yet.

[Community Project] WIP Weather & Ocean Water Shader

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    I wanna use the Ocean in my Project! its Really GReat Awesome Work!, But how i Replace the Character with mine? Delete and Replace Reference is not Working./ Should i Copy and Paste a

    Leave a comment:


  • replied
    How long before we can possibly see this implemented into the ocean shader too?

    Also, how would we add this to a project, stand alone? atleast, what you have so far.

    Edit: Checked your other thread and I understand you'll be releasign an alpha once the configurations are set, godspeed my friend.

    While I wouldn't mind testing it without this, just for a play around, I'd hate to take time out of your schedule to have you upload it when it isn't ready.
    Last edited by Yoyomike; 08-03-2016, 10:53 PM.

    Leave a comment:


  • replied
    Wow [MENTION=1127]TK-Master[/MENTION] that is a huge difference. It looks fantastic.

    Leave a comment:


  • replied
    I figured I should post my findings for anyone who might be interested about this stuff. [MENTION=10267]Handkor[/MENTION]

    After spending a few days experimenting with various ideas and normal interpolation methods I ended up using bicubic B-Spline interpolation, it's considered to be on the blurry side out of all the bicubic methods but it's the only one I found that can completely eliminate pixelation artifacts even with really low-res maps (like 64x64) so it's a perfect fit in this case.

    Linear interpolation between the 3 triangle vertex normals (using barycentric coordinates) doesn't seem to smooth it at all for whatever reason.

    Quick comparison screens between trilinear texture sampling and bicubic.
    Click image for larger version

Name:	trilinear-fluid.jpg
Views:	1
Size:	50.2 KB
ID:	1112797

    Click image for larger version

Name:	bicubic-fluid.jpg
Views:	1
Size:	43.8 KB
ID:	1112798

    That's a huge difference if you ask me! in this case it makes a 128x128 normal map look like 4k.

    Here is the custom node code for bicubic sampling.
    Required inputs: Tex, UV
    Code:
    float2 res;
    Tex.GetDimensions(res.x, res.y);
    
    UV = UV*res-0.5;
    float2 index = floor(UV);
    float2 fraction = frac(UV);
    float2 one_frac = 1.0 - fraction;
    float2 one_frac2 = one_frac * one_frac;
    float2 fraction2 = fraction * fraction;
    
    float2 w0 = 1.0/6.0 * one_frac2 * one_frac;
    float2 w1 = 2.0/3.0 - 0.5 * fraction2 * (2.0-fraction);
    float2 w2 = 2.0/3.0 - 0.5 * one_frac2 * (2.0-one_frac);
    float2 w3 = 1.0/6.0 * fraction2 * fraction;
    float2 g0 = w0 + w1;
    float2 g1 = w2 + w3;
    
    float2 h0 = ((w1 / g0) - 0.5 + index) / res;
    float2 h1 = ((w3 / g1) + 1.5 + index) / res;
    
    float3 tex00 = Texture2DSample(Tex, TexSampler, h0);
    float3 tex10 = Texture2DSample(Tex, TexSampler, float2(h1.x, h0.y));
    float3 tex01 = Texture2DSample(Tex, TexSampler, float2(h0.x, h1.y));
    float3 tex11 = Texture2DSample(Tex, TexSampler, h1);
    
    tex00 = lerp(tex01, tex00, g0.y);
    tex10 = lerp(tex11, tex10, g0.y);
    return lerp(tex10, tex00, g0.x);

    Leave a comment:


  • replied
    I know this is stupid of me but someone said it wouldn't cook and package for them a while back and I said I'd try. I just downloaded the project fresh off github and tried to cook n package (tried oceanexamplemap01 and the entire project) but it failed with code 25, anda ton of ocean material warnings, path warnings.

    Tried a sample c++ project I've been working on and cooked n packaged no problem, tried a bp third person template, no issues. Win 64.

    Ideas. I can post the output log.

    Edit it appears because the old sky BP fails to compile or whatever in the level BP in OceanExample01 you need to replace the skydome with the new one and the new hud. Works fine.

    Edit2: I'm getting 17-25 fps average on the stock project in 4.12, any ideas why? I used to get 60-120, gotta be planar reflections the last time I packaged up a stock download off github it was silky crazy high fps. this is on a 760m(obile). must be planar reflections? will do some testing.

    [2016.07.28-01.28.16:380][996]LogChartCreation: 142 frames collected over 8.38 seconds, disregarding 0.00 seconds for a 16.94 FPS average
    Last edited by Nsomnia; 07-27-2016, 09:52 PM.

    Leave a comment:


  • replied
    is it possible to use this in ark?

    Leave a comment:


  • replied
    TK-Master, I appreciate your contribution on this, I think you are in the right track

    UE4 absolutely needs a good dynamic water shader (ocean, lake and rivers).
    The current options are simply terrible, some just looks like a melted thinfoil, others looks like a perfect colored mirror ,
    even lumion 1.0 had a better ocean shader than UE4 today (almost 7 years ago): https://www.youtube.com/watch?v=vhOvBICNE9Q
    hell, even unreal engine 3 in 2005 had some advanced dynamic water shaders, 11 years ago!!!
    So please Epic, make this happen, a good believable water shader is very important in game design specially on Archviz.

    Leave a comment:


  • replied
    Originally posted by Handkor View Post
    I just cheated and used the Normal from Height node in the material editor. Yes the best you can do is get the normal interpolated between your height values but ignore the vertices and just focus on the height buffer but as information density/frequency it is all you got.

    Depending on how stretched out you make your buffer the normal can be a bit flat. The good news though is that the dynamic plane can follow your actor/camera so you can keep the density pretty high.
    Alright, I will keep digging and see how it goes hopefully the interpolation method will look good enough (otherwise I will have to power through it and get the vertex factory method working).
    Thanks for your input! I appreciate it

    Leave a comment:


  • replied
    Originally posted by TK-Master View Post
    Oh a displacement render target is what I'm currently using for testing but the problem with that approach is the normals.
    I can make a second render target for the normal map but that is not going to look smooth (especially with lower resolution grids) since it would be the vertex normals, not the normals per pixel.

    Do you know of a way to calculate the correct pixel normal from the vertex normals perhaps? I'm thinking some kind of interpolation might do it.
    I just cheated and used the Normal from Height node in the material editor. Yes the best you can do is get the normal interpolated between your height values but ignore the vertices and just focus on the height buffer but as information density/frequency it is all you got.

    Depending on how stretched out you make your buffer the normal can be a bit flat. The good news though is that the dynamic plane can follow your actor/camera so you can keep the density pretty high.

    Leave a comment:


  • replied
    Originally posted by Handkor View Post
    No geometry shader, no vertex factory and not custom vertex buffer, my implementation is strictly applied as a displacement map using CanvasRenderTarget2D and a Transformation material. It's done using what I wrote in the old RenderTarget read wiki page but instead of a capture camera setup, it is done behind the scene in canvas.
    Oh a displacement render target is what I'm currently using for testing but the problem with that approach is the normals.
    I can make a second render target for the normal map but that is not going to look smooth (especially with lower resolution grids) since it would be the vertex normals, not the normals per pixel.

    Do you know of a way to calculate the correct pixel normal from the vertex normals perhaps? I'm thinking some kind of interpolation might do it.

    Leave a comment:


  • replied
    Originally posted by TK-Master View Post
    Hey Handkor, nice to hear from you as always

    I saw your game jam entry a while back, It's really cool! congrats

    For now I'm not worried that much about the fps problem, I have integrated delta time into the algorithm so it's more consistent now (although not yet perfect, it still needs work but I think I got this figured out).
    Currently I have to say I'm kinda struggling with the GPU implementation though, I have not done this before and there are not any simple examples or guides about vertex factories, .usf and whatnot out there.

    If you could lend a hand with that, it would be awesome!
    No geometry shader, no vertex factory and not custom vertex buffer, my implementation is strictly applied as a displacement map using CanvasRenderTarget2D and a Transformation material. It's done using what I wrote in the old RenderTarget read wiki page but instead of a capture camera setup, it is done behind the scene in canvas.

    Leave a comment:


  • replied
    Originally posted by Handkor View Post
    Hey TK-Master in the May Epic Jam I made a dynamic wave surface that runs on the GPU and supports custom obstacles. For example the mud is also a dynamic surface and it's heightmap affects the wave propagation. It's running on a 2048x2048 grid in the Jam entry. Like you said in a previous post the technique tends to be frame based and can cause timing issues to mix with the ocean wave system but in my Jam implementation the surface update is not tied to your fps and can be controlled independently, also since I've bumped the buffer from 32-bit to 128-bit the increased floating point precision can allow me to pass a delta time to the transformation to bring it in line with other more mathematical systems.

    If you have any questions on implementation I'll gladly share what I've got here.

    Dropbox link if you want to try out the demo
    Hey Handkor, nice to hear from you as always

    I saw your game jam entry a while back, It's really cool! congrats

    For now I'm not worried that much about the fps problem, I have integrated delta time into the algorithm so it's more consistent now (although not yet perfect, it still needs work but I think I got this figured out).
    Currently I have to say I'm kinda struggling with the GPU implementation though, I have not done this before and there are not any simple examples or guides about vertex factories, .usf and whatnot out there.

    If you could lend a hand with that, it would be awesome!

    Leave a comment:


  • replied
    Originally posted by TK-Master View Post
    I'm already making good progress



    It currently runs on the CPU, the performance is not that great with grids > 256x256 as you can expect but it's totally acceptable at lower resolution grids (it's also possible to multi-thread it, so it should be even better).
    The video showcases 2 different propagation algorithms that I found. The waves can reflect from walls or custom obstacles btw!
    Hey TK-Master in the May Epic Jam I made a dynamic wave surface that runs on the GPU and supports custom obstacles. For example the mud is also a dynamic surface and it's heightmap affects the wave propagation. It's running on a 2048x2048 grid in the Jam entry. Like you said in a previous post the technique tends to be frame based and can cause timing issues to mix with the ocean wave system but in my Jam implementation the surface update is not tied to your fps and can be controlled independently, also since I've bumped the buffer from 32-bit to 128-bit the increased floating point precision can allow me to pass a delta time to the transformation to bring it in line with other more mathematical systems.



    If you have any questions on implementation I'll gladly share what I've got here.

    Dropbox link if you want to try out the demo
    Last edited by Handkor; 07-20-2016, 01:45 PM.

    Leave a comment:


  • replied
    Tozan, read tge first post.

    DotCam, would it be possible forme to submit my moon mesh and material to the project?
    It uses a half sphere to save on polys (as you never see the back of the moon) and a high resolution photo of our moon.

    I love this projet and intend to use it fir a game of my own. Would really like to contribute anything i can.
    Cheers! And keep up the great work everyone involved!

    Leave a comment:


  • replied
    what files do you download to get this weather system?
    and how to do you install it?

    Leave a comment:

Working...
X