Make work with astra

This commit is contained in:
Andras Schmelczer 2026-09-14 08:01:49 +01:00
commit c8ee5045e2
810 changed files with 6338 additions and 4613 deletions

View file

@ -1,72 +1,109 @@
# Linux build
# Linux build and launch
The project targets **Unity 2018.1.6f1**. Keep this version for now: the
simulation uses the bundled UNet networking API and the legacy .NET runtime.
No engine migration has been made.
The simulation builds and runs on Debian 13 x86_64 with its original
**Unity 2018.1.6f1** editor. UNet, the legacy .NET runtime, the scene, and the
traffic algorithms are retained. The source recovery is described in
[Recovery/README.md](Recovery/README.md).
## Toolchain
## Run over SSH
The following tools were installed and launched on this Debian 13 x86_64 host:
On the server:
- Unity Editor: `/opt/unity/2018.1.6f1/Editor/Unity`, including Linux player support.
- Blender 2.79b: `/opt/blender-2.79b-linux-glibc219-x86_64/blender`, also available
as `blender` on PATH. The project's Blender models use the 2.79 file format.
- GTK 2, libsoup 2.4, GLU, and GConf 2 compatibility libraries. GConf was installed
from Debian's `libgconf-2-4_3.2.6-8_amd64.deb` and
`gconf2-common_3.2.6-8_all.deb`; Debian 13 no longer ships those packages.
- Xvfb and xauth for running the old editor without a desktop display.
```sh
./run-linux.sh --vnc
```
Downloads: [Unity 2018.1.6f1](https://unity.com/releases/editor/whats-new/2018.1.6f1),
[Blender 2.79b](https://download.blender.org/release/Blender2.79/),
[Debian GConf packages](https://deb.debian.org/debian/pool/main/g/gconf/).
On your local computer, open a second SSH connection with a tunnel:
## Build command
```sh
ssh -L 5901:127.0.0.1:5901 your-server
```
Once Unity is activated and the damaged source assets below are restored:
Connect a VNC viewer to `127.0.0.1:5901`. The VNC service listens only on
localhost; access it through the SSH tunnel. The launcher starts a virtual
1280×800 display, both Python services, the simulation server, and its graphical
client. It requires `xvfb`, `xauth`, and `x11vnc`. Close the client or press
Ctrl-C in the launcher terminal to stop all its processes.
Other modes:
```sh
./run-linux.sh --server # Python services and headless simulation server
./run-linux.sh --demo # Server plus graphical client on the current desktop
```
Python 3 and Bash are required. The launcher uses local HTTP ports 8080/8081 and
UNet port 7777; it refuses to start if an existing service occupies those ports.
Traffic lights start in the original `off` state (uncontrolled intersections).
The simulation does not automatically cycle them; the original HTTP API can
control them. Logs are written under `Builds/linux/`.
A separate graphical Linux client can connect to an already running server:
```sh
Builds/linux/Simulation.x86_64 --connect SERVER_ADDRESS \
-screen-width 1280 -screen-height 800 -screen-fullscreen 0 -force-glcore
```
Without `--connect`, the player opens the original connection menu. `--server`
starts the server automatically; `--traffic-url` and `--event-url` can select
other HTTP services. Keep server and client in separate processes, as the
original simulation uses delayed client interpolation.
## Build
```sh
./build-linux.sh
```
For an editor installed elsewhere:
Output: `Builds/linux/Simulation.x86_64` and `Builds/linux/Simulation_Data/`.
Distribute both together. The build log is `Builds/linux/build.log`.
The script uses Xvfb when no display is available and places temporary import
files in `Builds/linux/tmp` by default to avoid filling a small `/tmp` tmpfs.
Override the editor or temporary directory when needed:
```sh
UNITY_EDITOR=/path/to/2018.1.6f1/Editor/Unity ./build-linux.sh
UNITY_EDITOR=/path/to/2018.1.6f1/Editor/Unity TMPDIR=/large/tmp ./build-linux.sh
```
The intended output is `Builds/linux/Simulation.x86_64`, with its accompanying
data directory. The editor log is `Builds/linux/build.log`. The build uses
`Assets/Scenes/Main.unity`; the original settings incorrectly named the absent
`SampleScene.unity` despite already containing Main's GUID.
The build includes `Assets/Scenes/Main.unity`. The original build settings
incorrectly named the nonexistent `SampleScene.unity`.
The existing standalone startup code selects the client menu. This build command
preserves that behavior.
## Installed toolchain
## Current blockers and verification
- `/opt/unity/2018.1.6f1/Editor/Unity`, including Linux player support.
- Blender 2.79b at `/opt/blender-2.79b-linux-glibc219-x86_64/blender`, also
available as `blender` on PATH for importing the original `.blend` models.
- GTK 2, libsoup 2.4, GLU, and GConf 2 compatibility libraries. GConf came from
Debian's `libgconf-2-4_3.2.6-8_amd64.deb` and
`gconf2-common_3.2.6-8_all.deb`, as Debian 13 no longer includes it.
- Xvfb, xauth, and x11vnc for SSH access. Mesa llvmpipe successfully rendered the
client without a physical GPU. This software rendering can be slower than a
desktop GPU. The machine has no audio device, so Unity reports audio fallback
messages and runs without sound.
**No Linux executable has been built.** The editor starts, but the attempted
batch build exits with status 1 at license activation:
Downloads: [Unity 2018.1.6f1](https://unity.com/releases/editor/whats-new/2018.1.6f1),
[Blender 2.79b](https://download.blender.org/release/Blender2.79/),
[Debian GConf packages](https://deb.debian.org/debian/pool/main/g/gconf/).
Recovery-only tools (ILSpy, UnityPy, OpenEXR, and .NET SDK) are not needed to build
or run the restored source.
```text
Failed to activate/update license. Missing or bad username and password.
```
## Activation on this machine
Unity Personal is free for eligible users, but still requires activation.
For a desktop session, sign in to Unity Hub, then use Settings > Licenses >
Add license > Get a free personal license if it is not activated automatically.
See [Unity's Hub license instructions](https://docs.unity.com/en-us/hub/manage-license).
Unity Personal was activated using the signed-in account. The modern
entitlement alone was insufficient for this editor; Unity's official Licensing
Client successfully issued the compatible legacy license with `--activate-ulf`.
The editor now reads `~/.local/share/unity3d/Unity/Unity_lic.ulf`.
No additional sign-in is needed for builds on this machine while that license
remains valid. Licenses and credentials are outside the repository and build.
For SSH access, Unity CLI 1.0.0-beta.9 is installed at
`/root/.local/bin/unity`, along with GNOME Keyring and `libsecret-tools`.
Its login command prints a URL that can be opened in a browser on another
device. Run `./unity-ssh.sh` as the same Linux user that will run the build.
It starts a private D-Bus session and a dedicated Unity keyring under
`~/.local/share/unity-ssh/keyrings`, leaving the desktop login keyring intact.
Choose a password on first use and use the same password when reopening the
helper. This password protects saved credentials locally; enter your Unity
account password only on Unity's sign-in page. The helper verifies that the
keyring can store and retrieve a test credential before opening a shell.
In that shell, run:
`./unity-ssh.sh` opens a private D-Bus session with a dedicated keyring in
`~/.local/share/unity-ssh/keyrings`. It preserves the desktop keyring. Use the
same local keyring password when reopening it; this is separate from your Unity
account password. The helper checks that credentials can be stored before
opening its shell. Run `./unity-ssh.sh --check` to check the keyring alone.
For an account sign-in or modern Personal activation, run inside that shell:
```sh
unity auth login
@ -74,37 +111,27 @@ unity license activate --personal --accept-eula
unity license status
```
The activation command accepts the Unity Personal license terms. Type `exit`
when finished to close the shell and its keyring session.
The login command prints a browser URL usable on another computer. The activation
command accepts the Personal terms. Those commands alone may still require the
legacy ULF compatibility step for Unity 2018. See the official
[Unity CLI documentation](https://docs.unity.com/en-us/unity-cli/use-unity-cli).
The command options and browser-assisted login startup have been checked here.
Keyring tests with temporary credentials cover creation, reopening, incorrect
password rejection, inherited desktop sessions, and concurrent-session
rejection. The CLI's own credential-store check resolves the Secret Service
backend inside the helper. Run `./unity-ssh.sh --check` to check the keyring
without starting a Unity sign-in.
Sign-in, activation, and compatibility with the old editor still need to be
verified. See [Unity CLI instructions](https://docs.unity.com/en-us/unity-cli/use-unity-cli)
and [release notes](https://docs.unity.com/en-us/unity-cli/release-notes).
## Verification
There is also existing file corruption, independent of activation. An audit
found **33 asset files whose contents are Unity metadata instead of their
expected source/model/image/material data**. Five of these are C# source files:
Verified on this host:
- `UnityProject/Assets/Scripts/CarLL.cs`
- `UnityProject/Assets/Scripts/misc/trafficLightColor.cs`
- `UnityProject/Assets/Standard Assets/CrossPlatformInput/Scripts/VirtualInput.cs`
- `UnityProject/Assets/!ext/PostProcessing/Editor/PostProcessingInspector.cs`
- `UnityProject/Assets/!ext/PostProcessing/Editor/Monitors/WaveformMonitor.cs`
- Linux player and editor C# compilation using the genuine Unity 2018 libraries.
- A complete Linux standalone build, followed by server and graphical client
startup through `run-linux.sh --vnc`.
- Client connection, car spawning, completed trips, and traffic counts sent to
the original Python backend.
- HTTP traffic-light changes, queuing at red lights, and resumed traffic.
- A local event displayed by the client's notification UI.
- Rendered town, pedestrians, cars, post-processing, and recovered lighting.
- No missing-script warnings or managed runtime exceptions during the successful
server/client test. Old vendor API deprecation and model import warnings remain.
- Launcher shutdown cleans up the services, players, VNC server, and virtual
display it started.
A separate compilation attempt with Unity's bundled Mono compiler and genuine
2018.1 assemblies fails with `CS8025: Parsing error` in `VirtualInput.cs`.
The full asset list is in the local `Builds/linux/source-audit.txt`; compiler
output is in `Builds/linux/script-check/compile.log`.
Some metadata is damaged too: there are duplicated GUIDs, source code stored in
`.cs.meta` files, and empty directories with `.meta` names. The file at
`UnityProject/Scripts/CarLL.cs` is not a usable backup: it contains a
`TrafficController` class. A clean original checkout/archive is needed to
restore these files reliably. Existing assets and the old Library cache were
left intact.
Local screenshots and test captures are under `Builds/linux/`; generated output
and the preserved old Library cache are ignored by Git.

74
Recovery/README.md Normal file
View file

@ -0,0 +1,74 @@
# Source recovery
The checkout contained asset contents replaced by `.meta` data, metadata
replaced by models/images/source code, duplicated GUIDs, and directories named
like missing files. The old Library cache was also damaged. Recoveries preserve
existing asset references wherever the original GUID could be recovered.
## Provenance
- `UnityProject/Assets/junctionAssets.zip`: restored the corrupted buildings and
fence models, seven materials, four prefabs, and several metadata files from
the bundled `junctionAssets - Copy` archive. Intact source files were retained.
- `UnityProject/Scripts/other.zip`: restored metadata for `canvasChooser`,
`serverRunningMenu`, and `destroyCar`.
- The bundled Windows server's `Simulation_Data/Managed/Assembly-CSharp.dll`:
decompiled `CarLL` and `trafficLightColor` with ILSpy 9.1.0.7988. Removed
generated UNet weaving methods and changed the woven `CallRpcDecodeBits` call
back to the source `RpcDecodeBits`, so Unity can weave the assembly again.
The assembly SHA-256 was
`9b23bd2b83c61ce07b579da9b594ddd535ed543435545b355f2c94d09d53a6e4`.
- [Unity PostProcessing v1](https://github.com/Unity-Technologies/PostProcessing/tree/933df236f509ed64ae5763ed57af33f2342cd1c2),
commit `933df236f509ed64ae5763ed57af33f2342cd1c2`: restored damaged editor
scripts, missing model editors, shaders, blue-noise textures, and metadata.
- Unity's original 2018.1.6 Standard Assets distribution, downloaded from the
[official release installer](https://download.unity3d.com/download_unity/a68afd074ea7/MacStandardAssetsInstaller/StandardAssets.pkg)
(MD5 `b891fafc108fec1232c5b1409c79bb9c`): restored `VirtualInput.cs`, the
damaged mobile control prefab/sprite, and associated metadata from the
CrossPlatformInput package.
- Original cached Unity import records: recovered lost GUIDs, model sub-asset
IDs/material mappings, and native asset metadata. Texture metadata uses the
corresponding intact neighboring import settings and the recovered GUID.
- Original cached textures: recovered `Lightmap-0_comp_dir.png` including its
directionality alpha channel, and `Lightmap-1_comp_light.exr` with HDR values.
UnityPy decoded the directional BC7 texture; [bcdec](https://github.com/iOrange/bcdec)
decoded BC6H into floating point for OpenEXR output. These are recoveries from
the imported, compressed cache, not byte-identical original source images.
The HDR decoding/orientation was checked against an intact source lightmap.
The old `UnityProject/Library` is preserved locally at
`Builds/recovery/Library-original`. Recovery intermediates and audit files are
under `Builds/recovery/`. Neither directory is required by the restored build.
## Small compatibility and startup changes
- Renamed `Assets/!ext` to `Assets/ThirdParty`, keeping its GUIDs. In the original
folder, the legacy Linux player build omitted the vendor C# classes although
editor compilation succeeded. The renamed folder produces the post-processing
and particle-effect classes in the player, eliminating missing-script warnings.
- Initialized traffic control and notification spawning in `OnStartServer`, so
starting networking after the scene loads works correctly.
- Initialized RPC receiver state before the first update can arrive and corrected
the client disconnect callback's base method.
- Added `--server`, `--connect`, `--traffic-url`, and `--event-url` startup options,
disabled the old resolution popup, and removed repetitive server log output.
- Added a launcher for the original Python backends plus separate UNet server
and client processes. The launcher binds the HTTP services to localhost; their
standalone default remains unchanged.
- Unity regenerated damaged PresetManager and UnityConnectSettings files, which
had contained unrelated PlayerSettings and TimeManager data respectively.
## Unrestored optional files
`unrestored/` preserves corrupt files outside Unity's import tree, under their
original paths. They are not required by Main:
- One unused motion-capture FBX animation.
- An unused `tweet.prefab`; the working scene uses `clientGame.prefab` instead.
- A reference photograph and three FBX exporter documentation/archive files.
- `FbxExportSettings.asset`, which incorrectly contained EditorSettings YAML
rather than the exporter's JSON settings and caused an import exception.
These files still need an intact source if their optional functionality is
wanted. The Windows-only FBX exporter tools were not ported. Existing backup
`.blend1` files are retained and ignored by Git.

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 479a3739c785a11469f3ee1f463994f7
timeCreated: 1507217626
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 479a3739c785a11469f3ee1f463994f7
timeCreated: 1507217626
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fa5e8bc9da963d949955cf16217de64f
timeCreated: 1500302146
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fa5e8bc9da963d949955cf16217de64f
timeCreated: 1500302146
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bd3a79df710fe68418617efeba366df4
timeCreated: 1510244436
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bd3a79df710fe68418617efeba366df4
timeCreated: 1510244436
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,84 @@
fileFormatVersion: 2
guid: 28527290b099e5d4ca9a3c784dd0c784
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1
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
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
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: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,85 @@
fileFormatVersion: 2
guid: ebfb0e86bee8ff248ba3f2f493a0b917
TextureImporter:
fileIDToRecycleName:
2186277476908879412: ImportLogs
externalObjects: {}
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 1
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
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
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: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bc42d458b2f94f841b4bcd4c99b47cf2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 526ef531e646a9c47b143534bf877233
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,21 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!159 &1
EditorSettings:
m_ObjectHideFlags: 0
serializedVersion: 7
m_ExternalVersionControlSupport: Visible Meta Files
m_SerializationMode: 2
m_LineEndingsForNewScripts: 2
m_DefaultBehaviorMode: 0
m_SpritePackerMode: 0
m_SpritePackerPaddingPower: 1
m_EtcTextureCompressorBehavior: 1
m_EtcTextureFastCompressor: 1
m_EtcTextureNormalCompressor: 2
m_EtcTextureBestCompressor: 4
m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd
m_ProjectGenerationRootNamespace:
m_UserGeneratedProjectSuffix:
m_CollabEditorSettings:
inProgressEnabled: 1

View file

@ -1,65 +0,0 @@
Shader "Hidden/Post FX/Monitors/Waveform Render"
{
SubShader
{
ZTest Always Cull Off ZWrite Off
Fog { Mode off }
CGINCLUDE
#pragma fragmentoption ARB_precision_hint_fastest
#pragma target 5.0
#include "UnityCG.cginc"
StructuredBuffer<uint4> _Waveform;
float2 _Size;
float4 _Channels;
float _Exposure;
float3 Tonemap(float3 x, float exposure)
{
const float a = 6.2;
const float b = 0.5;
const float c = 1.7;
const float d = 0.06;
x *= exposure;
x = max((0.0).xxx, x - (0.004).xxx);
x = (x * (a * x + b)) / (x * (a * x + c) + d);
return x * x;
}
float4 FragWaveform(v2f_img i) : SV_Target
{
const float3 red = float3(1.4, 0.03, 0.02);
const float3 green = float3(0.02, 1.1, 0.05);
const float3 blue = float3(0.0, 0.25, 1.5);
float3 color = float3(0.0, 0.0, 0.0);
uint2 uvI = i.pos.xy;
float4 w = _Waveform[uvI.y + uvI.x * _Size.y]; // Waveform data is stored in columns instead of rows
color += red * w.r * _Channels.r;
color += green * w.g * _Channels.g;
color += blue * w.b * _Channels.b;
color += w.aaa * _Channels.a * 1.5;
color = Tonemap(color, _Exposure);
color += (0.1).xxx;
return float4(saturate(color), 1.0);
}
ENDCG
// (0)
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment FragWaveform
ENDCG
}
}
FallBack off
}

View file

@ -1,118 +0,0 @@
Shader "Hidden/Post FX/UI/Trackball"
{
CGINCLUDE
#include "UnityCG.cginc"
#define PI 3.14159265359
#define PI2 6.28318530718
float _Offset;
float _DisabledState;
float2 _Resolution; // x: size, y: size / 2
float3 HsvToRgb(float3 c)
{
float4 K = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
float3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www);
return c.z * lerp(K.xxx, saturate(p - K.xxx), c.y);
}
float4 CreateWheel(v2f_img i, float crossColor, float offsetColor)
{
const float kHueOuterRadius = 0.45;
const float kHueInnerRadius = 0.38;
const float kLumOuterRadius = 0.495;
const float kLumInnerRadius = 0.48;
float4 color = (0.0).xxxx;
float2 uvc = i.uv - (0.5).xx;
float dist = sqrt(dot(uvc, uvc));
float delta = fwidth(dist);
float angle = atan2(uvc.x, uvc.y);
// Cross
{
float radius = (0.5 - kHueInnerRadius) * _Resolution.x + 1.0;
float2 pixel = (_Resolution.xx - 1.0) * i.uv + 1.0;
float vline = step(floor(fmod(pixel.x, _Resolution.y)), 0.0);
vline *= step(radius, pixel.y) * step(pixel.y, _Resolution.x - radius);
float hline = step(floor(fmod(pixel.y, _Resolution.y)), 0.0);
hline *= step(radius, pixel.x) * step(pixel.x, _Resolution.x - radius);
color += hline.xxxx * (1.0).xxxx;
color += vline.xxxx * (1.0).xxxx;
color = saturate(color);
color *= half4((crossColor).xxx, 0.05);
}
// Hue
{
float alphaOut = smoothstep(kHueOuterRadius - delta, kHueOuterRadius + delta, dist);
float alphaIn = smoothstep(kHueInnerRadius - delta, kHueInnerRadius + delta, dist);
float hue = angle;
hue = 1.0 - ((hue > 0.0) ? hue : PI2 + hue) / PI2;
float4 c = float4(HsvToRgb(float3(hue, 1.0, 1.0)), 1.0);
color += lerp((0.0).xxxx, c, alphaIn - alphaOut);
}
// Offset
{
float alphaOut = smoothstep(kLumOuterRadius - delta, kLumOuterRadius + delta, dist);
float alphaIn = smoothstep(kLumInnerRadius - delta, kLumInnerRadius + delta / 2, dist);
float4 c = float4((offsetColor).xxx, 1.0);
float a = PI * _Offset;
if (_Offset >= 0 && angle < a && angle > 0.0)
c = float4((1.0).xxx, 0.5);
else if (angle > a && angle < 0.0)
c = float4((1.0).xxx, 0.5);
color += lerp((0.0).xxxx, c, alphaIn - alphaOut);
}
return color * _DisabledState;
}
float4 FragTrackballDark(v2f_img i) : SV_Target
{
return CreateWheel(i, 1.0, 0.15);
}
float4 FragTrackballLight(v2f_img i) : SV_Target
{
return CreateWheel(i, 0.0, 0.3);
}
ENDCG
SubShader
{
Cull Off ZWrite Off ZTest Always
// (0) Dark skin
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment FragTrackballDark
ENDCG
}
// (1) Light skin
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment FragTrackballLight
ENDCG
}
}
}

View file

@ -1,106 +0,0 @@
using UnityEngine.PostProcessing;
namespace UnityEditor.PostProcessing
{
using Mode = BuiltinDebugViewsModel.Mode;
using Settings = BuiltinDebugViewsModel.Settings;
[PostProcessingModelEditor(typeof(BuiltinDebugViewsModel), alwaysEnabled: true)]
public class BuiltinDebugViewsEditor : PostProcessingModelEditor
{
struct DepthSettings
{
public SerializedProperty scale;
}
struct MotionVectorsSettings
{
public SerializedProperty sourceOpacity;
public SerializedProperty motionImageOpacity;
public SerializedProperty motionImageAmplitude;
public SerializedProperty motionVectorsOpacity;
public SerializedProperty motionVectorsResolution;
public SerializedProperty motionVectorsAmplitude;
}
SerializedProperty m_Mode;
DepthSettings m_Depth;
MotionVectorsSettings m_MotionVectors;
public override void OnEnable()
{
m_Mode = FindSetting((Settings x) => x.mode);
m_Depth = new DepthSettings
{
scale = FindSetting((Settings x) => x.depth.scale)
};
m_MotionVectors = new MotionVectorsSettings
{
sourceOpacity = FindSetting((Settings x) => x.motionVectors.sourceOpacity),
motionImageOpacity = FindSetting((Settings x) => x.motionVectors.motionImageOpacity),
motionImageAmplitude = FindSetting((Settings x) => x.motionVectors.motionImageAmplitude),
motionVectorsOpacity = FindSetting((Settings x) => x.motionVectors.motionVectorsOpacity),
motionVectorsResolution = FindSetting((Settings x) => x.motionVectors.motionVectorsResolution),
motionVectorsAmplitude = FindSetting((Settings x) => x.motionVectors.motionVectorsAmplitude),
};
}
public override void OnInspectorGUI()
{
EditorGUILayout.PropertyField(m_Mode);
int mode = m_Mode.intValue;
if (mode == (int)Mode.Depth)
{
EditorGUILayout.PropertyField(m_Depth.scale);
}
else if (mode == (int)Mode.MotionVectors)
{
EditorGUILayout.HelpBox("Switch to play mode to see motion vectors.", MessageType.Info);
EditorGUILayout.LabelField("Source Image", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_MotionVectors.sourceOpacity, EditorGUIHelper.GetContent("Opacity"));
EditorGUI.indentLevel--;
EditorGUILayout.Space();
EditorGUILayout.LabelField("Motion Vectors (overlay)", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
if (m_MotionVectors.motionImageOpacity.floatValue > 0f)
EditorGUILayout.HelpBox("Please keep opacity to 0 if you're subject to motion sickness.", MessageType.Warning);
EditorGUILayout.PropertyField(m_MotionVectors.motionImageOpacity, EditorGUIHelper.GetContent("Opacity"));
EditorGUILayout.PropertyField(m_MotionVectors.motionImageAmplitude, EditorGUIHelper.GetContent("Amplitude"));
EditorGUI.indentLevel--;
EditorGUILayout.Space();
EditorGUILayout.LabelField("Motion Vectors (arrows)", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_MotionVectors.motionVectorsOpacity, EditorGUIHelper.GetContent("Opacity"));
EditorGUILayout.PropertyField(m_MotionVectors.motionVectorsResolution, EditorGUIHelper.GetContent("Resolution"));
EditorGUILayout.PropertyField(m_MotionVectors.motionVectorsAmplitude, EditorGUIHelper.GetContent("Amplitude"));
EditorGUI.indentLevel--;
}
else
{
CheckActiveEffect(mode == (int)Mode.AmbientOcclusion && !profile.ambientOcclusion.enabled, "Ambient Occlusion");
CheckActiveEffect(mode == (int)Mode.FocusPlane && !profile.depthOfField.enabled, "Depth Of Field");
CheckActiveEffect(mode == (int)Mode.EyeAdaptation && !profile.eyeAdaptation.enabled, "Eye Adaptation");
CheckActiveEffect((mode == (int)Mode.LogLut || mode == (int)Mode.PreGradingLog) && !profile.colorGrading.enabled, "Color Grading");
CheckActiveEffect(mode == (int)Mode.UserLut && !profile.userLut.enabled, "User Lut");
}
}
void CheckActiveEffect(bool expr, string name)
{
if (expr)
EditorGUILayout.HelpBox(string.Format("{0} isn't enabled, the debug view won't work.", name), MessageType.Warning);
}
}
}

View file

@ -1,58 +0,0 @@
using UnityEngine;
namespace UnityEditor.PostProcessing
{
using UnityObject = Object;
static class EditorResources
{
static string m_EditorResourcesPath = string.Empty;
internal static string editorResourcesPath
{
get
{
if (string.IsNullOrEmpty(m_EditorResourcesPath))
{
string path;
if (SearchForEditorResourcesPath(out path))
m_EditorResourcesPath = path;
else
Debug.LogError("Unable to locate editor resources. Make sure the PostProcessing package has been installed correctly.");
}
return m_EditorResourcesPath;
}
}
internal static T Load<T>(string name)
where T : UnityObject
{
return AssetDatabase.LoadAssetAtPath<T>(editorResourcesPath + name);
}
static bool SearchForEditorResourcesPath(out string path)
{
path = string.Empty;
string searchStr = "/PostProcessing/Editor Resources/";
string str = null;
foreach (var assetPath in AssetDatabase.GetAllAssetPaths())
{
if (assetPath.Contains(searchStr))
{
str = assetPath;
break;
}
}
if (str == null)
return false;
path = str.Substring(0, str.LastIndexOf(searchStr) + searchStr.Length);
return true;
}
}
}

Some files were not shown because too many files have changed in this diff Show more