Pages

Monday 16 February 2015

Week 20: Water Shaders and More Blueprints

Water in Unreal Engine 4

This week I continued to work on the Off The Map competition project. As part of our level we wanted to have a lake of tears and for that we needed a water shader, so another member of my team and me set out to have a little competition as to who can create the better water shader. Following a simple tutorial online I managed to create a quite good shader, however it required a lot of tweaking which is what I spent most of this week doing. In the end we got a decent result, however we couldn't get any reflections on the water surface.

A bit of research later we then discovered that UE4 currently doesn't support reflections on translucent materials, so I sat down again and created another water shader and made it opaque. The reflections that we got from that shader looked even better, however we really wanted to stick with the translucent water as well, as this would also give a nice effect once you are actually below the water surface. We tried out having a plane of opaque water on top of the translucent water and while that looked kinda good it just didn't work. In the end we just stuck with using translucent water and ditched the idea of opaque water completely.

Opaque Water

Translucent Water

Blueprint Work

In addition to creating the water shader I was also working on some additional blueprints. In particular a simple jumping puzzle that I am still working on, which involves a massive fountain in the middle of our level. I wanted cards (which for now are just simple blocks) to rotate around the fountain in a particular pattern and have the player jump from card to card. I wasn't quite sure how to achieve this at first, as there is no way of changing the pivot point of meshes in unreal, however I was able to solve this by creating a scene component and then attaching the card mesh to that scene component. Instead of rotating the card I would then rotate the scene component and the card would move with it - Or to keep it short: I worked around it by using a scene component as a make-shift pivot point for each card.

The blueprint was working perfectly. however since the fountain itself hasn't been modelled yet, I wasn't able to complete this puzzle yet. Mostly due to missing collision. I also attempted at creating a simple level switch feature. We currently have a spot in the level where we want the level to completely change from being all green and beautiful to a more purple and ominous atmosphere. I got the level to load using the 'Open Level' feature just fine, however this way the old level gets completely removed, including all saved variables, which would be a problem first of all for setting the player position to what it was when he switched the level (instead of the player start), but most importantly for collectibles, which we plan on putting into the game. The level switch would completely reset all the collectibles, which is something we cannot do.

So instead I tried using the level streaming feature that is built into unreal, thinking I could just stream the level. Which worked... just fine. In fact it even loaded much faster than using the open level node. However, there was a split second gap as the level was loading where the levels were both overlapping, due to me loading the new level and after that unloading the old level. I tried switching around the order, however that way it would unload the level and the player would start falling into the void, before the new level could load fully. So unfortunately this method also didn't work out.

I went back onto using open level instead of streaming and got myself some information on savegames. Unreal has a way of saving variables into a file and then enabling you to read from that file after you've switched the level. This is great, just what I needed! I created a simple function that would save the player location in a save game and then load it back up and teleport the player back to it once the new level was loaded - and I am sure it would work perfectly, however messing around with the level so much has caused it to just constantly crash as it is. I will have a look further into it during the next week. It shouldn't take me too long to fix this issue.

Looking ahead!

We are now at the beginning of the third week. It feels like we have absolutely ages for this project, but the reality is that time is slowly ticking along and we are getting closer and closer to the end. Not just for this project, but the end of the second year. I am not sure whether I am too happy about what I have achieved this year, however I can safely say I got a lot more confident in using zBrush as well as Unreal Engine 4 - and with another 2-3 months ahead of me I am sure I will learn even more. I will probably focus more on building a portfolio during the summer, as I currently don't feel like I have anything that really shows off my skills well enough for me to be happy to use it as part of my portfolio. Speaking of portfolio, I actually got around to creating a model this time. I was asked to produce a bush for our level so I sat down and made one. I am not particularly too fond of it, however my team members have said that it will do. Here is a quick screenshot of it in our level:
Sweet Briar Bush
It's pretty tiny, however we will hopefully use it multiple time in the level and just have it overlapping a couple of time to make it seem a lot bigger.

I am looking forward to the challenges that the next week will bring up. Stay tuned~

No comments:

Post a Comment