Wednesday, 14 May 2014

Transparency Issues

The issue I hit with transparency within both Maya and Unity was that when applying a PNG or Targa to the entire mesh of say the 'WoSD,' was that the faces from the back of the mesh like the ammo canisters could be seen through the front faces:

Here the ladders above the left gun are a single plane that require transparency for the gaps in the steps. The simple solution seemed to be to apply a separate transparent texture to only the ladders, using a .jpg for the rest of the body. However, this presented a strange white aliasing problem. Some research on the Unity forums brought me to the understanding that where values are semi transparent, Unity works out the values in between are white, as if the image is sitting on a white backdrop: this video explains it well:

I followed the instructions, downloading the plugin that allowed for the solidify function. The results were successful. The problem however, was that I was using Targa files to enable Unity to read the attatched alpha file, while preserving the bleed created by solidifying the images. Targa files are quite large, and considering I had an entire Targa image for say a spider mech wheel, this was going to be a highly inefficient approach:

Here is an example of the stain glass windows Targa file. As you can see there is a lot of wasted space on a file that is 16.9mb in size.

I had to find a more efficient way to include transparency into our game level. The first obvious approach to include all of the transparent game objects on one UV map. To do this I imported all of the FBX files with transparency into one scene, and arranged a new map with elements like wheels and vandalism:

This shot highlights the white aliasing issue to the right. For some reason, where on my mac book the PNG created the same white alias, here on the university's computers the PNG to left works.

Despite the PNG working okay, I decided I still wanted to use the Targa file format. As I am using also semi transparency, and not just full transparency in the empty spaces, I like to have the alpha channel so I can tweak and control transparency levels with for example the Nighthawks' windows:

There is still unused space on the UV, but having all of the transparent faces on one map is much more efficient. I didn't have the solidify plugin on the university computers, so did a simple method of bleeding out the colours by hand using a soft brush.

Here is the alpha map. The white areas are fully visible, whereas the black areas cannot be seen. The grey areas are semitransparent. I have also just realised that I have missed the transparency and colour bleeding of the bottom stain glass window plane, something I will amend.

While I am on the subject of efficiently, Adam was in charge of UV unwrapping, and he sent me some really nice and efficient UVs. Occasionally however, I would unwrap simple block assets like walls and floors, and I feel I could have been much move efficient:

Again there is a lot of wasted space on this, and with simplicity of the designs, some of the faces could have shared the same planar projection. 

I was more efficient with this container UV, sharing the same projection for 3 of the 4 longer faces (apart from the one with the Nasti Moons emblem), and using using one projection for the square end faces.

Also, with smaller assets like this one, perhaps I could have taken the UV snapshots at a smaller resolution. Generally I projected at 2048x2048, sometimes 1024x1024 for smaller assets. Perhaps I could have used even smaller resolution projections for the smaller less detailed assets to further efficiency.

No comments:

Post a Comment