SOLVED: What's the shadow/darken effect on the base of turrets and mortars?

Started by Master Bucketsmith, August 12, 2016, 03:05:05 PM

Previous topic - Next topic

Master Bucketsmith

So, vanilla or modded, there's two effects applied to the base of a turret or mortar.
One is the castEdgeShadow, the other I don't know.
And it's the other one that's darkening the graphic for the base. The shadow applies to the ground on the tiles it occupies.

I'm trying to figure that out because no matter how white I make the white parts of my edited file, the effect is applied and it turns out rather grey. It looks a bit odd to have that much of a difference between base and top!

Anyone any ideas where that effect comes from and how to disable it?

Master Bucketsmith

Turns out it's related to whether or not a structure has a stuff cost.
If it can be build from different materials, the game alters the colour of the texture.
I never realised vanilla mortars had that code.

SG_bun

Care to explain a little? I've been running into issues with 'stuff' not being defined. I remove classifying as Metallic or whatever and it works so I just assumed it worked fine but now it's clear that I'm missing something...

Anyway object look nice and pretty and white if they have no 'stuff' category also.

Master Bucketsmith

Quote from: Threepete on August 26, 2016, 09:25:21 AM
Care to explain a little? I've been running into issues with 'stuff' not being defined. I remove classifying as Metallic or whatever and it works so I just assumed it worked fine but now it's clear that I'm missing something...

Anyway object look nice and pretty and white if they have no 'stuff' category also.
Sure:
    <castEdgeShadows>true</castEdgeShadows> <!-- this is what causes the shadow effect on the ground in the tiles the building occupies - NOT the effect on the texture of the base. -->
    <stuffCategories> <!-- having this means the building has the option to be build with different materials -->
      <li>Metallic</li> <!-- these are the categories of materials that can be chosen from in-game, it's defined in CategoryDefs, I think -->
    </stuffCategories>
    <costStuffCount>100</costStuffCount> <!-- this defines the amount of the chosen resource it requires -->
    <costList> <!-- the regular cost of fixed resource types -->
      <Steel>150</Steel> <!-- this how you define which resource and how many of it -->
      <Component>4</Component>
    </costList>

By adding a 'stuff cost' to a building, you set it up to be build by different materials. It will pick the vanilla texture as it is, but lighting effects and such are still applied if the structure is set to be on a layer lower than Lighting, I think.
And by having a stuff cost, the texture will have a recolour applied to it depending on which material is picked. How it picks the recolour values is defined elsewhere, I don't know where.
Thus, by NOT having a stuff cost, the game will pick the texture as it is.

I never bother with building my turrets and mortars out of anything but steel, so I falsely assumed that the recolour it gets from steel being the chosen resource was actually the vanilla texture. Outside of the game the texture just looked somewhat darker, but in hindsight that is probably because I'd be looking at it against a pure white or grey checkerboard background, depending on whether in windows explorer or paint.net. Also, since it's on the Building layer, all light effects are applied to it. So in-game the texture will just look different. (Don't forget the brain sees colours depending on the colours around the one you're focusing on.)

By removing the stuff cost from my firefoam mortar, I was able to use it's special base texture without it looking funky. I just never noticed the recolour was because of the stuff cost, and I never selected a different material during testing to get that click.

By removing the stuff cost from my flare mortar, which uses the vanilla MortarBase texture, it looked like it was lightening the texture when it was merely taking the texture as it truly is and not recolouring it. So after a painful process of checking the C# code and XML files, I thought I'd try something stupid and add the stuff cost back in. And voila! Because it picks steel as the default resource, I saw it as a dark steel texture again! What I thought was vanilla, but wasn't!
To fix that, for now, I simply lowered the 'lightness' on the texture in paint.net to match the dark steel look, and used that. Removed the stuff cost.
So in essence, it uses a custom texture that's made to look like the steel variant of the vanilla texture. :)

I hope that's a decent elaboration. I'm not sure if you're saying you're still having issues, but if so, feel free to give more details. Maybe I can help you out.