Friday, 20 March 2020

Technical Obstacles

For a couple of weeks I've tried to get around an annoying issue I've had with textures in-game. Basically, to achieve greater levels of detail I've been using multiple materials per object. The first usually a basic ground texture like gravel, then on top specific details overlayed i.e. a street with road markings.

This can be manually textured all into one texture sheet, but then the quality can be severally compromised, especially over large areas.

As you can see, even though the gravel is a 4k texture, because the area is so large it quickly becomes muddy. However, to get around this I can simply put the same texture into the material without first processing it into a traditional texture sheet. By doing this I can tile the texture across the whole area with no loss of quality:

This is the same area, just with separated textures. Now because the gravel is on its on material and tiled I can place an overlay with the original uvw texture but remove the muddy gravel. Alas, this too isn't without issues:

The textures may look better but the transparent overlay layer with the road markings are now no longer read by the renderer, making them visible regardless of the fog. After some reading, this turns out to be an issue with how Unity handles standard lighting and that any transparency pass is done last, resulting in the above look.

So after a lot of fiddling and research I did manage to over come this issue:

So overall it looks much, much better, the floor has a high quality tiled gravel texture and the roads also have a transparent overlay, which now is considered by the renderer, achieving the exact look I wanted.

This was fixed by using one of Unity's obsolete shaders (no idea why its obsolete, it is obviously still useful) and manually setting the render depth for this particular material.

Typically the "Render Queue" is set too 3000, by lowering it, the engine now analyses this material before rendering any Z-Depth aka the fog.


No comments:

Post a Comment