Friday, November 23, 2018

Week 8 

After optimising my level better i can finally add more models and detail to the environment. The first step i wanted to cover before importing new models was the finalisation of the temple.

The temple has been an on going issue. The first problem was its polygon count, which I've managed to fix and reduce to 87K. The second issue I came across was that the temple was not welded at certain parts which mean light would break through the roof. It wasn't a solid build. To fix this i welded the corners and roofs together making it one solid piece. I then experimented with attaching the roof parts and the walls into one mesh, then duplicating it two times, re scaling and attaching them. Approaching the temple this way would mean i would only have to use one draw call of 4096 x 4096. This is a lot more efficient and would be ideal. 

The main problem with this was that the lighting of the temple within the engine wasn't building correctly. It  took a few hours of understanding how light maps work to fix this. Light maps are simply a separate UV that unreal automatically creates. It works much like the flattening map function within 3DS MAX in which it creates individual islands for every polygon within the UV. However with a model that has 80K polygons the Light map resolution would have to be roughly 8196 x 8196. Unreal only lets you create a light map resolution of 4096 x 4096. This meant i simply couldn't have a single mesh sharing one UV with such a polygon density. Thus i had to readjust how many models I split the temple into so unreal engine could build the lighting with no problems. 



After finishing the temple it was time to add more models to my scene to fill it out more. I started with walls surrounding the perimeter because I wasn't happy with the current set up. After researching traditional gates and towers that surround a historic Chinese temple I applied the most common recurring theme to my environment. The build it self wasn't complex and i managed to keep it relativity low polygon.



I then went on to create a shrine in which I could place the Buddha which in my original concept drawings would of been within the temple. But since the feedback i got given I decided to instead put it outside and work only on the outside environment. This meant creating a shrine in which it could be placed.



After this i went on to create fences that fit more to the theme than the bamboo originally did. I then also added a lake terrain box so it wasn't the standard terrain surrounding the temple grounds. This will allow me to add tiles or ground textures with custom normals, roughness, speculars so on and so forth achieving a higher quality finish than standard terrain could create. 



Lastly and most importantly I decided against using the outline blueprint within my environment. The main reason for this was that it was clashing with the ability to create dynamic lighting, god rays, volumetric fog and dynamic shadows. These 4 aspects are the reason unreal engine thrives graphically over unity. And since I chose unreal for its better graphical implementations I decided i should make use of them. Over all it has greatly increased the aesthetics of my environment and unless i can work out how to manipulate the blueprint to still allow for these graphical enhancements to occur i will not be going back. This also means that my original plan of having a high polygon count on technically implemented models was wasted and I could infact get away with greatly decreased poly counts on models such as the temple as there is no outline giving the suggestion of the polygon count anymore. This art style is more representative of games such as Zelda: Breath of the wild rather than my original inspiration of dungeon defenders. 




Saturday, November 17, 2018

Week 7 - Optimisation 

My project finally starting hitting the breaking point of optimisation. I had never made a unreal engine project this big before so i didn't know the limits of the engine and how far I could go before it started to drop below an FPS that was optimal. 

This didn't mean i had no awareness that 200K tris for a building was abnormally large. I was aware through the teachings i've received what should be expected of polygon count but without breaking the system my self i would never have known how far i can go and how far i should be going. 

The most taxing part of my project so far was not even the polygon count it was more the amount of alpha planes the engine was trying to compute. But i'll break it all more down in the proceeding paragraphs. 

List of assets that have been optimised -

Temple 207k Tris -> 99k Tris 

150K Grass Plane Foliage -> 56.7K

Blossom 10k Tris -> 6k Tris

20 Tree Foliage Instances -> 14 Tree Foliage Instances

Baked shadows off on Blossom Trees

Static shadows on all objects from half dynamic

Cull range from 0 -> 5K on all grass foliage

Environment change for linear movement to reduce polycount

The temple.

The temple was exceedingly large on the polygon count. The polygon count reduces performance because of the amount of individual faces the engine has to calculate how the light responds the the normals and smoothing groups being applied to the model. The temple is made of approximately 52 individual models, majority of them are duplicates and varied in someway meaning I could easily then unwrap them and attach to share the same UV space.

This allowed me to combine the entirety of the 52 models down into a mere 12 static mesh instances. Each of these static mesh instances is it's own draw call. This is optimisation for the future when I move on to texturing.  

The cel-shader depending on how its coded in the blue print can either allow for outlines around smoothing groups (or, and) around the geometry of the building. So I tried to keep the integrity of the shape as much as I could when cutting the Tri count down. I won't to greatly in detail of what parts of the temple were more or less efficient than others but I will outline the ones that were great or the ones that were terrible. 

The walls of my temple were by far the least efficient. This is simply because I'm now focusing on only the outside environment I didn't need double sided meshes to block light from penetrating the walls. Meaning I could model simple plane geometry in the shape similar to the original. Just cutting the shape of the walls down meant removing approximately 16000 Tris. 

Each polygonal instance of the roofs were around 5000 Tris. I managed to cut each instance down to around 2500 which meant around Half my Tri count was obliterated. The fences were 16000 Tris which is so ridiculously large that I just deleted them instead of trying to find a work around. I will most likely remodel a lower polygon version. 

You can naturally tell a difference between the high poly and low poly in engine. However as I anticipated it's not anywhere near enough to justify keeping a static instances that doubles the lower poly. If in the near future I find a problem with my engine that was costing severe performance and fixed it and can in fact use the lower poly as a LOD and not as the mesh I will do so. And if I further need to optimise I will LOD the lowerpoly and use this aswell. 

                98k(not in scale)                                                           207k

Foliage

I've never worked with foliage in unreal engine or even unity for that matter so it makes sense that I wouldn't know the limitations for quantity within an engine. Nothing surprised me immensely about how little or how much you could push it before you dipped below 60 fps. However I've learnt much more than I thought I would in terms of foliage within a game engine.

Firstly the blossom tree, I managed to cut it down from 10k to 6k. The trunk of the tree was roughly 2.1k which I then cut down to around 0.8k already taking off 1.3k Tris. The leaves were 8k Tris. I realised that the amount of planes within a fibermesh instance in zbrush does not dictate the amount of leaves. The amount of leaves is a variable decided on the alpha texture, this meant i could drastically decrease the polycount and even increase the quality of the tree. 

Iv'e decided to keep both meshes but mostly use the 6k and then dot the 10k around for variation in colour and size. This all together cut down around 120k Tris from my scene. 

I turned shadows off the blossom trees for now because calculating where light doesn't penetrate in an instance of 4K alpha planes is very taxing.

However I was a little surprised to find that the most taxing aspect of my FMP so far was indeed the grass planes. I expected the process of optimisation to maybe involve reducing the plane count but not so much on the use of lighting. However static shadows are essential for aesthetically pleasing foliage so I kept it on and simply reduced the amount of planes instead. 


This is with the amount of planes reduced. As you can see the grass foliage is still "extremely bad" meaning I'll need to possibly increase the size of the grass on the texture to reduce the amount of light that can get through the plane, increasing performance. 

Its also important to note I've decided to change my plan of the environment. Originally I was going to let the player run around the forest surrounding the temple. However because of the player perspective if i do this it means i cant reduce the grass planes on either side of the main path. However if they are forced down a linear path then because of their eye level its a lot harder to make out the grass plane count across the field as they are all parallaxing and its not been viewed from a top down perspective. 

So far this is all the optimisation I've applied. I will find that I'll need to optimise more when I start bringing in textures with draw calls, more models, particle effects, animations, terrain instances and high resolution mountain textures for around the environment. But I will cross that bridge when I come to it. 

So far I've managed to increase the FPS from 80 to 130 in a single day with very little loss of quality and an even cleaner temple build. 

Wednesday, November 14, 2018

Week 7 - Large Update


Since week 6 I have added a substantial more amount of content into my FMP after critical reflection of my presentation last week.

Aspects that have been added -

(Organic)

- One blossom tree model & foliage instance
- One grass plane foliage instance
- One flower foliage instance
- New terrain textures

(Technical)

- One water wheel & house extension (animated)
- Two dragon statues (duplicated)
- Four fountain models (duplicated)
- Bridge 
- Second & Third tier of temple
- Outside terrace walks

(Removed)

- Main walk way up to the temple (player spawn)

Organic Modelling

Originally i was going to leave all organic modelling towards the end of my self made modelling deadline simply because I wanted everything to be white boxed and most organic modelling with alpha maps cant be added without colour.

The blossom tree is around 10K polygons. Which is fundamentally too high IF they were all single static meshes. However because I unwrapped the leaves and tree within the same UV and attached them as a single mesh with two different materials it allows me the possibility to add them as static mesh foliage instances. Which greatly increases performance and optimisation so the polygon count doesn't become irrelevant but defiantly matters less. The modelling of the tree was a standard z-brush process with nothing too complex. However it required a better understanding of how fibermesh worked and I now feel comfortable using the modifier to create foliage for large living organic meshes. I also learnt of a new modifier within max called optimisation. Optimisation drastically reduces the poly count much like Z-remsher in zbrush only you don't have the control through polypainting the desired place for high polygon or low polygon redistribution.



The grass plane model was the standard process of creating grass blade models within max, applying smoothing groups, turbo-smoothing and applying a gradient material. The reason this process is widely used is because when baking onto a plane you can choose any custom resolution, auto inputs a alpha map, bakes a normal map and also bakes dynamic shadowing through specular and light maps. The only downside is you don't get photorealstic texturing on the blades of grass post baking. However you can paint this onto the baked diffuse map after. But for my game in which photorealism does give anything it only takes away from the style so this method doesn't have any drawbacks.

I also followed the same method for the baking of the flower texture. By creating petals, rotating and mirroring them around a pivot point at 72 degree angles, modelling a cylinder and applying a FF3 modifier to bend in the direction I wished, I created the stem. I then used the grass models to create the leaves.



The material differs from materials added to technical modelling because you need to allow for dynamic lighting to be applied to both the side the normal is facing and the side its not. In other words you need to apply a subsurface lighting application into the blueprint. Along with this I needed to add wind animation to my foliage. Which is simple contrary to how complex it may sound at first. This is made easy due to unreal built in wind blueprint nodes. I followed a great tutorial on YouTube which made use of multiple vector parameters to control variation of wind, saturation and tint on the material which made the same blueprint applicable to multiple models.



The terrain textures are pictures I took my self with a DLSR camera. There were 3 variables I needed to consider when taking real life texture photos. The direction of light, the colour temperature of the day, how easily the photo can be made seamless. Along with this there was also the variation of distance, close, mid range and far away which can all be used in their own unique situations. This meant a total of 9 pictures of the same texture in order to find the perfect shot for my game. The reason i worried about the colour balance of the photo (temperature tint, e.g, red or blue tint) was so I didn't lose quality if I changed the saturation after the photo was taken. I would of taken RAW photos for even more graphical control but its not needed and more work to the workflow.  After the photoshoot was done I simply resized the photo and made the one i thought was most relevant to my game seamless. 

Its worth mentioning that I'm aware the photos might be to realistic for my artstyle however if this is the case its fairly easy to readjust the textures to look more hand drawn. 

Technical Modelling

The waterwheel was a basic model and even more basic to animate it. I wont go to in depth because its simply not necessary. The only part worth mentioning about the process here would be that finding a decent reference of a waterwheel that represented Chinese architecture was hard. All the references of Chinese water wheels looked very different from each other. So in order to make it fit my theme I applied it to a Chinese styled house on the side of it. 



The dragon model was also fairly simple. However there were a few aspects I did change and a couple more I would change if I had time to go over it again. For starters the model itself although it does look like a Chinese dragon, the statues outside of temples are alot more robust, and figuratively suggest the idea of a Chinese dragon unlike mine which is a literal representation of the mythical beast meaning its less authentically less believable in my environment which contrasts with the idea of creating an immersive environment.  Secondly the dragon was around 10K polygons which i thought at first was actually too low. Rethinking it this was a bad deduction and then I further reduced it to 5k, If this still proves too high i will try applying the optimisation tool i learnt previously that is built into max. 



I personally feel my ability within the software increasing. I'm much more comfortable and efficient in my workflow. This project so far has increased my knowledge through research tenfold compared to the passive learning environment of a class. There is alto more problem solving and intuition in creating an environment than i originally thought. Furthermore readdressing the problem of polycount within my FMP I believe within the last week I've made active decisions to solve this.

I should note that I've decided against a bamboo forest because it no matter how many times I revisit this idea I just cant find away or even picture it looking good within my environment. 



References

https://www.youtube.com/watch?v=XuY5WIaqdkg Blueprint Tutorial (for foliage mat) 

Notes

 - I have added the third and second layer to the temple. The reason this isn't of higher priority in the blog is because they are really just duplicates with abit of polygon trimming (around 40k) on each tier. There wasn't any major modelling issues or critical reflection that needed mentioning. However this is a large landmark for me to of completed. 

- I've drastically increased my focus on the outside terrain due to the feedback given on the presentation. 

- I've added some smaller buildings around the temple as you can see in the last picture 

- I've changed the cloud textures and animation speed on the sky box as Ian said it was too stormy

- Every single aspect in this project is now hand made or self referenced ( There are no outside placeholders in these pictures, textures, models or anything else).

-

Friday, November 9, 2018

Week 6 - Presentation - Critical Reflection 

On the 6/11/2018 I had a presentation of my ongoing progress of my FMP so far. The presentation its self went smoothly although i could defiantly delivered it with more clarity. Most importantly I want to highlight the feed back I was given on my project.

They gave me 5 points of feedback. All of them I'm going to implement into my environment.

- The poly count needs reducing.
- The project is too ambitious i should focus on the outside environment before attempting the inside.
- The skybox doesn't match the atmosphere I'm trying to create.
- The overall grade of my environment is highly dependent on how efficiently I build it, cheating the system. 
- I should focus the polygon density more on the architecture rather than organic modelling such as the bamboo. 

To reduce the polycount they gave me a further in depth method of doing this. For example screen shotting the walls one the tier two of the temple and higher and replacing that with the walls currently there instead. As I will not be able to go in the temple or up there this will be a more effective use of my poly count. They also suggested this method to be used on my bamboo. 

The also suggested I use the free poly count on creating statues and detailed misc around the environment. 

This is the first adjustment I'm making based on the feedback. I'm currently in the process of modelling a dragon statue within Zbrush.