Система ржавчины типо пашет. Еще очень сырая

This commit is contained in:
bybohka committed 2026-10-12 15:40:07 +03:00
1 parent 5c934702c0
commit f9eb14868d
18 files changed
+3885 -3634

No files matched your search

@@ -12,6 +12,9 @@ Material:
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _METALLICSPECGLOSSMAP
- _NORMALMAP
- _PARALLAXMAP
- _SPECGLOSSMAP
- _SPECULAR_SETUP
m_InvalidKeywords: []
@@ -52,7 +55,7 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Texture: {fileID: 2800000, guid: 4148a9b11b8cdf243a0b164cbe3eb439, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
+4
View File
@@ -60,10 +60,14 @@ Material:
m_Ints: []
m_Floats:
- _NoiseScale: 4
- _PaintProgress: 0
- _PaintSmoothness: 0.85
- _PuttyProgress: 0
- _QueueControl: 0
- _QueueOffset: 0
- _RustAmount: 0
- _RustInitial: 0
- _SandProgress: 0
m_Colors:
- _BaseColor: {r: 0.103315964, g: 0.085617654, b: 0.52156866, a: 1}
m_BuildTextureStacks: []
+4 -2
View File
@@ -24,7 +24,9 @@ Material:
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_ValidKeywords:
- _METALLICSPECGLOSSMAP
- _NORMALMAP
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
@@ -63,7 +65,7 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Texture: {fileID: 2800000, guid: dd8521890becf1644b8478b8a3774cdc, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
File diff suppressed because it is too large. Load diff
@@ -4,6 +4,7 @@ public class CarConditionGenerator : MonoBehaviour
{
[Header("Настройки спавна")]
[Range(0f, 1f)] [SerializeField] private float rustProbability = 0.7f; // Шанс появления ржавчины
[SerializeField] private float minRustAmount = 0.2f;
[SerializeField] private float maxRustAmount = 0.85f;
[SerializeField] private Color baseCarColor = Color.gray;
@@ -17,31 +18,27 @@ public class CarConditionGenerator : MonoBehaviour
{
CarPart[] allParts = GetComponentsInChildren<CarPart>(true);
foreach (var part in allParts)
foreach (CarPart part in allParts)
{
CarPartVisuals visuals = part.GetComponent<CarPartVisuals>();
if (visuals == null) visuals = part.gameObject.AddComponent<CarPartVisuals>();
// 1. Устанавливаем базовый цвет кузова
// 1. Базовый цвет кузова
visuals.SetPaintColor(baseCarColor);
// 2. Если деталь пластиковая (бампер) — пропускаем ржавчину
// 2. Пластиковые детали (бампер) не ржавеют
if (part.Data != null && !part.Data.canRust)
{
visuals.SetRust(0f);
visuals.SetDamage(0f);
continue;
}
// 3. Рандомизируем ржавчину для металла
if (Random.value < rustProbability)
{
float randomRust = Random.Range(0.2f, maxRustAmount);
visuals.SetRust(randomRust);
}
else
{
visuals.SetRust(0f);
}
// 3. Для металла - случайное начальное повреждение
float damage = Random.value < rustProbability
? Random.Range(minRustAmount, maxRustAmount)
: 0f;
visuals.SetDamage(damage);
}
}
}
+201 -25
View File
@@ -1,45 +1,221 @@
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(Renderer))]
/// <summary>
/// Стадии ремонта кузовной детали. Вычисляются из значений прогресса, отдельно хранить не нужно.
/// </summary>
public enum RepairStage
{
Healthy, // деталь целая, ржавчины нет
Rusted, // есть ржавчина - нужна зачистка
Cleaned, // ржавчина счищена, голый металл - нужна шпаклёвка
Puttied, // зашпаклёвано - нужна шлифовка
Sanded, // отшлифовано - нужна покраска
Repaired // покрашено, ремонт завершён
}
/// <summary>
/// Состояние внешнего вида детали и стадии ремонта. Значения передаются в шейдер CarPaint_Rust
/// через MaterialPropertyBlock, только в те слоты материалов, где этот шейдер есть
/// (стёкла, фары и т.п. на той же детали не затрагиваются).
/// </summary>
[DisallowMultipleComponent]
public class CarPartVisuals : MonoBehaviour
{
private Renderer partRenderer;
private MaterialPropertyBlock propertyBlock;
private static readonly int BaseColorProp = Shader.PropertyToID("_BaseColor");
private static readonly int RustAmountProp = Shader.PropertyToID("_RustAmount");
private static readonly int RustInitialProp = Shader.PropertyToID("_RustInitial");
private static readonly int PuttyProp = Shader.PropertyToID("_PuttyProgress");
private static readonly int SandProp = Shader.PropertyToID("_SandProgress");
private static readonly int PaintProp = Shader.PropertyToID("_PaintProgress");
private static readonly int RustAmountProp = Shader.PropertyToID("_RustAmount");
private static readonly int BaseColorProp = Shader.PropertyToID("_BaseColor");
// Порог, после которого стадия считается завершённой (и значение "защёлкивается" до 100%)
private const float DoneThreshold = 0.98f;
private const float RustCleanThreshold = 0.02f;
[Range(0f, 1f)] [SerializeField] private float currentRust = 0f;
[SerializeField] private Color currentColor = Color.white;
[Header("Состояние (можно крутить в инспекторе во время Play)")]
[Range(0f, 1f)] [SerializeField] private float rustInitial; // сколько детали было поражено
[Range(0f, 1f)] [SerializeField] private float rustCurrent; // сколько ржавчины осталось
[Range(0f, 1f)] [SerializeField] private float putty;
[Range(0f, 1f)] [SerializeField] private float sanding;
[Range(0f, 1f)] [SerializeField] private float paint;
[SerializeField] private Color paintColor = Color.white;
public float CurrentRust => currentRust;
public Color CurrentColor => currentColor;
private void Awake()
private struct Slot
{
partRenderer = GetComponent<Renderer>();
propertyBlock = new MaterialPropertyBlock();
public Renderer renderer;
public int materialIndex;
}
public void SetRust(float amount)
private readonly List<Slot> slots = new List<Slot>();
private MaterialPropertyBlock block;
private bool initialized;
public float CurrentRust => rustCurrent;
public float InitialRust => rustInitial;
public Color CurrentColor => paintColor;
public RepairStage Stage
{
currentRust = Mathf.Clamp01(amount);
ApplyProperties();
get
{
if (rustInitial <= 0.001f) return RepairStage.Healthy;
if (rustCurrent > RustCleanThreshold) return RepairStage.Rusted;
if (putty < DoneThreshold) return RepairStage.Cleaned;
if (sanding < DoneThreshold) return RepairStage.Puttied;
if (paint < DoneThreshold) return RepairStage.Sanded;
return RepairStage.Repaired;
}
}
/// <summary>Прогресс текущей стадии 0..1 (для подсказок и UI).</summary>
public float StageProgress
{
get
{
switch (Stage)
{
case RepairStage.Rusted: return 1f - rustCurrent / Mathf.Max(rustInitial, 0.001f);
case RepairStage.Cleaned: return putty;
case RepairStage.Puttied: return sanding;
case RepairStage.Sanded: return paint;
default: return 1f;
}
}
}
// ---------- Инициализация ----------
private void EnsureInit()
{
if (initialized) return;
initialized = true;
block = new MaterialPropertyBlock();
CarPart owner = GetComponent<CarPart>();
foreach (Renderer r in GetComponentsInChildren<Renderer>(true))
{
// Не трогаем рендереры вложенных деталей (например, зеркало внутри двери)
if (owner != null && r.GetComponentInParent<CarPart>(true) != owner) continue;
Material[] mats = r.sharedMaterials;
for (int i = 0; i < mats.Length; i++)
{
if (mats[i] != null && mats[i].HasProperty(RustAmountProp))
slots.Add(new Slot { renderer = r, materialIndex = i });
}
}
if (slots.Count == 0)
{
Debug.LogWarning($"[{name}] Нет материалов с шейдером CarPaint_Rust (свойство _RustAmount). " +
"Ржавчина и ремонт на этой детали не будут видны.", this);
}
}
private void OnValidate()
{
// Позволяет двигать слайдеры в инспекторе и сразу видеть результат
if (Application.isPlaying && initialized) Apply();
}
// ---------- Установка состояния ----------
/// <summary>Задать начальное повреждение детали (0 = целая). Сбрасывает все стадии ремонта.</summary>
public void SetDamage(float amount)
{
amount = Mathf.Clamp01(amount);
if (amount <= 0.001f) amount = 0f;
rustInitial = amount;
rustCurrent = amount;
putty = 0f;
sanding = 0f;
paint = 0f;
Apply();
}
/// <summary>Задать цвет краски без проверок (для генератора состояния).</summary>
public void SetPaintColor(Color newColor)
{
currentColor = newColor;
ApplyProperties();
paintColor = newColor;
Apply();
}
private void ApplyProperties()
{
if (partRenderer == null) return;
// ---------- Действия инструментов ----------
// amount01 - доля полной работы за этот кадр (deltaTime / время полной обработки).
// Возвращают false, если инструмент сейчас не подходит этой стадии.
partRenderer.GetPropertyBlock(propertyBlock);
propertyBlock.SetFloat(RustAmountProp, currentRust);
propertyBlock.SetColor(BaseColorProp, currentColor);
partRenderer.SetPropertyBlock(propertyBlock);
public bool CleanRust(float amount01)
{
if (Stage != RepairStage.Rusted) return false;
rustCurrent -= rustInitial * amount01;
if (rustCurrent <= RustCleanThreshold) rustCurrent = 0f;
Apply();
return true;
}
public bool ApplyPutty(float amount01)
{
if (Stage != RepairStage.Cleaned) return false;
putty = Mathf.Min(1f, putty + amount01);
if (putty >= DoneThreshold) putty = 1f;
Apply();
return true;
}
public bool Sand(float amount01)
{
if (Stage != RepairStage.Puttied) return false;
sanding = Mathf.Min(1f, sanding + amount01);
if (sanding >= DoneThreshold) sanding = 1f;
Apply();
return true;
}
public bool PaintRepair(float amount01)
{
if (Stage != RepairStage.Sanded) return false;
paint = Mathf.Min(1f, paint + amount01);
if (paint >= DoneThreshold) paint = 1f;
Apply();
return true;
}
/// <summary>Перекраска целой или уже отремонтированной детали в другой цвет.</summary>
public bool Recolor(Color newColor)
{
RepairStage s = Stage;
if (s != RepairStage.Healthy && s != RepairStage.Repaired) return false;
paintColor = newColor;
Apply();
return true;
}
// ---------- Передача в шейдер ----------
private void Apply()
{
EnsureInit();
foreach (Slot s in slots)
{
if (s.renderer == null) continue;
s.renderer.GetPropertyBlock(block, s.materialIndex);
block.SetColor(BaseColorProp, paintColor);
block.SetFloat(RustInitialProp, rustInitial);
block.SetFloat(RustAmountProp, rustCurrent);
block.SetFloat(PuttyProp, putty);
block.SetFloat(SandProp, sanding);
block.SetFloat(PaintProp, paint);
s.renderer.SetPropertyBlock(block, s.materialIndex);
}
}
}
@@ -1,43 +0,0 @@
using UnityEngine;
public class CarRestorationTool : MonoBehaviour
{
[Header("Параметры")]
[SerializeField] private float cleanSpeed = 0.25f; // Сколько ржавчины снимается в секунду
[SerializeField] private float range = 2.5f;
[SerializeField] private LayerMask interactableLayer;
private Camera playerCamera;
private void Awake()
{
playerCamera = Camera.main;
}
private void Update()
{
// Зажата ЛКМ — процесс чистки
if (Input.GetMouseButton(0))
{
TryCleanPart();
}
}
private void TryCleanPart()
{
Ray ray = new Ray(playerCamera.transform.position, playerCamera.transform.forward);
if (Physics.Raycast(ray, out RaycastHit hit, range, interactableLayer))
{
CarPartVisuals visuals = hit.collider.GetComponentInParent<CarPartVisuals>();
if (visuals != null && visuals.CurrentRust > 0f)
{
float newRust = visuals.CurrentRust - (cleanSpeed * Time.deltaTime);
visuals.SetRust(newRust);
// Здесь можно запустить систему частиц искр (Particles) и звук шлифмашинки
}
}
}
}
@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: be6ae3f5845047c6b571b3e3a10b5b44
timeCreated: 1791330653
+133 -32
View File
@@ -1,66 +1,106 @@
using TMPro;
using UnityEngine;
public enum ToolType { Hands, Sander, SprayCan }
// Порядок важен: он совпадает с порядком секторов в ToolRadialMenu (индекс = номер сектора)
public enum ToolType { Hands, RustCleaner, Putty, Sander, SprayCan }
public class PlayerToolManager : MonoBehaviour
{
[Header("Инструмент")]
public ToolType currentTool = ToolType.Hands;
[Header("Настройки")]
[Header("Луч инструмента")]
[SerializeField] private float toolRange = 2.5f;
[SerializeField] private LayerMask interactableLayer;
[SerializeField] private float sandSpeed = 0.35f; // Скорость очистки в сек.
[SerializeField] private Color sprayPaintColor = new Color(0.1f, 0.4f, 0.8f); // Выбранный цвет краски
[Header("Время полной обработки детали, сек")]
[SerializeField] private float cleanTime = 5f;
[SerializeField] private float puttyTime = 3f;
[SerializeField] private float sandTime = 4f;
[SerializeField] private float paintTime = 3f;
[Header("Перекраска целой детали")]
[SerializeField] private Color sprayPaintColor = new Color(0.1f, 0.4f, 0.8f);
[Header("Подсказка о состоянии детали (необязательно)")]
[Tooltip("Если не задан - текст рисуется простым OnGUI по центру экрана")]
[SerializeField] private TextMeshProUGUI statusText;
private Camera playerCam;
private string status = "";
private GUIStyle guiStyle;
private void Awake()
{
playerCam = GetComponentInChildren<Camera>();
if (playerCam == null) playerCam = Camera.main;
}
private void Update()
{
// Не используем инструменты, если открыто меню или выбраны пустые руки
if (currentTool == ToolType.Hands) return;
// Пока выбираем инструмент (Tab) или в руках ничего нет - инструменты не работают
if (currentTool == ToolType.Hands || Input.GetKey(KeyCode.Tab))
{
SetStatus("");
return;
}
CarPartVisuals visuals = FindTarget();
if (visuals == null)
{
SetStatus("");
return;
}
string text = $"{StageText(visuals.Stage)}";
if (visuals.Stage != RepairStage.Healthy && visuals.Stage != RepairStage.Repaired)
text += $" {Mathf.RoundToInt(visuals.StageProgress * 100f)}%";
// Зажата ЛКМ — работаем инструментом
if (Input.GetMouseButton(0))
{
UseActiveTool();
if (!UseTool(visuals)) text = HintFor(visuals.Stage);
}
SetStatus(text);
}
private void UseActiveTool()
private CarPartVisuals FindTarget()
{
if (playerCam == null) return null;
Ray ray = new Ray(playerCam.transform.position, playerCam.transform.forward);
if (!Physics.Raycast(ray, out RaycastHit hit, toolRange, interactableLayer)) return;
CarPartVisuals visuals = hit.collider.GetComponentInParent<CarPartVisuals>();
if (visuals == null) return;
// Ignore: зоны монтажа - это триггеры на том же слое, луч не должен в них упираться
if (!Physics.Raycast(ray, out RaycastHit hit, toolRange, interactableLayer, QueryTriggerInteraction.Ignore))
return null;
if (currentTool == ToolType.Sander)
return hit.collider.GetComponentInParent<CarPartVisuals>();
}
private bool UseTool(CarPartVisuals visuals)
{
float dt = Time.deltaTime;
switch (currentTool)
{
// ШЛИФОВКА: снижаем ржавчину к 0
if (visuals.CurrentRust > 0f)
{
float updatedRust = visuals.CurrentRust - (sandSpeed * Time.deltaTime);
visuals.SetRust(updatedRust);
}
}
else if (currentTool == ToolType.SprayCan)
{
// ПОКРАСКА: красим, только если ржавчина удалена
if (visuals.CurrentRust <= 0.05f)
{
visuals.SetPaintColor(sprayPaintColor);
}
else
{
// Подсказка игроку
Debug.Log("Нельзя красить: деталь еще ржавая! Зашлифуйте её.");
}
case ToolType.RustCleaner:
// TODO: частицы искр / щётки и звук
return visuals.CleanRust(dt / cleanTime);
case ToolType.Putty:
return visuals.ApplyPutty(dt / puttyTime);
case ToolType.Sander:
return visuals.Sand(dt / sandTime);
case ToolType.SprayCan:
// Ремонтная покраска идёт цветом детали, чтобы заплатка слилась с кузовом.
// Целую деталь баллончик перекрашивает в выбранный цвет.
if (visuals.Stage == RepairStage.Sanded) return visuals.PaintRepair(dt / paintTime);
return visuals.Recolor(sprayPaintColor);
default:
return false;
}
}
@@ -68,4 +108,65 @@ public class PlayerToolManager : MonoBehaviour
{
currentTool = newTool;
}
public void SetSprayColor(Color color)
{
sprayPaintColor = color;
}
// ---------- Тексты ----------
private static string StageText(RepairStage stage)
{
switch (stage)
{
case RepairStage.Healthy: return "Деталь целая";
case RepairStage.Rusted: return "Ржавчина";
case RepairStage.Cleaned: return "Зачищено, нужна шпаклёвка";
case RepairStage.Puttied: return "Зашпаклёвано, нужна шлифовка";
case RepairStage.Sanded: return "Отшлифовано, нужна покраска";
default: return "Отремонтировано";
}
}
private static string HintFor(RepairStage stage)
{
switch (stage)
{
case RepairStage.Rusted: return "Сначала счистите ржавчину (зачистка)";
case RepairStage.Cleaned: return "Нужна шпаклёвка (шпатель)";
case RepairStage.Puttied: return "Нужна шлифовка";
case RepairStage.Sanded: return "Нужна покраска (баллончик)";
default: return "Этот инструмент здесь не нужен";
}
}
// ---------- Вывод ----------
private void SetStatus(string value)
{
status = value;
if (statusText != null)
{
statusText.text = value;
statusText.gameObject.SetActive(!string.IsNullOrEmpty(value));
}
}
private void OnGUI()
{
if (statusText != null || string.IsNullOrEmpty(status)) return;
if (guiStyle == null)
{
guiStyle = new GUIStyle(GUI.skin.label)
{
alignment = TextAnchor.MiddleCenter,
fontSize = 22
};
}
GUI.Label(new Rect(Screen.width * 0.5f - 300f, Screen.height * 0.62f, 600f, 40f), status, guiStyle);
}
}
+15 -10
View File
@@ -6,7 +6,8 @@ public class ToolRadialMenu : MonoBehaviour
[Header("Ссылки")]
[SerializeField] private GameObject menuPanel;
[SerializeField] private PlayerToolManager toolManager;
[SerializeField] private Image[] sectorIcons; // 3 иконки (0: Руки, 1: Шлифмашинка, 2: Баллончик)
[Tooltip("По одной иконке на инструмент в порядке ToolType: Руки, Зачистка, Шпатель, Шлифовка, Баллончик")]
[SerializeField] private Image[] sectorIcons;
[Header("Цвета выделения")]
[SerializeField] private Color normalColor = Color.white;
@@ -42,7 +43,11 @@ public class ToolRadialMenu : MonoBehaviour
{
isMenuOpen = true;
menuPanel.SetActive(true);
// Сразу подсвечиваем текущий инструмент
selectedIndex = Mathf.Clamp((int)toolManager.currentTool, 0, Mathf.Max(0, sectorIcons.Length - 1));
HighlightSelection();
// Разблокируем курсор для кругового выбора
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
@@ -50,21 +55,21 @@ public class ToolRadialMenu : MonoBehaviour
private void CalculateMouseSector()
{
if (sectorIcons.Length == 0) return;
Vector2 screenCenter = new Vector2(Screen.width * 0.5f, Screen.height * 0.5f);
Vector2 mouseDelta = (Vector2)Input.mousePosition - screenCenter;
// Если мышь почти в центре — ничего не меняем
// Если мышь почти в центре - ничего не меняем
if (mouseDelta.magnitude < 30f) return;
// Вычисляем угол мыши от -180 до 180 градусов
// Угол мыши 0..360 (0 = вправо, против часовой стрелки)
float angle = Mathf.Atan2(mouseDelta.y, mouseDelta.x) * Mathf.Rad2Deg;
if (angle < 0) angle += 360f; // Переводим в 0..360
if (angle < 0) angle += 360f;
// 3 сектора по 120 градусов:
// Сектор 0 (0..120): Руки
// Сектор 1 (120..240): Шлифмашинка
// Сектор 2 (240..360): Баллончик
selectedIndex = Mathf.FloorToInt(angle / 120f);
// Сектора одинакового размера: для 5 инструментов по 72 градуса
float sectorSize = 360f / sectorIcons.Length;
selectedIndex = Mathf.Clamp(Mathf.FloorToInt(angle / sectorSize), 0, sectorIcons.Length - 1);
HighlightSelection();
}
File diff suppressed because it is too large. Load diff
+90
View File
@@ -0,0 +1,90 @@
#ifndef REPAIR_SURFACE_INCLUDED
#define REPAIR_SURFACE_INCLUDED
// Исправленная послойная модель реставрации кузова без артефактов на границах
void RepairSurface_float(
float N,
float3 BaseColor,
float3 RustColor,
float RustInitial,
float RustAmount,
float PuttyProgress,
float SandProgress,
float PaintProgress,
float PaintSmoothness,
out float3 Albedo,
out float Metallic,
out float Smoothness)
{
const float e = 0.04; // мягкость перехода
const float3 bareMetal = float3(0.55, 0.56, 0.58);
const float3 puttyRaw = float3(0.62, 0.58, 0.50);
const float3 puttySanded = float3(0.72, 0.70, 0.66);
float sand = saturate(SandProgress);
// 1. Исходная зона повреждения детали (0..1)
float zone = smoothstep(1.0 - RustInitial, 1.0 - RustInitial + e, N) * step(0.001, RustInitial);
// 2. Маска шпаклёвки (наносится поверх голого металла)
float fillEdge = 1.0 - PuttyProgress * (RustInitial + e);
float puttyMask = smoothstep(fillEdge + e, fillEdge, N) * step(0.001, PuttyProgress);
if (PuttyProgress >= 0.99) puttyMask = 1.0;
// Свойства подложки (голый металл или шпаклёвка)
float3 underColor = lerp(bareMetal, lerp(puttyRaw, puttySanded, sand), puttyMask);
float underSmooth = lerp(0.45, lerp(0.05, 0.35, sand), puttyMask);
float underMetal = lerp(0.8, 0.0, puttyMask);
// 3. Маска нанесения новой краски (растёт от краёв зоны внутрь)
float paintEdge = (1.0 - RustInitial) + PaintProgress * (RustInitial + e);
float paintMask = (1.0 - smoothstep(paintEdge, paintEdge + e, N)) * step(0.001, PaintProgress);
if (PaintProgress >= 0.99) paintMask = 1.0;
// ВАЖНО: Доля повреждения, которая ЕЩЁ видна (не перекрыта краской).
// При завершении покраски (paintMask = 1) это значение строго равно 0 даже на полутонах!
float damageVisible = zone * (1.0 - paintMask);
// 4. Очаги ржавчины (лежат поверх всего, пока не счищены)
float rust = smoothstep(1.0 - RustAmount, 1.0 - RustAmount + e, N) * step(0.001, RustAmount);
// Смешиваем заводскую краску с повреждением
float3 col = lerp(BaseColor, underColor, damageVisible);
float sm = lerp(PaintSmoothness, underSmooth, damageVisible);
float met = lerp(0.0, underMetal, damageVisible);
// Поверх накладываем оставшуюся ржавчину
col = lerp(col, RustColor, rust);
sm = lerp(sm, 0.1, rust);
met = lerp(met, 0.0, rust);
Albedo = col;
Metallic = met;
Smoothness = sm;
}
void RepairSurface_half(
half N,
half3 BaseColor,
half3 RustColor,
half RustInitial,
half RustAmount,
half PuttyProgress,
half SandProgress,
half PaintProgress,
half PaintSmoothness,
out half3 Albedo,
out half Metallic,
out half Smoothness)
{
float3 a;
float m;
float s;
RepairSurface_float(N, BaseColor, RustColor, RustInitial, RustAmount,
PuttyProgress, SandProgress, PaintProgress, PaintSmoothness, a, m, s);
Albedo = a;
Metallic = m;
Smoothness = s;
}
#endif
+7
View File
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 8406d757d93120545ba59c440d9e5031
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -4272,6 +4272,471 @@ MonoBehaviour:
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -16.250977
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 15
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -16.250977
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 17
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -1.8896484
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 29
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -1.8896484
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 30
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -4.8291016
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 125
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -5.7529297
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 961
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -5.7529297
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 965
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -0.9658203
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 967
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -1.8896484
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 968
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -4.8291016
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 972
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -0.9658203
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 973
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -1.8896484
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 975
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -0.9658203
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 978
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -3.8632812
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 979
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -1.8896484
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 980
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -0.9658203
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 981
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -3.8632812
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 982
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -1.8896484
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 992
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -2.8554688
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 993
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -6.71875
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 997
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -3.7792969
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 998
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -3.7792969
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 1007
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -1.8896484
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 1022
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 977
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -2.8554688
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 1024
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1015
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -0.9658203
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 998
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1015
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -0.9658203
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 1000
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1015
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -0.9658203
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 1007
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1015
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -0.9658203
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 1010
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1018
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -0.9658203
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 998
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1018
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: -0.9658203
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 1007
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
- m_FirstAdjustmentRecord:
m_GlyphIndex: 1018
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0.9658203
m_YAdvance: 0
m_SecondAdjustmentRecord:
m_GlyphIndex: 1012
m_GlyphValueRecord:
m_XPlacement: 0
m_YPlacement: 0
m_XAdvance: 0
m_YAdvance: 0
m_FeatureLookupFlags: 0
m_MarkToBaseAdjustmentRecords: []
m_MarkToMarkAdjustmentRecords: []
m_ShouldReimportFontFeatures: 0
Binary file not shown.
@@ -0,0 +1,145 @@
fileFormatVersion: 2
guid: e51f2e745d4576b47a83d8f86f0e9d51
TextureImporter:
internalIDToNameTable:
- first:
213: -3696744076696302973
second: "\u041D\u0430\u0436\u0434\u0430\u0447\u043A\u0430_0"
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationMethod: 0
spriteTessellationDetail: -1
spriteGeometrySubdivision: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: "\u041D\u0430\u0436\u0434\u0430\u0447\u043A\u0430_0"
rect:
serializedVersion: 2
x: 0
y: 0
width: 531
height: 376
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 38accf239d682bcc0800000000000000
internalID: -3696744076696302973
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
"\u041D\u0430\u0436\u0434\u0430\u0447\u043A\u0430_0": -3696744076696302973
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,145 @@
fileFormatVersion: 2
guid: b3c5bd671864c2449a29c0d5b952d048
TextureImporter:
internalIDToNameTable:
- first:
213: 3880672017184065750
second: "\u0428\u043F\u0430\u0442\u0435\u043B\u044C_0"
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 2
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationMethod: 0
spriteTessellationDetail: -1
spriteGeometrySubdivision: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites:
- serializedVersion: 2
name: "\u0428\u043F\u0430\u0442\u0435\u043B\u044C_0"
rect:
serializedVersion: 2
x: 0
y: 0
width: 576
height: 347
alignment: 0
pivot: {x: 0, y: 0}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
physicsShape: []
tessellationDetail: -1
bones: []
spriteID: 6d80e0293aaead530800000000000000
internalID: 3880672017184065750
vertices: []
indices:
edges: []
weights: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable:
"\u0428\u043F\u0430\u0442\u0435\u043B\u044C_0": 3880672017184065750
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant: