Hologram calls, HaulOS phone, Enhanced lighting, smoother camera; Blender remaster review files
Game: - Assistant and Director portraits: GPT backgrounds and a holographic appear/disappear shader (Talk/TalkHolo) instead of on/off - Phone redesigned (HaulOS home, address bar, dock, error/loading states) and the browser link made sturdier - Settings > Graphics > Lighting: Classic / Enhanced (runtime volume, no project assets changed); Enhanced SSAO uses the smooth interleaved-gradient method at high samples so flat panels don't speckle - Painted board textures (T_HullPanel, T_BarnRed) keep only edge wear: the big bare-wood patches read as dirty smudges - The head leans into a sidestep smoothly instead of snapping with A / D - New keys in all 11 languages Review only (nothing swapped into the game yet): ArtSource/Blender/remaster (v1 paint pass of our own models, Synty-built ones left out), remaster/crew (crew repaint with arm, colour-edge and face fixes), remaster_v2 (smooth-geometry pilot). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -77,7 +77,7 @@ namespace GrassCutter
|
||||
readonly Dictionary<string, float> _said = new Dictionary<string, float>();
|
||||
readonly float[] _mood = new float[7];
|
||||
AudioSource _voice;
|
||||
VisualElement _panel, _picture;
|
||||
VisualElement _panel, _frame, _picture;
|
||||
Label _caption;
|
||||
Booth _booth;
|
||||
// the user's filmed loops of her, one per mood
|
||||
@ -128,6 +128,7 @@ namespace GrassCutter
|
||||
I._voice.Stop();
|
||||
I._queue.Clear();
|
||||
I.Panel(false);
|
||||
I._talk?.Cut();
|
||||
I._on = false;
|
||||
}
|
||||
|
||||
@ -135,6 +136,8 @@ namespace GrassCutter
|
||||
{
|
||||
// she lives on the cinema layer, above the windows: a window opened mid-line hides her till it closes
|
||||
if (_panel != null) _panel.style.visibility = UIRoot.I && UIRoot.I.AnyModal ? Visibility.Hidden : Visibility.Visible;
|
||||
// the frame lights up ahead of the hologram filling it, and goes out after
|
||||
if (_frame != null && _talk != null) _frame.style.opacity = Mathf.Clamp01(_talk.Appear * 3f);
|
||||
if (_on || _queue.Count == 0) return;
|
||||
if (!Ready()) return;
|
||||
var (line, at) = _queue.Dequeue();
|
||||
@ -214,22 +217,26 @@ namespace GrassCutter
|
||||
if (on && (_panel == null || _panel.panel == null)) Build();
|
||||
if (_panel == null) return;
|
||||
_booth?.Show(on);
|
||||
if (on) _talk?.Play(0);
|
||||
else _talk?.Stop();
|
||||
// the picture comes in and goes out as a hologram; the panel goes once it has (TalkVideo.Gone)
|
||||
_talk?.Show(on);
|
||||
_caption.style.display = on ? DisplayStyle.Flex : DisplayStyle.None;
|
||||
if (on)
|
||||
{
|
||||
_panel.style.display = DisplayStyle.Flex;
|
||||
_panel.BringToFront();
|
||||
UIK.PopIn(_panel, 0f, 0.25f);
|
||||
UIK.PopIn(_caption, 0.2f, 0.25f);
|
||||
}
|
||||
else _panel.style.display = DisplayStyle.None;
|
||||
else if (_talk == null) _panel.style.display = DisplayStyle.None;
|
||||
}
|
||||
|
||||
void Build()
|
||||
{
|
||||
var root = UIRoot.I ? UIRoot.I.Cinema : null;
|
||||
if (root == null) return;
|
||||
_talk = new TalkVideo("asst", new[] { "happy", "stern", "fed" }, 400, 406);
|
||||
// the window inside its 3 px border, at 1.5x
|
||||
int outW = Mathf.RoundToInt((PicW * 0.8f - 6f) * 1.5f), outH = Mathf.RoundToInt((PicH * 0.8f - 6f) * 1.5f);
|
||||
_talk = new TalkVideo("asst", new[] { "happy", "stern", "fed" }, 400, 406, outW, outH, new Rect(0f, 0f, 1f, 1f), "T_Talk_AsstBg");
|
||||
_talk.Gone = () => { if (_panel != null) _panel.style.display = DisplayStyle.None; };
|
||||
_panel = new VisualElement { pickingMode = PickingMode.Ignore };
|
||||
_panel.style.position = Position.Absolute;
|
||||
_panel.style.left = 22;
|
||||
@ -246,20 +253,15 @@ namespace GrassCutter
|
||||
var edge = new Color(0.55f, 0.85f, 0.95f, 0.9f);
|
||||
frame.style.borderLeftColor = frame.style.borderRightColor = frame.style.borderTopColor = frame.style.borderBottomColor = edge;
|
||||
frame.style.overflow = Overflow.Hidden;
|
||||
frame.style.backgroundColor = new Color(0.08f, 0.12f, 0.22f);
|
||||
var bg = AssetBank.I ? AssetBank.I.Tex("T_Dir_Bg") : null;
|
||||
if (bg)
|
||||
{
|
||||
frame.style.backgroundImage = new StyleBackground(bg);
|
||||
frame.style.unityBackgroundScaleMode = ScaleMode.ScaleAndCrop;
|
||||
frame.style.unityBackgroundImageTintColor = new Color(0.82f, 0.86f, 0.95f);
|
||||
}
|
||||
// see-through glass: the room behind her is in the picture, which the hologram brings in
|
||||
frame.style.backgroundColor = new Color(0.02f, 0.06f, 0.12f, 0.35f);
|
||||
frame.style.opacity = 0f;
|
||||
_frame = frame;
|
||||
_panel.Add(frame);
|
||||
_picture = new VisualElement { pickingMode = PickingMode.Ignore };
|
||||
_picture.style.flexGrow = 1;
|
||||
_picture.style.unityBackgroundScaleMode = ScaleMode.ScaleAndCrop;
|
||||
_talk.Switched = rt => _picture.style.backgroundImage = new StyleBackground(Background.FromRenderTexture(rt));
|
||||
_talk.Switched(_talk.Rt);
|
||||
_picture.style.unityBackgroundScaleMode = ScaleMode.StretchToFill;
|
||||
_picture.style.backgroundImage = new StyleBackground(Background.FromRenderTexture(_talk.Rt));
|
||||
frame.Add(_picture);
|
||||
var tag = UIK.Text(Loc.T("ASSISTANT · G.R.A.S.S.A."), "", frame, true);
|
||||
tag.style.position = Position.Absolute;
|
||||
|
||||
@ -405,20 +405,15 @@ namespace GrassCutter
|
||||
public PhoneCall(VisualElement screen)
|
||||
{
|
||||
_root = Box(screen, 0f, 0f, W, H);
|
||||
_root.style.backgroundColor = new Color(0.1f, 0.16f, 0.3f);
|
||||
// mission control behind him, and him in front from the hips up, like a video call
|
||||
var bg = AssetBank.I ? AssetBank.I.Tex("T_Dir_Bg") : null;
|
||||
if (bg)
|
||||
{
|
||||
_root.style.backgroundImage = new StyleBackground(bg);
|
||||
_root.style.unityBackgroundScaleMode = ScaleMode.ScaleAndCrop;
|
||||
_root.style.unityBackgroundImageTintColor = new Color(0.82f, 0.86f, 0.95f);
|
||||
}
|
||||
_talk = new TalkVideo("boss", new[] { "calm", "stern", "angry" }, 640, 650);
|
||||
_picture = Box(_root, 0f, PicTop, W, H - PicTop - PicBottom);
|
||||
_picture.style.unityBackgroundScaleMode = ScaleMode.ScaleAndCrop;
|
||||
_talk.Switched = rt => _picture.style.backgroundImage = new StyleBackground(Background.FromRenderTexture(rt));
|
||||
_talk.Switched(_talk.Rt);
|
||||
_root.style.backgroundColor = new Color(0.02f, 0.04f, 0.09f);
|
||||
// his office on Earth behind him, him in front from the hips up, like a video call: the whole screen is one
|
||||
// picture, which comes in and goes out as a hologram (TalkVideo)
|
||||
var fig = new Rect(0f, PicBottom / H, 1f, (H - PicTop - PicBottom) / H);
|
||||
_talk = new TalkVideo("boss", new[] { "calm", "stern", "angry" }, 640, 650, RtW, RtH, fig, "T_Talk_BossBg");
|
||||
_picture = Box(_root, 0f, 0f, W, H);
|
||||
_picture.style.unityBackgroundScaleMode = ScaleMode.StretchToFill;
|
||||
_picture.style.backgroundImage = new StyleBackground(Background.FromRenderTexture(_talk.Rt));
|
||||
_talk.Gone = () => _root.style.display = DisplayStyle.None;
|
||||
_fx = Box(_root, 0f, 0f, W, H);
|
||||
|
||||
// the anger vein on his forehead
|
||||
@ -438,7 +433,7 @@ namespace GrassCutter
|
||||
var bar = Box(_root, 0f, 0f, W, 230f);
|
||||
bar.style.backgroundColor = new Color(0.02f, 0.05f, 0.12f, 0.72f);
|
||||
bar.style.alignItems = Align.Center;
|
||||
bar.style.paddingTop = 78;
|
||||
bar.style.paddingTop = 46;
|
||||
var name = UIK.Text("G.R.A.S.S.A.", "", bar, true);
|
||||
name.style.fontSize = 64; name.style.color = new Color(1f, 0.86f, 0.4f);
|
||||
var row = new VisualElement { pickingMode = PickingMode.Ignore };
|
||||
@ -454,6 +449,10 @@ namespace GrassCutter
|
||||
who.style.fontSize = 28; who.style.color = new Color(0.86f, 0.92f, 1f);
|
||||
_timer = UIK.Text("00:00", "", bar, false);
|
||||
_timer.style.fontSize = 26; _timer.style.color = new Color(0.7f, 0.8f, 0.9f, 0.8f);
|
||||
_timer.style.marginTop = 6;
|
||||
// the bar is a fixed height: nothing in it may be squeezed (the row under the name was, to nothing, and the
|
||||
// timer sat on top of it)
|
||||
name.style.flexShrink = 0; row.style.flexShrink = 0; _timer.style.flexShrink = 0;
|
||||
|
||||
// the red button at the foot
|
||||
var hang = Box(_root, (W - 110f) * 0.5f, H - 160f, 110f, 110f);
|
||||
@ -463,7 +462,9 @@ namespace GrassCutter
|
||||
key.style.fontSize = 48; key.style.color = Color.white;
|
||||
key.style.unityTextAlign = TextAnchor.MiddleCenter;
|
||||
key.style.flexGrow = 1;
|
||||
Show(false);
|
||||
// the agency's bar and the button light up ahead of the picture, and go out after it
|
||||
_talk.Drawn = a => { float o = Mathf.Clamp01(a * 3f); bar.style.opacity = o; hang.style.opacity = o; };
|
||||
_root.style.display = DisplayStyle.None;
|
||||
}
|
||||
|
||||
static VisualElement Box(VisualElement parent, float x, float y, float w, float h)
|
||||
@ -482,9 +483,15 @@ namespace GrassCutter
|
||||
|
||||
public void Show(bool on)
|
||||
{
|
||||
_root.style.display = on ? DisplayStyle.Flex : DisplayStyle.None;
|
||||
_booth?.Show(on);
|
||||
if (!on) { _talk?.Stop(); return; }
|
||||
// off: the hologram fades out, then TalkVideo.Gone hides the screen
|
||||
_talk?.Show(on);
|
||||
if (!on)
|
||||
{
|
||||
if (_talk == null) _root.style.display = DisplayStyle.None;
|
||||
return;
|
||||
}
|
||||
_root.style.display = DisplayStyle.Flex;
|
||||
_root.BringToFront();
|
||||
_lastT = 0f;
|
||||
for (int i = 0; i < _mood.Length; i++) _mood[i] = 0f;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -5,35 +5,52 @@ using UnityEngine.Video;
|
||||
namespace GrassCutter
|
||||
{
|
||||
/// <summary>
|
||||
/// A character's talking loops (Assets/StreamingAssets/Talk/<who>_<mood>.webm, VP8 with alpha, made by
|
||||
/// Tools/director/talk_videos.py): one player per mood, each looping into its own texture. The picture shows the one for
|
||||
/// the mood of the moment; the others wait where they left off, so a change of mood is a cut, not a stall.
|
||||
/// A character's talking loops (Assets/StreamingAssets/Talk/<who>_<mood>.webm, made by Tools/director/talk_videos.py):
|
||||
/// one player per mood, each looping into its own texture; the picture shows the one for the mood of the moment, the others
|
||||
/// wait where they left off, so a change of mood is a cut, not a stall.
|
||||
///
|
||||
/// Unity's player drops the webm's alpha and shows the figure on the black it was filmed on. Every frame the shader
|
||||
/// (Resources/Talk/TalkHolo) cuts the black away again, puts the figure over the room behind the character, and draws the
|
||||
/// hologram: <see cref="Show"/> fades the call in with a sweep of light, scanlines
|
||||
/// and glitches, and out the same way; while on, only faint scanlines are left.
|
||||
/// </summary>
|
||||
public class TalkVideo
|
||||
{
|
||||
const float InTime = 0.8f, OutTime = 0.5f;
|
||||
|
||||
readonly VideoPlayer[] _players;
|
||||
readonly RenderTexture[] _rts;
|
||||
readonly RenderTexture[] _raw;
|
||||
readonly RenderTexture _out;
|
||||
readonly Material _mat;
|
||||
int _on = -1;
|
||||
float _appear, _target;
|
||||
bool _clear = true;
|
||||
|
||||
/// <summary>The picture now; <see cref="Switched"/> says when it changes.</summary>
|
||||
public RenderTexture Rt => _rts[Mathf.Max(0, _on)];
|
||||
public System.Action<RenderTexture> Switched;
|
||||
/// <summary>The finished picture, the size of the window it fills.</summary>
|
||||
public RenderTexture Rt => _out;
|
||||
/// <summary>0 gone .. 1 fully there.</summary>
|
||||
public float Appear => _appear;
|
||||
/// <summary>Called once the picture has faded right out after <see cref="Show"/>(false).</summary>
|
||||
public System.Action Gone;
|
||||
/// <summary>Called every frame the picture is drawn, with <see cref="Appear"/>: for what fades along with it.</summary>
|
||||
public System.Action<float> Drawn;
|
||||
|
||||
public TalkVideo(string who, string[] moods, int w, int h)
|
||||
/// <param name="figW">The loops' width and height (the picture half).</param>
|
||||
/// <param name="outW">The window's shape, in pixels to render.</param>
|
||||
/// <param name="figRect">Where the figure stands in the window, 0..1 from the bottom left; it fills it like ScaleAndCrop.</param>
|
||||
/// <param name="bg">Resources/Talk/<bg>: the room behind, filling the window.</param>
|
||||
public TalkVideo(string who, string[] moods, int figW, int figH, int outW, int outH, Rect figRect, string bg)
|
||||
{
|
||||
var go = new GameObject("Talk " + who);
|
||||
Object.DontDestroyOnLoad(go);
|
||||
go.AddComponent<TalkVideoTicker>().Owner = this;
|
||||
_players = new VideoPlayer[moods.Length];
|
||||
_rts = new RenderTexture[moods.Length];
|
||||
_raw = new RenderTexture[moods.Length];
|
||||
for (int i = 0; i < moods.Length; i++)
|
||||
{
|
||||
var rt = new RenderTexture(w, h, 0, RenderTextureFormat.ARGB32) { name = $"Talk {who} {moods[i]}" };
|
||||
var rt = new RenderTexture(figW, figH, 0, RenderTextureFormat.ARGB32) { name = $"Talk {who} {moods[i]}" };
|
||||
rt.Create();
|
||||
// see-through until the first frame is in
|
||||
var was = RenderTexture.active;
|
||||
RenderTexture.active = rt;
|
||||
GL.Clear(true, true, Color.clear);
|
||||
RenderTexture.active = was;
|
||||
Clear(rt, Color.black);
|
||||
var vp = go.AddComponent<VideoPlayer>();
|
||||
vp.playOnAwake = false;
|
||||
vp.source = VideoSource.Url;
|
||||
@ -45,8 +62,38 @@ namespace GrassCutter
|
||||
vp.targetTexture = rt;
|
||||
vp.Prepare();
|
||||
_players[i] = vp;
|
||||
_rts[i] = rt;
|
||||
_raw[i] = rt;
|
||||
}
|
||||
_out = new RenderTexture(outW, outH, 0, RenderTextureFormat.ARGB32) { name = $"Talk {who}" };
|
||||
_out.Create();
|
||||
Clear(_out, Color.clear);
|
||||
|
||||
var shader = Resources.Load<Shader>("Talk/TalkHolo");
|
||||
_mat = new Material(shader) { hideFlags = HideFlags.DontSave };
|
||||
var bgTex = Resources.Load<Texture2D>("Talk/" + bg);
|
||||
_mat.SetTexture("_BgTex", bgTex);
|
||||
_mat.SetFloat("_HasBg", bgTex ? 1f : 0f);
|
||||
_mat.SetVector("_FigST", Cover(figRect, outW, outH, figW, figH));
|
||||
_mat.SetVector("_BgST", Cover(new Rect(0f, 0f, 1f, 1f), outW, outH, bgTex ? bgTex.width : outW, bgTex ? bgTex.height : outH));
|
||||
_mat.SetVector("_Px", new Vector4(outW, outH, 0f, 0f));
|
||||
}
|
||||
|
||||
/// <summary>uv in the window -> uv in a picture of srcW x srcH that fills <paramref name="r"/> (cropped, not squeezed).</summary>
|
||||
static Vector4 Cover(Rect r, int outW, int outH, float srcW, float srcH)
|
||||
{
|
||||
float rw = r.width * outW, rh = r.height * outH;
|
||||
float s = Mathf.Max(rw / srcW, rh / srcH);
|
||||
float fx = rw / (srcW * s), fy = rh / (srcH * s);
|
||||
float sx = fx / r.width, sy = fy / r.height;
|
||||
return new Vector4(sx, sy, 0.5f - fx * 0.5f - r.x * sx, 0.5f - fy * 0.5f - r.y * sy);
|
||||
}
|
||||
|
||||
static void Clear(RenderTexture rt, Color c)
|
||||
{
|
||||
var was = RenderTexture.active;
|
||||
RenderTexture.active = rt;
|
||||
GL.Clear(true, true, c);
|
||||
RenderTexture.active = was;
|
||||
}
|
||||
|
||||
/// <summary>Plays the loop for this mood (and only it).</summary>
|
||||
@ -57,14 +104,44 @@ namespace GrassCutter
|
||||
{
|
||||
if (_on >= 0) _players[_on].Pause();
|
||||
_on = mood;
|
||||
Switched?.Invoke(_rts[mood]);
|
||||
}
|
||||
if (!_players[mood].isPlaying) _players[mood].Play();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
/// <summary>Fades the call in (with the hologram's sweep) or out; out, the loop stops once it's gone.</summary>
|
||||
public void Show(bool on)
|
||||
{
|
||||
if (_on >= 0) _players[_on].Pause();
|
||||
_target = on ? 1f : 0f;
|
||||
if (on && _on < 0) Play(0);
|
||||
}
|
||||
|
||||
/// <summary>Gone at once, no fade (a film cuts in).</summary>
|
||||
public void Cut()
|
||||
{
|
||||
_target = _appear = 0f;
|
||||
Tick();
|
||||
}
|
||||
|
||||
internal void Tick()
|
||||
{
|
||||
float dt = Time.unscaledDeltaTime;
|
||||
_appear = Mathf.MoveTowards(_appear, _target, dt / (_target > _appear ? InTime : OutTime));
|
||||
if (_appear <= 0f && _target <= 0f)
|
||||
{
|
||||
if (_clear) return;
|
||||
_clear = true;
|
||||
if (_on >= 0) _players[_on].Pause();
|
||||
Clear(_out, Color.clear);
|
||||
Drawn?.Invoke(0f);
|
||||
Gone?.Invoke();
|
||||
return;
|
||||
}
|
||||
_clear = false;
|
||||
if (_on < 0) return;
|
||||
_mat.SetFloat("_Appear", _appear);
|
||||
_mat.SetFloat("_T", Time.unscaledTime);
|
||||
Graphics.Blit(_raw[_on], _out, _mat);
|
||||
Drawn?.Invoke(_appear);
|
||||
}
|
||||
|
||||
/// <summary>The Director: calm (and pleased), stern (and worried), furious.</summary>
|
||||
@ -81,4 +158,11 @@ namespace GrassCutter
|
||||
return (Mood)best;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Draws a <see cref="TalkVideo"/>'s picture once a frame, after the players have had theirs.</summary>
|
||||
public class TalkVideoTicker : MonoBehaviour
|
||||
{
|
||||
public TalkVideo Owner;
|
||||
void LateUpdate() => Owner?.Tick();
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,6 +163,8 @@ namespace GrassCutter
|
||||
SetChoice(Loc.T("Grass density"), Loc.T("How many blades are drawn. There is just as much to cut either way."),
|
||||
new[] { Loc.T("Low"), Loc.T("Medium"), Loc.T("High") }, () => GameSettings.GrassDetail, v => { GameSettings.GrassDetail = v; RefreshRows(); });
|
||||
SetToggle(Loc.T("Bloom"), Loc.T("A soft glow around the sun, lamps and anything bright."), () => GameSettings.Bloom, v => { GameSettings.Bloom = v; RefreshRows(); });
|
||||
SetChoice(Loc.T("Lighting"), Loc.T("Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look."),
|
||||
new[] { Loc.T("Classic"), Loc.T("Enhanced") }, () => GameSettings.Lighting, v => GameSettings.Lighting = v);
|
||||
}
|
||||
|
||||
void AudioTab()
|
||||
|
||||
Reference in New Issue
Block a user