Foliage

A new section for modding SOW Waterloo. Ask questions, post tips here.
Jace11
Reactions:
Posts: 50
Joined: Fri Feb 26, 2016 11:06 pm

Foliage

Post by Jace11 »

Download link was broken with the recent website changes. This terrain mod is still included with the grog toolbar but once the game goes to x64 it will be separated out. I am presently pushing to get it in the stock game but there are no guarantees. Regardless, in my opinion it really has proved to be a 'must have' mod by helping Waterloo maps look their best. Here's the new link:
Jace11's Terrain Mod.zip
(1.21 MiB) Downloaded 55 times
Download link edited and added by RebBugler, 22 March 2023
________________________________________________________________________________________________________

I noticed in early development screenshots and some more recent ones posted by people here that the crops and foliage looked a lot more defined than what we have in game now. The game seems to contain two sets of textures for plants and trees etc. One is a packed 2048x2048 texture and the other is the individual textures in the terrain folder for each sprite. These are slightly better in quality but if I set up a mod with a gfx.csv to use those individual textures (or a copy of them) I get a substantial loss in frames in game - even though, in my opinion it looks a lot better. I expect that's why the packed versions are used, but they seem to lose something in the process, either in dds compression of the alpha or something else that makes them hard to see at times (perhaps the alpha threshold used in TexturePacker is slightly high). The alphas of crops seem to accumulate the more there are in the field of view giving rise to this dark effect, even though the texture on the packed.dds is bright.

Image

This can be completely alleviated by using the unpacked textures, but as I said, you lose frames badly. I did have a go with the latest version of texturepacker tonight which eventually got them to pack with a clearer alpha.

Image

I'll test it out for a few days and then post it up for people to try once its working alright.
Last edited by Jace11 on Tue Aug 02, 2016 9:49 am, edited 1 time in total.
Saddletank
Reactions:
Posts: 2171
Joined: Sat Dec 24, 2011 4:49 am

Re: Foliage

Post by Saddletank »

Your brighter grass with the edited alpha channel is great in the lower pic.

Please would you consider adjusting the alpha for the stock textures that come with the game? We play MP almost exclusively with armies of over 50,000 men on the map and we need the framerates to stay as high as practical.

Thanks.
Last edited by Saddletank on Tue Aug 02, 2016 12:23 pm, edited 1 time in total.
HITS & Couriers - a different and realistic way to play SoW MP.
Jace11
Reactions:
Posts: 50
Joined: Fri Feb 26, 2016 11:06 pm

Re: Foliage

Post by Jace11 »

All i'm doing really is getting the game to use a different set of default textures (ones already included).

Unfortunatley I don't think I can do it as I'd hoped. Packed textures seem to have their alphas rendered differently, even if the alpha is "perfect" it still gives rise to the effects seen in the first image. I thought I'd got it working but it turned out the game wasn't using the repacked version I made, when I forced it to, it still gave the same effect as seen in the first screen - so I don't think its possible.

I'm pretty sure whoever on the team worked on terrain textures encountered the same issues and I'm just running over the same ground. It was probably a design decision to limit the loss of detail as much as possible but still use packed textures for terrain to maximize performance. On the plus side though, when you do use the separate textures, the FPS hit isn't as bad as I first thought - it can be 1 to 3 FPS, which might not seem much but this game can get pretty slow already when alot of sprites are on the field so it will probably be a mod for smaller scale battles or people with powerful rigs that don't care so much. Foliage isn't animated so I suppose that may be why the hit isn't that big.

BTW texturepacker has a free 7 day trial if anyone is interested in trying anything similar - sprites, units etc.


Edit:- download added for unpacked terrain mod. extract the zip to your mods folder etc etc, activate and deactivate as required. I'd be interested to see what kind of performance loss other people experience.

Edit2: download removed - a better version is available below.
Last edited by Jace11 on Tue Aug 09, 2016 2:38 am, edited 1 time in total.
Jace11
Reactions:
Posts: 50
Joined: Fri Feb 26, 2016 11:06 pm

Re: Foliage

Post by Jace11 »

Duh! OK!

I finally figured it out. The reason the textures for crops etc are dark is the packed textures have been made with black backgrounds. Those in the Terrain folder have full color backgrounds, that's why they look better. The alphas aren't perfect and get compressed a bit *maybe* when making the .dds. Using a black background for the textures on the packed sheet then gives rise to black outlines on the crops etc. I made a new sprite sheet with the full backgrounds so you get the nicer foliage without the performance hit seen in my previous version. I've tested it briefly (loading with and without the mod and checking FPS from certain unit positions) and I can't detect any FPS loss. I was losing 1-2 FPS with my previous version, so this is an improvement I think. It was made using TextureMapper again, but I didn't use a plist as I wanted the whole background for each texture. TM will trim and crop them to fit in the smallest space etc, but I just wanted to make sure each sprite's integrity is maintained so I did it the old fashioned way with a gfx list.

This file is the original textures fixed up to display correctly.
The attachment PackedTerrainSprites.zip is no longer available




Edit- a second mod is also available (Terrain Sprites version 3)
- this is a modded version that includes alot of little tweaks to colors, alphas and a few new sprites. Looks a bit better than the one above, you can't run them together, it is a replacement for the mod above.
The attachment TerrainSprites3.zip is no longer available
Attachments
TerrainSprites3.zip
(1.18 MiB) Downloaded 22 times
PackedTerrainSprites.zip
(1.22 MiB) Downloaded 21 times
Last edited by Jace11 on Fri Jan 13, 2017 1:30 am, edited 1 time in total.
User avatar
RebBugler
Reactions:
Posts: 4238
Joined: Sun Aug 03, 2008 12:51 am
Location: Ouachita Mountains, Arkansas

Re: Foliage

Post by RebBugler »

Using a black background for the textures on the packed sheet then gives rise to black outlines on the crops etc.
I'm left scratching my head about this because I can't find where black backgrounds were used as the alpha, they're all transparent when I open them in Paint.net. I'm pretty familiar with alpha formatting because of my flag work. Furthermore, it's not a packing issue because I tested my flags on 4096x sheets before packing them and saw no degradation or shadowing upon packing.

You say this sheet is packed, but without a plist and using the GFX file, not the gfxpacked file, then it's just a texture sheet, albeit with very unique coordinate entries.

FPS is no issue because the number of texture sheets wasn't increased.
It was made using TextureMapper

Maybe this is the app that made the difference, tell us more please.

Regardless, this mod works great at eliminating unwanted dark outlines that seem to be inherent with all the vegetation. Very nice work!

Permission to use it as an add-on with the next upgrade of the Grog Toolbar?
If OK'd, what do I call it? The Jace 11 Foliage Fixer? :)
Bugles & Flags Gettysburg - Toolbar, Flags, Scenarios, and More...
Jace11
Reactions:
Posts: 50
Joined: Fri Feb 26, 2016 11:06 pm

Re: Foliage

Post by Jace11 »

I just called called it packed, because the previous version I put up that used individual sprites I called "unpacked" but you're right I guess, it's just a sheet. But then TexturePacker makes exactly the same kind of sheets, its just it's brilliant at making the coordinate file and can pack images closer together.

It was made using Texture Packer, sorry just a typo... there is no other program, though my trial has just expired, so its a bit trickier to use now. For sheets where all the sprites are the same size I can use Photoshop to make a contact sheet, but where they differ I now have to edit after making the sheet.

As for why it works?
I think its mostly to do with converting from .png to .dds and the .png format. Something happens during this process that causes the issue. I've noticed that the .png format has some surprises, for instance, a transparency can still have RGB colour values hidden underneath... and converting png to dds carries these RGB values over. I'll try and make an image to explain.
Last edited by Jace11 on Fri Aug 12, 2016 5:30 pm, edited 1 time in total.
User avatar
RebBugler
Reactions:
Posts: 4238
Joined: Sun Aug 03, 2008 12:51 am
Location: Ouachita Mountains, Arkansas

Re: Foliage

Post by RebBugler »

I just called called it packed, because the previous version I put up that used individual sprites I called "unpacked" but you're right I guess, it's just a sheet. But then TexturePacker makes exactly the same kind of sheets, its just it's brilliant at making the coordinate file and can pack images closer together.

It was made using Texture Packer, sorry just a typo... there is no other program, though my trial has just expired, so its a bit trickier to use now. For sheets where all the sprites are the same size I can use Photoshop to make a contact sheet, but where they differ I now have to edit after making the sheet.

As for why it works?
I think its mostly to do with converting from .png to .dds and the .png format. Something happens during this process that causes the issue. I've noticed that the .png format has some surprises, for instance, a transparency can still have RGB colour values hidden underneath... and converting png to dds carries these RGB values over. I'll try and make an image to explain.
Much clearer now, thanks. I've also used the packer for making non-packed sheets, not cropping the background, etc., but not with different sizes. I read somewhere that oblong dds conversions have issues so I've avoided anything not squared.

So, if it's a png to dds format change that's helping out here, how is it that you have the png files to begin with? I know that the dds files can be converted back to png, and then repacked, but wouldn't those former dds graphics still show the degradation that is inherent with dds converts. Hope I'm making sense, still learning, and will be forever, about how graphic conversions work.

Please continue your explanations, this mod has our attention, or at least mine. :)
Bugles & Flags Gettysburg - Toolbar, Flags, Scenarios, and More...
con20or
Reactions:
Posts: 2541
Joined: Fri Jun 11, 2010 8:49 pm

Re: Foliage

Post by con20or »

Please continue your explanations, this mod has our attention, or at least mine. :)
+1
Last edited by con20or on Fri Aug 12, 2016 10:21 pm, edited 1 time in total.
gunship24
Reactions:
Posts: 728
Joined: Mon Jan 31, 2011 1:31 am

Re: Foliage

Post by gunship24 »

I just loaded up both files and this is what I see. Our one is on the right and Jace's is on the left. Our one has a transparency layer on top (probably not the technical way to describe it) but only for certain colours.
The attachment Clipboard01_2016-08-12.jpg is no longer available
Attachments
Clipboard01_2016-08-12.jpg
Clipboard01_2016-08-12.jpg (272.56 KiB) Viewed 929 times
Last edited by gunship24 on Fri Aug 12, 2016 11:25 pm, edited 1 time in total.
Jace11
Reactions:
Posts: 50
Joined: Fri Feb 26, 2016 11:06 pm

Re: Foliage

Post by Jace11 »

Reb: I dont have the original png files. I used the separate textures in the /Terrain folder. I took the colour channel of each (they all have backgrounds) and made a sheet, then did the same with the alphas. These were all in bmp format btw. Then I just combined the two to make the dds.

P.S feel free to add it to your mod if you want.

So, I'm not really sure what's happening (I'm no expert either), but the alpha is picking up some of the background surrounding the image.

Below is an example, it isn't what I did to make the mod, its just to explain why you may have a black (or whatever) background even though you think you don't..

It starts with the sunflower.dds from the terrain folder, I made a png from it. The transparency looks empty, but its not.!! When you convert it back to dds, you get the background back...

I wonder if when the sprites sheets are being made this is what happens. The end results (e.g WL_Terrain_Sprites.dds) have black backgrounds and the alphas are picking some of this up. it seems the .png saves every pixel's RGB. If you have an alpha, you won't see them unless the alpha allows, but they are still there... converting to .dds seems to copy all the RGBS too, so that's what you get in color channel of the dds.

Image

I've attached a png file with the hidden RGB values, if you convert it to dds you should see the difference. If you are making textures from pngs I think you have to be mindful if it contains a hidden RGB, because most editing programs won't display it, but it does appear in the final conversion to .dds!
Attachments
GFX_WL_Sunflower.zip
(66.59 KiB) Downloaded 16 times
Last edited by Jace11 on Sat Aug 13, 2016 1:29 am, edited 1 time in total.
Post Reply