Wednesday 29 May 2013

Waterfalls

The waterfalls needed to conform to the underlying rock, so I decided to rely on vertex painting to "stream" the water flow, and also to push it outward around the rocks as it cascaded down.

The mesh for the waterfall was therefore fairly dense, and the vertex colours allowed me to paint in opacity and position offset.

Although this worked okay for rolling down rocks, getting a natural looking curve where the water was seeming to bounce off the rock and then arc downward was a bit tricky using vertex painting, so I made a second, thinner mesh which was already arced.

The overall effect ended up much less dense-flowing water than I had planned, but I actually think this is a little more practical, and I've warmed to the way it looks now.

In the case of the enourmous waterfalls in the vista, I felt I needed them to block light to the rocks behind them, so I made a material which allowed me to paint blackness, which looked like moderately convincing soft shadows.

At the bottom and top of the waterfall, a cloudy mist of water is created using a particle emitter. This was particularly hard to tone-adjust for night because the particle system was already adjusting the vertex colour in order to fade each particle over time, and UDK's material instance control through matinee (which is what I've been using to adjust the amount of light on materials so far) doesn't seem to play nice with emitters.

I was able to find a workaround by allowing matinee to control a variable on an actor (i happened to use the brightness of a tiny out-of-level light, but I could have used anything). This is read ten times per second using kismet, and applied to all emitters. This was a pain to set up and is messy and probably highly non-optimal, but I really couldn't stand such bright water mist at night!


Friday 24 May 2013

Grass Performance

My level was really starting to run slowly. It was a real inconvenience to accurately measure the effect of objects on performance, but after installing FRAPS, I was able to see the framerate as I made adjustments to the level without having to jump in-game.

It wasn't long before I had identified that in areas of poorest performance, the grass was taking about half the render time, which is far, far more than it should have been. I wasn't sure if it was getting drawn behind terrain which would later draw on top of it (overdraw). At this time the grass wasn't getting culled, so I figured I'd experiment a little there.

What I noticed, however, was that changing the draw distance on the grass was not actually culling the grass. It turns out this is because UDK was clumping together the grass actors into batches in their hundreds, and wouldn't cull them unless none of these actors could be seen. With such enourmous clumps, this meant almost no culling, and almost guaranteed maximum overdraw. After adjusting the clump sizes to be in small clumps no wider than a dozen meters or so, my framerate improved from a low of 17 FPS to a low of 30FPS... a huge and really pleasing improvement in performance!

Thursday 23 May 2013

Effects pt 2

I've now modelled a torch bracket and done a flickering flame visual effect. It would have been nice to use a "proper" fire flipbook (series of images, like a 2d animation), but it wasn't practical to find time to record that for myself, so instead I photoshopped four photos of fire and used some shader trickery to make them look "alive".

The flame effect is missing a couple of things, which I may get time to add later: it needs a glow effect (ideally one which has lit rain on it when its raining to give the impression the fire is lighting the rain drops), it needs a distortion effect, and also smoke.


Since it featured heavily in my brief, I decided to rush together the rain and sky and drop much of the polish time I had allocated. This means that the rain will most likely be little more than clouds and rain particles, and I probably won't get time to do puddles, wet rocks or splashes. But I think its absence would have hurt the ambition of this project more than a little less polish.

Here's what I've got so far for the rain. You'll notice I'm also reducing the direct light whenever its overcast. The sharp shadows during rain obviously weren't right, but this introduced the problem of a darker scene, so I decided to use postprocessing to compensate. I also introduce more fog during rain.

I experimented with a ring around the player with rain falling on it, but I abandoned this in the end because it was too obvious that the rain moved with the player whenever the player strafed. It occurs to me now that I may be able to scroll the texture with the player strafing, but this may prove fiddly so I'll leave it for now.


I tried out a really quick lightning system which basically just enables a light very briefly intermittently during a storm. This looks okay, though it is noticably absent in lighting up the sky at this time.

Snow works in much the same way as the rain, creating an overcast effect, reducing the direct light and generating particles. The fog is a little bit lighter and denser while snowing though.

The snow particles drift down in a natural-looking manner, which I'm fairly pleased with. I would have liked to have gone for a stronger blizzard, but this would have required me fixing up something clever with the precipitation ring mentioned above, and/or using a lot, lot more particles, which I'm reluctant to do given the strain my level is already putting on the performance.


Friday 17 May 2013

Effects pt 1


There a lot of different effects and things, and the quick ones I tend not to type up, but here are a few that I’ve done over the past couple of weeks.

I’ve added leaves falling from trees. This uses a mesh-emitter. I was not able to control the fall of the leaves as I would have liked using UDK’s Cascade editor, so instead I made the material offset the leaf as it falls.



I’ve tone-balanced all the shaders to look correct during the day and night. I also started work on the postprocessing effect. It colourises the scene slightly based on time of day and time of year so that day is warmer, night is colder, spring is greener, summer is yellower, autumn is oranger and winter is bluer. These are obviously “fakes”, but help to give a bit of atmosphere.

The postprocessing effect also now adds fog in the morning, which is particularly dense during winter. For the moment this effect is entirely in postprocessing, but I’d like to add ground mist throughout the level to compliment the depth-based whiting.


Also in postprocessing now is heat haze. This essentially offsets the position of pixels based on depth and height. Although I couldn’t get actual world height, I’m using screen position to fudge it, and I don’t think most people will notice. To get the rippling effect I’m just using the same normal map as my water texture, panning upwards, and it is the red and green channels which drive the offset.

Relying entirely on the sun to cast the light makes interesting lighting quite difficult, so I decided to add torches to the level. I’m partway through making the torch and bracket model, but I’ve started placing warm, flickering lights throughout the level and they really help to add interest, particularly at night, and they contrast nicely with the cool night-time tones. I’ll obviously need to make a flame visual effect, which I’m looking forward to. I’m hoping to add a cool visual effect for the torchlight bouncing off the rain if I have time to add rain, but rain is starting to look like a low priority with all the stuff that *needs* to be done.

Friday 10 May 2013

Grass revisited


I had another go at the grass. Last time it ended up very “crazy” looking. It was doing lots of different things, in lots of different colours, pointing lots of ways and generally being a real mess and bizarre. I fell into this trap by trying to make a very small amount of grass look interesting, and repeating it a lot. I also fell victim to trying to make something as efficient as possible by prioritising performance bang-for-buck with artistic decision-making. I therefore made patches too dense and just generally tried to do too much with too little.

So this time around, my bakes were much simpler, and the textures much less complicated – it doesn’t even have a normal texture. The result is a much less remarkable-looking set of grass patches.


I set about scattering them throughout the level by painting them onto the landscape. By controlling their size and the density of placement, I was able to make interesting patches of grass without them looking quite so nuts as before.


I added a gentle wind to the grass without the use of texture lookups. Although it uses a lot of nodes, the instruction count isn’t too high and it’s a lot cheaper than using a texture lookup. (incidentally, the tree wind is done in a similar textureless way).

The grass also grows and shrinks with the seasons. This is done by making the grass both thinner and shorter using the texture.

It’s not the best grass in the world, but at least it isn’t an eyesore any longer. If I get time, I’d like to add some more plants: daisies and dandelions which will be most visible during spring and summer, but also medium-sized plants to fill the size gap between the tiny grass and the large trees. Edit: not going to have time :(

Friday 3 May 2013

River

Sorry for the lack of updates. I've moved up to Newcastle to start a new job (Junior Technical Artist at Ubisoft) and didn't have access to the internet for a while. So here come a few updates at once, dated according to when i should have posted them!


The river water represented something of a technical challenge. I wanted realistic water which appeared to be flowing in the direction of the river. I did some research on flow maps, but due to time and software constraints, I would not be able to implement flow maps as described here. Instead I opted to rely on clever unwrapping, and some vertex painting to indicate flow direction for the river edges.


I decided to break the river into several sections using rapids. Not only would the rapids look nice, but this would allow me to avoid one large piece of geometry (which is generally advisable to avoid for various technical reasons). This would also help if I needed to use several reflection maps.

The normal map was made by height-painting over a photograph of rippled, flowing water. This was then taken into max and baked down, and the normal map was further tweaked in photoshop to ensure the ripples were shallower on the trailing edge.

Utilising the flow-directed unwrap with the panning normal maps and a scene-captured cube map gave a really pleasing result, which was a great starting point. I added depth and Fresnel-based transparency (ensuring the player could look down into the water). I’m still trying to figure out why the distortion isn’t working, but I have faith I can get that done eventually.

With just a reflection map and a bit of colour balance, I had a pretty good result:



The water looked a bit too pristine, so I decided to make it darker and browner when looking down into the water, and I decided to add some foam into the water. Although foam does split apart and can change in size, its overall shape stays the same as it travels down water, so I added it simply panning. It looked repetitive and static, so I overlaid it on top of itself to break the repetition, and  used a blurry noise map to offset its UVs as it moved down the river. This meant that the foam seems to move about and “wibble”, and looked pretty good in conjunction with the ripples. Obviously the foam is not as reflective as the water, so I changed that, but I was not able to get a nice diffuse effect on the ripples since the water is a translucent shader and therefore does not receive shadows.

I started by using a realtime cube map capture (every 2 seconds) for the reflections, which had the benefit of automatically adjusting to night lighting as the scene itself darkened. However, using just one statically-positioned capture actor meant that only a small portion of the river had accurate reflections. Placing several would be too costly, since they would all need to be capturing at all times, so I tried attaching the actor to the player, but found that to be too detrimental to the frame rate as well.

In consideration of the fact that my texture usage was still very low, I chose to use multiple static cube map renders, captured “offline”. This meant that although the reflections were actually showing summer daytime at all times, I hoped that nobody would really notice so long as they were tone-corrected for night. Because the river has been broken into five sections by rocky rapids, I could use a different cube map for each section.

Finally, I added some "white turbulence" to help the water edges and rocky parts feel like the water was flowing at a higher pressure, and against the surrounding rocks. I have yet to do freezing water, water at low flow, or water levels rising and lowering, but I doubt I'll have time for any of that any longer.