Before using Planet Forge, you must install the Burst package from the Window / Package Manager inside Unity. Once installed, make sure it’s enabled for maximum performance. 在使用 Planet Forge 之前,您必须从 Unity 中的 Window / 包管理器安装 Burst 包。安装完成后,请确保它已启用以获得最佳性能。
Getting Started 开始使用
The planet example scenes are in the Plugins/CW/Planet Forge/Scenes folder. These show you what a fully configured planet with atmosphere looks like with different settings. 行星示例场景位于 Plugins/CW/Planet Forge/Scenes 文件夹中。这些场景展示了不同设置下,一个完全配置好的带有大气的行星的外观。
The tutorial scenes for the planet surface are in the Plugins/CW/SpaceGraphicsToolkit/Features/Landscape/Examples folder. These teach you about the major components and settings for the planet surface. 行星表面的教程场景位于“Plugins/CW/SpaceGraphicsToolkit/Features/Landscape/Examples”文件夹中。这些场景教您关于行星表面的主要组件和设置。
The tutorial scenes for the planet atmosphere are in the Plugins/CW/SpaceGraphicsToolkit/Features/Sky/Examples folder. These teach you about the major components and settings for the planet atmosphere. 行星大气教程场景位于“Plugins/CW/SpaceGraphicsToolkit/Features/Sky/Examples”文件夹中。这些场景向您介绍了行星大气的关键组件和设置。
Make Your Own Planet 创建您的星球
To make your own planet, I recommend you begin with one of the example scenes in the Plugins/CW/Planet Forge/Scenes folder. For example: 为了创建自己的星球,我建议您从“Plugins/CW/Planet Forge/Scenes”文件夹中的示例场景开始。例如:
In the “Alythar” demo scene, you can find the “Alythar” GameObject. 在“Alythar”演示场景中,您可以找到“Alythar”游戏对象。
This GameObject has two children: SgtSphereLandscape, and SgtSky. 这个 GameObject 有两个子对象:SgtSphereLandscape 和 SgtSky。
The SgtSphereLandscape GameObject has the SgtSphereLandscape component. This component has the Radius setting, which you can set to your desired value. SgtSphereLandscape GameObject 具有 SgtSphereLandscape 组件。此组件具有半径设置,您可以将其设置为所需值。
If you select the SgtSky GameObject, you can see it has the SgtSky component, with the InnerMeshRadius setting. Make sure this setting matches or is close to your planet surface Radius value. 如果您选择 SgtSky GameObject,您可以看到它具有 SgtSky 组件,并设置了 InnerMeshRadius。请确保此设置与您的星球表面半径值匹配或接近。
On the same SgtSky GameObject, you can click the SgtSkyDepthTex component’s Randomize Hue button to quickly change the color. You can also see the SgtSkyLightingTex component, and click the Randomize Sharpness RGB button to change the color of the night/dark transition. 在同一 SgtSky GameObject 上,您可以点击 SgtSkyDepthTex 组件的随机化色调按钮来快速更改颜色。您还可以看到 SgtSkyLightingTex 组件,并点击随机化锐度 RGB 按钮来更改夜晚/黑暗过渡的颜色。
Next, you can see the SgtSphereLandscape GameObject has a child called SgtLandscapeBiome. If you’ve changed the SgtSphereLandscape component’s Radius value, then you may want to increase the SurfaceScale. Next, you can click the various Randomize buttons to see what different settings look like. 接下来,您可以看到 SgtSphereLandscape GameObject 有一个名为 SgtLandscapeBiome 的子对象。如果您已更改 SgtSphereLandscape 组件的半径值,那么您可能需要增加 SurfaceScale。接下来,您可以点击不同的随机化按钮,看看不同的设置看起来如何。
If your planet is very large, you may want to add an additional layer to the Layers list. If you add an additional layer, I recommend you make the Size value smaller than the size of the previous layer. For example, if layer 0 has a size of 100, then layer 1 can have a size of something like 14.1 recommend dividing the previous size by a prime number, so the tiling is less apparent. 如果您的星球非常大,您可能想在图层列表中添加一个额外的图层。如果您添加一个额外的图层,我建议您将大小值设置得比上一个图层小。例如,如果第 0 层的大小为 100,那么第 1 层的大小可以是 14.1 左右。我建议将前一个大小除以一个素数,这样拼接的痕迹就不那么明显了。
SgtSphereLandscape
All planets begin with the SgtSphereLandscape component, which you can add to a new GameObject. This component will generate a sphere with the specified Radius, and the mesh detail will automatically increase as the Observer (default = MainCamera) approaches. The mesh detail will increase until the triangles are near the MinimumTriangleSize value, which you can adjust depending on your project detail and performance requirements. The Detail setting adjusts the overall detail of the planet based on the observer distance. 所有行星都以 SgtSphereLandscape 组件开始,您可以将该组件添加到新的 GameObject 中。此组件将生成一个具有指定半径的球体,当观察者(默认为主摄像机)接近时,网格细节将自动增加。网格细节将增加,直到三角形接近最小三角形大小值,您可以根据项目细节和性能要求进行调整。细节设置根据观察者距离调整行星的整体细节。
If you want the planet to generate faster, then you can increase the MaxSplitsPerFrame setting. Keep in mind this has a performance penalty, so you should experiment with different values depending on your project. 如果您想使星球生成更快,则可以增加 MaxSplitsPerFrame 设置。请注意,这会有性能惩罚,因此您应根据您的项目尝试不同的值。
If you have a pre-generated AlbedoTex and/or HeightTex, then you can set them. Keep in mind these must use cylindrical (equirectangular) projection. The HeightTex must be Single Channel with Read/Write enabled. 如果您已生成预处理的 AlbedoTex 和/或 HeightTex,则可以设置它们。请注意,这些必须使用圆柱(等角)投影。HeightTex 必须是单通道且启用读写权限。
By default the planet in the editor will update PreviewSteps amount of times. If you want the planet to preview with a higher detail, you can click the Update LOD button, which will update it an additional PreviewSteps amount of times. You can also increase PreviewSteps. Every time you update a planet setting, it will be regenerated this amount of times. 默认情况下,编辑器中的行星将更新 PreviewSteps 次数。如果您想以更高的细节预览行星,可以点击“更新 LOD”按钮,这将额外更新 PreviewSteps 次数。您还可以增加 PreviewSteps。每次更新行星设置时,它将以此数量重新生成。
Preview Steps 预览步骤
10
Update LOD 更新 LOD
Add Collider 添加碰撞体
Add Detail 添加详情
Add Color 添加颜色
Add Biome 添加生物群落
Detail 详情
5
Minimum Triangle Siz 最小三角形尺寸
0.1
Max Splits Per Frame 每帧最大分割数
1
Max Merges Per Frant 每帧最大合并数
5
Material 材料
- SGT_Landscapt o.\odot
Observer 观察者
None (Transform) • 无(变换)•
Radius 半径
50
Albedo Tex 反照率纹理
None (Texture 2D) o.\odot 无(二维纹理) o.\odot
Height Tex 高度纹理
None (Texture 2D] o.\odot None(纹理 2D] o.\odot
Preview Steps 10
Update LOD
Add Collider
Add Detail
Add Color
Add Biome
Detail 5
Minimum Triangle Siz 0.1
Max Splits Per Frame 1
Max Merges Per Frant 5
Material - SGT_Landscapt o.
Observer None (Transform) •
Radius 50
Albedo Tex None (Texture 2D) o.
Height Tex None (Texture 2D] o.| Preview Steps | 10 |
| :---: | :---: |
| Update LOD | |
| Add Collider | |
| Add Detail | |
| Add Color | |
| Add Biome | |
| Detail | 5 |
| Minimum Triangle Siz | 0.1 |
| Max Splits Per Frame | 1 |
| Max Merges Per Frant | 5 |
| Material | - SGT_Landscapt $\odot$ |
| Observer | None (Transform) • |
| Radius | 50 |
| Albedo Tex | None (Texture 2D) $\odot$ |
| Height Tex | None (Texture 2D] $\odot$ |
SgtLandscapeColor
If your planet only has a heightmap and you want to color it based on height and slope, then you can use the SgtLandscapeColor component to color it. You can add this component to a child GameObject, or click the Add Collider button to do the same. 如果您的星球只有高度图,并且您想根据高度和坡度为其上色,那么您可以使用 SgtLandscapeColor 组件来实现。您可以将此组件添加到一个子 GameObject 上,或者点击添加碰撞体按钮来完成相同操作。
The GradientTex can be set to any texture with read/write enabled. This texture can be a picture of a landscape that has colors you want to use for your planet. You can find over 100 examples in the Plugins/CW/Planet Forge/Gradients folder. 梯度纹理可以设置为任何具有读写权限的纹理。这种纹理可以是您想要用于您星球的颜色景观的图片。您可以在“插件/CW/行星锻造/渐变”文件夹中找到超过 100 个示例。
SgtLandscapeDetail
To increase the surface detail of your planet, you can use the SgtLandscapeDetail component. You can add this component to a child GameObject, or click the Add Detail button to do the same. 为了增加您星球表面的细节,您可以使用 SgtLandscapeDetail 组件。您可以将此组件添加到子 GameObject 中,或者点击添加细节按钮来完成相同操作。
SgtLandscapeBiome
If you want to combine multiple layers of detail and color, you should instead use the SgtLandscapeBiome component. You can add this component to a child GameObject, or click the Add Biome button to do the same. This has the same settings as SgtLandscapeColor, and the Layers setting allows up to 5 layers which have the same settings as the SgtLandscapeDetail component. 如果您想合并多个细节和颜色的层级,您应该使用 SgtLandscapeBiome 组件。您可以将此组件添加到子 GameObject 中,或者点击添加生物群落按钮执行相同操作。这具有与 SgtLandscapeColor 相同的设置,并且层设置允许最多 5 层,这些层的设置与 SgtLandscapeDetail 组件相同。
SgtLandscapeCollider
If you want your planet to have MeshColliders that match the visual mesh, then you can use the SgtLandscapeCollider component. You can add this component alongside the SgtSphereLandscape component, or click the Add Collider button to do the same. It will then generate colliders down to the specified MinimumTriangleSize. 如果您想让您的星球拥有与视觉网格匹配的 MeshColliders,则可以使用 SgtLandscapeCollider 组件。您可以将此组件与 SgtSphereLandscape 组件一起添加,或者点击添加碰撞器按钮执行相同操作。然后,它将生成指定最小三角形大小的碰撞器。
SgtLandscapeObject
If you want to place objects on your planet’s surface, you can add the SgtLandscapeObject to them. Your object’s Transform component’s Position and Rotation values will then be updated to match the underlying surface position and normal. 如果您想在您的星球表面上放置对象,您可以将其添加到 SgtLandscapeObject 中。此时,您的对象的变换组件的位置和旋转值将更新以匹配底层表面的位置和法线。
Space & MaskTex 空间 & 遮罩纹理
The SgtLandscapeColor/Detail/Biome components all have the Space and MaskTex setting. If Space is set to Global, then the component will apply changes to the whole planet. If it’s set to Local, then it will apply based on the current Transform position/rotation/scale, and you can see a preview of it in the Scene tab. SgtLandscapeColor/Detail/Biome 组件都具有空间和遮罩纹理设置。如果空间设置为全局,则组件将对整个星球应用更改。如果设置为本地,则将根据当前变换位置/旋转/缩放应用,您可以在场景标签中预览它。
The MaskTex can be set to any Single Channel texture with the Alpha8/R8 format, and it must have Read/Write enabled. When Space is set to Global, this mask will wrap around the whole planet using cylindrical (equirectangular) projection, the same as the base planet’s AlbedoTex/HeightTex. If it’s set to Local, then the mask will stretch to the size of the GameObject, which you can see a preview of in the Scene tab. MaskTex 可以设置为任何单通道 Alpha8/R8 格式的纹理,并且必须启用读写权限。当空间设置为全局时,此遮罩将使用圆柱(等经纬)投影环绕整个星球,与基础星球的 AlbedoTex/HeightTex 相同。如果设置为局部,则遮罩将拉伸到 GameObject 的大小,您可以在场景标签中预览。
SgtSky
All planet atmospheres are made with the SgtSky component, which you can add to a new GameObject. This component has the InnerMeshRadius setting, which should match or be close to your SgtSphereLandscape component’s Radius setting. The Height setting can be used to control the distance between the planet and the outer edge of the atmosphere. 所有行星大气层都使用 SgtSky 组件制作,您可以将该组件添加到新的 GameObject 中。此组件具有内部网格半径设置,应与您的 SgtSphereLandscape 组件的半径设置相匹配或接近。高度设置可用于控制行星与大气层外边缘之间的距离。
This atmosphere effect requires camera depth data, which can be enabled by adding the CwDepthTextureMode component to your camera(s). 此大气效果需要相机深度数据,可以通过向您的相机添加 CwDepthTextureMode 组件来启用。
To control the overall sky color, you can add the SgtSkyDepthTex component alongside SgtSky. 为了控制整体天空颜色,您可以在 SgtSky 组件旁边添加 SgtSkyDepthTex 组件。
If you set the Lighting setting to Simple or Scatter, then you can add the SgtSkyLightingTex component alongside SgtSky, which allows you to control the sunset color and position. 如果您将照明设置设置为简单或散射,那么您可以在 SgtSky 旁边添加 SgtSkyLightingTex 组件,这允许您控制日落颜色和位置。
If you set the Lighting setting to Scatter, then you can add the SgtSkyScatteringTex component alongside SgtSky, which allows you to control the atmospheric scattering color of the sunlight as it goes through the atmosphere. 如果您将照明设置设置为散射,那么您可以在 SgtSky 旁边添加 SgtSkyScatteringTex 组件,这允许您控制阳光穿过大气层时的散射颜色。
Planet Size 行星大小
The planets in the example scenes have a radius of 50 units/meters. However, you can adjust the SgtSphereLandscape component’s Radius setting to any value you like depending on your project requirements. If you change the radius by a large amount, it’s likely the surface detail scale will be incorrect. To fix this, you can adjust the SgtSphereLandscape component’s SurfaceScale component. For example, if you make the planet have a radius of 5000 (100x), then you may want to set SurfaceScale to 10 (10x) or greater. 示例场景中的行星半径为 50 单位/米。然而,您可以根据项目需求调整 SgtSphereLandscape 组件的半径设置到任何您喜欢的值。如果您大幅更改半径,表面细节比例可能不正确。为了解决这个问题,您可以调整 SgtSphereLandscape 组件的 SurfaceScale 组件。例如,如果您将行星半径设置为 5000(100 倍),那么您可能希望将 SurfaceScale 设置为 10(10 倍)或更大。
If your planet is large (e.g. a radius of over 5000 units), then keep in mind the floating point precision of the camera rendering and physics will reduce and may cause issues. To fix this, your project must use some type of origin shifting system, where the objects get moved around the camera, rather than the camera moving around the objects. This results in the camera not moving too far from the scene origin ( 0,0,00,0,0 ), or not moving at all in some implementations. If you have the full Space Graphics Toolkit asset, then you can implement the Universe feature with the SgtFloatingCamera and SgtFloatingObject components, which adds origin shifting. 如果您的星球很大(例如半径超过 5000 单位),请记住相机渲染和物理的浮点精度会降低,可能会引起问题。为了解决这个问题,您的项目必须使用某种类型的原点偏移系统,其中对象围绕相机移动,而不是相机围绕对象移动。这导致相机不会移动得太远离开场景原点( 0,0,00,0,0 ),或在某些实现中根本不移动。如果您拥有完整的空间图形工具包资产,则可以使用 SgtFloatingCamera 和 SgtFloatingObject 组件实现宇宙功能,这些组件添加了原点偏移。
Known Issues 已知问题
If your planets are small, in some scenarios there are single-pixel gaps that can flicker between the terrain LOD chunks. 如果您的行星很小,在某些情况下,地形 LOD 块之间可能会有闪烁的单像素间隙。
The SgtLandscapeDetai//Biome components automatically convert the HeightTex into a normal map. However, there is no caching if multiple detail layers share the same HeightTex, so the memory usage of a planet can be much higher than is necessary. SgtLandscapeDetai//Biome 组件自动将 HeightTex 转换为法线图。然而,如果多个细节层共享相同的 HeightTex,则不会进行缓存,因此行星的内存使用量可能比必要的要高得多。
The LOD updates based on the MaxSplitsPerFrame setting. So if you enable VSync, then the LOD may be very slow to update if your system is otherwise capable of very high frame rates. 基于 MaxSplitsPerFrame 设置进行 LOD 更新。因此,如果您启用 VSync,那么如果您的系统在其他方面能够达到非常高的帧率,LOD 的更新可能会非常慢。
The LOD checks are currently run in Update, so they have greater performance impact than is necessary, especially when near the planet surface when there are more LOD chunks. LOD 检查目前是在更新中运行的,因此它们比必要的性能影响更大,尤其是在接近行星表面且存在更多 LOD 块时。
The LOD textures are offset by half a texel when they increase in detail, which causes the planet surface to appear to shift slightly as you approach. LOD 纹理在细节增加时偏移半个 texel,这导致当你接近时,星球表面看起来会略微移动。
The SgtLandscapeDetail/Biome components don’t take rotation into account when applying normal data to the planet, so the lighting direction may render incorrectly. SgtLandscapeDetail/Biome 组件在将正常数据应用到星球上时没有考虑旋转,因此光照方向可能渲染错误。
The atmosphere component (SgtSky) appears to begin rendering incorrectly as the planet radius approaches or exceeds 5,000,000, or if the camera’s Clipping Planes / Far approaches or exceeds 10,000,000. 大气组件(SgtSky)似乎在行星半径接近或超过 5000000,或者相机的裁剪平面/远距离接近或超过 10000000 时开始渲染错误。
These issues are currently being worked on and have the highest priority. 这些问题目前正在处理中,具有最高优先级。