CSG in the player: build time baking and runtime editing
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
調査の方向性
Start by tracing ChiselModelManager.UpdateModels and its #if UNITY_EDITOR block, then follow the build-time scene processing and asset lookups described in the issue. Check how paint settings, hotspot layouts, surface parameter identities, and editor-only mesh data are supplied to player builds, including IL2CPP constraints. Done means an unsaved scene builds with all models visible, and runtime brush edits rebuild correctly in a player build with player tests.
索引モデルが issue の本文から書いたものです。
説明
The CSG only runs in the editor. A build should either bake the models into plain meshes, or keep them editable in the player.
Done when (in 6.6 and Unity 7)
- Baked: a player built from a scene saved with stale meshes shows them up to date, and contains no Chisel components or code.
- Runtime: in a player, changing a brush and calling
ChiselRuntime.Update()changes its mesh, tested in a player build.
Design
One setting per build, "CSG in the player", off by default:
| Setting | Code in the player | Scenes in the player |
|---|---|---|
| Off (baked) | No Chisel assemblies or Burst CSG jobs | Plain meshes and colliders |
| On (runtime) | Core, components, Burst jobs | Chisel components, with meshes up to date at build time |
- The setting should be a build profile sub-asset (
BuildProfile.AddComponent) that writesCHISEL_RUNTIMEinto the profile'sscriptingDefines; CI can useBuildPlayerOptions.extraScriptingDefines. Check that a define set inIPreprocessBuildWithReportis too late, so it has to be in place before the build starts. - With the setting off the code should go too: core, components and dots.extensions should get
"defineConstraints": [ "UNITY_EDITOR || CHISEL_RUNTIME" ](try||in 6.6 and Unity 7 first). A build preprocess should fail clearly when user code references Chisel without the same constraint.
Build step (both settings)
- There should be one
Bake(Scene), called fromIProcessSceneWithReport(6.6) andAssetPostprocessor.OnProcessScene(Unity 7, where the interface is deprecated), likeChiselDrawModesProcessScene, whose debug renderer hiding should move into it. - It should build every model.
- Baked:
- should strip the Chisel components, partial and selection meshes and debug renderers, leaving
MeshFilter,MeshRendererandMeshCollider
- should strip the Chisel components, partial and selection meshes and debug renderers, leaving
- Runtime:
- should keep the components, with the meshes it built
- should optionally keep partial and selection meshes and debug renderers, for a CSG editor that runs in the player (partial and selection meshes are
#if UNITY_EDITORinChiselRenderableObjectstoday, so that code has to compile in a player too) - should write the project's materials into a preloaded asset (a player has no
ProjectSettings/) - should store each model's lightmap UV settings (texels per unit, padding, maximum size), so a player can lay out lightmap UVs as the editor does
- Check first:
- whether the processed scene is isolated from the scenes open in the editor.
- The managers are static,
CompactHierarchyManager.Flushbuilds every dirty tree, and some lookups are global (ChiselPaintManager'sFindObjectsByType, the decal hierarchy scan). Each model is its ownCSGTree, so the CSG results themselves can't mix.
- Scene processing:
- Should be cached by Unity.
- It can run in a worker process isolated from the editor.
- If a lightmapped model's rebuilt meshes differ from the ones saved in the scene, its lightmaps no longer fit: warn to rebake the lighting.
- The callbacks also fire when a scene loads in the editor's Play mode, so we might want to skip this for Play mode.
Runtime (setting on)
- Updating:
- add
ChiselRuntime.Update(), which the game would call after editing; it should callChiselNodeHierarchyManager.Update()andUpdateModels() - everything should be done when
ChiselRuntime.Update()returns: MeshColliders should be baked immediately, not deferred as in the editor (ChiselColliderObjects.DeferBakingoff) - make
UpdateModelswork in a player; only the lightmap resolution update (the player would get the settings from the build step) and the editor's saved mesh reuse (it usesAssetDatabase) should stay editor only - in Play mode only
ChiselRuntime.Update()should update the models:ChiselModelComponent.UpdateModelSettingsLookup()andChiselModelManager.BuildTheNodesOfNow()should not callUpdateModels()then
- add
- Noticing changes:
ChiselRuntime.Update()should checkTransform.hasChangedon the registered nodes to find moved ones- edits should go through the Chisel component setters (e.g.
ChiselBoxComponent.Max), not their serialized fields; check that every setter marks its component dirty
- Loading:
- for now
ChiselRuntime.Update()should rebuild every model; properly detecting when sub-meshes should be updated or not (when unchanged) at build time is #106 and can be tackled later - the project's materials should come from the asset the build step preloads
- for now
- Limits:
- we don't support lightmaps at runtime
- a runtime player would carry
Unity.Entities(used only for blobs) and its world bootstrap: replace the blobs or setUNITY_DISABLE_AUTOMATIC_SYSTEM_BOOTSTRAP
- Not tested: Burst and native containers under IL2CPP, MeshCollider cooking cost.
Order: the build step and baking first, then runtime.
- 主要言語
- C#
- スター
- 135
- フォーク
- 15
- 平均マージ
- 24分
- マージ済み PR(30日)
- 89
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
RadicalCSG/com.chisel のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
RadicalCSG/com.chisel#148 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
RadicalCSG/com.chisel#177 ·
メンテナーはふだん 1 日以内に返信
-
Manually test all generators対応中かも @LogicalError が 1 日前に担当しました。 オープンtask
難易度 4/5 1週間以上 初心者へのやさしさ 15/100
RadicalCSG/com.chisel#166 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Improve decal UXオープンenhancement UX
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
RadicalCSG/com.chisel#165 ·
メンテナーはふだん 1 日以内に返信
-
enhancement UX
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
RadicalCSG/com.chisel#164 ·
メンテナーはふだん 1 日以内に返信
RadicalCSG/com.chisel の issue をすべて見る
似ている issue
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
MustacheCase/zanadir#506 ·
メンテナーはふだん 1 日以内に返信
-
effort:S P3 refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
nightscout/nocturne#3243 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
dasher-project/Dasher-Windows#84 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
libnativeapi/nativeapi#21 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100