Scatters ‐ Stopping Scatters from Growing Inside Buildings - Gameslinx/Parallax-Continued GitHub Wiki

image

Masking Scatters

You might want to prevent trees from growing inside buildings or runways. Parallax Continued introduces a new type of MapDecal PQSMod which lets you use a texture to control where scatters can and can't spawn.

MapDecalVertexRemoveScatter

This is the config form of the PQSMod (sorry for the formatting, GH is terrible at it):

MapDecalVertexRemoveScatter
{
	name = ParallaxMaskKSC
	BlockedScatters		// The scatters you want to mask using this decal
	{
		name = OakTree
		name = PineTree
		name = KerbinShrub
		name = Roses
	}
	Position		// Latitude and longitude of the decal centre - I use the exact centre of the VAB
	{
		// Exact center of the top of the KSC VAB between the two helipads
		latitude = -0.0967843592808297
		longitude = -74.6187354971911
	}
	debugShowDecal = false		// Enable this to show the decal debug colours
	colorMap = Parallax_StockScatterTextures/Textures/Kerbin/PluginData/kscMask2.dds		// The mask to use
	debugColorMap = Parallax_StockScatterTextures/Textures/Kerbin/PluginData/kscMask2.dds	// Set this if debugShowDecal is enabled, otherwise just remove it
	angle = 15		// The rotation of the decal - angle 15 aligns exactly with the vanilla runway facing direction (out to sea, 90 deg)
	radius = 5100	// Size of the decal
	order = 99999	// Order in which to apply the decal
}

Here's an example of the mask for the vanilla KSC. Note that you should flip this vertically when saving as a DDS.

image

How To Create A Mask

First you need to find a reference point. I use this exact spot here:

image

latitude = -0.0967843592808297
longitude = -74.6187354971911

Next, zoom out far and hold Left Alt + scroll down to tighten the FOV. Make sure your FOV is as low as possible for the best mapping. Take a screenshot:

image

Now colour in areas you want to remove scatters from in black! White everywhere else. You can blur the edges by 1 pixel to get a slightly smoother mask. Masks do not need to be high resolution at all, 256 x 256 will be appropriate for most.

Save the mask as a .dds file inside a PluginData folder, and write a module manager patch to apply it:

@Kopernicus:AFTER[ParallaxStock]:NEEDS[MyKSCModFolderName]
{
    @Body[Kerbin]
    {
        %PQS
        {
            %Mods
            {
                !MapDecalVertexRemoveScatter:HAS[#name[ParallaxMaskKSC]]    // Remove the existing parallax mask for the vanilla KSC, if needed
                MapDecalVertexRemoveScatter
                {
                    // fill this in with the relevant info using the above template
                }
            }
        }
    }
}

Now load the game. You can use KittopiaTech to edit the decal in-game by installing it, pressing Ctrl+P, clicking Kerbin -> PQS -> Mods -> MapDecalVertexRemoveScatter -> [make your edits] -> go back to the PQS GUI window and hit 'rebuild sphere' - remember to copy these changes over to your config.

You might be able to apply the decal using Kerbal Konstructs, but I've not tested it.