Mask on belt ingame is very lighten than icon mask

Place to get help with not working mods / modding interface.
Post Reply
User avatar
DemerNkardaz
Inserter
Inserter
Posts: 26
Joined: Wed Jan 18, 2023 12:32 am
Contact:

Mask on belt ingame is very lighten than icon mask

Post by DemerNkardaz »

I make mask for code colorizing belts and its icons, make it identical ways, but icon is good and entity is very light.
Ting, blend and alpha params is identical.
Image
Image

Icon and mask (and its lighter than entity but in game ok lol)
ImageImage

Entity mask sample
ImageImage

Just locals

Code: Select all

local icon_base_path = "__PLORD__/graphics/icons/belts/"
local underground_belt_base_icon = icon_base_path .. "underground_belt.png"
local underground_belt_base_icon_mask = icon_base_path .. "underground_belt_mask.png"

local underground_belt_path = "__PLORD__/graphics/entity/belt_underground/"
local underground_belt_base_texture = "underground-belt-structure.png"
local underground_belt_base_texture_mask = "underground-belt-structure-mask.png"

local mask_alpha_base = 0.9
local tint_base = {r = 1, g = 1, b = 1}
Entity color function

Code: Select all

local function generate_underground_belt_texture(tint, blend, base_texture, base_texture_mask)
	return
	{	
		direction_in =
		{
			sheets = 
			{
				
				{
				  filename = underground_belt_path .. base_texture,
				  priority = "extra-high",
				  width = 96,
				  height = 96,
				  y = 96,
				  hr_version =
				  {
				    filename = underground_belt_path .. "hr-" .. base_texture,
				    priority = "extra-high",
				    width = 192,
				    height =192,
				    y = 192,
				    scale = 0.5
				  }
				},
				{
				  filename = underground_belt_path .. base_texture_mask,
				  priority = "extra-high",
				  width = 96,
				  height = 96,
				  y = 96,
				  tint = util.get_color_with_alpha(tint or tint_base, mask_alpha_base, true),
				  blend_mode = blend or "additive-soft",
				  hr_version =
				  {
				    filename = underground_belt_path .. "hr-" .. base_texture_mask,
				    priority = "extra-high",
				    width = 192,
				    height =192,
				    y = 192,
				    tint = util.get_color_with_alpha(tint or tint_base, mask_alpha_base, true),
				    blend_mode = blend or "additive-soft",
				    scale = 0.5
				  }
				}
			}
			
		},
		direction_out =
		{
			sheets = 
			{
				
				{
				  filename = underground_belt_path .. base_texture,
				  priority = "extra-high",
				  width = 96,
				  height = 96,
				  hr_version =
				  {
				    filename = underground_belt_path .. "hr-" .. base_texture,
				    priority = "extra-high",
				    width = 192,
				    height = 192,
				    scale = 0.5
				  }
				},
				{
				  filename = underground_belt_path .. base_texture_mask,
				  priority = "extra-high",
				  width = 96,
				  height = 96,
				  tint = util.get_color_with_alpha(tint or tint_base, mask_alpha_base, true),
				  blend_mode = blend or "additive-soft",
				  hr_version =
				  {
				    filename = underground_belt_path .. "hr-" .. base_texture_mask,
				    priority = "extra-high",
				    width = 192,
				    height = 192,
				    tint = util.get_color_with_alpha(tint or tint_base, mask_alpha_base, true),
				    blend_mode = blend or "additive-soft",
				    scale = 0.5
				  }
				}
			}
		},
		direction_in_side_loading =
		{
			sheets = 
			{
				
				{
				  filename = underground_belt_path .. base_texture,
				  priority = "extra-high",
				  width = 96,
				  height = 96,
				  y = 96*3,
				  hr_version =
				  {
				    filename = underground_belt_path .. "hr-" .. base_texture,
				    priority = "extra-high",
				    width = 192,
				    height = 192,
				    y = 192*3,
				    scale = 0.5
				  }
				},
				{
				  filename = underground_belt_path .. base_texture_mask,
				  priority = "extra-high",
				  width = 96,
				  height = 96,
				  y = 96*3,
				  tint = util.get_color_with_alpha(tint or tint_base, mask_alpha_base, true),
				  blend_mode = blend or "additive-soft",
				  hr_version =
				  {
				    filename = underground_belt_path .. "hr-" .. base_texture_mask,
				    priority = "extra-high",
				    width = 192,
				    height = 192,
				    y = 192*3,
				    tint = util.get_color_with_alpha(tint or tint_base, mask_alpha_base, true),
				    blend_mode = blend or "additive-soft",
				    scale = 0.5
				  }
				}
			}
		},
		direction_out_side_loading =
		{
			sheets = 
			{
				
				{
				  filename = underground_belt_path .. base_texture,
				  priority = "extra-high",
				  width = 96,
				  height = 96,
				  y = 96*2,
				  hr_version =
				  {
				    filename = underground_belt_path .. "hr-" .. base_texture,
				    priority = "extra-high",
				    width = 192,
				    height = 192,
				    y = 192*2,
				    scale = 0.5
				  }
				},
				{
				  filename = underground_belt_path .. base_texture_mask,
				  priority = "extra-high",
				  width = 96,
				  height = 96,
				  y = 96*2,
				  tint = util.get_color_with_alpha(tint or tint_base, mask_alpha_base, true),
				  blend_mode = blend or "additive-soft",
				  hr_version =
				  {
				    filename = underground_belt_path .. "hr-" .. base_texture_mask,
				    priority = "extra-high",
				    width = 192,
				    height = 192,
				    y = 192*2,
				    tint = util.get_color_with_alpha(tint or tint_base, mask_alpha_base, true),
				    blend_mode = blend or "additive-soft",
				    scale = 0.5
				  }
				}
			}
		},
		back_patch =
		{
		  sheet =
		  {
		    filename = "__base__/graphics/entity/fast-underground-belt/fast-underground-belt-structure-back-patch.png",
		    priority = "extra-high",
		    width = 96,
		    height = 96,
		    hr_version =
		    {
		      filename = "__base__/graphics/entity/fast-underground-belt/hr-fast-underground-belt-structure-back-patch.png",
		      priority = "extra-high",
		      width = 192,
		      height = 192,
		      scale = 0.5
		    }
		  }
		},
		front_patch =
		{
		  sheet =
		  {
		    filename = "__base__/graphics/entity/fast-underground-belt/fast-underground-belt-structure-front-patch.png",
		    priority = "extra-high",
		    width = 96,
		    height = 96,
		    hr_version =
		    {
		      filename = "__base__/graphics/entity/fast-underground-belt/hr-fast-underground-belt-structure-front-patch.png",
		      priority = "extra-high",
		      width = 192,
		      height = 192,
		      scale = 0.5
		    }
		  }
		}
	}
end
Icon color function

Code: Select all

local function generate_belt_icon(tint, blend, base_icon, base_icon_mask)
  return
  {
    {
      icon = base_icon,
      icon_size = 64,
      icon_mipmaps = 4
    },
    {
      icon = base_icon_mask,
      icon_size = 64,
      icon_mipmaps = 4,
      tint = util.get_color_with_alpha(tint or tint_base, mask_alpha_base, true),
      blend_mode = blend or "additive-soft",
    }
  }
end
Colorizing code

Code: Select all

for e_name, entity in pairs(data.raw["underground-belt"]) do
	if not e_name:find("wooden") then
	if (e_name == "underground-belt") then tint = {r = 0.9, g = 0.77, b = 0.35} end
	if (e_name == "fast-underground-belt") then tint = {r = 1, g = 0.25, b = 0.25} end
	if (e_name == "express-underground-belt") then tint = {r = 0.4, g = 0.8, b = 0.9} end
	if (e_name == "PLORD_underground_belt_green") then tint = {r = 0.3, g = 0.85, b = 0.35} end
	if (e_name == "PLORD_underground_belt_orange") then tint = {r = 0.95, g = 0.65, b = 0.15}end
	if (e_name == "PLORD_underground_belt_pink") then tint = {r = 0.9, g = 0.3, b = 0.65} end
	if (e_name == "PLORD_underground_belt_purple") then tint = {r = 0.6, g = 0.35, b = 0.9}end
	if (e_name == "PLORD_underground_belt_black") then tint = {r = 0.65, g = 0.65, b = 0.65} end
	if (e_name == "PLORD_underground_belt_grey") then tint = {r = 0.55, g = 0.55, b = 0.55} end
	if (e_name == "PLORD_underground_belt_white") then tint = {r = 0.9, g = 0.9, b = 0.9} end
	entity.structure = generate_underground_belt_texture(tint, blend, underground_belt_base_texture, underground_belt_base_texture_mask)
	entity.icons = generate_belt_icon(tint, blend, underground_belt_base_icon, underground_belt_base_icon_mask)
	end
end

for e_name, item in pairs(data.raw["item"]) do
	if e_name:find("underground") and e_name:find("belt") and not e_name:find("wooden") then
	if (e_name == "underground-belt") then tint = {r = 0.9, g = 0.77, b = 0.35} end
	if (e_name == "fast-underground-belt") then tint = {r = 1, g = 0.25, b = 0.25} end
	if (e_name == "express-underground-belt") then tint = {r = 0.4, g = 0.8, b = 0.9} end
	if (e_name == "PLORD_underground_belt_green") then tint = {r = 0.3, g = 0.85, b = 0.35} end
	if (e_name == "PLORD_underground_belt_orange") then tint = {r = 0.95, g = 0.65, b = 0.15}end
	if (e_name == "PLORD_underground_belt_pink") then tint = {r = 0.9, g = 0.3, b = 0.65} end
	if (e_name == "PLORD_underground_belt_purple") then tint = {r = 0.6, g = 0.35, b = 0.9}end
	if (e_name == "PLORD_underground_belt_black") then tint = {r = 0.25, g = 0.25, b = 0.25} end
	if (e_name == "PLORD_underground_belt_grey") then tint = {r = 0.55, g = 0.55, b = 0.55} end
	if (e_name == "PLORD_underground_belt_white") then tint = {r = 0.9, g = 0.9, b = 0.9} end
	item.icons = generate_belt_icon(tint, blend, underground_belt_base_icon, underground_belt_base_icon_mask)
	item.subgroup = "PLORD_underground_belts"
	end
end

User avatar
DemerNkardaz
Inserter
Inserter
Posts: 26
Joined: Wed Jan 18, 2023 12:32 am
Contact:

Re: Mask on belt ingame is very lighten than icon mask

Post by DemerNkardaz »

Half-Resolved
Icon don't used blend mode and it confused me.
But with this I don't take true color like on icon, need to edit mask and texture hue/saturation to more darken and use additive blend mode or other methods, trying to make this good.
Best with color multiplicative blend mode - colors most true, but it makes all transparent place in black color instead of transparency, this bad.

UPD: using normal blend mode with mask of all middle part is best variant with colors and pixel glitches what I currently found
Using normal blend mode with mask only of arrows have some troubles with my trying to masks
Using additive killing black color and not gives full true colors with my trying to masks
Image

Post Reply

Return to “Modding help”