• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Level Design MIP Map Problems

[TW]DrGuppy

Tripwire Interactive Staff
Nov 22, 2005
1,039
36
38
Atlanta, Georgia
The Problems:



1. Alpha textures (in this case, the field) fade out too quickly with MIP maps on.

2. Taking off MIP maps causes a 'shimmering' effect and FPS drops. This is because the entire field is now forced to render the 1024x1024 texture all the time and all these pixels fight for position on your monitor.

3. Since downloading the new Nvidia dds format v8.23 plug-in I have been unable to export any alpha or masked textures without a black outline popping up in-game. This black outline starts at the second MIP level.

What I want to do:

The map I am currently working on has a 2km view distance and I want to have foliage (bushes, fields, etc.) that will conceal the player even at extended ranges. In order to accomplish this the textures with large transparent sections (thin bushes, field textures) need to fade into a solid colour or stop at a certain MIP map level.

The Nvidia dds format v8.23 plug-in that I download allows me to set the max number of MIP maps, which is what I want, but it also adds a black outline around the image which I cannot seem to get rid of. Here is the options screen for this plug-in:



The ideal situation is being able to export the .dds file with no black outline and a max of 8ish MIP map levels so the texture doesn't fade to nothing.

Any help you guys can give me is appreciated. If you need more information or specifics let me know! Thanks. :)
 
This isn't too tough (though it took me for ever to figure it out properly). Save your foliage with a transparent background as a dds, 8 mip maps works well. Make sure it's a 1 bit alpha. Now open the dds file, and you will have the texture, surrounded by the black alpha area. Use the color select tool and select only the black texture area. Use the colorize tool to change the black texture into a green that generally matches your foliage texture. Don't fill in the area with the paint bucket or anything, just manually edit it the selected areas with the color tool. Now save the dds again, using the same parameters that you used the create it from the psd file. That hopefully should give you a good mip map without the dark edges. Let me know if any of that isn't clear or if it doesn't work properly.

Edit: a couple of things, you can actually save the dds as a 1 bit or 5 bit alpha. The five bit looks great as a masked texture because it has smooth edges, 1 bit is usually a bit more square. Also, if you have fiddled around the presets, I would recommend uninstalling the nvidia tools and reinstalling them. I've tried messing with these before and it has always made things worse and it is near impossible to get them back to the original setting. Also, if the mips are disapearing, that's because there are too many. Limit it to eight, that's probably the best balance of performance, general look, and ability to conceal.
 
Upvote 0
Nothing personal is meant in this post... :)
The probable answers are in bold, but you may find the rest useful (or not...)

- Always leave Mips on textures that will be applied to the scene.
You never want a Mip-less texture in most circumstances.

- Why not simply using UnrealEd's Mip on import?
I have not found any reason to use the NVDxt software other than for creating border Mips for Projectors and Emitters.
It serves no other useful purpose for most work.

- Attempting to twist the engine around your will and design often fails. :p
A mapper has to design their map to accomodate the features and functionality of the game engine.
I have doubts about getting a 2km view distance with "solid" filled plants, and having it render with any speed.

- Looking at your screenshot, the "black border" that you are seeing on the Mips is most likely correct for the texture you are using.
As the texture is scaled down for each successive Mip level, a box resample or similar method is used to average out the pixels that will make up the target Mip pixel, so if the texture has solid black around the outside of the plant image, that will slowly get more mixed into the plant texture edges as the Mips go down.
The fix for this is to use a base dark green color relative to the actual plant image color for the solid areas outside of the plant on the texture. That way a dark green is blended on Mip edges instead of black.

- MIPs normally reduce from the base texture size down to 1x1.
Why would you want to change this? What is it that you are hoping to achieve?
By changing the number of levels, you will simply limit what choices the engine can use to render texels as they move further from the camera, causing anomalies in the visual image.
If you are attempting to stop all Mips on a 256x256 texture at 64x64, then you are forcing the engine to use a larger texture to render only a few pixels of each distant triangle, which will cause more GPU processing.

- Most likely what you are seeing is the fact that the small triangles used for the staticmesh plants are also reducing down to 1 pixel or less, which is why the field is "disappearing". Look at it in rmode 1 to see.
You could verify that the texture 1x1 Mip is solid green with alphachannel of about 50%, which may give a near solid color value for trangles that are still rendered at that far distance.
This would require you to hand-paint the smaller Mip levels of the texture, assuming the NvDxt plugin allows you to use multiple targets for each Mip level.


A few things:

- The engine does not support a Staticmesh LOD system, which is technically what you need here to do what you want.

- Attempting to put Deco Layers or Staticmesh fields that reach for kilometers is pretty much guaranteed to kill the framerate. :)

- Attempting to put Deco Layers or Staticmesh fields that reach kilometers using alphablend instead of masked is pretty much guaranteed to kill the framerate even faster. :D

- Forcing or changing Mip levels on the alpha plant texture will not succeed in anything to do with optimizing how this is going to run.
If the plants are set to a distance of 52500 UUs (1km) and you want players to be able to hide behind that even when looked at through a scope, I doubt anyone will be able to play the map with any sort of reasonable framerate.
The number of polys and all of the distance alphablending is going to kill virtually every system currently out there.
This same thing will hold true regardless of whether you use Terrain Deco Layer or StaticMesh plants.

- You want the texture to fade to a Mip of 1x1. Technically it doesn't fade to "nothing".

- If using Terrain, be aware that the values that you specify for Deco Layer Distance Max/Min do cause an alpha-fade between those two values.

- If this is being created with multiple large staticmeshes, they will not optimally cull unless they are in small enough sections. So everything will be rendering.


Good luck... :)
 
Upvote 0
Couple of things on the previous post, I think was DrGuppy is trying to do is very similar to the wheatfield meshes that are used in many levels, only with a different plant texture. Those wheat field meshes use an enormous texture that definitely doesn't go down to 1x1 pixel, and they run well enough.

Maybe in general it's best to have textures reduce to the smallest size, but vegetation, especially vegetation that is meant to provide cover, seems to me to be a different story. The trick is to try and match what two people can and cant see of each other, even though they are some distance away.

One idea that might work if you are using static meshes for this is a very large and relatively simplistic mesh, mainly borders and occasional pieces on the inside, and in this larger mesh a number of smaller meshes with a cull distance. In a large map, from a low viewing angle, it would be almost impossible to see the difference and it would lower the triangle count and the depth of the scene.
 
Upvote 0
I assumed it was a custom texture by the border issue. :)
If it is an alpha texture, I'm willing to bet that every Mip below about 16x16 is probably for the most part transparent (on the alpha channel), which is why the field texture fades out at a specific distance radius.
Hand-painting all of the lower Mips will fix this, making sure to ramp upwards in opacity as the Mip gets smaller so that the 2x2 and 1x1 are about 30-50% opaque green, but it will require some time and a Mip software/plugin that will support doing it.

A fully Mip'ed (to 1x1, but hand-painted) texture should always render faster and with less visual anomalies than stopping at Mip six or so. ;)
But this would be up to the artist/level designer to implement it and try it.
For masked/1-bit style textures, they all get so raggy below 25% Mip that it may not make too much visual difference. :)

The multi-Staticmesh idea is a good one.
Too bad the CullDistance property didn't support negative numbers (I don't believe it does, UDN says no, I personally never tried), or a pseudo-LOD could be implemented this way.
 
Upvote 0
This isn't too tough (though it took me for ever to figure it out properly). Save your foliage with a transparent background as a dds, 8 mip maps works well. Make sure it's a 1 bit alpha. Now open the dds file, and you will have the texture, surrounded by the black alpha area. Use the color select tool and select only the black texture area. Use the colorize tool to change the black texture into a green that generally matches your foliage texture. Don't fill in the area with the paint bucket or anything, just manually edit it the selected areas with the color tool. Now save the dds again, using the same parameters that you used the create it from the psd file. That hopefully should give you a good mip map without the dark edges. Let me know if any of that isn't clear or if it doesn't work properly.

Edit: a couple of things, you can actually save the dds as a 1 bit or 5 bit alpha. The five bit looks great as a masked texture because it has smooth edges, 1 bit is usually a bit more square. Also, if you have fiddled around the presets, I would recommend uninstalling the nvidia tools and reinstalling them. I've tried messing with these before and it has always made things worse and it is near impossible to get them back to the original setting. Also, if the mips are disapearing, that's because there are too many. Limit it to eight, that's probably the best balance of performance, general look, and ability to conceal.

Yeah I already did that first trick to get hard edges without any transparency FPH. I'm not sure what you mean by "manually edit the selected areas with the colour tool" but if the end result is just to get hard edges then I already have that. Even with the hard edges and not a trace of black in the texture I still get a black outline (or transparent white with 'Alpha Modulate' unchecked under the MIP map options) on all the MIP maps. The only part that doesn't have any problems is the first original texture before MIP mapping kicks in.

Nothing personal is meant in this post... :)
The probable answers are in bold, but you may find the rest useful (or not...)

No worries DG, I never take anything personal. Especially from someone who has already 'made it' in the industry. :cool:

- Always leave Mips on textures that will be applied to the scene.
You never want a Mip-less texture in most circumstances.

The only reason I took them off in the first place was to stop my grass, bushes, and field textures from completely disappearing. This, as you very well know, isn't good for FPS so I was hoping to limit the number of Mips a few levels before the texture became invisible.

- Why not simply using UnrealEd's Mip on import?
I have not found any reason to use the NVDxt software other than for creating border Mips for Projectors and Emitters.
It serves no other useful purpose for most work.

Hmm, I just tried to do this without success. I saved the file as a .dds in PS without Mips and then imported it into ROEd with the 'Generate MipMaps' box checked. However, the texture in-game didn't have any Mips at all. :confused:

- Attempting to twist the engine around your will and design often fails. :p
A mapper has to design their map to accomodate the features and functionality of the game engine.
I have doubts about getting a 2km view distance with "solid" filled plants, and having it render with any speed.

The view distance is set to 90 000 UUs which is about 2km but that will only come into play in a few areas if you really try. The normal engagement range is 1km or less, especially around the higher detail areas.

The map is also well designed (if I do say so myself ;)) and has an optimized layout. The gameplay follows the path of a large 'C' shape. Starting in a higher detail forest, moving onto the low detail fields, and then ending in the high detail town. The forest area and town have a huge mountain in between them with an AP so they never have to render each other. I'm being very careful about how many textures and meshes I use, and how detailed they are. The terrain is done with two heightmaps, one for the main play area, and another for the mountains and the fields. I am not using any decolayers in the map. Instead, I am using combined staticmeshes that go from about 5000 to 15000 polys and all of these are laid out so hills will cull them. All the spawns are behind BSP as well.

I also have backups plans in case old UEd has it out for me. The forest meshes are made out of 5 different plant statics and if the poly counts are too high in the end I can simply remove certain types of plants. View distance can also be cut to 1km if I have to.


- Looking at your screenshot, the "black border" that you are seeing on the Mips is most likely correct for the texture you are using.
As the texture is scaled down for each successive Mip level, a box resample or similar method is used to average out the pixels that will make up the target Mip pixel, so if the texture has solid black around the outside of the plant image, that will slowly get more mixed into the plant texture edges as the Mips go down.
The fix for this is to use a base dark green color relative to the actual plant image color for the solid areas outside of the plant on the texture. That way a dark green is blended on Mip edges instead of black.

I've double-checked and made sure that there is no black in the texture, especially around the edges. I haven't figured out how to create a 1 pixel border of green around the image yet, any hints or will I have to Google it? ;)

- MIPs normally reduce from the base texture size down to 1x1.
Why would you want to change this? What is it that you are hoping to achieve?
By changing the number of levels, you will simply limit what choices the engine can use to render texels as they move further from the camera, causing anomalies in the visual image.
If you are attempting to stop all Mips on a 256x256 texture at 64x64, then you are forcing the engine to use a larger texture to render only a few pixels of each distant triangle, which will cause more GPU processing.

What I hope to achieve is a texture that either fades into a solid colour or stops at a certain Mip level that still has enough of the texture left to conceal players and not completely disappear. What I'm finding is that on textures that are mostly transparent they will actually disappear completely after a certain Mip level/distance. Larger bushes with not as many alpha texels don't have this problem and tend to Mip into a solid colour.

I understand that the ideal situation is to leave the Mips at default but that just isn't working well enough to provide cover past 500 meters or so. I'm hoping that to have enough Mip levels active so that the GPU isn't strained very much.

- Most likely what you are seeing is the fact that the small triangles used for the staticmesh plants are also reducing down to 1 pixel or less, which is why the field is "disappearing". Look at it in rmode 1 to see.
You could verify that the texture 1x1 Mip is solid green with alphachannel of about 50%, which may give a near solid color value for trangles that are still rendered at that far distance.
This would require you to hand-paint the smaller Mip levels of the texture, assuming the NvDxt plugin allows you to use multiple targets for each Mip level.

Ok I think I understand this. I'll give it a try and report back but what do you mean by 'use multiple targets for each Mip level? Also I'm sure the staticmeshes are not becoming so small as to render them invisible because putting a solid texture on them shows that they are still quite visible.
A few things:

- The engine does not support a Staticmesh LOD system, which is technically what you need here to do what you want.

It would be nice but I believe I can keep the poly count at around 100 000 - 150 000. Keep in mind that there's isn't very much BSP in the level either.

- Attempting to put Deco Layers or Staticmesh fields that reach for kilometers is pretty much guaranteed to kill the framerate. :)

As I mentioned above, I'm not planning on using Deco Layers at all. I've had some bad experiences with them in the past. The static meshes are all combined or are being APs with cull distances (well, not yet but I'm working on it).

- Attempting to put Deco Layers or Staticmesh fields that reach kilometers using alphablend instead of masked is pretty much guaranteed to kill the framerate even faster. :D

Yup, I'm using masked DXT1 textures for almost everything.

- Forcing or changing Mip levels on the alpha plant texture will not succeed in anything to do with optimizing how this is going to run.
If the plants are set to a distance of 52500 UUs (1km) and you want players to be able to hide behind that even when looked at through a scope, I doubt anyone will be able to play the map with any sort of reasonable framerate.
The number of polys and all of the distance alphablending is going to kill virtually every system currently out there.
This same thing will hold true regardless of whether you use Terrain Deco Layer or StaticMesh plants.

I understand that changing the Mip levels is not recommended but at the moment it's the only option I've got. I am trying to use as many Mip levels as I can to keep the performance up while not losing the cover entirely. Also, the scopes in RO reverse some of the effects of cull distances and Mip maps (not 100% sure on the Mip maps) so you don't have to worry about setting plants to the full view distance of a scoped weapon.

- You want the texture to fade to a Mip of 1x1. Technically it doesn't fade to "nothing".

I don't think this is true. If you take a look at the chain link fence in KrasnyiOktyabr or in RigaDocks you should see that they will fade to nothing at a certain distance. I'm pretty sure this is because there are more alpha texels than actual solid ones in the texture.

- If using Terrain, be aware that the values that you specify for Deco Layer Distance Max/Min do cause an alpha-fade between those two values.

- If this is being created with multiple large staticmeshes, they will not optimally cull unless they are in small enough sections. So everything will be rendering.


Good luck... :)

Might need more than luck for this one. :D

Couple of things on the previous post, I think was DrGuppy is trying to do is very similar to the wheatfield meshes that are used in many levels, only with a different plant texture. Those wheat field meshes use an enormous texture that definitely doesn't go down to 1x1 pixel, and they run well enough.

Most of those meshes are 2048x1024 while mine are 1024x1024 for optimization purposes. I've tried the larger field textures on my map and they do indeed go down to 1x1 or invisible at about 1km or so.

Maybe in general it's best to have textures reduce to the smallest size, but vegetation, especially vegetation that is meant to provide cover, seems to me to be a different story. The trick is to try and match what two people can and cant see of each other, even though they are some distance away.

I think I'll try thickening the texture up a bit and see if that helps. I'm really hoping I don't have to go to 2048x1024 because my fields have about 5 or 6 unique textures.

One idea that might work if you are using static meshes for this is a very large and relatively simplistic mesh, mainly borders and occasional pieces on the inside, and in this larger mesh a number of smaller meshes with a cull distance. In a large map, from a low viewing angle, it would be almost impossible to see the difference and it would lower the triangle count and the depth of the scene.

I thought of this but with 5 or 6 different field textures this could be more hassle than it's worth. This also doesn't solve the problem of the grass or bushes disappearing.

Phew! Thanks you two for the help, I really appreciate it. Hopefully I can get this problem fixed in the near future.
 
Upvote 0
I assumed it was a custom texture by the border issue. :)
If it is an alpha texture, I'm willing to bet that every Mip below about 16x16 is probably for the most part transparent (on the alpha channel), which is why the field texture fades out at a specific distance radius.
Hand-painting all of the lower Mips will fix this, making sure to ramp upwards in opacity as the Mip gets smaller so that the 2x2 and 1x1 are about 30-50% opaque green, but it will require some time and a Mip software/plugin that will support doing it.

A fully Mip'ed (to 1x1, but hand-painted) texture should always render faster and with less visual anomalies than stopping at Mip six or so. ;)
But this would be up to the artist/level designer to implement it and try it.
For masked/1-bit style textures, they all get so raggy below 25% Mip that it may not make too much visual difference. :)

The multi-Staticmesh idea is a good one.
Too bad the CullDistance property didn't support negative numbers (I don't believe it does, UDN says no, I personally never tried), or a pseudo-LOD could be implemented this way.

Looks like I missed this post in my previous response that took 1h 40m to write, apparently. :eek: I definitely think the best way to do things (with your convincing) is to have a fully Mipped 1024x1024 DXT1 1-bit alpha texture that is custom painted for the last few Mip levels. Right now the fields become invisible at about 500 meters, which is beyond the range in which I care about how they look. I just want something to be there past 500 meters so some poor guy happily crawling around in a field doesn't become the laughing-stock of some tank crew. :p

EDIT: Can I edit the Mip levels with the plug-in I have now or would you recommend a separate one?
 
Upvote 0
Even with the hard edges and not a trace of black in the texture I still get a black outline (or transparent white with 'Alpha Modulate' unchecked under the MIP map options) on all the MIP maps. The only part that doesn't have any problems is the first original texture before MIP mapping kicks in.

As mentioned, this will probably be because your source texture most likely has a black background on the RGB channels.
In other words, if looking at the texture in PS without the alpha channel, you want something like B and not like A.
When viewed in UnrealEd, just make sure the bMasked or bAlpha is False and you can see the full RGB channels of the texture without the alpha channel. The background should be a green/yellow/brown color that is commonly found in the colors of the foliage in question.


texfoliagebgndeg0.jpg


Notice that the second grass texture has a green background.

If you leave the RGB channel background color as black, when the Mips are created which are essentially resampled-by-2 down-sized images, it starts to pull pixels in on the RGB channels during the box-filtering, plus it starts to change the alpha channel edges.
So the black (or whatever) background color starts to creep in on the actual texture outline edges.

The way I do it is to work on any foliage completely masked (floating), then I paste that onto a solid background of a common or slightly darker color than the foliage, flatten it, and export.

Hmm, I just tried to do this without success. I saved the file as a .dds in PS without Mips and then imported it into ROEd with the 'Generate MipMaps' box checked. However, the texture in-game didn't have any Mips at all.
You can't re-DXT a DXT... :)
So the Mips checkbox and right-click Compress essentially do nothing in UnrealEd on an imported .dds file. You end up simply importing whatever you created with the source .dds you import.
You would have to import as .bmp/.tga/.pcx to get the Editor's Mips and Compress features functional.

However, UnrealEd will simply create a full...1x1 Mip'ed DXT, but is useful to see if your external .dds'er software is messing up in comparison.

The view distance is set to 90 000 UUs
TWI must have modified the engine... :p
The UE2.5 engine limit on rendering view is 64k units (~1km)...

The map is also well designed
It sounds like you really thought this one out. :)

I've double-checked and made sure that there is no black in the texture, especially around the edges. I haven't figured out how to create a 1 pixel border of green around the image yet, any hints or will I have to Google it?
So the actual texture RGB channels background is green?
As seen in my examples above (the one on the right).

What I hope to achieve is a texture that either fades into a solid colour
As mentioned then, the only possible fix that I see is to hand paint the RGB and Alpha Channels of the lower Mips.
However, locating software that allows you to do that I am unsure of...
I don't believe the PS Plugin will do it, neither will Compressonator.

what do you mean by 'use multiple targets for each Mip level?
Essentially creating some of the actual Mip textures themselves.
So if you had a 1024x1024 main texture, you would have to export and view the Mips starting at probably around 64x64 and see how much "block resampling bleed damage" has been done to the original image.
What will occur is the filtering will start to blur out the RGB and Apha Channels until you are left with a blob-down-to-a-pixel on the RGB, and a semi-transparent-blob-down-to-totally-transparent-pixel on the Alpha channel (white blob amidst black background down to fully black).
This is why the texture will "disappear" at a certain distance.

The best scenario would be to touch up the smaller Mip textures so that it actually blended from the source texture of "grass blades" down to a reasonable facsimile of a "horizontal grass field" (ie. no individual blades visible), just like we see in real life.

But as I mentioned, I am unaware of any DXT software that lets you edit the Mips and then "insert/compile/attach" them back into the .dds file.

I know of software that will export all Mips out of a .dds though...

*edit* I just Googled it and there are some programs that will edit Mips. Best to search and decide on one yourself.
Perhaps MipEdit? I didn't look at them all...

It would be nice but I believe I can keep the poly count at around 100 000 - 150 000. Keep in mind that there's isn't very much BSP in the level either.
I am working on a large set of custom meshes for UT2004 and (eventually into UT3) Onslaught modes that are a combination of multi-textured, skinned, lightmapped, etc., and the current first game map to use these is pushing about 250,000 triangles of combined Staticmesh, Terrain, and details.
FPS is 30+ on a P4-3.2HT with ATI X800, and getting better on hardware above that.
So it is possible to do it on today's hardware.

I also have some real nice high-poly buildings under development for my RO map. Screenshots in a couple of days. :)

I don't think this is true. ... I'm pretty sure this is because there are more alpha texels than actual solid ones in the texture.
The lowest Mip will still be a 1x1. :p
The resulting full alpha transparency 1x1 will occur on any source texture that is more than 50% transparency on the alpha channel, which is also what you are experiencing with your foliage.

I think I'll try thickening the texture up a bit and see if that helps. I'm really hoping I don't have to go to 2048x1024 because my fields have about 5 or 6 unique textures.
A larger base texture is not the issue.
Lower Mips becoming fully transparent will be.

Anything that is far in the distance will be using smaller mip textures, such as between 16x16 and 1x1.
If the triangle is getting down to pixel-sized, the best performance will be to use a 1x1 texture on it. Attempting to force a 64x64 to be textured to that triangle will impact performance (albeit not necessarily excessively, and depending on the GPU hardware possibly not noticeable at all).

So the source texture used should be a comfortable size based on its near-distance visual quality.
Then because the Mips will be eventually becoming transparent, those Mip textures will have to be modified to fix that.

A super-large source texture ( > 1024x1024) with fewer mips can be used to sort-of fix it, but this IMHO will not be as optimized as doing it the correct way.
(I hope not to step on toes with that comment).

Hope this helps...
 
Last edited:
Upvote 0
OK.. i'll confess, I didn't read all of the replies...

Did you use UEd to auto 'create MIPS maps', or did you create hand-crafted mips and stitch them together in the Nvidia DDS tools?

I've noticed that often when using the UnrealEd 'Create MIPS Maps' on somewhat transparent or otherwise detailed textures, that you are better off creating your MIPS in your photo editing package and stitching them together... THEN importing the DDS into UnrealEd.
 
Upvote 0
Ok! After a complete hard drive failure, and the loss of almost everything (except my map thankfully), I am now back up and running. So first off I want to say thanks to UncleDrax and DGUnreal because my previous problem is now fixed. :D

The reason for bringing this topic back is because I have a new problem with MIP maps on my grass texture. The grass is slightly different from the other fields/foliage because the staticmesh is a whole bunch of triangles, instead of rectangles, and the texture is clamped. As you can see from the screenshots the texture is being stretched to the tip of the staticmesh triangles, but only after about 3-5 MIP levels. The sad part is that before my HDD crash I think I had this problem nailed but I'm having a terrible time trying to (re?)fix this issue.



The only ways I can stop the stretching is to stop the MIP levels at about 4 to 6, or check the "Alpha Zero Border (1-texel)" option but neither of these are ideal because they cause the shimmering effect (as described before) or completely fade out too soon. Both of these options aren't ideal. Any help would be great. :)
 
Upvote 0