[Community Project] WIP Weather & Water Shader

Hi ,

thanks for the beautiful !
But it seems to have problems in local multiplayer with split screen. When player 1 moves or rotates his camera it changes the reflections and shading for player 2 (although, not the other way around). Does someone know a way I can fix that or get around it?

Here is an illustration of the problem in the island map. When I add a second local player in split screen the second player uses the reflections calculated by the first player’s camera transform…

Very interesting I like the idea of a flow map. but I think you would have it is the same “size and resolution” as the heightmap and use the same placement mechanism. But that doesnt sound like a problem. I’m very curious about .

I will check for you, but as far as I remember the was not finalized in the multiplayer portion, but I might be wrong… lets hope it is just something missing somewhere. A question tho, why are you using split screen? Is that part of your gameplay or is it a way to realize if the multiplayer part is ok?

Yeah, it is a local multiplayer project. I am actually a physicist, so I’m not new to programming but I am a bit new to game dev and Unreal. I searched around and I cannot find any discussion of reflections in split screen mode or for multiplayer, so I am surprised is an for me here… Thanks for looking into it.

Technically, multiplayer uses what we call network replication, and the part which touches the point is the word “network” because to allow replication of a status for a material in multiplayer you relly on different processes to have the executable perform differently: one is the server part and the other is the client part, or in case of session hosting for cooperative mode, one is set as the hosting session while others join one sharing the same map/environment etc.

What looks here is that split screen are using the same set of data, so besides having different cameras per display tile, they are using the exactly same data, therefore obtaining the wrong perspective for the reflection (that part is the planar reflections, which is a separate component built-in Unreal Engine).

You can start a coop mode the following way:

  • check your console key inside your project: Menu Edit -> Project Settings -> Engine: Input -> Console Keys ( I usually use the “” key since it works best for my international keyboard)
  • you need to package your project for Windows (or if you use it) with shortcut: Menu File -> Package Project -> Windows -> Windows 64bit
  • run the executable file generated as : your_project_name.exe or OceanProject.exe
  • you need to remember the name for your Map where you created your level or if using the project the one described bring up the console and type: open IslandMap?listen
  • run another executable in the same machine or in another machine
  • if you run in another machine, you need to know the IP address for the 1st one, here Im showing if you do in the same machine once the executable is loaded, bring the console and type: open 127.0.0.1

The way I described above you will have a correct way for testing multiplayer.

I will proceed the testings here to see if that with planar reflection is a wrong setup on the multiplayer part or something really caused by the split screen.

I strongly suspect it is not a problem with the normal multiplayer but the fact that I am trying to use a network game as a local split screen game. Do you think it would be difficult for me to repurpose the project into a local multiplayer (I’m assuming would fix the reflection problem) and do you have a pointer for where to start with that? Can I just delete all the network references?

The steps I provided above are common to any project since the multiplayer is a built-in inside the Engine. The only changes we do with blueprints is to set if they are replicated through network or not, and if so which variables should be replicated. The variables could be anything inside.

I have followed the steps above and the replication is fine for the waves and the reflections are ok too. The you are experiencing is really because the split screen is not a which allows the built-in multiplayer to work, since for it to work you need to network distinct process running in order to have an exchange of replicated values. So one single process can’t handle multiplayer from the core, but as two process which matches the real situation in real world it works perfectly!

Later I will post a small video showing the steps above in action, get back in 1 hour that the video should be up!

The link is bellow:

watch?v=-VqizBYxBGE

Thanks for the video. It is a little hard to hear, especially when the waves come in (but I could mostly follow).

But it is not really what I want. I really want a single process for a local split screen (not cool anymore?). I checked all the relevant Blueprints and the only one that had replication set was the skydome. Unsetting replication for that didn’t help. I also checked all the C++ and none of them had replication explicitly (though the engine probably takes care of that in the background). I think the is in the materials for the shader since they all have references to camera position and direction, so assuming only one camera. There is also the InfiniteSystemComponent which follows Player 0, but setting follow mode to “stationary” just makes the waves very small and doesn’t fix my split screen problem. I think in order to make it split screen compatible I need to edit the materials and make them not depend on the camera position, but I am not very familiar with materials and their functions, so the more I try to hack it the worse it looks and doesn’t seem to get rid of the camera dependence. I wonder if I could create two materials and make one invisible to the other player or something like that… but I don’t know how to make that work.

Replication is only related to different processes, it won’t work for a singtle process, so no change regarding that will make that work. Your on having the solution running on single process with a split screen will require a deep analysis. Is it the only thing messed up the reflections?

The infinite to work really need a single camera reference, because the Infinite is an ilusion. It is just a plane very large which is moved with the camera giving a fake infinite feeling.

No, other things get messed up for the second player too, like the shading and color, especially if the first player looks up at the sky. I will keep playing with it and see if I can get something to work and will let you know if I have any success. It will be difficult though, since I only understand about 30% of what’s happening in the materials and roughly 0% (give or take) of why it’s done that way.

The shading and color might be caused by SkyLight placed in the scene. In order for you to test if it is the root cause, you just disable it in the level and play again. In multiplayer (the built-in one like in the video) we just call the recapture method, so both server and client are updated same way, is important, because the SkyLight is the indirect light in the scene and if you have the directional light moving the indirect light must update accordingly.

I never used the split screen , so I will really need some time to look and understand whats going on. If it uses the built-in multiplayer in a special way, then there must be a way to fix everything. Actually it is hard to find someone with a good idea for split screen usage, so many assets probably are not made with that usage in mind Im afraid.

Anyway all is part of the learning process, but in my opinion you are going to stuff a bit complex right now… it is really important to understand how materials works in the engine, since it is the base for everything else.

Yes, you are right! Thanks! It partially works now. If I set the sunlight to stationary instead of moveable then it gets rid of the strange shading/lighting I was seeing. I still cannot use the “Ultra” shader or any of them that use SSR without getting strange in split screen, so now I use the one with Gerstner waves, Foam and Cubemap and it looks pretty good. Not as good as Ultra, but definitely better than the I had before. And I guess I will have a hard time including any of the weather or time of day if I want to later, but for now it is a big improvement already.

Cheers!

The Sun is a DirectionalLight component, your direct light, which to simulate a time pass would need to be Moveable. The indirect light is provided by another component called SkyLight, which usually will be set the same and your Sun (if Moveable, then SkyLight is also Moveable, and so on). You could have the SkyLight set as Stationaty while the Sun is Moveable but it might not work OK in night time, since the SkyLight will inject too many light into the scene, unless is desirable.

I will see if I can check the with the reflections today with split screen and get back to you.

@MagicBlueFrog I have identified the with the Infinite system inside the C++ plugin, which is only taking the camera from player 0 to move the plane, so what you see in the portion of the screen for player 1 is the plane moving with the perspective of player 0, all the remain of the code do it right, meaning the waves are ok, but as the reflections are the most affected by the angles and position, it has visually a higher impact on player 1 portion of the screen. So, basically I will change the code to look for the correct camera from the correct player to finally use it in the Infinite system. Give me few more time to change the code, test and release it.

, thanks!
The other thing I have been playing with is making a finite because I do not want the to interfere with other lakes and rivers, etc. in my level and I just need a finite sea rather than an . All I did was duplicate the BP_Ocean and called it BP_FiniteOcean and deleted the InfiniteSystemComponent and the BillboardComponent (“Icon”) and replaced it with a simple SceneComponent (because I don’t really understand why it is there unless it is to turn the whole together with the player who observes it…?). indeed gives me a finite which doesn’t follow the player around, but the Screen Space Reflections and Planar Reflections still follow Player 0’s camera. I don’t know if a finite system would interest other users, but if they don’t use split screen then the Ultra shader would still work for them using set up, whether or not you manage to get the reflections working, so it would probably be simple to add to the package.

I was messing with the code and it looks like the Infinite system is partially guilty only… the reflections might be a general bug on the split screen , which to be sure I will need to look on the engine source code. Im looking at aswell now that I have realized , so it will take way more time than expected.

@MagicBlueFrog I have just finalized the checking and it is an engine bug when dealing with reflections with split screen. I have just created a new project (4.17, 4.18 and 4.19) with 3rd person template, added Water Planes asset into it and left the TranslucentWater_Example map as default, added a 2nd PlayerStart and assigned both players with auto for player 0 and 1 respectivelly, created a game mode class including in the OnBegin event a CreatePlayer, set override for game mode with the new one created, and set split screen vertical.

When executed, while moving the player 0, the reflections on the water get messed on player 1. In translucent water, there is no Planar Reflections, there is no plugin, therefore no InfiniteOcean system, just the plain free Epic’s Water Planes.

On Monday morning I will submit a bug report, since is detected in the latest 3 engine versions, it might be even older. Once I get the number I will post it here, so others can vote for it to receive more attention from developers.

Hey all, been a while! Hope you are all doing well. :slight_smile:

I’ve been gone for the better part of a year and once again I am very grateful to the entire community for keeping project alive. Looks like we just hit 2500 posts in 63 page long thread… I never thought that would happen when I first posted it, you guys are !

A couple people I would like to mention by name:

@ - (known as TheZoc on Github) messaged me 8 months ago and graciously offered to take over management on Github while I was gone. I literally couldn’t have done without you, thank you so much for everything you have done! You made my time away a lot easier knowing the project would be kept up to date. Thank you man. Seriously thank you so much, you have no idea how much that meant to me, so again, thank you!!! :slight_smile:

@ - I have not had time to read back through all I missed, but it is abundantly clear you have been assisting people on thread for some time now. I can’t thank you enough for taking the time to do , from what I have read you seem to be very knowledgeable about project, and have helped a lot of people fix their issues. If there is anything I can do for you (I’d gladly add you as a Github admin or contributor if you are interested) please let me know!

There are so many more of you it would take forever to individually go through, but please know that I see you, and thank you for everything. :slight_smile:

Ok, now down to business.

I’ve been digging through the project again over the past couple of days looking at what needs improvement, and have decided it is time to de-bloat and remove old and unused content, and improve readability before going any further. Couple examples; the Ultra shader is an absolute mess of wires and undocumented nodes, nearly all blueprints have no comments or variable descriptors, etc, etc. The download size is also quite large, I’m going to see what we can do about that.

Many people seem to be having issues moving the content to another project, which is my fault. There isn’t much documentation and the blueprints don’t fall back on defaults as gracefully as they should, is another area I will be working on over the coming days. I want to get the project to a state where is is a solid foundation to work from before adding more features.

If anybody has any contributions they would like to add, please either leave a post here, or feel free to PM me if you prefer.

Thanks guys! :wink:

@Its been a pleasure man, good you are back, so grateful for work that also have opened my eyes for Unreal as the first time I saw running so beautyfully… for me is paying kindness with kindness :slight_smile: not that I got close to that :smiley: I would like to have admin status on if possible (<Email removed by Mod>), so I can post changes on every new engine release, since been a constant and people usually not familiar on how to fix C++ code when API breaks apart.

I do agree the materials need some cleanup, maybe some parts separate into material functions to better get reused on other types for lower performance scenarios.

I will contribute with the free options Im developing in my FFT , so I think it will be nice both oceans offering same status, so it will be like a matter of taste in the end.