diff --git a/docs/en/UI/overall.md b/docs/en/UI/overall.mdx similarity index 100% rename from docs/en/UI/overall.md rename to docs/en/UI/overall.mdx diff --git a/docs/en/UI/quickStart/button.md b/docs/en/UI/quickStart/button.mdx similarity index 79% rename from docs/en/UI/quickStart/button.md rename to docs/en/UI/quickStart/button.mdx index 20cb753101..25aaa2a6b7 100644 --- a/docs/en/UI/quickStart/button.md +++ b/docs/en/UI/quickStart/button.mdx @@ -13,7 +13,7 @@ label: UI Add a `Button` node in the **[Hierarchy Panel](/docs/interface/hierarchy/)**. - + > If the parent or ancestor node does not have a Canvas component, a root Canvas node will be automatically added. @@ -21,7 +21,7 @@ Add a `Button` node in the **[Hierarchy Panel](/docs/interface/hierarchy/)**. In the editor, you can easily set the button's transition effects for different states. - + ## Properties @@ -41,4 +41,4 @@ In the editor, you can easily set the button's transition effects for different ## Script Development - \ No newline at end of file + \ No newline at end of file diff --git a/docs/en/UI/quickStart/canvas.md b/docs/en/UI/quickStart/canvas.mdx similarity index 85% rename from docs/en/UI/quickStart/canvas.md rename to docs/en/UI/quickStart/canvas.mdx index 7bb4b12c1b..f4490fc003 100644 --- a/docs/en/UI/quickStart/canvas.md +++ b/docs/en/UI/quickStart/canvas.mdx @@ -13,19 +13,19 @@ The root canvas is the foundation of the UI, but not all `UICanvas` nodes are ro Add a Canvas node in the **[Hierarchy Panel](/docs/interface/hierarchy/)**. - + ### Set Properties Select the node that has the `Canvas` component and you can set its properties in the **[Inspector Panel](/docs/interface/inspector)**. - + ### Root Canvas If the parent or ancestor node of the newly added canvas node already contains an active `UICanvas` component, this canvas will not have rendering or interaction functionality. - + ## Properties diff --git a/docs/en/UI/quickStart/event.md b/docs/en/UI/quickStart/event.mdx similarity index 96% rename from docs/en/UI/quickStart/event.md rename to docs/en/UI/quickStart/event.mdx index 0d6db41457..ad15ad431e 100644 --- a/docs/en/UI/quickStart/event.md +++ b/docs/en/UI/quickStart/event.mdx @@ -37,4 +37,4 @@ stateDiagram ## Script Development - \ No newline at end of file + \ No newline at end of file diff --git a/docs/en/UI/quickStart/group.md b/docs/en/UI/quickStart/group.mdx similarity index 82% rename from docs/en/UI/quickStart/group.md rename to docs/en/UI/quickStart/group.mdx index 8ec0cae9b5..88b9b399c2 100644 --- a/docs/en/UI/quickStart/group.md +++ b/docs/en/UI/quickStart/group.mdx @@ -11,7 +11,7 @@ The `UIGroup` component allows you to inherit or ignore properties such as **opa Select the node, then in the **[Inspector Panel](/docs/interface/inspector)**, click **Add Component** and choose **UIGroup**. You can control the opacity of multiple UI elements by modifying the settings. - + ## Properties @@ -25,4 +25,4 @@ Select the node, then in the **[Inspector Panel](/docs/interface/inspector)**, c ## Script Development - \ No newline at end of file + \ No newline at end of file diff --git a/docs/en/UI/quickStart/image.md b/docs/en/UI/quickStart/image.mdx similarity index 80% rename from docs/en/UI/quickStart/image.md rename to docs/en/UI/quickStart/image.mdx index f4851aed68..d50c736771 100644 --- a/docs/en/UI/quickStart/image.md +++ b/docs/en/UI/quickStart/image.mdx @@ -13,7 +13,7 @@ The `Image` component is used to display images within a `UICanvas`. Add an `Image` node in the **[Hierarchy Panel](/docs/interface/hierarchy/)**. - + > If the parent or ancestor node does not have a Canvas component, a root canvas node will be automatically added. @@ -21,13 +21,13 @@ Add an `Image` node in the **[Hierarchy Panel](/docs/interface/hierarchy/)**. The content displayed by the `Image` depends on the selected [Sprite asset](). Select the node with the `Image` component, and in the **[Inspector Panel](/docs/interface/inspector)**, choose the corresponding sprite asset in the Sprite property to change the displayed content. - + ### Modify Draw Mode The `Image` component currently provides three draw modes: Normal, Nine-Patch, and Tiled (the default is Normal). You can visually feel the rendering differences between modes by modifying the width and height in each mode. - + ### Adjust Size @@ -45,4 +45,4 @@ For adjusting the size of UI elements, refer to [Quickly Adjust UI Element Size] ## Script Development - \ No newline at end of file + \ No newline at end of file diff --git a/docs/en/UI/quickStart/order.md b/docs/en/UI/quickStart/order.mdx similarity index 100% rename from docs/en/UI/quickStart/order.md rename to docs/en/UI/quickStart/order.mdx diff --git a/docs/en/UI/quickStart/text.md b/docs/en/UI/quickStart/text.mdx similarity index 84% rename from docs/en/UI/quickStart/text.md rename to docs/en/UI/quickStart/text.mdx index 8a30a56a37..4ebb6ce4b6 100644 --- a/docs/en/UI/quickStart/text.md +++ b/docs/en/UI/quickStart/text.mdx @@ -13,7 +13,7 @@ The `Text` component is used to display text within a `UICanvas`. Add a `Text` node in the **[Hierarchy Panel](/docs/interface/hierarchy/)**. - + > If the parent or ancestor node does not have a Canvas component, a root canvas node will be automatically added. @@ -21,19 +21,19 @@ Add a `Text` node in the **[Hierarchy Panel](/docs/interface/hierarchy/)**. Select the node with the `Text` component, and in the **[Inspector Panel](/docs/interface/inspector)**, modify the `text` property to change the content of the `Text` element. - + ### Set Font Select the node with the `Text` component, and in the **[Inspector Panel](/docs/interface/inspector)**, modify the `font` property to change the font type of the `Text` element. - + ### Modify Font Size The `Text` component can modify the rendering size by adjusting the `FontSize`. - + > Changing the `size` in `UITransform` will not affect the rendering size of `Text`. @@ -57,4 +57,4 @@ The `Text` component can modify the rendering size by adjusting the `FontSize`. ## Script Development - \ No newline at end of file + \ No newline at end of file diff --git a/docs/en/UI/quickStart/transform.md b/docs/en/UI/quickStart/transform.mdx similarity index 92% rename from docs/en/UI/quickStart/transform.md rename to docs/en/UI/quickStart/transform.mdx index 95c05f739c..3451905fa9 100644 --- a/docs/en/UI/quickStart/transform.md +++ b/docs/en/UI/quickStart/transform.mdx @@ -11,7 +11,7 @@ The `UITransform` component is specifically designed to represent the size and p When a node with a UI component is added, the `UITransform` component will automatically be added (replacing the previous [Transform](/apis/core/#Transform) component). In the editor, you can select the node and use the `RectTool` (shortcut key `T`) to quickly adjust properties, or you can set precise properties in the **[Inspector Panel](/docs/interface/inspector)**. - + > When the main canvas's render mode is `Screen`, the editor will prohibit modifications to its `transform` to avoid screen adaptation issues. Therefore, in scripts, **developers should avoid modifying the `transform` properties of the main canvas in screen space.** diff --git a/docs/en/UI/system.md b/docs/en/UI/system.mdx similarity index 100% rename from docs/en/UI/system.md rename to docs/en/UI/system.mdx diff --git a/docs/en/animation/animator.mdx b/docs/en/animation/animator.mdx index ca1675e1e2..f916d1a682 100644 --- a/docs/en/animation/animator.mdx +++ b/docs/en/animation/animator.mdx @@ -26,16 +26,16 @@ The Animation Control Component ([Animator](/apis/core/#Animator)) of the model If the model contains animations, a read-only [Animation Controller](/en/docs/animation/animatorController/) will be automatically bound for you. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*WkafRagPFo8AAAAAAAAAAAAADsJ_AQ/original) + If there is no Animation Control Component ([Animator](/apis/core/#Animator)), you can create one as shown below -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*uOuPT5cFwx4AAAAAAAAAAAAADsJ_AQ/original) + 2. Create an [Animation Controller](/en/docs/animation/animatorController/) asset and bind it to the model -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*PxHwTrU58yAAAAAAAAAAAAAADsJ_AQ/original) -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*Ds5TTosYiDYAAAAAAAAAAAAADsJ_AQ/original) + + 3. After editing the Animation Controller ([see details](/en/docs/animation/animatorController/)), you can play the animations according to the logic of the [Animation Controller](/en/docs/animation/animatorController/) diff --git a/docs/en/animation/animatorController.mdx b/docs/en/animation/animatorController.mdx index f51c8db8c8..535c3c7a86 100644 --- a/docs/en/animation/animatorController.mdx +++ b/docs/en/animation/animatorController.mdx @@ -13,20 +13,20 @@ Through the Animation Controller editor, users can organize the playback logic o 1. Prepare the Animation Clips ([Create Animation Clips](/en/docs/animation/clip)). -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*Wl35T7U_zg8AAAAAAAAAAAAADsJ_AQ/original) + 2. To organize the playback of these Animation Clips, we need to create an Animation Controller ([AnimatorController](/apis/core/#AnimatorController)) asset. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*PxHwTrU58yAAAAAAAAAAAAAADsJ_AQ/original) + 3. The newly created Animation Controller has no data. We need to edit it, double-click the asset, and add an Animation State ([AnimatorState](/apis/core/#AnimatorState)) to it. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*V0n1TJMquGYAAAAAAAAAAAAADsJ_AQ/original) + 4. Click AnimatorState to bind an [Animation Clip](/en/docs/animation/clip) ([AnimationClip](/apis/core/#AnimationClip)) to it. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*xfPTRJg-hOMAAAAAAAAAAAAADsJ_AQ/original) + 5. Bind the Animation Controller ([AnimatorController](/apis/core/#AnimatorController)) asset to the [Animation Control Component](/en/docs/animation/animator). -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*Ds5TTosYiDYAAAAAAAAAAAAADsJ_AQ/original) + 6. At this point, you can play the `Idle` animation in the exported project through `animator.play("New State")`. diff --git a/docs/en/animation/clip-for-artist.md b/docs/en/animation/clip-for-artist.mdx similarity index 50% rename from docs/en/animation/clip-for-artist.md rename to docs/en/animation/clip-for-artist.mdx index 28e7851aa2..9dbc93ee39 100644 --- a/docs/en/animation/clip-for-artist.md +++ b/docs/en/animation/clip-for-artist.mdx @@ -15,37 +15,37 @@ Blender's animation editing interface is very user-friendly, clearly visualizing 1. Open Blender, import a model format supported by Blender, and then switch to the **Animation Editing** window: -![image.png](https://gw.alipayobjects.com/zos/OasisHub/6922d329-6cfa-473d-9fd1-312592e7c307/1622617152228-2c30967c-9203-4ad2-b239-6033cb004bc3.png) + 2. Using the "New Animation Clip" button shown above, you can quickly copy the current animation clip and then perform unique operations. If the button is not displayed, make sure the "**Action Editor**" is open: -![image.png](https://gw.alipayobjects.com/zos/OasisHub/53cc73a1-17b2-4a4f-ad42-9a8b059fb69c/1622617514416-e0b83cd6-439f-4003-aa23-f85ca0df04dc.png) + For example, a new animation clip named **animation_copy** is created, and only the last 5 frames of the animation are retained: -image.png +image.png -image.png +image.png -image.png +image.png The exported clip timeline must be consistent, which can be configured in two places: the bottom right corner or the output properties: -image.png +image.png -image.png +image.png 3. Since the timeline must be consistent, you need to move the animation clips just sliced to the starting frame by dragging them: -image.png +image.png -image.png +image.png 4. At this point, the animation slices are ready. Export them as glTF or FBX and integrate them into the Galacean engine: -image.png +image.png -image.png +image.png Unity can also export animation slices, but it is less efficient. @@ -59,44 +59,44 @@ Plugin: [AntG-Unity-Plugin.unitypackage.zip](https://www.yuque.com/attachments/y 3. Double-click the plugin and **Import** the default selected options: -image.png +image.png If the installation is successful, you will see an **AntG** option in the menu bar: -image.png +image.png 4. Drag the FBX file that needs slicing into the asset panel: -image.png +image.png 5. Click on the asset to bring up the animation debugging preview box. Add animation slices and adjust the timeline **start** and **end** for each slice as needed. If the animation preview appears abnormal, ensure that the **Resample Curves** option, which is enabled by default, is unchecked. After slicing is complete, remember to click the **Apply** button in the lower right corner to confirm. -image.png +image.png -image.png +image.png 6. At this point, the animation slice resource has been created. Next, we will introduce how to export it. First, drag the resource into the node tree: -image.png +image.png 7. Then add the **Animator** Component to the node: -image.png +image.png 8. You can see that the Animator component needs to be bound to an Animator Controller resource, so we need to create a new Animator Controller resource in the resource bar: -image.png +image.png 9. Double-click the controller resource and drag our previously created animation slice into it: -image.png +image.png 10. The Animator Controller resource is now complete and can be bound to the Component we just created: -image.png +image.png 11. Right-click the node and select Export AntG: -image.png +image.png 12. At this point, the created animation slice glTF file has been exported. You can visit Galacean's [glTF Viewer](https://galacean.antgroup.com/engine/gltf-viewer) for functionality verification. diff --git a/docs/en/animation/clip.mdx b/docs/en/animation/clip.mdx index 025a459d6c..d348d7c510 100644 --- a/docs/en/animation/clip.mdx +++ b/docs/en/animation/clip.mdx @@ -11,7 +11,7 @@ There are two common ways to obtain animation clips: 1. Import models with animations created using third-party tools (such as Autodesk® 3ds Max®, Autodesk® Maya®, Blender). See [Creating Animation Clips for Artists](/en/docs/animation/clip-for-artist) -![1](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*Qc8sQ6iJd8IAAAAAAAAAAAAADsJ_AQ/original) + 2. Create animation clips in Galacean (the editor and script creation methods will be introduced below). @@ -19,7 +19,7 @@ There are two common ways to obtain animation clips: The animation clip editor currently supports editing all interpolable properties except for physics-related components. If you need to edit other properties, you need to add the corresponding components to the entity. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*3SAjRb60cfoAAAAAAAAAAAAADsJ_AQ/original) + > Note: The Galacean animation editor defaults to 60FPS. The time `0:30` shown in the figure above is at the 30th frame. If the timeline scale is `1:30`, it is at the 90th frame. @@ -29,49 +29,49 @@ The animation clip editor currently supports editing all interpolable properties 1. In the **[Assets Panel](/en/docs/assets/interface)**, right-click/click + to create an `Animation Clip` asset. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*j4FMRKx91nEAAAAAAAAAAAAADsJ_AQ/original) + 2. Double-click the `Animation Clip` asset and select an entity as the editing object for the `Animation Clip`. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*_E1kRqt8LroAAAAAAAAAAAAADsJ_AQ/original) + Clicking the `Create` button will automatically add the [Animation Control Component](/en/docs/animation/animator) to your entity and add the animation clip to the [Animation Controller](/en/docs/animation/animatorController/). -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*q46SRrV6WfsAAAAAAAAAAAAADsJ_AQ/original) -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*C2a4SZDGG_4AAAAAAAAAAAAADsJ_AQ/original) + + 3. Add the properties to animate (here I added two). -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*69xIS7ABJJkAAAAAAAAAAAAADsJ_AQ/original) -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*-4bnQI-LcLsAAAAAAAAAAAAADsJ_AQ/original) + + 4. Add keyframes to the properties. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*QnQwR6tLRYMAAAAAAAAAAAAADsJ_AQ/original) + When we click the add keyframe button, the keyframe will store the current value of the specified property. So when we haven't changed anything, the keyframe stores the `position` value of the entity at that moment. We want it to move to the position (3, 0, 0) after 60 frames, so first modify the cube to (3, 0, 0) through the property panel and then add a keyframe. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*ClTgSriu4-8AAAAAAAAAAAAADsJ_AQ/original) + Similarly, we also add keyframes for the `rotation` property. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*hOkoRKlNfeYAAAAAAAAAAAAADsJ_AQ/original) + ##### Recording Mode We provide a recording mode to facilitate developers in quickly adding keyframes. When recording mode is enabled, keyframes are automatically added when the corresponding properties are modified. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*sFwtSLOlyhoAAAAAAAAAAAAADsJ_AQ/original) + ### Text Animation Example First, you need an entity with a TextRender component. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*VGEGS6kOBqkAAAAAAAAAAAAADsJ_AQ/original) + When we add properties at this point, we can see that the properties that can add keyframes have increased with the interpolable properties related to the `TextRenderer` component. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*X5YxQb_HieUAAAAAAAAAAAAADsJ_AQ/original) + We add keyframes using recording mode as described above. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*tsTqSqZVsdUAAAAAAAAAAAAADsJ_AQ/original) + ### Frame Animation Example @@ -81,16 +81,16 @@ In addition to numerical types, Galacean also supports animation curves of refer Galacean also supports animation editing of asset properties within components. If there are material assets in the component, there will be additional asset property editing in the `Inspector`. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*ctbcSKqHmIAAAAAAAAAAAAAADsJ_AQ/original) + It should be noted that the default [material](/en/docs/graphics/material/material/) in the editor is not editable. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*SNRHQbOcqhAAAAAAAAAAAAAADsJ_AQ/original) + So, if we want to animate the material of this cube, we need to create a new material and replace it. Then, just like above, enable recording mode and directly modify the properties. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*uEQOS52hXpUAAAAAAAAAAAAADsJ_AQ/original) -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*TGDFTrXZbAEAAAAAAAAAAAAADsJ_AQ/original) + + ## More Operations @@ -100,23 +100,23 @@ So, if we want to animate the material of this cube, we need to create a new mat Select the keyframe and drag it. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*_vZSR4YEDqMAAAAAAAAAAAAADsJ_AQ/original) + You can zoom the timeline by scrolling the `mouse wheel`. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*BTgPS45hkNYAAAAAAAAAAAAADsJ_AQ/original) + #### Modify Keyframe Value Enable recording mode, move the timeline to the specified keyframe, and then re-enter the value. If recording mode is not enabled, you need to click the add keyframe button again. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*MiSXQZ4q7DMAAAAAAAAAAAAADsJ_AQ/original) + #### Delete Keyframe Select the keyframe, right-click and choose delete, or press the delete/backspace key on the keyboard. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*MpPMRK2WaEMAAAAAAAAAAAAADsJ_AQ/original) + ### Editing Child Entities @@ -124,43 +124,43 @@ Select the keyframe, right-click and choose delete, or press the delete/backspac 1. We add a child entity to the cube we just created. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*6RYIQpG7DPwAAAAAAAAAAAAADsJ_AQ/original) + 2. We can see that the properties of the child entity can be added by clicking "Add Property" again. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*j7rfRq0REKIAAAAAAAAAAAAADsJ_AQ/original) + 3. Enable recording mode, edit the child entity and add keyframes. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*j7rfRq0REKIAAAAAAAAAAAAADsJ_AQ/original) + ### Edit Animation Curves The `Animation Clip Editor` supports animation curve editing. Click the curve icon in the upper right corner to switch. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*luV0QaDUAQAAAAAAAAAAAAAADsJ_AQ/original) + The vertical axis in curve mode represents the value of the property. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*luV0QaDUAQAAAAAAAAAAAAAADsJ_AQ/original) + You can adjust the vertical axis scale by pressing `shift + mouse wheel`. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*SjO2TaubiuIAAAAAAAAAAAAADsJ_AQ/original) + The color of the curve corresponding to the property is the same as the color of the button. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*OS3uSbdB36AAAAAAAAAAAAAADsJ_AQ/original) + Selecting a keyframe will show two control points. Adjusting the control points will adjust the curve. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*kikYQoiYMLoAAAAAAAAAAAAADsJ_AQ/original) + You can also set built-in preset values directly by right-clicking the keyframe. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*KRzoT5Pocc4AAAAAAAAAAAAADsJ_AQ/original) + Selecting a property in the property panel allows you to edit the curve of the specified property only. diff --git a/docs/en/animation/layer.mdx b/docs/en/animation/layer.mdx index 3ea945e452..5f6d4225d7 100644 --- a/docs/en/animation/layer.mdx +++ b/docs/en/animation/layer.mdx @@ -35,16 +35,16 @@ The weight of the first layer is always 1.0. ## Editor Usage ### Additive Mode We add an animation layer in the editor and set `Blending` to `Additive`. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*JyqiQ6kvqBcAAAAAAAAAAAAADsJ_AQ/original) + You can see that this character has added a `head shaking` animation on top of the original animation. ### Override Mode Set `Blending` to `Override`. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*5TfbQJjPZDMAAAAAAAAAAAAADsJ_AQ/original) + You can see that the character's animation completely replaces the animation of the first layer. ### Blending Weight -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*HSxgTZIDqQ0AAAAAAAAAAAAADsJ_AQ/original) + You can see that the higher the weight of the animation layer, the greater the impact on the animation effect. diff --git a/docs/en/animation/overview.md b/docs/en/animation/overview.mdx similarity index 100% rename from docs/en/animation/overview.md rename to docs/en/animation/overview.mdx diff --git a/docs/en/animation/sprite-sheet.md b/docs/en/animation/sprite-sheet.md deleted file mode 100644 index d9aaba7e2b..0000000000 --- a/docs/en/animation/sprite-sheet.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -order: 7 -title: Frame Animation -type: Animation -label: Animation ---- - -Galacean supports reference-type animation curves. You can add keyframes of asset types such as (sprites). The following image shows the process of creating sprite animations: - -1. Add the `SpriteRenderer` component to the node - -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*XiUaQ76M4Q0AAAAAAAAAAAAADsJ_AQ/original) - -2. Add `Sprite`, you can refer to [Sprite](/en/docs/graphics/2D/sprite) - -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*ababSZAMpJMAAAAAAAAAAAAADsJ_AQ/original) - -3. Create [Animation Clip](/en/docs/animation/clip) in the **[Assets Panel](/en/docs/assets/interface)** - -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*CZQjSqZAHGsAAAAAAAAAAAAADsJ_AQ/original) - - -4. Enable recording mode, click on the corresponding frame number in the editor, and add `Sprite` in `SpriteRenderer` to automatically add keyframes - -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*Eff6TbgYps8AAAAAAAAAAAAADsJ_AQ/original) - - -### Script Implementation - -The engine supports reference-type animation curves ([AnimationRefCurve](/apis/core/#AnimationRefCurve)) in version 1.1. The value of the keyframe can be assets such as (sprites, materials). You can create reference-type animation curves to achieve capabilities such as frame animation: - - diff --git a/docs/en/animation/state-machine.mdx b/docs/en/animation/state-machine.mdx index d44a0d433b..71db538c2f 100644 --- a/docs/en/animation/state-machine.mdx +++ b/docs/en/animation/state-machine.mdx @@ -51,7 +51,7 @@ Solo and Mute are usually used for debugging, helping developers test and debug #### Editor Usage Connect the animation state ([AnimatorState](/apis/core/#AnimatorState)) to `entry`, and the animation on it will automatically play when you run the exported project, without needing to call `animator.play`. Click on the entity bound to the animation control component ([Animator](/en/docs/animation/animator)) to preview the animation. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*0_DkSoSAhmUAAAAAAAAAAAAADsJ_AQ/original) + #### Script Usage @@ -67,11 +67,11 @@ animatorStateMachine.addEntryStateTransition('Idle'); #### Editor Usage Connect the two `AnimatorState` you want to transition between to achieve the animation transition effect. Click on the line between the two animations to modify the animation transition parameters and adjust the effect. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*h3I4TZoxtnYAAAAAAAAAAAAADsJ_AQ/original) + Click on the line to set the parameters of the animation transition ([AnimatorStateTransition](/apis/core/#AnimatorStateTransition)), such as adding conditions: -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*vlmLQqR2k7QAAAAAAAAAAAAADsJ_AQ/original) + If multiple conditions are added, the transition will only start when all conditions are met. @@ -184,7 +184,7 @@ class AnimationScriptExample extends Script { ### Animation State Machine Animation Loop Connect the animation state to the `exit` state, and the state machine will exit and re-enter `entry`, making the overall process loop. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*1AfgS6S88SYAAAAAAAAAAAAADsJ_AQ/original) + #### Script Usage @@ -202,9 +202,9 @@ In this way, every time you play the `Run` animation on the layer where the anim ### State Machine Script You can add state machine scripts to each animation state, which allows you to receive callbacks in different events of the animation state machine (such as state entry, exit, update, etc.) [see details](/apis/core/#StateMachineScript). -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*VrCXQqS3w7QAAAAAAAAAAAAADsJ_AQ/original) + -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*A7I7QqiDCfkAAAAAAAAAAAAADsJ_AQ/original) + #### Script Usage The state machine script provides three animation state cycles: diff --git a/docs/en/animation/system.md b/docs/en/animation/system.mdx similarity index 100% rename from docs/en/animation/system.md rename to docs/en/animation/system.mdx diff --git a/docs/en/art/bake-blender.md b/docs/en/art/bake-blender.md deleted file mode 100644 index 3b07dbdd29..0000000000 --- a/docs/en/art/bake-blender.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -order: 0 -title: Blender Baking -type: Art -label: Art ---- - -> **_Special thanks to Monk and UU Efficiency Team for providing this tutorial._** - -In the process of actual model production, artists may use a lot of materials and textures to achieve better visual effects. However, there may be significant rendering discrepancies when exporting, and sometimes some effects may be lost. - -We have optimized the process of maximizing the restoration of 3D model rendering as much as possible, hoping to help everyone. - -### Blender Baking - -1. Select the model. Currently, this building is composed of many different models, and we need to merge them into one model. - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/062ab80a-f13e-4bde-b916-61ed65150540/1635163063741-2a68da6a-bb53-47ef-8404-7f52c127c802.png) - -2. The shortcut to merge 2 models is **Ctrl+J**. If there are any models with modifiers, you need to apply the modifiers before merging; otherwise, the effects of the modifiers will be lost. - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/ba1e9e63-4bf9-431d-95e3-d508e79aad63/1635163542878-3653c3a0-e4f5-4a6c-b7b7-d7184c98a819.png) - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/2178d932-f0f2-438a-9f8c-527d1f6f05fa/1635163601788-28030c1a-37cd-4713-ba7a-af822bc3933a.png) - -3. Start baking. Select the Shader Editor view, choose the material properties, and in the Node Editor (**Shift+A**) create: Texture -> Image Texture. - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/e2ba5925-225c-48fa-b9e7-250e6f4e64a0/1635164198831-1237a411-8897-4ad0-b992-33c8b2b4000c.png) - -4. Click on **New** and give it a suitable name. You can see the image texture you just created on the left side when expanded. - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/cd9518f4-a6cd-48f3-8b04-7e7dfd20e661/1635164520500-013dc671-1db1-44f2-94a2-7213e0c5c343.png) - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/3864b696-e0f0-4511-a230-1ca067205f67/1635164571943-ab22c291-6e52-49f2-87d3-cacc1ba6d468.png) - -5. Copy this image texture you created to all material nodes under the building and make sure they are selected. - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/f92bd96d-4afd-42b5-b575-672461acb064/1635164645095-27735887-b48b-48ee-8877-c01efda281f2.png) - -6. Configure the baking parameters, but do not click on bake yet; we need the next step, UV. - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/38b7d00e-1363-420d-bbc0-a06b1cbbb5f1/1635164890110-0f3449bd-7109-4d22-b083-dc725797b93e.png) - -### Unwrapping UV - -1. Enter UV Editing view, select the building model, press **Tab** to enter edit mode, and you will see that the UV is currently messy. - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/f98df575-2c59-4288-a567-0ecbc66c1548/1635164950027-7a66b660-7b1d-4e83-a499-b37ac64bb6a9.png) - -2. Select the intelligent UV projection by pressing **U**, click OK, and you will get a decent UV unwrap. Of course, if the artist has time, they can also do it manually. - -image.png - -image.png - -image.png - -3. Return to the shader view, select the model layer and all materials under the layer, leave the baking parameters unchanged, and click Bake. There is a progress bar below, just wait patiently. - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/e8c439b1-4dc4-419e-abe4-ad7fb7a3b8e5/1635165107820-c9733262-2672-4d1a-ac01-0452ed71c440.png) - -4. After baking is complete, the image texture we created on the left has been baked. Press **alt+s** to quickly save this baked texture. - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/96becab7-74e3-4b2b-94e8-0c74bc5929d5/1635165192308-88c6f55f-faa6-4aa2-91c5-2b7114dbc3e8.png) - -### Exporting glTF File - -1. Delete all materials of the above model, create a background material, and assign it. - -image.png - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/a2d19c0a-79b9-4d51-b306-83a86d4388e4/1635165697839-5f88f82f-a66b-453d-970d-3398818ca8d8.png) - -2. Drag the house's baked image into the node view, and connect the color. - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/ad28062c-09f0-4586-8ca0-a927f94e57d0/1635165825176-cb680c0b-9126-47f8-8ee2-920df3831a89.png) - -3. Export in glTF format, make sure both layers' eyes and camera are enabled. - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/1590d92c-54ba-4efa-b6ca-6c2c3e8b95de/1635165880957-933cc281-8848-436f-a2af-186d818202d1.png) - -4. Preview the effect in the [glTF Viewer](https://galacean.antgroup.com/#/gltf-viewer). - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/81cfd9e4-474a-45dc-8133-de27a9c08dd6/1635166016557-59978f7f-6c91-4f13-99b3-9907e5c8cd44.png) - -Hope this helps everyone~ diff --git a/docs/en/art/bake-blender.mdx b/docs/en/art/bake-blender.mdx new file mode 100644 index 0000000000..1d3e3b60eb --- /dev/null +++ b/docs/en/art/bake-blender.mdx @@ -0,0 +1,86 @@ +--- +order: 0 +title: Blender Baking +type: Art +label: Art +--- + +> **_Special thanks to Monk and UU Efficiency Team for providing this tutorial._** + +In the process of actual model production, artists may use a lot of materials and textures to achieve better visual effects. However, there may be significant rendering discrepancies when exporting, and sometimes some effects may be lost. + +We have optimized the process of maximizing the restoration of 3D model rendering as much as possible, hoping to help everyone. + +### Blender Baking + +1. Select the model. Currently, this building is composed of many different models, and we need to merge them into one model. + + + +2. The shortcut to merge 2 models is **Ctrl+J**. If there are any models with modifiers, you need to apply the modifiers before merging; otherwise, the effects of the modifiers will be lost. + + + + + +3. Start baking. Select the Shader Editor view, choose the material properties, and in the Node Editor (**Shift+A**) create: Texture -> Image Texture. + + + +4. Click on **New** and give it a suitable name. You can see the image texture you just created on the left side when expanded. + + + + + +5. Copy this image texture you created to all material nodes under the building and make sure they are selected. + + + +6. Configure the baking parameters, but do not click on bake yet; we need the next step, UV. + + + +### Unwrapping UV + +1. Enter UV Editing view, select the building model, press **Tab** to enter edit mode, and you will see that the UV is currently messy. + + + +2. Select the intelligent UV projection by pressing **U**, click OK, and you will get a decent UV unwrap. Of course, if the artist has time, they can also do it manually. + +image.png + +image.png + +image.png + +3. Return to the shader view, select the model layer and all materials under the layer, leave the baking parameters unchanged, and click Bake. There is a progress bar below, just wait patiently. + + + +4. After baking is complete, the image texture we created on the left has been baked. Press **alt+s** to quickly save this baked texture. + + + +### Exporting glTF File + +1. Delete all materials of the above model, create a background material, and assign it. + +image.png + + + +2. Drag the house's baked image into the node view, and connect the color. + + + +3. Export in glTF format, make sure both layers' eyes and camera are enabled. + + + +4. Preview the effect in the [glTF Viewer](https://galacean.antgroup.com/#/gltf-viewer). + + + +Hope this helps everyone~ diff --git a/docs/en/art/bake-c4d.md b/docs/en/art/bake-c4d.mdx similarity index 62% rename from docs/en/art/bake-c4d.md rename to docs/en/art/bake-c4d.mdx index f1ee105a50..904e480f9b 100644 --- a/docs/en/art/bake-c4d.md +++ b/docs/en/art/bake-c4d.mdx @@ -13,11 +13,11 @@ Baking is the process of expressing all the rendered material color information Baking requires two sets of models: a high-poly model and a low-poly model. The high-poly model is used to bake more detailed textures, while the low-poly model is used in the engine with the textures. Both models must have consistent UVs, so the low-poly model is created first with UVs laid out, then detailed to create the high-poly model. The high-poly model can have more details to bake richer textures. -![1.gif](https://gw.alipayobjects.com/mdn/rms_d27172/afts/img/A*pbduQosyOJwAAAAAAAAAAAAAARQnAQ) + The left is the low-poly model, and the right is the high-poly model. The wiring information shows that the high-poly model has more details. -![2.gif](https://gw.alipayobjects.com/mdn/rms_d27172/afts/img/A*SgbzSKngA2IAAAAAAAAAAAAAARQnAQ) + Although the wiring details differ, the visible parts of both models must be consistent. The covered parts are not considered, so the high-poly model must be derived from the low-poly model to ensure UV consistency. @@ -25,34 +25,34 @@ Although the wiring details differ, the visible parts of both models must be con 1. Adjust the high-poly model in C4D to render the desired effect. Textures used on the face should also be drawn according to the overall UV layout. Once the materials are adjusted, you can prepare for baking. -image.png +image.png 2. An important point in baking is to select the camera mode. Specify the tag for the camera to be output, and add the unique camera tag of the OC renderer. - + 3. Click the added camera tag to enter the tag properties. There are many options for the camera type, one of which is baking. Select baking. -image.png +image.png 4. In the baking menu, set the baking group ID to a number other than 1, here it is set to 2. -image.png +image.png 5. Then group the models to be baked. As shown below, group all the required models and add the OC object tag. -image.png +image.png 6. Click the tag to display the tag properties, select the object layer, and set the baking ID inside to the same value as the baking group ID, which is 2 here. Then click render to bake the required image. -image.png +image.png -image.png +image.png If you are not very satisfied with the baking results, both C4D and Substance Painter can be used to paint and modify the textures. Realistic rendering is not the only option; painting textures can also be used to restore some special styles. -image.png +image.png ```markdown -image.png +image.png ``` diff --git a/docs/en/art/lottie.md b/docs/en/art/lottie.mdx similarity index 56% rename from docs/en/art/lottie.md rename to docs/en/art/lottie.mdx index ddd13a6770..9812fcabcc 100644 --- a/docs/en/art/lottie.md +++ b/docs/en/art/lottie.mdx @@ -14,25 +14,25 @@ label: Art ## How to use Bodymovin - Clone the project to your local machine from the Bodymovin GitHub homepage (link: airbnb/lottie-web), or download the .zip package.    - ![image.png](https://gw.alipayobjects.com/zos/OasisHub/429a17b1-19b3-41b8-902c-4992d722832f/1597673434824-27e06992-4a7d-486a-8514-62a470c53789.png) + - Find the "bodymovin.zxp" file in the "/build/extension" directory of the project directory, which is the plugin package. - Download and install ZXP Installer. ZXP Installer address: [https://aescripts.com/learn/zxp-installer](https://aescripts.com/learn/zxp-installer)
-![image.png](https://gw.alipayobjects.com/zos/OasisHub/1e996008-498c-4845-953b-8d39f05503e0/1597674042809-af5a084f-f21b-4bf4-b0d4-7404466b2a1e.png) + - Open AE, click "Edit" > "Preferences" > "General" menu item, check "Allow Scripts to Write Files and Access Network", and click OK. -![image.png](https://gw.alipayobjects.com/zos/OasisHub/22b31fcd-2b6e-4691-abd1-b173ccab87e7/1597674058269-f2242296-32c5-4ae9-973b-2943e04e94bc.png) + - Click "Window" > "Extensions" > "Bodymovin" menu item to open the Bodymovin interface and use the plugin. -![image.png](https://gw.alipayobjects.com/zos/OasisHub/cb002ffc-4b59-4dbd-a85d-56e0c1809475/1597674100420-41e2440c-fe9a-4280-8000-4f384ccdf9c3.png) + - Open the Bodymovin plugin window, and you will find the name of the project appearing in the list below. Select the name, set the JSON file output location, and click "Render". -image.png +image.png - Click Settings in the image above to configure the exported JSON: -image.png +image.png diff --git a/docs/en/assets/custom.md b/docs/en/assets/custom.mdx similarity index 96% rename from docs/en/assets/custom.md rename to docs/en/assets/custom.mdx index c8371064cb..4f914cfbeb 100644 --- a/docs/en/assets/custom.md +++ b/docs/en/assets/custom.mdx @@ -25,4 +25,4 @@ export class FBXLoader extends Loader { ## Reference - + diff --git a/docs/en/assets/gc.md b/docs/en/assets/gc.mdx similarity index 83% rename from docs/en/assets/gc.md rename to docs/en/assets/gc.mdx index 7c01677c4b..09941909ac 100644 --- a/docs/en/assets/gc.md +++ b/docs/en/assets/gc.mdx @@ -11,7 +11,7 @@ To avoid loading resources repeatedly, once a resource is loaded, it is cached i For example, the entity shown in the figure below contains a [MeshRenderer](/apis/core/#MeshRenderer) component, which depends on [Material](/apis/core/#Material). _Material_ may be referenced by multiple _MeshRenderers_. If _Material_ is released, other _MeshRenderers_ that reference it will not be able to find the _Material_ and will report an error. -![image.png](https://gw.alipayobjects.com/mdn/mybank_yulibao/afts/img/A*wXmqRIwqI18AAAAAAAAAAAAAARQnAQ) + > Note: JavaScript cannot track object references. Generally, in weakly typed languages like JavaScript, memory management functions are not provided to developers. All object memory is managed through garbage collection mechanisms, and you cannot determine when an object will be released, so there is no [destructor](https://zh.wikipedia.org/wiki/%E8%A7%A3%E6%A7%8B%E5%AD%90) to call for releasing referenced resources. @@ -25,13 +25,13 @@ engine.resourceManager.gc(); If you need to verify whether assets have been successfully released, you can follow the steps below and open the following example on a blank page: - + In this example, `Texture2D` and `Sprite` are created to render 2D sprites during initialization. When you click the GC button in the upper right corner, the `root` node is destroyed, and the reference counts of the texture and sprite assets are cleared. At this point, these assets will be truly destroyed. Taking memory snapshots before and after `gc` can give a more intuitive understanding of this process. 1. Before gc: **Developer Tools** -> **Memory** -> **Take Heap Snapshot** 2. After gc: **Developer Tools** -> **Memory** -> **Take Heap Snapshot** -> **Compare** -> **Select Snapshot Before gc** -image-1 +image-1 -image-1 +image-1 diff --git a/docs/en/assets/interface.md b/docs/en/assets/interface.mdx similarity index 85% rename from docs/en/assets/interface.md rename to docs/en/assets/interface.mdx index 556bb668b3..b031615361 100644 --- a/docs/en/assets/interface.md +++ b/docs/en/assets/interface.mdx @@ -5,7 +5,7 @@ type: Asset Workflow label: Resource --- -image-20240319102237183 +image-20240319102237183 The asset panel is an important panel in the editor that helps you manage all the assets used in the scene. In the asset panel, you can view and manage all the assets used in the scene, such as materials, textures, models, etc. Through the asset panel, you can add or delete assets, as well as categorize them for better organization. @@ -34,25 +34,25 @@ Currently, the editor supports the following uploaded or created assets (**+** i To add assets to the scene, you can click the add button on the asset panel or use the add option in the right-click menu of the asset panel to add new assets. After adding assets, you can edit the properties of the assets in the **[Inspector Panel](/en/docs/interface/inspector)**. The asset types in the asset panel are very rich, such as materials, textures, models, fonts, etc. Refer to the table above for details. -image-20240319103341208 +image-20240319103341208 You can also drag files into the asset panel to add assets. For multiple files, you can select and drag them into the asset panel together. -drag6 +drag6 ### Organizing Assets Assets in the asset panel can be managed by categorization for better organization. You can create folders in the asset panel and move assets into the corresponding folders (you can also move them into folders in the left directory) to achieve categorized management. Folders in the asset panel can be nested, allowing you to create multi-level folders for better organization of assets. -drag7 +drag7 The asset panel provides a user-friendly toolbar for browsing assets, helping you quickly find a specific asset or type of asset. You can also modify the browsing mode, sorting method, and thumbnail size of assets according to your usage habits. -drag8 +drag8 After organizing the assets, each asset has a **relative path**. You can right-click an asset to copy its path. -image-20240319132804611 +image-20240319132804611 This is important for project development because projects often need to load assets asynchronously, meaning that certain assets (or even scenes) do not need to be loaded during initialization. You can control the loading of an asset through scripts. For specific syntax, refer to the usage of [Assets](/en/docs/assets/load) and [Scenes](/en/docs/core/scene). For example, to load a scene: @@ -76,13 +76,13 @@ You can also use `⌘`+ `C` and `⌘`+ `V` operations. After selecting an asset, the **[Inspector Panel](/en/docs/interface/inspector)** on the right will display the configurable properties of the asset. The configurable items corresponding to different assets are different. For example, glTF assets will display a model preview window, and material assets will display detailed material configuration options. -image-20240319120017637 +image-20240319120017637 ### Using Assets 部分资产(如 glTF 资产)支持拖拽到场景中或节点树中。 -drag9 +drag9 ### Shortcuts diff --git a/docs/en/assets/load.md b/docs/en/assets/load.mdx similarity index 97% rename from docs/en/assets/load.md rename to docs/en/assets/load.mdx index 810ab48dcc..b620f2f458 100644 --- a/docs/en/assets/load.md +++ b/docs/en/assets/load.mdx @@ -86,7 +86,7 @@ this.engine.resourceManager.load("Assets/texture.png"); > In the editor, you can quickly copy the relative path of the asset through **[Asset Panel](/en/docs/assets/interface)** -> **Right-click asset** -> **Copy relative path**. -![image-20240717180517517](https://mdn.alipayobjects.com/rms/afts/img/A*yft2SLLgIyQAAAAAAAAAAAAAARQnAQ/original/image-20240717180517517.png) + ### baseUrl diff --git a/docs/en/assets/overall.md b/docs/en/assets/overall.mdx similarity index 100% rename from docs/en/assets/overall.md rename to docs/en/assets/overall.mdx diff --git a/docs/en/assets/type.md b/docs/en/assets/type.md deleted file mode 100644 index 7ec0b87706..0000000000 --- a/docs/en/assets/type.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -order: 1 -title: Types of Assets -type: Asset Workflow -label: Resource ---- - -Galacean defines a series of out-of-the-box built-in assets and also provides flexible custom loading capabilities. - -## Built-in Resource Types - -| Resource | Loading Type | Reference | -| ------------ | ----------------------- | -------------------------------------------------------------------------- | -| Texture2D | AssetType.Texture2D | [Example](https://galacean.antgroup.com/#/examples/latest/wrap-mode) | -| TextureCube | AssetType.HDR | [Example](https://galacean.antgroup.com/#/examples/latest/hdr-loader) | -| glTF | AssetType.GLTF | [Example](https://galacean.antgroup.com/#/examples/latest/gltf-basic) | -| Compressed Texture | AssetType.KTX2 | [Example](https://galacean.antgroup.com/#/examples/latest/compressed-texture) | -| Ambient Light | AssetType.Env | [Example](https://galacean.antgroup.com/#/examples/latest/ambient-light) | -| Sprite Atlas | AssetType.SpriteAtlas | [Example](https://galacean.antgroup.com/#/examples/latest/sprite-atlas) | -| Font | AssetType.Font | [Example](https://galacean.antgroup.com/#/examples/latest/text-renderer-font) | - -> Note: The ambient light baking product comes from the editor or using glTF Viewer, see the image below: - -![gltf viewer](https://gw.alipayobjects.com/mdn/rms_7c464e/afts/img/A*9mGbSpQ4HngAAAAAAAAAAAAAARQnAQ) - -## Custom Asset Loaders - -Users can also create custom loaders to load custom resources: - -```typescript -@resourceLoader(FBX, ["fbx"]) -export class FBXLoader extends Loader { - load(item: LoadItem, resourceManager: ResourceManager): AssetPromise { - return new AssetPromise((resolve, reject)=> { - ... - }) - } -} -``` - -1. Mark it as a _ResourceLoader_ using the [@resourceLoader](/apis/core/#resourceLoader) decorator, passing in the type enum and the parsed resource extension. In the example above, `FBX` is the type enum, and `["fbx"]` is the parsed resource extension. -2. Override the [load](/apis/core/#ResourceManager-load) method. The `load` method will receive `loadItem` and `resourceManager`, where `loadItem` contains the basic loading information, and `resourceManager` can help load other referenced resources. -3. Return an [AssetPromise](/apis/core/#AssetPromise) object. `resolve` the resolved resource result, for example, FBX returns a specific `FBXResource`. -4. If there is an error, `reject` it. diff --git a/docs/en/basics/overview.md b/docs/en/basics/overview.mdx similarity index 100% rename from docs/en/basics/overview.md rename to docs/en/basics/overview.mdx diff --git a/docs/en/basics/quickStart/quick-start.md b/docs/en/basics/quickStart/quick-start.mdx similarity index 70% rename from docs/en/basics/quickStart/quick-start.md rename to docs/en/basics/quickStart/quick-start.mdx index f3aa0ea84a..ca9e1a25a7 100644 --- a/docs/en/basics/quickStart/quick-start.md +++ b/docs/en/basics/quickStart/quick-start.mdx @@ -10,11 +10,11 @@ We will understand the use of the engine through an example of a "rotating duck. After logging in, the first thing you see is the editor's homepage, which displays all the projects you have created. Use the button in the upper right corner to create a project. After clicking, you can choose the type of project to create, either 2D or 3D. We choose 3D Project. -image-20230921161225962 +image-20230921161225962 At this point, a new blank project will open, with a camera and a directional light built into the scene. -image-20240705161613717 +image-20240705161613717 ## Build the Scene @@ -33,49 +33,49 @@ Before that, let's explain some basic concepts in the game engine: First, click this [link](https://gw.alipayobjects.com/os/bmw-prod/6cb8f543-285c-491a-8cfd-57a1160dc9ab.glb) to download a 3D model of a duck. Drag the downloaded model to the asset panel, and after a while, you will see that the model has been uploaded to the editor: -image-20240705162025015 +image-20240705162025015 Next, drag the model from the asset panel to the scene view, and you can render this 3D model in the scene. At this point, a new entity has been added to the scene's node tree. -image-20240705162359455 +image-20240705162359455 ### Adjust the Duck's Transform First, to better preview the final effect on mobile devices, we can select the **camera** entity. You can use the positioning button to clarify the current preview camera's position in the scene, simulate real device previews by selecting different sizes of mobile devices, and also choose to lock the preview window so that it does not disappear when selecting other entities. -image-20240705162931132 +image-20240705162931132 Next, we select the duck and use the **move**, **rotate**, **scale**, and other [transform](/en/docs/core/transform) operations from the top toolbar. Switching between different transform types will also switch different operation handles on the duck. These operation handles are similar to the interactions in most 3D software. If you are using such handles for the first time, don't worry, just move the mouse to the handle and play around a bit, and you will quickly get the hang of it. Through simple transform operations, we can adjust the duck's position, angle, and size to meet our expected effect. The camera preview in the upper left corner will display the effect of your adjustments in real-time. -image-20240705163544657 +image-20240705163544657 ### Adjusting the Light At this point, the duck is a bit dark. Select the `DirectLight` light entity in the node tree, and in the inspector panel on the right, drag the slider to appropriately adjust the intensity of the light, making the scene brighter. -image-20240705164814972 +image-20240705164814972 ### Making the Duck Rotate First, in the asset panel, *right-click → Create → New Empty Script* to create a Script asset. -image-20240705170003841 +image-20240705170003841 After creation, you can see a new Script asset in the asset panel. -image-20240705170256694 +image-20240705170256694 Next, select the duck entity, and in the inspector panel on the right, click **Add Component** to add a [ Script ](/en/docs/script/class) component. -image-20240705165619069 +image-20240705165619069 Click **Select asset** to choose the Script you just created. This binds the script to the entity, meaning the script's lifecycle functions will apply to this entity. -image-20240705170349805 +image-20240705170349805 After creating the script, you can **double-click it** to jump to the code editor page. -image-20240705170853613 +image-20240705170853613 In the code editor, add a line of code in the `onUpdate` function to make the duck rotate along the Y-axis. After writing the code, save it (`⌘+s`), and you can see the effect in real-time in the preview area on the right. @@ -94,6 +94,6 @@ export default class extends Script { We have completed the development work in the editor. Next, let's export this project to the local machine. Click the **Download** button on the left toolbar to bring up the export interface. Here, rename the project to "duck", then click the `Download` button. The editor will package the project into a `duck.zip` file for download. -image-20240705171230958 +image-20240705171230958 After the project is packaged, open the box project with VsCode, run `npm install` & `npm run dev`, and you can see the project running normally. diff --git a/docs/en/basics/version.md b/docs/en/basics/version.mdx similarity index 96% rename from docs/en/basics/version.md rename to docs/en/basics/version.mdx index d7bbc13105..c2ef6a9e6a 100644 --- a/docs/en/basics/version.md +++ b/docs/en/basics/version.mdx @@ -61,7 +61,7 @@ In [Project Settings](/en/docs/interface/menu/#项目设置), you can control th Most Galacean packages will output version information in the `Console` at runtime. -image.png +image.png This is usually used to determine if there are issues with package version dependencies: diff --git a/docs/en/core/scene.mdx b/docs/en/core/scene.mdx index 2ccc326c17..dd0675e5c9 100644 --- a/docs/en/core/scene.mdx +++ b/docs/en/core/scene.mdx @@ -94,7 +94,7 @@ engine.sceneManager.removeScene(scene2); The example of multi-scene rendering is as follows: - + ### Merging Scenes diff --git a/docs/en/core/transform.mdx b/docs/en/core/transform.mdx index c27dc8d900..3fefb201a0 100644 --- a/docs/en/core/transform.mdx +++ b/docs/en/core/transform.mdx @@ -11,7 +11,7 @@ label: Core > For a deeper understanding, refer to Galacean's **[Coordinate System](/docs/core/space)**. - + ## Editor Usage diff --git a/docs/en/device/restore.md b/docs/en/device/restore.mdx similarity index 100% rename from docs/en/device/restore.md rename to docs/en/device/restore.mdx diff --git a/docs/en/graphics/2D/2d.md b/docs/en/graphics/2D/2d.mdx similarity index 83% rename from docs/en/graphics/2D/2d.md rename to docs/en/graphics/2D/2d.mdx index 5871667d7d..df76d21127 100644 --- a/docs/en/graphics/2D/2d.md +++ b/docs/en/graphics/2D/2d.mdx @@ -8,11 +8,11 @@ label: Graphics/2D Galacean is a 3D/2D interactive solution. You can quickly experience 2D interactive development by **clicking Template** -> **Flappy Bird** in the **Menu View** on the **Editor Homepage**. -image.png +image.png You can also create a blank 2D project by **clicking New Project** -> **2D Project** in the **Project View** on the **Editor Homepage**. -image.png +image.png In the editor, there is not much difference between 2D and 3D projects, except that the perspective switches from 3D to 2D, and the default camera is set to **orthographic**. In the **Hierarchy Interface**, you can **select a node and right-click** -> **2D Object** to quickly create a 2D child node. In a 2D project, you can attach a **Sprite Renderer** and set **Sprite Assets** to render images, use a **Text Renderer** to render 2D text, use **SpriteMask** to achieve masking effects for 2D elements, and use Lottie or Spine (2D skeletal animation) to display 2D effects. For performance optimization, you can also pack **sprites** into a **sprite atlas** to improve request and rendering performance. diff --git a/docs/en/graphics/2D/lottie.md b/docs/en/graphics/2D/lottie.mdx similarity index 92% rename from docs/en/graphics/2D/lottie.md rename to docs/en/graphics/2D/lottie.mdx index 20400c634f..f34025e94c 100644 --- a/docs/en/graphics/2D/lottie.md +++ b/docs/en/graphics/2D/lottie.mdx @@ -16,17 +16,17 @@ It is recommended that designers use base64 format for images when exporting Lot After obtaining the `.json` file, developers need to upload the `.json` file to the Galacean Editor. Use the upload button in the asset panel to select the "lottie" asset, choose a local [lottie json](https://github.com/galacean/galacean.github.io/files/14106485/_Lottie.3.json) file, and then upload it: - + ### Add Component Select an entity, add the Lottie component, and choose the resource as the asset uploaded in the previous step to display and play the Lottie effect: -![lottie](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*ehFMT7vBaCAAAAAAAAAAAAAADjCHAQ/original) + Developers can adjust various parameters in the properties panel to configure the Lottie: -![lottie](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*OswOQI837OkAAAAAAAAAAAAADjCHAQ/original) + | Property | Description | | :--- | :--- | @@ -74,9 +74,9 @@ await lottie.play(); The editor provides an animation slicing function, allowing you to cut the entire segment provided by the designer into multiple segments. Each segment needs to define three fields: segment name, start frame, and end frame. - + - + This operation will add the `lolitaAnimations` field in the Lottie protocol to implement animation slicing: @@ -129,17 +129,17 @@ engine.resourceManager.load({ }); ``` - + ### 3D Transform In business scenarios, there is often a need for 3D transformations, such as entrance animations for pop-ups. For example, with rotation, traditional lottie-web solutions can only rotate along the **Z-axis** (i.e., perpendicular to the screen's normal direction). Even if we achieve rotation along the **X-axis** or **Y-axis** in AE, it will be ignored when played with lottie-web. -3D rotation +3D rotation Thanks to the unified architecture of the Galacean Engine 2D/3D engine, 3D transformation functions can be easily implemented. - + ### Version Dependencies | Engine Version | Lottie Version | diff --git a/docs/en/graphics/2D/spine/editor.md b/docs/en/graphics/2D/spine/editor.mdx similarity index 66% rename from docs/en/graphics/2D/spine/editor.md rename to docs/en/graphics/2D/spine/editor.mdx index b2c4394084..87f6a21898 100644 --- a/docs/en/graphics/2D/spine/editor.md +++ b/docs/en/graphics/2D/spine/editor.mdx @@ -21,29 +21,29 @@ Below is a brief overview of the Spine asset export process: 1. After completing the animation, click `Spine Menu` > `Export` to open the export window. -Export panel in Spine editor +Export panel in Spine editor 2. In the upper left corner of the export window, select **Binary** (recommended to export in binary format instead of JSON format, as it results in smaller file sizes and faster loading). -Export window in Spine editor +Export window in Spine editor 3. Check the **Texture Atlas** packing checkbox. -Click packing texture atlas button in Export window +Click packing texture atlas button in Export window 4. Click **Packing Settings**. The packing settings refer to the texture packing configurations. Refer to the [official documentation](https://zh.esotericsoftware.com/spine-texture-packer) for detailed parameters. After completing the packing settings, click **OK**. -Texture pack window in Spine Editor +Texture pack window in Spine Editor 5. Return to the export window, select the export folder, and click **Export**. -Click export button in texture pack window +Click export button in texture pack window 6. You will get the following three files: -Spine assets in folder +Spine assets in folder - spineboy.skel: Contains skeleton and animation data, the core information for binding animation actions to the skeleton. - spineboy.atlas: Stores information about the texture atlas, including the position and size of each texture in the atlas. @@ -54,30 +54,30 @@ The second step is to import the files exported from the Spine editor into the G After opening the editor, drag the exported files directly into the [Assets Panel](/docs/assets/interface/) to upload them, as shown in the following GIF: -Drag spine assets into Galacean editor +Drag spine assets into Galacean editor You can also click the upload button in the assets panel and select the files to upload: -Use upload button to upload spine assets -
+Use upload button to upload spine assets +
Once uploaded, you will see the uploaded Spine assets in the assets panel, including: SpineSkeletonData assets, SpineAtlas assets, and texture assets. ### SpineSkeletonData Asset -Spine skeleton data asset icon +Spine skeleton data asset icon The SpineSkeletonData asset stores skeleton data and references to the generated SpineAtlas asset. By clicking the asset, you can preview the Spine animation in the inspector, where you can switch between `Skin` and `Animation Clips` in the preview panel: -Spine skeleton data preview +Spine skeleton data preview ### SpineAtlas Asset -Spine atlas asset +Spine atlas asset The SpineAtlas asset stores the texture atlas file and contains references to the required texture assets. By clicking the asset, you can view its referenced texture assets and atlas information in the inspector. -Spine atlas preview +Spine atlas preview ### Updating Assets If you need to update your Spine assets, re-export the assets from the Spine editor and import them into the Galacean editor to overwrite the existing files. @@ -91,23 +91,23 @@ After uploading the assets, you can add Spine animations to the scene using the Drag-and-drop is the quickest method. Click the SpineSkeletonData asset, hold and drag it into the viewport to quickly create an entity with the SpineAnimationRenderer component and specify the selected SpineSkeletonData asset. -Drag Spine skeleton data asset into viewport +Drag Spine skeleton data asset into viewport ### Quick Add Click the quick add button in the upper left corner and select `2D Object` > `SpineAnimationRenderer`. -Quick add Spine animation renderer +Quick add Spine animation renderer After adding, you will see a new entity with the SpineAnimationRenderer component. Click the Resource property and select the uploaded SpineSkeletonData asset to see the Spine animation. -Select spine skeleton data asset in component panel +Select spine skeleton data asset in component panel ### Manual Add The manual method is similar to quick add but requires manually creating a new entity in the node tree and adding the SpineAnimationRenderer component via the AddComponent button in the inspector. -Use add component to add spine animation renderer +Use add component to add spine animation renderer After adding the SpineAnimationRenderer component, you also need to specify the component's Resource, which is the SpineSkeletonData asset that the SpineAnimationRenderer component will render. @@ -117,7 +117,7 @@ All three methods for adding Spine animations are essentially the same: by addin The SpineAnimationRenderer component configuration is as follows: -Spine animation renderer component config +Spine animation renderer component config Using the SpineAnimationRenderer component, you can configure the Spine animation assets and default states: @@ -133,5 +133,5 @@ Using the SpineAnimationRenderer component, you can configure the Spine animatio Finally, after completing scene editing, you can refer to the [Project Export](/en/docs/platform/platform/) process to export the editor project. Next section: [Using Galacean Spine Runtime in Your Code](/en/docs/graphics/2D/spine/runtime) -



+



Next Chapter: [Using in Code](/en/docs/graphics/2D/spine/runtime) diff --git a/docs/en/graphics/2D/spine/example.md b/docs/en/graphics/2D/spine/example.mdx similarity index 69% rename from docs/en/graphics/2D/spine/example.md rename to docs/en/graphics/2D/spine/example.mdx index 85e882f49b..8605f57b88 100644 --- a/docs/en/graphics/2D/spine/example.md +++ b/docs/en/graphics/2D/spine/example.mdx @@ -10,58 +10,57 @@ label: Graphics/2D/Spine/example The Galacean editor provides a series of tutorial templates to help you quickly get started with using Spine animations. After entering the [editor](https://galacean.antgroup.com/editor/projects), you can click on the Templates Tab on the left to view these templates. -

**Animation Control** This template demonstrates how to use the `setAnimation` and `addAnimation` APIs of `AnimationState` to orchestrate Spine animations: -spine-animation +spine-animation **Animation Transition and Blending** This template shows how to set transitions and blend animations between different tracks in Spine: -spine-mix-blend +spine-mix-blend **Mix and Match Outfits** This template demonstrates the capability of Spine to mix and match outfits. By freely combining attachments from different skins, you can mix and match accessories from various skins: -mix-and-match +mix-and-match **Dynamic Partial Skin Switching** This template showcases the ability to dynamically switch partial skins. You can create new attachments based on an additionally uploaded atlas and replace them dynamically. -spine-dynamic-change +spine-dynamic-change ## Examples **Animation Control** This example demonstrates how to orchestrate a Spine animation queue using the `setAnimation` and `addAnimation` APIs: - + **Follow Shooting** This example shows how to achieve an aiming and shooting effect by modifying the IK bone position: - + **Partial Skin Switching** This example demonstrates how to achieve a partial outfit change by modifying attachments in slots: - + **Full Skin Switching** This example demonstrates how to achieve full skin switching using the `setSkin` method: - + **Skin Mixing** This example demonstrates how to achieve mix-and-match effects at runtime by combining new skins: - + **Physics** This example showcases the physics-based animation effects in Spine 4.2: - + The next chapter: [Versions and Performance](/docs/graphics/2D/spine/other) diff --git a/docs/en/graphics/2D/spine/other.md b/docs/en/graphics/2D/spine/other.mdx similarity index 97% rename from docs/en/graphics/2D/spine/other.md rename to docs/en/graphics/2D/spine/other.mdx index f6b98df2bf..381ec41457 100644 --- a/docs/en/graphics/2D/spine/other.md +++ b/docs/en/graphics/2D/spine/other.mdx @@ -9,7 +9,7 @@ label: Graphics/2D/Spine/other ### Upgrades and Changes in 1.4 After upgrading to Editor version 1.4, besides updating the engine version in the editor's [Project Settings](/docs/interface/menu/#project-settings), please note the following changes to the 1.4 Spine API: -1. We no longer recommend creating Spine animations using the method: adding the `SpineAnimationRenderer` component via `addComponent` + setting the resource using `set SpineResource`.
+1. We no longer recommend creating Spine animations using the method: adding the `SpineAnimationRenderer` component via `addComponent` + setting the resource using `set SpineResource`.
In version 1.4, we introduced an instantiation method `instantiate` for SpineResource. The `instantiate` method returns a Spine animation entity that uses the resource, making the creation process much faster and more convenient. 2. `defaultState` has been renamed to `defaultConfig`. This parameter represents the default configuration of the Spine animation. The renamed parameter makes its purpose clearer. diff --git a/docs/en/graphics/2D/spine/overview.md b/docs/en/graphics/2D/spine/overview.mdx similarity index 100% rename from docs/en/graphics/2D/spine/overview.md rename to docs/en/graphics/2D/spine/overview.mdx diff --git a/docs/en/graphics/2D/spine/runtime.md b/docs/en/graphics/2D/spine/runtime.mdx similarity index 94% rename from docs/en/graphics/2D/spine/runtime.md rename to docs/en/graphics/2D/spine/runtime.mdx index 2b9f24abc5..c0b9fae7a5 100644 --- a/docs/en/graphics/2D/spine/runtime.md +++ b/docs/en/graphics/2D/spine/runtime.mdx @@ -36,7 +36,7 @@ await engine.resourceManager.load({ If not added to the scene, you need to load it manually in the code. Follow these steps: 1. Copy the SkeletonDataAsset link. Right-click on the SkeletonDataAsset, select `Copy relative path` to copy the asset path. - + 2. Use ResourceManager to load @@ -66,10 +66,10 @@ const resource = await engine.resourceManager.load({ ``` When loading custom uploaded assets: -- If passing the parameter as `url`, ensure the files are in the same directory, such as:
-https://your.spineboy.json
-https://your.spineboy.atlas
-https://your.spineboy.png
+- If passing the parameter as `url`, ensure the files are in the same directory, such as:
+https://your.spineboy.json
+https://your.spineboy.atlas
+https://your.spineboy.png
- If passing the parameter as `urls` (multiple links), the files do not need to be in the same directory: ```typescript @@ -83,10 +83,10 @@ const resource = await engine.resourceManager.load({ }); ``` -- If no texture URL is provided, the loader will read the texture image name from the atlas file and look for the texture in the same directory as the atlas file.
-- If the custom uploaded asset lacks file extensions, you can add URL query parameters to the links, e.g.:
-https://your.spineboyjson?ext=.json,
-https://your.spineboyatlas?ext=.atlas
+- If no texture URL is provided, the loader will read the texture image name from the atlas file and look for the texture in the same directory as the atlas file.
+- If the custom uploaded asset lacks file extensions, you can add URL query parameters to the links, e.g.:
+https://your.spineboyjson?ext=.json,
+https://your.spineboyatlas?ext=.atlas
- If the Spine animation atlas includes multiple images (e.g., a.png and b.png), follow the order recorded in the atlas file to pass the image URLs: ```typescript @@ -236,26 +236,26 @@ The first three parameters are easy to understand, so let’s focus on the fourt When `delay > 0` (e.g., `delay` is 1), the preceding animation switches to the next animation after playing for 1 second, as shown below: -animation delay > 0 + If animation A’s duration is less than 1 second, it will either loop until 1 second or remain in its finished state until 1 second, depending on whether looping is enabled. When `delay = 0`, the next animation plays immediately after the preceding animation finishes, as shown below: -animation delay = 0 + Assuming animation A lasts 1 second and the transition duration is 0.2 seconds, animation B will transition starting at 0.8 seconds (1 - 0.2). When `delay < 0`, the next animation begins before the preceding animation finishes, as shown below: Similarly, if animation A lasts 1 second with a 0.2-second transition, animation B will begin transitioning at 0.6 seconds. -animation delay < 0 + Besides `addAnimation`, the [addEmptyAnimation](https://zh.esotericsoftware.com/spine-api-reference#AnimationState-addEmptyAnimation) method can add an empty animation. Empty animations reset animations to their initial state. `addEmptyAnimation` takes three parameters: `TrackIndex`, `mixDuration`, and `delay`. The `TrackIndex` and `delay` parameters are the same as those in `addAnimation`. The `mixDuration` parameter specifies the transition duration, and the animation will reset to its initial state over this duration. As shown below (the brown area on the right represents the empty animation): -Add empty animation api +Add empty animation api ... @@ -273,7 +273,7 @@ For more details on these parameters, refer to the [TrackEntry official document #### **Animation Events** -Animation event diagram +Animation event diagram When controlling animations via the `AnimationState` API, various events, as shown above, can be triggered. - When a new animation starts, the `Start` event is triggered. diff --git a/docs/en/graphics/2D/sprite.md b/docs/en/graphics/2D/sprite.mdx similarity index 83% rename from docs/en/graphics/2D/sprite.md rename to docs/en/graphics/2D/sprite.mdx index d742b3b5de..ab5337cf80 100644 --- a/docs/en/graphics/2D/sprite.md +++ b/docs/en/graphics/2D/sprite.mdx @@ -21,11 +21,11 @@ label: Graphics/2D The region determines the display content of the sprite. You can select a rectangular area in the texture to display, and the excess part will be automatically filtered out, as shown below: -avatar +avatar The pivot represents the position of the sprite's center in the region, as shown below: -avatar +avatar ## Usage @@ -35,13 +35,13 @@ The pivot represents the position of the sprite's center in the region, as shown In the **[Assets Panel](/en/docs/assets/interface/)**, right-click on the blank area and select **Upload** → **Sprite** → **Select the corresponding image** to upload the sprite asset. After a successful upload, the current asset list will synchronously add a texture asset named `image_name.png` and a sprite asset named `image_name-spr.png`. -avatar +avatar #### Create Blank Sprite In the **[Assets Panel](/en/docs/assets/interface/)**, right-click on the blank area and select **Create** → **Sprite** to create a blank sprite asset. -avatar +avatar #### Script Creation @@ -58,8 +58,8 @@ const spriteWithTexture = new Sprite(engine, texture2D); Here, we specifically explain the setting of the pivot in the editor. For the pivot, the bottom-left corner of the texture is `(0, 0)`, the X-axis goes from left to right, and the Y-axis goes from bottom to top. The editor has some built-in common pivot shortcut values, as shown below: -avatar +avatar If the built-in values do not meet your needs, you can customize your own pivot, as shown below: -avatar +avatar diff --git a/docs/en/graphics/2D/spriteAtlas.md b/docs/en/graphics/2D/spriteAtlas.mdx similarity index 81% rename from docs/en/graphics/2D/spriteAtlas.md rename to docs/en/graphics/2D/spriteAtlas.mdx index 49e4f413d0..c581decb0d 100644 --- a/docs/en/graphics/2D/spriteAtlas.md +++ b/docs/en/graphics/2D/spriteAtlas.mdx @@ -14,7 +14,7 @@ label: Graphics/2D In the example of the sprite atlas below, only one draw call is made per frame: - + ## Editor Usage @@ -22,11 +22,11 @@ In the example of the sprite atlas below, only one draw call is made per frame: Right-click in the **[Assets Panel](/en/docs/assets/interface/)**, select `Create` from the `Function List`, and choose `Sprite Atlas`. At this point, a blank sprite atlas asset is successfully created. -buildBox +buildBox Select the `Sprite Atlas` asset to view detailed information about the asset in the **[Inspector Panel](/en/docs/interface/inspector)**. -buildBox +buildBox ### Adding Sprites @@ -36,13 +36,13 @@ After determining the inclusion relationship between the `Sprite Atlas` and the Left-click to select the `Sprite` asset to be added. In the **[Inspector Panel](/en/docs/interface/inspector)**, find the sprite's `Affiliation`, and select `Pack into Atlas` to choose the `Sprite Atlas` asset you want to pack into. -buildBox +buildBox #### Method 2: Operating the Sprite Atlas Left-click to select the target `Sprite Atlas` asset. In the **[Inspector Panel](/en/docs/interface/inspector)**, find the sprite list of the atlas, and select `Add Sprite` to choose the `Sprite` asset you want to pack. (If you select a folder, all sprites in the folder directory will be added) -buildBox +buildBox ### Removing Sprites @@ -50,25 +50,25 @@ Left-click to select the target `Sprite Atlas` asset. In the **[Inspector Panel] Left-click to select the `Sprite` asset to be removed from the atlas. In the **[Inspector Panel](/en/docs/interface/inspector)**, find the sprite's `Affiliation` (make sure the target atlas path matches), and click the remove button to remove the sprite from the target atlas. -buildBox +buildBox #### Method 2: Operating the Sprite Atlas Left-click to select the `Sprite Atlas` asset to be operated on. In the **[Inspector Panel](/en/docs/interface/inspector)**, find the sprite list of the atlas, find the sprite object to be removed, and click the remove button. -buildBox +buildBox ### Quick Operations on Sprites After the `Sprite` asset is added to the `Sprite Atlas`, you can quickly operate the sprite in the **[Inspector Panel](/en/docs/interface/inspector)** of the `Sprite Atlas`. Its properties will be synchronously modified in the `Sprite` asset. -buildBox +buildBox ### Settings #### Packaging Settings -image-20231208165843716 +image-20231208165843716 | Setting Name | Description | | ------------------ | ---------------------------------------- | @@ -80,11 +80,11 @@ After the `Sprite` asset is added to the `Sprite Atlas`, you can quickly operate If you encounter the following warning during packaging, it means that the size of the atlas exceeds the maximum width and height of the texture. You can solve this by adjusting the `Max Texture Width` and `Max Texture Height` or **rearranging** the scattered images for packaging. - + #### Export Settings -image-20231208165430415 +image-20231208165430415 | Property | Value | | --- | --- | @@ -98,7 +98,7 @@ If you encounter the following warning during packaging, it means that the size Click on the `Sprite Atlas` asset, adjust the `Max Texture Width` and `Max Texture Height` in the `Packaging Settings`, and then call `Pack and Preview` in the `Packaging Object` to ensure a high level of atlas utilization. -![image-20210901171947471](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*lyhRSY63HJgAAAAAAAAAAAAADjCHAQ/original) + The left side of the preview image shows the size information of the exported image, and the right side shows the atlas utilization information (representing the percentage of the total area of all scattered images occupying the final large image). You can adjust the packing settings based on this value to achieve better results. @@ -122,7 +122,7 @@ galacean-tool-atlas p inputPath -o outputName Here, `inputPath` represents the path of the folder to be packed, and `outputName` represents the name of the output sprite atlas file. If you get the result shown in the image below, it means the packing was successful. -image.png +image.png | Property | Description | | -------------- | --------------------------------------------- | diff --git a/docs/en/graphics/2D/spriteMask.md b/docs/en/graphics/2D/spriteMask.mdx similarity index 85% rename from docs/en/graphics/2D/spriteMask.md rename to docs/en/graphics/2D/spriteMask.mdx index 2ca55b28e6..4847086511 100644 --- a/docs/en/graphics/2D/spriteMask.md +++ b/docs/en/graphics/2D/spriteMask.mdx @@ -8,7 +8,7 @@ label: Graphics/2D The Sprite Mask component is used to apply masking effects to [Sprite Renderer](/en/docs/graphics/2D/spriteRenderer/) and [Text Renderer](/en/docs/graphics/2D/text/) in 3D/2D scenes. - + Control the interaction with [Sprite](/en/docs/graphics/2D/sprite/) using parameters provided by [SpriteMask](/apis/core/#SpriteMask). @@ -21,7 +21,7 @@ Control the interaction with [Sprite](/en/docs/graphics/2D/sprite/) using parame The `influenceLayers` of `SpriteMask` indicates which mask layers the mask will affect for `SpriteRenderer`. The `maskLayer` of `SpriteRenderer` indicates which mask layers the sprite belongs to, as shown below: -070C8B9F-14E2-4A9A-BFEC-4BC3F2BB564F +070C8B9F-14E2-4A9A-BFEC-4BC3F2BB564F In the image above, the spriteMask affects sprites in `Layer1` and `Layer30`. spriteRenderer0 is in `Layer2`, so there is no intersection, and spriteRenderer0 does not interact with spriteMask. spriteRenderer1 is in `Layer1`, which intersects with the mask layers affected by spriteMask, so spriteRenderer1 interacts with spriteMask. @@ -31,25 +31,25 @@ In the image above, the spriteMask affects sprites in `Layer1` and `Layer30`. sp When we need to mask a sprite, we first need to create an entity and add a sprite mask component, as shown below: -![mask-create](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*GYVBTbTvqU4AAAAAAAAAAAAADjCHAQ/original) + ### Setting the Mask Area The sprite mask component uses an image to represent the mask area. We set the sprite resource through the component's `sprite` parameter, as shown below: -![mask-sprite](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*k5GsSYqQTKoAAAAAAAAAAAAADjCHAQ/original) + ### Setting the Sprite's Mask Type After the above two steps, you may find that the mask still has no effect. This is because the current sprite's mask type is still the default (None). We set the `mask interaction` of the sprite in the scene to the inner mask type, as shown below: -![mask-interaction](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*GdxhSYLY4EIAAAAAAAAAAAAADjCHAQ/original) + ### Setting alpha cutoff This parameter represents the lower limit of the effective `alpha` value for the current mask (range: `0~1`). In other words, any alpha value in the sprite's texture that is less than the alpha cutoff will be discarded (i.e., it will not be considered as a mask area). We can dynamically adjust the value of this property to see the actual effect, as shown below: -![mask-alpha](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*2CLjT7UTVa8AAAAAAAAAAAAADjCHAQ/original) + Similarly, in the script, we can use the following code to apply the sprite mask: diff --git a/docs/en/graphics/2D/spriteRenderer.md b/docs/en/graphics/2D/spriteRenderer.mdx similarity index 81% rename from docs/en/graphics/2D/spriteRenderer.md rename to docs/en/graphics/2D/spriteRenderer.mdx index 04327d2eb9..b7245616ff 100644 --- a/docs/en/graphics/2D/spriteRenderer.md +++ b/docs/en/graphics/2D/spriteRenderer.mdx @@ -10,11 +10,11 @@ The [SpriteRenderer](/apis/core/#SpriteRenderer) component is used to display im > Note: By default, the sprite renderer places the image on the XoY plane. -avatar +avatar ## Properties -![Properties Panel](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*pcbLSahH--YAAAAAAAAAAAAADjCHAQ/original) + | Property | Type | Description | | :----------------------------------------------------------- | :-------------------------------------------------------- | :------------------------------------------------------------------------------------------------ | @@ -36,13 +36,13 @@ The [SpriteRenderer](/apis/core/#SpriteRenderer) component is used to display im By selecting a node in the **[Hierarchy Panel](/en/docs/interface/hierarchy)**, you can quickly add a child node with a sprite renderer by right-clicking -> **2D Object** -> **Sprite Renderer**. -avatar +avatar #### Attach Sprite Renderer to a Node To attach a sprite renderer to an existing node, simply go to the **[Inspector Panel](/en/docs/interface/inspector)** of the selected node, then choose **Add Component** -> **2D** -> **Sprite Renderer**. -avatar +avatar #### Script Creation @@ -57,33 +57,33 @@ spriteRenderer.sprite = sprite; When displaying an image, first add a sprite component to an entity and then set the sprite asset as follows: -avatar +avatar ### Rendering Size Setting the `width` and `height` of `SpriteRenderer` can explicitly specify the size of the sprite in 3D space. If not set, the size of the `Sprite` will be used as the default value. - + ### Set Color Adjust the color by setting the `color` property to achieve fade-in and fade-out effects, as shown below: -avatar +avatar ### Image Flip In addition to basic image display, `SpriteRenderer` also supports image flipping. Simply set the `flipX/flipY` properties to achieve flipping, as shown below: -avatar +avatar - + ### Drawing Modes The sprite renderer currently provides three drawing modes: normal, nine-slice, and tiled drawing (default is normal drawing). By modifying the drawing width and height in different drawing modes, you can visually perceive the rendering differences between the modes, as shown below: - + ### Masking @@ -93,5 +93,5 @@ Please refer to the [Sprite Mask](/en/docs/graphics/2D/spriteMask) documentation Please refer to the [Custom Shader](/en/docs/graphics-shader-custom) documentation. - + diff --git a/docs/en/graphics/2D/text.md b/docs/en/graphics/2D/text.mdx similarity index 92% rename from docs/en/graphics/2D/text.md rename to docs/en/graphics/2D/text.mdx index dd9d781795..8e282a3117 100644 --- a/docs/en/graphics/2D/text.md +++ b/docs/en/graphics/2D/text.mdx @@ -14,12 +14,12 @@ label: Graphics/2D To display text, you need to add a text component to an entity, as shown below: -![Add Text Component](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*3d5AQYTtcNkAAAAAAAAAAAAADjCHAQ/original) + ### Parameter Description Select an entity with the TextRenderer component, and you can set all related properties in the inspector on the right to configure the text component: -![Add Text Component](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*9XKjSYHZQWsAAAAAAAAAAAAADjCHAQ/original) + The property descriptions are as follows: | Property | Description | @@ -44,17 +44,17 @@ The property descriptions are as follows: After adding the text component, you can set the Text property to display the desired text, as shown below: -![Set Display Text](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*J6nKTJOOm4kAAAAAAAAAAAAADjCHAQ/original) + ### Set Custom Font To make the text display more diverse, developers can upload their own font files. The editor currently supports the following font file formats: **.ttf**, **.otf**, **.woff** -![Set Font](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*CgA5S5vneeMAAAAAAAAAAAAADjCHAQ/original) + ## Script Usage - + 1. Create a [TextRenderer](/apis/core/#TextRenderer) component to display text 2. Set the [Font](/apis/core/#Font) object through the font property @@ -160,7 +160,7 @@ textRenderer.fontStyle = FontStyle.Bold | FontStyle.Italic; ### Multi-line Text - + ### Custom Fonts @@ -182,5 +182,5 @@ const font = await engine.resourceManager.load({ }); ``` - + ``` diff --git a/docs/en/graphics/background/background.md b/docs/en/graphics/background/background.mdx similarity index 87% rename from docs/en/graphics/background/background.md rename to docs/en/graphics/background/background.mdx index 2b092ba1a7..5378b7bf4f 100644 --- a/docs/en/graphics/background/background.md +++ b/docs/en/graphics/background/background.mdx @@ -14,9 +14,9 @@ Developers can customize the background for scenes, which will be rendered befor Developers can set different backgrounds according to their needs: - + In [Skybox](/en/docs/graphics-background-sky}) mode, by setting specific meshes and materials, various custom backgrounds can be achieved, such as `video background`: - + diff --git a/docs/en/graphics/background/sky.md b/docs/en/graphics/background/sky.mdx similarity index 91% rename from docs/en/graphics/background/sky.md rename to docs/en/graphics/background/sky.mdx index e1c8a52fa4..ecd41d38e7 100644 --- a/docs/en/graphics/background/sky.md +++ b/docs/en/graphics/background/sky.mdx @@ -20,19 +20,19 @@ In the editor, simply follow these steps to set the skybox for the background: A skybox texture is a [cube texture](/en/docs/graphics/texture/cube/). After preparing the HDR, follow the path **[Asset Panel](/en/docs/assets/interface)** -> **Right-click Upload** -> **Select TextureCube(.hdr)** -> **Choose the corresponding HDR map** -> **Cube texture asset creation complete**. -![image.png](https://mdn.alipayobjects.com/huamei_yo47yq/afts/img/A*Oi3FSLEEaYgAAAAAAAAAAAAADhuCAQ/original) + ### 2. Create Skybox Material After creating the cube texture asset, follow the path **[Asset Panel](/en/docs/assets/interface)** -> **Right-click Create** -> **Select Material** -> **Select the generated asset** -> **[Inspector Panel](/en/docs/interface/inspector)** -> **Click the Shader property in the Base section** -> **Select Sky Box** -> **Click HDR in the Base section** -> **Choose the cube texture created in the first step** to create the skybox material. -![image.png](https://mdn.alipayobjects.com/huamei_yo47yq/afts/img/A*9j2eSYkwg8MAAAAAAAAAAAAADhuCAQ/original) + ### 3. Set the Skybox Finally, follow the path **[Hierarchy Panel](/en/docs/interface/hierarchy)** -> **Select Scene** -> **[Inspector Panel](/en/docs/interface/inspector)** -> **Background section** -> **Set Mode to Sky** -> **Select the material created in the second step** -> **Set Mesh to the built-in Cuboid** to see the background of the scene change to the skybox. -![image.png](https://mdn.alipayobjects.com/huamei_yo47yq/afts/img/A*rqvsSpkGJ6UAAAAAAAAAAAAADhuCAQ/original) + ### Code to Set Skybox @@ -63,7 +63,7 @@ background.sky.mesh = PrimitiveMesh.createCuboid(engine, 2, 2, 2); Procedural sky is the default background in 3D projects in the editor. You can also follow the path **[Hierarchy Panel](/en/docs/interface/hierarchy)** -> **Select Scene** -> **[Inspector Panel](/en/docs/interface/inspector)** -> **Background section** -> **Set Mode to Sky** -> **Select the built-in SkyMat material** -> **Set Mesh to the built-in Sphere** -![image.png](https://mdn.alipayobjects.com/huamei_yo47yq/afts/img/A*Qe3IRJ9ciNoAAAAAAAAAAAAADhuCAQ/original) + ### Code to Set Procedural Sky @@ -81,7 +81,7 @@ background.sky.mesh = PrimitiveMesh.createSphere(engine); In the atmospheric scattering material's **[Inspector Panel](/en/docs/interface/inspector)**, you can see many adjustable properties: -image-4 +image-4 > The built-in atmospheric scattering material cannot have its properties freely adjusted; developers can create and adjust their own. diff --git a/docs/en/graphics/background/solidColor.md b/docs/en/graphics/background/solidColor.mdx similarity index 92% rename from docs/en/graphics/background/solidColor.md rename to docs/en/graphics/background/solidColor.mdx index 39ebc0296c..3dc2f49631 100644 --- a/docs/en/graphics/background/solidColor.md +++ b/docs/en/graphics/background/solidColor.mdx @@ -12,7 +12,7 @@ When the background type of the scene is set to solid color, the rendering area Navigate to **[Hierarchy Panel](/en/docs/interface/hierarchy)** -> **Select Scene** -> **[Inspector Panel](/en/docs/interface/inspector)** -> **Background Section** and set **Mode** to **Solid Color**, then choose the desired background color. You will see the background of the scene change in real-time. -![image.png](https://mdn.alipayobjects.com/huamei_yo47yq/afts/img/A*RDQ-T5h7YdEAAAAAAAAAAAAADhuCAQ/original) + Similarly, you can also set it in the script with the following code: diff --git a/docs/en/graphics/background/texture.md b/docs/en/graphics/background/texture.mdx similarity index 96% rename from docs/en/graphics/background/texture.md rename to docs/en/graphics/background/texture.mdx index a23ba37534..590351bf21 100644 --- a/docs/en/graphics/background/texture.md +++ b/docs/en/graphics/background/texture.mdx @@ -12,7 +12,7 @@ When the background type of the scene is set to texture, the rendering area of t According to the path **[Hierarchy Panel](/en/docs/interface/hierarchy)** -> **Select Scene** -> **[Inspector Panel](/en/docs/interface/inspector)** -> **Background Section** set **Mode** to **Texture**, then select the desired texture, you can see the background of the scene change in real-time. -![](https://gw.alipayobjects.com/zos/OasisHub/2673b2a2-a87b-4707-b3fc-9af334231298/2024-07-18%25252017.50.16.gif) + Similarly, in the script, you can also set it with the following code: diff --git a/docs/en/graphics/light/ambient.md b/docs/en/graphics/light/ambient.mdx similarity index 81% rename from docs/en/graphics/light/ambient.md rename to docs/en/graphics/light/ambient.mdx index 8a3f28b4f5..5551c0149a 100644 --- a/docs/en/graphics/light/ambient.md +++ b/docs/en/graphics/light/ambient.mdx @@ -8,13 +8,13 @@ label: Graphics/Light In addition to real-time computed direct light sources, we generally need to pre-bake lighting offline as ambient light for real-time sampling. This method effectively captures the global illumination and atmosphere of the environment, making objects blend better into their surroundings. -![image-20231227151844040](https://gw.alipayobjects.com/zos/OasisHub/23397353-5434-4bde-ace7-72c8731d5581/image-20231227151844040.png) + ## Editor Usage ### 1. Ambient Diffuse -image-20240219163916257 +image-20240219163916257 | Property | Function | | :-- | :-- | @@ -23,7 +23,7 @@ In addition to real-time computed direct light sources, we generally need to pre ### 2. Ambient Specular -image-20240219163941010 +image-20240219163941010 | Property | Function | | :-- | :-- | diff --git a/docs/en/graphics/light/bake.md b/docs/en/graphics/light/bake.mdx similarity index 69% rename from docs/en/graphics/light/bake.md rename to docs/en/graphics/light/bake.mdx index 5437c15a81..5c1153d028 100644 --- a/docs/en/graphics/light/bake.md +++ b/docs/en/graphics/light/bake.mdx @@ -8,7 +8,7 @@ label: Graphics/Light Baking refers to Galacean performing lighting calculations in advance and baking the results into a binary file (containing [diffuse spherical harmonics parameters](https://www.wikiwand.com/zh-hans/%E7%90%83%E8%B0%90%E5%87%BD%E6%95%B0) and [pre-filtered environment maps](https://learnopengl-cn.github.io/07%20PBR/03%20IBL/02%20Specular%20IBL/)), which are then sampled in real-time during runtime. -bake +bake We provide baking tools in the [editor](https://galacean.antgroup.com/editor) and the [glTF viewer](https://galacean.antgroup.com/engine/gltf-viewer). @@ -18,26 +18,26 @@ We provide baking tools in the [editor](https://galacean.antgroup.com/editor) an The editor has automatic baking enabled by default. It will automatically bake after modifying the background (color, exposure, rotation, etc.) or changing the baking resolution. -image-20240219164704802 +image-20240219164704802 You can also disable automatic baking and perform manual baking when needed. -image-20240219164728187 +image-20240219164728187 ### 2. Baking Resolution This indicates the resolution of the pre-filtered environment map after baking. The default resolution is 128, with the baked product being approximately 500KB; a resolution of 64 results in a baked product of about 125KB. You can choose the appropriate baking resolution based on the scene. -image-20240219164802607 +image-20240219164802607 ### 3. Setting Background Refer to the [background tutorial](/en/docs/graphics/background/sky/) to set the scene background. The editor will perform lighting baking based on the baking resolution and baking switch settings. Any modifications to the background (color, rotation, exposure, changing HDR maps, etc.) will depend on the baking switch to decide whether to bake automatically. **If you want to set a solid color background or a transparent background but do not want to bake the solid color background, you can first turn off the automatic baking switch and then switch to the [solid color background](/en/docs/graphics/background/solidColor/).** -image-20231009114455268 +image-20231009114455268 ## glTF Viewer We also provide a baking tool in the [glTF viewer](https://galacean.antgroup.com/engine/gltf-viewer) on our official website. Simply drag and drop an HDR map onto the webpage to automatically download the baked product: -![gltf viewer](https://gw.alipayobjects.com/mdn/rms_7c464e/afts/img/A*9mGbSpQ4HngAAAAAAAAAAAAAARQnAQ) + diff --git a/docs/en/graphics/light/directional.md b/docs/en/graphics/light/directional.mdx similarity index 91% rename from docs/en/graphics/light/directional.md rename to docs/en/graphics/light/directional.mdx index 4b626eb62d..480943c5f2 100644 --- a/docs/en/graphics/light/directional.md +++ b/docs/en/graphics/light/directional.mdx @@ -8,7 +8,7 @@ label: Graphics/Light **Directional Light** represents light that is emitted uniformly in a certain direction, with parallel light rays. Sunlight hitting the Earth's surface can be considered directional light because the distance between the Sun and the Earth is much greater than the Earth's radius. Therefore, sunlight hitting the Earth can be seen as a set of parallel light rays coming from the same direction, i.e., directional light. -image-20240319173643671 +image-20240319173643671 Directional light has 3 main characteristics: _color_ ([color](/apis/core/#DirectLight-color)), _intensity_ ([intensity](/apis/core/#DirectLight-intensity)), and _direction_ ([direction](/apis/core/#DirectLight-direction)). The _direction_ is represented by the orientation of the node where the directional light is located. diff --git a/docs/en/graphics/light/light.md b/docs/en/graphics/light/light.mdx similarity index 94% rename from docs/en/graphics/light/light.md rename to docs/en/graphics/light/light.mdx index 5437541c90..a42e850d67 100644 --- a/docs/en/graphics/light/light.md +++ b/docs/en/graphics/light/light.mdx @@ -24,13 +24,13 @@ Proper use of lighting can provide realistic rendering effects. This section inc Direct light usually shines from an area or in a specific direction, entering the eye (camera) directly after one reflection, as shown in the following example: - + ## Indirect Light Ambient light is emitted from all around and enters the eye, as shown in the following example: - + ## Real-time Lighting and Baked Lighting diff --git a/docs/en/graphics/light/point.md b/docs/en/graphics/light/point.mdx similarity index 89% rename from docs/en/graphics/light/point.md rename to docs/en/graphics/light/point.mdx index 1caf0072b4..1165d1ae05 100644 --- a/docs/en/graphics/light/point.md +++ b/docs/en/graphics/light/point.mdx @@ -8,7 +8,7 @@ label: Graphics/Light A **point light** is a light source located at a point in space that emits light rays in all directions, similar to a light bulb in real life. -image-20240319174317201 +image-20240319174317201 Point lights have 3 main characteristics: _color_ ([color](/apis/core/#PointLight-color)), _intensity_ ([intensity](/apis/core/#PointLight-intensity)), and _range_ ([distance](/apis/core/#PointLight-distance)). Areas beyond the range will not receive light from the point light, and the intensity of the light decreases as the distance from the light source increases. diff --git a/docs/en/graphics/light/shadow.md b/docs/en/graphics/light/shadow.mdx similarity index 85% rename from docs/en/graphics/light/shadow.md rename to docs/en/graphics/light/shadow.mdx index a75c64fe21..5962b70908 100644 --- a/docs/en/graphics/light/shadow.md +++ b/docs/en/graphics/light/shadow.mdx @@ -10,7 +10,7 @@ Shadows can effectively enhance the three-dimensionality and realism of the rend ## Scene Configuration -image-20240730114010025 +image-20240730114010025 There are some configurations in the scene that can affect global shadows: @@ -25,7 +25,7 @@ There are some configurations in the scene that can affect global shadows: ## Light Configuration -image-20240724183629537 +image-20240724183629537 To cast shadows, there needs to be a [directional light](/en/docs/graphics/light/directional) in the scene. Currently, the engine can only enable shadows for one directional light `DirectLight`, mainly because shadow rendering doubles the DrawCall, which can severely impact rendering performance. In the absence of a specified [main light(scene.sun)](/apis/core/#Scene-sun), the engine will default to selecting the light with the highest intensity to cast shadows: @@ -39,7 +39,7 @@ To cast shadows, there needs to be a [directional light](/en/docs/graphics/light ## Projectiles and Receivers -image-20240724184711014 +image-20240724184711014 In the [Mesh Renderer Component](/en/docs/graphics/renderer/meshRenderer), `receiveShadows` determines whether the object receives shadows, and `castShadows` determines whether the object casts shadows. @@ -47,4 +47,4 @@ In the [Mesh Renderer Component](/en/docs/graphics/renderer/meshRenderer), `rece Starting from version `1.3`, the engine supports casting shadows for alpha cutoff (Alpha Cutoff) objects and transparent (Transparent) objects. For transparent objects to cast shadows, you need to enable the `Transparent` switch in the scene panel: -![](https://gw.alipayobjects.com/zos/OasisHub/3c972121-d072-4d2c-ba87-2a9ec88c9268/2024-07-30%25252011.36.32.gif) + diff --git a/docs/en/graphics/light/spot.md b/docs/en/graphics/light/spot.mdx similarity index 92% rename from docs/en/graphics/light/spot.md rename to docs/en/graphics/light/spot.mdx index ece5dbabdc..80d60be329 100644 --- a/docs/en/graphics/light/spot.md +++ b/docs/en/graphics/light/spot.mdx @@ -8,7 +8,7 @@ label: Graphics/Light **Spotlight** is like the light emitted from a flashlight in real life, emitting conically from a point in a specific direction. -image-20240319174652884 +image-20240319174652884 The spotlight has several main characteristics: _color_ ([color](/apis/core/#SpotLight-color)), _intensity_ ([intensity](/apis/core/#SpotLight-intensity)), _effective distance_ ([distance](/apis/core/#SpotLight-distance)), _scatter angle_ ([angle](/apis/core/#SpotLight-angle)), _penumbra attenuation angle_ ([penumbra](/apis/core/#SpotLight-penumbra)). The scatter angle indicates the angle within which there is light relative to the direction of the light source, and the penumbra attenuation angle indicates that within the effective angle range, the light intensity gradually attenuates to 0 as the angle increases. diff --git a/docs/en/graphics/material/composition.md b/docs/en/graphics/material/composition.mdx similarity index 100% rename from docs/en/graphics/material/composition.md rename to docs/en/graphics/material/composition.mdx diff --git a/docs/en/graphics/material/editor.md b/docs/en/graphics/material/editor.mdx similarity index 60% rename from docs/en/graphics/material/editor.md rename to docs/en/graphics/material/editor.mdx index 7ecb7065da..f0c30d5091 100644 --- a/docs/en/graphics/material/editor.md +++ b/docs/en/graphics/material/editor.mdx @@ -6,17 +6,17 @@ title: Using the Editor ### 1. Manually Create Material -image-20240206163405147 +image-20240206163405147 ### 2. Import Model Refer to the [Import and Use Model](/en/docs/graphics/model/use/) tutorial. We can first import the model into the editor. Generally, the model is already automatically bound to the material, and the user does not need to do anything; if you want to modify the material, we need to click the `duplicate & remap` button to generate a copy of the material and then edit the material copy. -remap +remap Switching shaders will not reset shader data. For example, if the base color is red, the base color will remain red even if the shader is switched. -image-20231009112713870 +image-20231009112713870 ### 3. Adjust Material diff --git a/docs/en/graphics/material/material.md b/docs/en/graphics/material/material.mdx similarity index 73% rename from docs/en/graphics/material/material.md rename to docs/en/graphics/material/material.mdx index cba63e7caa..fff2648c37 100644 --- a/docs/en/graphics/material/material.md +++ b/docs/en/graphics/material/material.mdx @@ -4,7 +4,7 @@ title: Material Overview Materials refer to a collection of properties used to describe the appearance and surface characteristics of an object. Materials determine how a model interacts with light during rendering, thus affecting its visual presentation. -image-20240206153815596 +image-20240206153815596 This section includes the following related information: diff --git a/docs/en/graphics/material/script.md b/docs/en/graphics/material/script.mdx similarity index 100% rename from docs/en/graphics/material/script.md rename to docs/en/graphics/material/script.mdx diff --git a/docs/en/graphics/mesh/bufferMesh.md b/docs/en/graphics/mesh/bufferMesh.mdx similarity index 96% rename from docs/en/graphics/mesh/bufferMesh.md rename to docs/en/graphics/mesh/bufferMesh.mdx index cd1cce9f37..28414f7fba 100644 --- a/docs/en/graphics/mesh/bufferMesh.md +++ b/docs/en/graphics/mesh/bufferMesh.mdx @@ -12,7 +12,7 @@ label: Graphics/Mesh Let's first overview the diagram of `BufferMesh`. -![image.png](https://gw.alipayobjects.com/mdn/rms_7c464e/afts/img/A*piB3Q4501loAAAAAAAAAAAAAARQnAQ) + `BufferMesh` has three core elements: @@ -30,7 +30,7 @@ Here are some common use cases of [MeshRenderer](/apis/core/#MeshRenderer) and [ ### Interleaved Vertex Buffer - + A common method, such as custom Mesh, Particle implementation, has the advantages of compact video memory and fewer CPU data uploads to the GPU per frame. The main feature of this case is that multiple [VertexElement](/apis/core/#VertexElement) correspond to one *VertexBuffer* ([Buffer](/apis/core/#Buffer)), and only one *VertexBuffer* is used to associate different vertex elements with the Shader. @@ -65,7 +65,7 @@ renderer.mesh = mesh; ### Independent Vertex Buffer - + It has advantages when mixing dynamic vertex buffers and static vertex buffers, such as _position_ being static but _color_ being dynamic. Independent vertex buffers can update only the color data to the GPU. The main feature of this case is that one [VertexElement](/apis/core/#VertexElement) corresponds to one _VertexBuffer_, and the [setData](/apis/core/#Buffer-setData) method of the [Buffer](/apis/core/#Buffer) object can be called separately to update the data independently. @@ -109,7 +109,7 @@ renderer.mesh = mesh; ### Instance Rendering - + GPU Instance rendering is a common technique in 3D engines. For example, it allows rendering objects with the same geometric shape at different positions in one go, significantly improving rendering performance. The main feature of this example is the use of the instance functionality of [VertexElement](/apis/core/#VertexElement). The last parameter of its constructor indicates the instance step rate (the number of instances drawn per vertex advance in the buffer, non-instance elements must be 0). The [instanceCount](/apis/core/#BufferMesh-instanceCount) of [BufferMesh](/apis/core/#BufferMesh) indicates the number of instances. diff --git a/docs/en/graphics/mesh/mesh.md b/docs/en/graphics/mesh/mesh.mdx similarity index 94% rename from docs/en/graphics/mesh/mesh.md rename to docs/en/graphics/mesh/mesh.mdx index ff021fa119..4d75da212f 100644 --- a/docs/en/graphics/mesh/mesh.md +++ b/docs/en/graphics/mesh/mesh.mdx @@ -20,7 +20,7 @@ Mesh assets generally come from: When you need to set a mesh for the mesh renderer, you only need to select the corresponding mesh asset. -import +import Correspondingly, in the script, the use of the mesh will be more free, and the complexity will also be higher. First, let's look at diff --git a/docs/en/graphics/mesh/modelMesh.md b/docs/en/graphics/mesh/modelMesh.mdx similarity index 95% rename from docs/en/graphics/mesh/modelMesh.md rename to docs/en/graphics/mesh/modelMesh.mdx index 90ac1f5109..f6ffacd145 100644 --- a/docs/en/graphics/mesh/modelMesh.md +++ b/docs/en/graphics/mesh/modelMesh.mdx @@ -8,7 +8,7 @@ label: Graphics/Mesh [ModelMesh](/apis/core/#ModelMesh) is a mesh rendering data class used to describe the geometric outline, mainly including vertex data (such as position, normal, and UV), indices, and blend shapes. It can not only be created and exported in glTF format using modeling software for engine parsing and restoration but also be conveniently written directly into data creation using scripts. - + ## Code Example @@ -85,7 +85,7 @@ The APIs for setting high-level data are: Compared to high-level data, setting data through low-level interfaces allows for free manipulation of vertex buffer data, which is not only flexible but may also bring performance improvements. However, it is necessary to understand the relationship between Vertex Buffer and Vertex Element, as shown in the following diagram: -![image.png](https://mdn.alipayobjects.com/huamei_jvf0dp/afts/img/A*68IjSo2kwUAAAAAAAAAAAAAADleLAQ/original) + ```typescript const pos = new Float32Array([1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0]); @@ -134,7 +134,7 @@ If you need to continuously modify the `ModelMesh` data, set the `releaseData` p modelMesh.uploadData(false); ``` - + ### **Reading Advanced Data** @@ -173,10 +173,10 @@ const result = mesh.getPositions(); `BlendShape` is commonly used to create highly detailed animations, such as facial expressions. The principle is quite simple, mainly blending the mesh data of base shape and target shape with weights to achieve smooth transition between shapes. **glTF Import BlendShape Animation Example:** - + **Custom BlendShape Animation in Script Example:** - + ### Detailed Steps diff --git a/docs/en/graphics/mesh/primitiveMesh.md b/docs/en/graphics/mesh/primitiveMesh.mdx similarity index 87% rename from docs/en/graphics/mesh/primitiveMesh.md rename to docs/en/graphics/mesh/primitiveMesh.mdx index d2217d0edb..36d72853f0 100644 --- a/docs/en/graphics/mesh/primitiveMesh.md +++ b/docs/en/graphics/mesh/primitiveMesh.mdx @@ -12,19 +12,19 @@ label: Graphics/Mesh The editor has built-in basic geometries such as `Cube`, `Sphere`, and `Cylinder`, which can be directly placed in the model by clicking `+` on the left node tree: -image-20231009111916680 +image-20231009111916680 Of course, we can also click `1` in the component panel to add the `Mesh Renderer` component, and click `2` to bind the desired basic geometry: -image-20231009112014068 +image-20231009112014068 Built-in geometries not meeting your needs? You can create a `Mesh` asset in the **[Asset Panel](/en/docs/assets/interface)** by **right-clicking** → **Create** → **PrimitiveMesh**, and adjust the parameters of the `Mesh` to meet your requirements. -image-20231009111916680 +image-20231009111916680 ## Script Usage - + The currently provided geometries are as follows: diff --git a/docs/en/graphics/model/assets.md b/docs/en/graphics/model/assets.mdx similarity index 71% rename from docs/en/graphics/model/assets.md rename to docs/en/graphics/model/assets.mdx index 5b7bd3d1cf..cb78ac3044 100644 --- a/docs/en/graphics/model/assets.md +++ b/docs/en/graphics/model/assets.mdx @@ -8,7 +8,7 @@ label: Graphics/Model After the model is imported, the imported model asset will be added to the **[Asset Panel](/en/docs/assets/interface)**. By clicking on the asset thumbnail, you can see the basic information of this model. -image-20231009112328575 +image-20231009112328575 | Area | Function | Explanation | | :--------- | :--------------- | :----------------------------------------------------------------- | @@ -25,13 +25,13 @@ After the model is imported, the imported model asset will be added to the **[As Hover the mouse over the model asset thumbnail and click the triangle button that appears on the right. The mesh, textures, animations, materials, and other sub-asset information contained in the model asset will be displayed in the resource panel. -image-20231009112328575 +image-20231009112328575 ### Mesh Sub-assets Click on the mesh sub-asset thumbnail to see the basic information of the mesh as follows: -image-20231009112328575 +image-20231009112328575 | Area | Function | Explanation | | :------- | :------------- | :------------------------ | @@ -42,20 +42,20 @@ Click on the mesh sub-asset thumbnail to see the basic information of the mesh a The only difference between the basic information of texture sub-assets and [texture](/en/docs/graphics/texture/texture/) assets is that the texture information is mostly read-only. -image-20231009112328575 +image-20231009112328575 ### Material Sub-assets Similarly, [material](/en/docs/graphics/material/material/) sub-assets work the same way: -image-20231009112328575 +image-20231009112328575 In general, users do not need to perform any operations on the materials that come with the model; however, in certain scenarios, developers may want to manually tweak the materials, such as changing the color. In this case, we can duplicate the original material by clicking **duplicate & remap**, and then modify it based on the original material parameters: -image-20231009112328575 +image-20231009112328575 ### Animation Sub-assets Animation sub-assets appear in the model assets in the form of [animation clips](/en/docs/animation/clip), and they are also **read-only**. -image-20231009112328575 +image-20231009112328575 diff --git a/docs/en/graphics/model/glTF.md b/docs/en/graphics/model/glTF.mdx similarity index 97% rename from docs/en/graphics/model/glTF.md rename to docs/en/graphics/model/glTF.mdx index d1e3abbd06..1e966418f7 100644 --- a/docs/en/graphics/model/glTF.md +++ b/docs/en/graphics/model/glTF.mdx @@ -12,7 +12,7 @@ label: Graphics/Model ## Ecosystem -image-20231009112129853 +image-20231009112129853 ## Exported Products @@ -35,7 +35,7 @@ Both types of products are supported in Galacean. The choice of export type can glTF has many features, and the official website provides a large number of [examples](https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0) for reference. Galacean also provides a replicated version for quick browsing. You can switch between different glTF models through the following **glTF List**. - + ### Plugin Support diff --git a/docs/en/graphics/model/importGlTF.md b/docs/en/graphics/model/importGlTF.mdx similarity index 72% rename from docs/en/graphics/model/importGlTF.md rename to docs/en/graphics/model/importGlTF.mdx index 9198dddd39..f8cc32f2c7 100644 --- a/docs/en/graphics/model/importGlTF.md +++ b/docs/en/graphics/model/importGlTF.mdx @@ -20,19 +20,18 @@ It should be noted that the editor will convert FBX to a [glTF format](/en/docs/ Drag the model file, or the compressed **.zip** file into the asset panel: -import +import ## Button Upload Click the upper right corner **Asset Panel** -> **GLTF/GLB/FBX** -image-20231009112129853 +image-20231009112129853 ## Right-click Upload Follow **Asset Panel** -> **Right-click** -> **Upload** -> **GLTF/GLB/FBX** -image-20231009112129853 +image-20231009112129853 After the import is complete, the imported model assets will be added to the **[Asset Panel](/en/docs/assets/interface)**. Let's [see what the model assets contain](/en/docs/graphics/model/assets/). diff --git a/docs/en/graphics/model/model.md b/docs/en/graphics/model/model.mdx similarity index 100% rename from docs/en/graphics/model/model.md rename to docs/en/graphics/model/model.mdx diff --git a/docs/en/graphics/model/opt.md b/docs/en/graphics/model/opt.mdx similarity index 84% rename from docs/en/graphics/model/opt.md rename to docs/en/graphics/model/opt.mdx index f9bc071598..0eee2deb50 100644 --- a/docs/en/graphics/model/opt.md +++ b/docs/en/graphics/model/opt.mdx @@ -19,6 +19,6 @@ In the editor, we can optimize the model in the following ways: 1. Use [Quantize](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_mesh_quantization/README.md) to compress mesh data. When exporting the project, check the GlTF Quantize option to quantize and compress the mesh. 1. Use [Meshopt](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_meshopt_compression/README.md) to further compress mesh data. -image-20240228171935612 +image-20240228171935612 Compression may affect the precision of the model mesh, but in most cases, it is difficult to distinguish with the naked eye. diff --git a/docs/en/graphics/model/restoration.md b/docs/en/graphics/model/restoration.mdx similarity index 79% rename from docs/en/graphics/model/restoration.md rename to docs/en/graphics/model/restoration.mdx index 6b568a4925..5ed615e4e6 100644 --- a/docs/en/graphics/model/restoration.md +++ b/docs/en/graphics/model/restoration.mdx @@ -6,7 +6,7 @@ group: Model label: Graphics/Model --- -![image.png](https://gw.alipayobjects.com/zos/OasisHub/5dd84590-7c37-4156-bb1a-498207880c75/1635493348596-92184a82-6aaa-4ab8-95e5-2d88762df213.png) + ## Background @@ -46,25 +46,25 @@ Currently, the most widely used algorithm in real-time rendering is the PBR algo It is worth mentioning that although different algorithms can cause some visual differences, their physical principles are consistent. For example, the higher the metallicity, the stronger the environmental reflection and the weaker the diffuse reflection; the higher the roughness, the more blurred the environmental reflection, as shown below: -![image.png](https://gw.alipayobjects.com/zos/OasisHub/ddfe44e2-c9ab-4692-b62f-b43b8965ee4c/1635432936926-b26c9652-6d95-4160-9743-b954025dfe32.png) + ### Differences in Lighting Like the real world, 3D scenes can also add [direct and ambient light](/en/docs/graphics/light/light/). By default, Galacean scenes have **no** light sources, only a blue-tinted [solid color diffuse](/apis/core/#AmbientLight-diffuseSolidColor), as shown in the first image on the left; whereas many modeling software come with built-in light sources: -![image.png](https://gw.alipayobjects.com/zos/OasisHub/391e9bd9-945d-474d-b3fb-8cb0490e2b6f/1635434650361-60d7f40f-9f22-4e48-8865-141415d638f9.png) + Ambient light based on [cube textures](/en/docs/graphics/texture/cube) enables IBL mode, requiring an HDRI map to simulate the surrounding environment, which can be [downloaded online](https://polyhaven.com/hdris). By default, Galacean scenes do not have an HDRI map bound, whereas many modeling software come with a visually appealing surrounding environment: -![image.png](https://gw.alipayobjects.com/zos/OasisHub/61c2287b-0793-4763-a5f5-70567fcdf106/1635477315862-08b0c680-029b-400b-8600-1d8cf7a20c60.png) + ### Differences in glTF Support The connection channel between the Galacean engine and modeling software is the [glTF file](/en/docs/graphics/model/glTF/). glTF supports standard [PBR properties](https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#reference-material-pbrmetallicroughness) and [general material properties](https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#reference-material), and supports plugins like [ClearCoat](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_clearcoat), as shown below. Therefore, as long as the operations in the modeling software can be exported to glTF, the engine can load them through the loader. However, those additional operations, such as some parameters of [vRay](https://www.chaosgroup.com/cn/vray/3ds-max) materials, cannot be exported to glTF files. -![image.png](https://gw.alipayobjects.com/zos/OasisHub/2010b748-ab8b-4e46-8b15-3aee4daa71f9/1635434775734-f8454efe-d268-4f80-87ab-40f1cddf96ea.png) + -![image.png](https://gw.alipayobjects.com/zos/OasisHub/acd35018-dc09-404b-a735-85a981384df1/1635434736607-cc408f27-a7d7-4a30-a7ea-e083f209d2c9.png) + ## Solution @@ -76,11 +76,11 @@ The primary prerequisite for ensuring visual fidelity is to debug the material i As mentioned earlier, the engine does not come with direct light by default. The simplest way to maintain fidelity is to delete the lights in the modeling software, ensuring that both the modeling software and the Galacean engine only have ambient light (best performance). -image.png +image.png If some scenes indeed require adding direct light, please ensure that the modeling software can export the [glTF light plugin](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_lights_punctual) (Google search keyword "\***\* modeling software KHR_lights_punctual" ), such as selecting **Punctual Lights** when exporting glTF from Blender. -image.png +image.png If the modeling software does not support exporting this lighting plugin, you can transfer it to Blender for export, or verbally describe the lighting data to the developers. @@ -88,13 +88,13 @@ If the modeling software does not support exporting this lighting plugin, you ca As mentioned earlier, the engine does not come with an environment map, i.e., HDRI map, by default, but modeling software usually does, such as Blender: -image.png +image.png We can first [download](https://polyhaven.com/hdris) our favorite HDRI images from the internet, then debug them in the modeling software. Once satisfied, deliver the final HDRI to the developers (since glTF does not support exporting HDR). Binding an environment map in the modeling software is very simple. You can Google search the keyword "\*\*\* modeling software environment IBL". Taking Blender as an example: -image.png +image.png ### Real-time Rendering Solution @@ -106,19 +106,19 @@ After unifying the lighting, we can choose the rendering solution. If you want t As mentioned earlier, Galacean PBR uses the **Cook-Torrance BRDF** reflectance equation, which is relatively close to the Principled BSDF - GGX algorithm in Blender: -image.png +image.png You can refer to the [Blender official tutorial](https://docs.blender.org/manual/en/2.80/addons/io_scene_gltf2.html#) to debug the material parameters that can be exported to glTF. The same applies to other modeling software; you can Google the keyword “\*\*\* modeling software export glTF”. Another relatively simple reference method is to import the glTF demo in the modeling software ([click to download](https://gw.alipayobjects.com/os/bmw-prod/85faf9f8-8030-45b2-8ba3-09a61b3db0c3.glb)). The PBR properties in this demo are quite comprehensive and can be used as a reference for debugging. For example, after importing into Blender, the material panel displays as follows: -![image.png](https://gw.alipayobjects.com/zos/OasisHub/6643f12a-6226-490f-b853-f962a38cb09b/1635499476109-753aae7a-5ffa-4d52-ace1-4eaaef81919f.png) + - Export Verification After exporting the glTF, you can drag the file into the [glTF Viewer](https://galacean.antgroup.com/engine/gltf-viewer) to check whether the corresponding colors, textures, parameters, etc., are correct: -image.png +image.png ### Baking Solution diff --git a/docs/en/graphics/model/use.md b/docs/en/graphics/model/use.mdx similarity index 90% rename from docs/en/graphics/model/use.md rename to docs/en/graphics/model/use.mdx index 82965046b3..9d35ddb6b8 100644 --- a/docs/en/graphics/model/use.md +++ b/docs/en/graphics/model/use.mdx @@ -15,7 +15,7 @@ In the editor, **models placed in the scene** will be preloaded with the scene f > The editor cannot directly adjust the scale property of the model node. Therefore, in most cases, you need to drag the model node under an entity node and then adjust the scale property of the entity node. -import +import In this case, you only need to find the specific node in the scene at runtime to get the corresponding model object. @@ -43,7 +43,7 @@ engine.resourceManager In the editor, you can directly get the URL of the model asset (**[Assets Panel](/en/docs/assets/interface)** -> **Right-click the model asset thumbnail** -> **Copy file info / Copy relative path**): -import +import For models not imported into the editor, the corresponding URL is the path where the model assets are stored. @@ -63,13 +63,13 @@ this.engine.resourceManager } ``` -image-20240313112859472 +image-20240313112859472 ## Using Models The loaded model object will return a root node containing rendering information and animation information. Its usage is no different from ordinary nodes. - + ### 1. Select Scene Root Node diff --git a/docs/en/graphics/particle/renderer-animation-module.md b/docs/en/graphics/particle/renderer-animation-module.mdx similarity index 92% rename from docs/en/graphics/particle/renderer-animation-module.md rename to docs/en/graphics/particle/renderer-animation-module.mdx index 25cfb8ca77..2c2b1b81c0 100644 --- a/docs/en/graphics/particle/renderer-animation-module.md +++ b/docs/en/graphics/particle/renderer-animation-module.mdx @@ -8,7 +8,7 @@ label: Graphics/Particle [`TextureSheetAnimationModule`](/apis/core/#TextureSheetAnimationModule) inherits from `ParticleGeneratorModule` and is used to control the texture sheet animation of the particle system. -avatar +avatar ## Properties diff --git a/docs/en/graphics/particle/renderer-color-module.md b/docs/en/graphics/particle/renderer-color-module.mdx similarity index 73% rename from docs/en/graphics/particle/renderer-color-module.md rename to docs/en/graphics/particle/renderer-color-module.mdx index b1011474b9..eb3cdccd09 100644 --- a/docs/en/graphics/particle/renderer-color-module.md +++ b/docs/en/graphics/particle/renderer-color-module.mdx @@ -8,7 +8,7 @@ label: Graphics/Particle [`ColorOverLifetimeModule`](/apis/core/#ColorOverLifetimeModule) inherits from `ParticleGeneratorModule` and is used to handle color changes during the lifecycle of a particle system. -avatar +avatar ## Properties @@ -20,4 +20,4 @@ label: Graphics/Particle For the [ParticleCompositeGradient](/apis/core/#ParticleCompositeGradient) object, the editor has a built-in gradient editor. The top of the gradient bar represents color keys, and the bottom represents alpha value keys. Each key's position on the gradient bar represents its time. Double-clicking an existing key can create a new key, and long-pressing a key and dragging it downwards can delete the key. -avatar avatar +avatar avatar diff --git a/docs/en/graphics/particle/renderer-emission-module.md b/docs/en/graphics/particle/renderer-emission-module.mdx similarity index 95% rename from docs/en/graphics/particle/renderer-emission-module.md rename to docs/en/graphics/particle/renderer-emission-module.mdx index 96fc64b96a..8d9c56539b 100644 --- a/docs/en/graphics/particle/renderer-emission-module.md +++ b/docs/en/graphics/particle/renderer-emission-module.mdx @@ -8,7 +8,7 @@ label: Graphics/Particle [EmissionModule](/apis/core/#EmissionModule) is the emission module of `ParticleGeneratorModule`. This module is used to handle the emission behavior of the particle system, including particle emission rate, emission shape, and burst behavior. -avatar +avatar ## Properties diff --git a/docs/en/graphics/particle/renderer-main-module.md b/docs/en/graphics/particle/renderer-main-module.mdx similarity index 96% rename from docs/en/graphics/particle/renderer-main-module.md rename to docs/en/graphics/particle/renderer-main-module.mdx index 5068bf276a..88e3a17e90 100644 --- a/docs/en/graphics/particle/renderer-main-module.md +++ b/docs/en/graphics/particle/renderer-main-module.mdx @@ -8,11 +8,11 @@ label: Graphics/Particle [MainModule](/apis/core/#MainModule) is the main module of `ParticleGeneratorModule`, containing the most basic particle generation parameters. These properties are mostly used to control the initial state of newly created particles. -avatar +avatar ## Properties - + You can debug each property one by one in the provided example to help you better understand and control the main particle module, thereby achieving various complex and beautiful visual effects. diff --git a/docs/en/graphics/particle/renderer-rotation-module.md b/docs/en/graphics/particle/renderer-rotation-module.mdx similarity index 90% rename from docs/en/graphics/particle/renderer-rotation-module.md rename to docs/en/graphics/particle/renderer-rotation-module.mdx index d58216a8f3..f58645870e 100644 --- a/docs/en/graphics/particle/renderer-rotation-module.md +++ b/docs/en/graphics/particle/renderer-rotation-module.mdx @@ -8,7 +8,7 @@ label: Graphics/Particle [`RotationOverLifetimeModule`](/apis/core/#RotationOverLifetimeModule) inherits from `ParticleGeneratorModule` and is used to control the rotation changes of the particle system over its lifetime. -avatar +avatar ## Properties diff --git a/docs/en/graphics/particle/renderer-size-module.md b/docs/en/graphics/particle/renderer-size-module.mdx similarity index 87% rename from docs/en/graphics/particle/renderer-size-module.md rename to docs/en/graphics/particle/renderer-size-module.mdx index 6b8be5a33f..183f5fb188 100644 --- a/docs/en/graphics/particle/renderer-size-module.md +++ b/docs/en/graphics/particle/renderer-size-module.mdx @@ -8,7 +8,7 @@ label: Graphics/Particle [`SizeOverLifetimeModule`](/apis/core/#SizeOverLifetimeModule) is a subclass of `ParticleGeneratorModule` used to handle size changes over the lifetime of a particle system. -avatar +avatar ## Properties @@ -24,7 +24,7 @@ label: Graphics/Particle For the [ParticleCompositeCurve](/apis/core/#ParticleCompositeCurve) object, a polyline editor is built into the editor for visual curve adjustments. -avatar +avatar Or in code: diff --git a/docs/en/graphics/particle/renderer-velocity-module.md b/docs/en/graphics/particle/renderer-velocity-module.mdx similarity index 90% rename from docs/en/graphics/particle/renderer-velocity-module.md rename to docs/en/graphics/particle/renderer-velocity-module.mdx index 6da663d949..dcf3bf03af 100644 --- a/docs/en/graphics/particle/renderer-velocity-module.md +++ b/docs/en/graphics/particle/renderer-velocity-module.mdx @@ -10,7 +10,7 @@ label: Graphics/Particle [`VelocityOverLifetimeModule`](/apis/core/#VelocityOverLifetimeModule) inherits from `ParticleGeneratorModule` and is used to control the velocity changes of a particle system over its lifetime. -avatar +avatar ## Properties diff --git a/docs/en/graphics/particle/renderer.md b/docs/en/graphics/particle/renderer.mdx similarity index 84% rename from docs/en/graphics/particle/renderer.md rename to docs/en/graphics/particle/renderer.mdx index e2bde23116..79e5ef4850 100644 --- a/docs/en/graphics/particle/renderer.md +++ b/docs/en/graphics/particle/renderer.mdx @@ -8,17 +8,17 @@ label: Graphics/Particle The particle (Particle Renderer) [ParticleRenderer](/apis/core/#ParticleRenderer) of the Galacean Engine is a commonly used rendering component with rich properties. By adjusting various property values, you can achieve colorful particle effects. -![avatar](https://mdn.alipayobjects.com/huamei_qbugvr/afts/img/A*oPEmTqfD_asAAAAAAAAAAAAADtKFAQ/original) + ## Components The particle component can be mounted on an activated Entity in the scene through the shortcut at the top of the hierarchy panel or by adding a component in the inspector panel. -![avatar](https://mdn.alipayobjects.com/huamei_qbugvr/afts/img/A*fD8iTZUbiI4AAAAAAAAAAAAADtKFAQ/original) + After adding, you can view the particle properties in the inspector panel. The particle panel at the bottom left corner of the view window can control the playback of particle effects in the view window. -![avatar](https://mdn.alipayobjects.com/huamei_qbugvr/afts/img/A*KekfSb89BSIAAAAAAAAAAAAADtKFAQ/original) + You can also mount the particle component in the script. @@ -35,7 +35,7 @@ let particleRenderer = particleEntity.addComponent(ParticleRenderer); In the editor, create it by adding material - selecting particle material. After editing, go back to the particle inspector panel to select and use the material. -avatar +avatar Or in the script: @@ -56,7 +56,7 @@ The particle panel that appears when an entity with a particle component is sele It should be noted that adjustments to particle playback on this panel are only for previewing in the view window and do not change the properties of the particle component. If you need to change the playback-related properties of the particle, you need to adjust them in the inspector panel. -avatar +avatar | Preview Playback Options | Description | | ------------------------ | ------------------------------------------------ | @@ -83,7 +83,7 @@ The [generator](/apis/core/#ParticleGenerator) property of `ParticleRenderer` is ## Other Parameters -avatar +avatar | Property | Description | | --- | --- | diff --git a/docs/en/graphics/renderer/meshRenderer.md b/docs/en/graphics/renderer/meshRenderer.mdx similarity index 93% rename from docs/en/graphics/renderer/meshRenderer.md rename to docs/en/graphics/renderer/meshRenderer.mdx index 401fd326eb..e92e481936 100644 --- a/docs/en/graphics/renderer/meshRenderer.md +++ b/docs/en/graphics/renderer/meshRenderer.mdx @@ -8,7 +8,7 @@ label: Graphics/Renderer [MeshRenderer](/apis/core/#MeshRenderer) is a mesh renderer component that uses mesh objects (such as cubes) as the data source for geometric outlines. When an entity is mounted with a mesh renderer component, you only need to set its `mesh` and `material` to render the object. - + ## Usage @@ -33,7 +33,7 @@ cube.setMaterial(new BlinnPhongMaterial(engine)); In the editor, you can easily set the properties of the mesh renderer. -image-20231007153753006 +image-20231007153753006 | Setting | Explanation | | :---------------- | :-------------------------------------------------------- | diff --git a/docs/en/graphics/renderer/order.md b/docs/en/graphics/renderer/order.mdx similarity index 93% rename from docs/en/graphics/renderer/order.md rename to docs/en/graphics/renderer/order.mdx index 3b97394ec8..2bc1868ccf 100644 --- a/docs/en/graphics/renderer/order.md +++ b/docs/en/graphics/renderer/order.mdx @@ -48,7 +48,7 @@ The engine provides the `priority` property for the renderer to modify the rende The calculation method of the distance from the renderer component bounding box to the camera depends on the [camera](/en/docs/graphics/camera/camera/) type. In an orthographic camera, it is the distance from the center of the renderer bounding box to the camera along the camera view direction. In a perspective camera, it is the direct distance from the center of the renderer bounding box to the camera position. -Distance to Camera Diagram +Distance to Camera Diagram > It should be noted that in different render queues, the rules for the impact of distance on render order are different. In the opaque render queue and alpha test render queue, the render order is **from near to far**, while in the transparent render queue, the render order is **from far to near**. diff --git a/docs/en/graphics/renderer/renderer.md b/docs/en/graphics/renderer/renderer.mdx similarity index 98% rename from docs/en/graphics/renderer/renderer.md rename to docs/en/graphics/renderer/renderer.mdx index f46590a77a..6c71b7f265 100644 --- a/docs/en/graphics/renderer/renderer.md +++ b/docs/en/graphics/renderer/renderer.mdx @@ -50,7 +50,7 @@ console.log("isCulled", renderer.isCulled); Below shows how to get the overall bounding box of multiple `Renderers`: - + ## Methods diff --git a/docs/en/graphics/renderer/skinnedMeshRenderer.md b/docs/en/graphics/renderer/skinnedMeshRenderer.mdx similarity index 90% rename from docs/en/graphics/renderer/skinnedMeshRenderer.md rename to docs/en/graphics/renderer/skinnedMeshRenderer.mdx index 314472a2ad..c3976bbc31 100644 --- a/docs/en/graphics/renderer/skinnedMeshRenderer.md +++ b/docs/en/graphics/renderer/skinnedMeshRenderer.mdx @@ -23,9 +23,9 @@ In models exported from the art workflow, all bone and BlendShape information is ## Skeletal Animation - + ## BlendShape - + diff --git a/docs/en/graphics/shader/builtins/blinnPhong.md b/docs/en/graphics/shader/builtins/blinnPhong.mdx similarity index 92% rename from docs/en/graphics/shader/builtins/blinnPhong.md rename to docs/en/graphics/shader/builtins/blinnPhong.mdx index a03f089e32..5a14f844b1 100644 --- a/docs/en/graphics/shader/builtins/blinnPhong.md +++ b/docs/en/graphics/shader/builtins/blinnPhong.mdx @@ -4,11 +4,11 @@ title: Blinn Phong [BlinnPhongMaterial](/apis/core/#BlinnPhongMaterial) material is one of the classic materials. Although it is not based on physical rendering, its efficient rendering algorithm and comprehensive optical components make it still applicable to many scenarios today. - + ## Editor Usage -blinn +blinn ## Parameter Introduction diff --git a/docs/en/graphics/shader/builtins/unlit.md b/docs/en/graphics/shader/builtins/unlit.mdx similarity index 64% rename from docs/en/graphics/shader/builtins/unlit.md rename to docs/en/graphics/shader/builtins/unlit.mdx index 408e1b329a..6cbd04d54e 100644 --- a/docs/en/graphics/shader/builtins/unlit.md +++ b/docs/en/graphics/shader/builtins/unlit.mdx @@ -4,11 +4,11 @@ title: Unlit In some simple scenes, you might not want to calculate lighting. The engine provides [UnlitMaterial](/apis/core/#UnlitMaterial), which uses the most streamlined shader code and only requires color or texture to render. Unlit material is suitable for rendering baked models. It only needs a basic texture or color to display the high-quality rendering results obtained from offline rendering. However, the downside is that it cannot display real-time light and shadow interactions because Unlit is determined by the texture and is not affected by any lighting. - + ## Editor Usage -unlit +unlit ## Parameter Introduction @@ -24,7 +24,7 @@ If you need to use the material through a script, you can go to the [material us As introduced in the [baking tutorial](/en/docs/art/bake-blender), if we have already created the baked map and want a **convenient material** where the color is only influenced by the baked texture, without adding lights, debugging normals, or adjusting advanced properties like metallic roughness, then you can try Galacean's [UnlitMaterial](/apis/core/#UnlitMaterial). glTF has a dedicated [KHR_materials_unlit](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit) plugin, which Galacean will parse to generate Unlit material. -image.png +image.png Test model: [TREX.zip](https://www.yuque.com/attachments/yuque/0/2021/zip/381718/1623651429048-7f6a3610-d5cb-4a73-97f5-0d37d0c63b2c.zip?_lake_card=%7B%22src%22%3A%22https%3A%2F%2Fwww.yuque.com%2Fattachments%2Fyuque%2F0%2F2021%2Fzip%2F381718%2F1623651429048-7f6a3610-d5cb-4a73-97f5-0d37d0c63b2c.zip%22%2C%22name%22%3A%22TREX.zip%22%2C%22size%22%3A499161%2C%22type%22%3A%22application%2Fx-zip-compressed%22%2C%22ext%22%3A%22zip%22%2C%22status%22%3A%22done%22%2C%22taskId%22%3A%22u458bcbec-d647-4328-8036-3d5eb12860f%22%2C%22taskType%22%3A%22upload%22%2C%22id%22%3A%22ua8a5baad%22%2C%22card%22%3A%22file%22%7D) @@ -32,34 +32,34 @@ Next, we will introduce how to export a glTF file with the unlit plugin using Bl 1. Import the model -![image.png](https://gw.alipayobjects.com/zos/OasisHub/e5dbfb61-5c0c-4ca5-8c7f-bde353d4c211/1623651809057-138f49cf-6fe7-4f54-8161-c7e157ec85fd-20210614150752343.png) + 2. Modify Shader The default shader type is BSDF. We need to change the shader type in the surface material properties to **Background**. -![image.png](https://gw.alipayobjects.com/zos/OasisHub/abf1e279-1f78-4d21-8c1f-d58d7f74992c/1623652169374-7f39e5f0-6639-4795-8565-b8f0b09420ed-20210614150804567.png) + -![image.png](https://gw.alipayobjects.com/zos/OasisHub/c8c51e5f-c7c6-44a3-87e2-dc649e13fddb/1623652230768-69cd6f7e-175d-4f9f-9042-b3629d422b8e.png) + 3. Add Baked Texture Add the baked texture and connect Color and Shader together. -![image.png](https://gw.alipayobjects.com/zos/OasisHub/50c69e7b-c099-4a2d-b546-8a55ff4f9309/1623652264008-7ae4c13c-6430-44b0-995e-2c23c9f117a7-20210614150846797.png) + -![image.png](https://gw.alipayobjects.com/zos/OasisHub/6ed13e19-a9e5-4454-a0d5-ad27b3cabe14/1623652368637-6dda44be-4cde-4f65-a72f-d39b5d3f60ce.png) + -![image.png](https://gw.alipayobjects.com/zos/OasisHub/e9a99c9c-f661-4666-86bc-d8e91030c0f7/1623652380351-501dd929-7f96-4578-b49a-11724a0782a7.png) + 4. Export glTF If the preview is normal, export the glTF. -![image.png](https://gw.alipayobjects.com/zos/OasisHub/4b6b5f8f-ebd2-46af-85c7-9a26b5f66a2e/1623652403568-450291a8-1a0b-4cf4-8e71-c183a05632b0-20210614150902221.png) + -![image.png](https://gw.alipayobjects.com/zos/OasisHub/1fe38185-399e-4f56-bff4-c39ba4ae3a2a/1623652462007-85b065a3-69fa-4d80-9dfd-834ef66da12a.png) + Drag the exported glTF file into the editor or [glTF Viewer](https://galacean.antgroup.com/engine/gltf-viewer). If the material type is **UnlitMaterial**, it means that the [KHR_materials_unlit](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit) extension has been exported, and Galacean has parsed it into an Unlit material. -![image.png](https://gw.alipayobjects.com/zos/OasisHub/fbb6ba43-f7d7-4757-a1d3-590083d30573/1623652636074-d8bb8437-f885-43fd-8957-8e14ae9fd8c0-20210614150914493.png) + diff --git a/docs/en/graphics/shader/custom.md b/docs/en/graphics/shader/custom.mdx similarity index 98% rename from docs/en/graphics/shader/custom.md rename to docs/en/graphics/shader/custom.mdx index 6f7fdd4076..7dbe048096 100644 --- a/docs/en/graphics/shader/custom.md +++ b/docs/en/graphics/shader/custom.mdx @@ -4,7 +4,7 @@ title: Custom Shaders There may be some special rendering requirements in the business, such as water flow effects, which need to be implemented through **custom shaders** (Shader). - + ## Creating Shaders @@ -111,7 +111,7 @@ The engine has automatically uploaded some commonly used variables, which users In addition to built-in variables, we can upload any custom-named variables in the shader. All we need to do is use the correct interface according to the shader data type. All upload interfaces are stored in [ShaderData](/apis/core/#ShaderData), and the shaderData instance objects are stored in the engine's four main classes: [Scene](/apis/core/#Scene), [Camera](/apis/core/#Camera), [Renderer](/apis/core/#Renderer), and [Material](/apis/core/#Material). We just need to call the interfaces on these shaderData to upload variables, and the engine will automatically assemble these data at the underlying level and perform optimizations such as redundancy checks. -![](https://mdn.alipayobjects.com/huamei_jvf0dp/afts/img/A*ijQMQJM_Vy0AAAAAAAAAAAAADleLAQ/original) + ### Benefits of Separating Shader Data diff --git a/docs/en/graphics/shader/shaderLab/intro.md b/docs/en/graphics/shader/shaderLab/intro.mdx similarity index 97% rename from docs/en/graphics/shader/shaderLab/intro.md rename to docs/en/graphics/shader/shaderLab/intro.mdx index 7092d3ed19..649d72dcbc 100644 --- a/docs/en/graphics/shader/shaderLab/intro.md +++ b/docs/en/graphics/shader/shaderLab/intro.mdx @@ -15,4 +15,4 @@ flowchart LR Below is a simple example of using ShaderLab, which includes two Shaders. The `normal` Shader defines a vertex shader that only implements MVP transformation and a fragment shader that specifies the pixel color through a Uniform variable. Additionally, the `lines` Shader is a [shadertoy](https://www.shadertoy.com/view/DtXfDr) example modified using ShaderLab. - + diff --git a/docs/en/graphics/shader/shaderLab/usage.md b/docs/en/graphics/shader/shaderLab/usage.mdx similarity index 61% rename from docs/en/graphics/shader/shaderLab/usage.md rename to docs/en/graphics/shader/shaderLab/usage.mdx index 7406c37165..9ecbc803a3 100644 --- a/docs/en/graphics/shader/shaderLab/usage.md +++ b/docs/en/graphics/shader/shaderLab/usage.mdx @@ -4,14 +4,14 @@ title: "Usage" With custom shader assets written using `ShaderLab`, we can implement user-defined materials by binding the shader to newly created materials. - + - `ShaderLab` Reflecting Material Properties If we write the `material property definition` module in `ShaderLab`, the properties defined in the module will be exposed in the Inspector panel of the material asset bound to the Shader. - + ## An Example of Implementing Planar Shadows Using Multi-Pass Technology - + diff --git a/docs/en/graphics/texture/2d.md b/docs/en/graphics/texture/2d.mdx similarity index 86% rename from docs/en/graphics/texture/2d.md rename to docs/en/graphics/texture/2d.mdx index 19b6733c89..943b36a0ee 100644 --- a/docs/en/graphics/texture/2d.md +++ b/docs/en/graphics/texture/2d.mdx @@ -1,8 +1,8 @@ --- order: 1 -title: 2D 纹理 -type: 图形 -group: 纹理 +title: 2D Texture +type: Graphics +group: Texture label: Graphics/Texture --- @@ -12,7 +12,7 @@ label: Graphics/Texture In the editor, you can easily import a 2D texture by following the path **[Asset Panel](/en/docs/assets/interface)** -> **Right-click Upload** -> **Select Texture2D** -> **Choose the corresponding texture** -> **2D texture asset creation complete**. -image.png +image.png Similarly, in the script, you can load an image through [ResourceManager](/apis/core/#ResourceManager) to get the corresponding 2D texture: @@ -55,7 +55,7 @@ texture.setImageSource(video); For scenarios where the texture content needs to be frequently updated, such as videos, you need to disable mipmap and set the texture usage to Dynamic when creating the texture to achieve better performance. The sample code is as follows: - + ### setPixelBuffer @@ -85,7 +85,7 @@ texture.getPixelBuffer(0, 0, width, height, 0, data); Assigning the texture to the corresponding property of the material ball can enable different rendering functions. For example, adding a base color texture can determine the basic tone of the model. In the editor, you only need to select the corresponding texture in the corresponding property. -image.png +image.png Similarly, in the script, you can set it like this: @@ -98,7 +98,7 @@ material.baseTexture = texture; ## Color Expansion -image.png +image.png To solve the problem of black edges appearing at the abrupt changes in Alpha values in images with transparent pixels, the editor has a built-in color expansion function. This function removes the black edges of the image by rewriting the RGB values of all transparent pixels in the image to the RGB values of the nearest non-fully transparent pixels. @@ -109,6 +109,6 @@ To solve the problem of black edges appearing at the abrupt changes in Alpha val ## Export Configuration -image.png +image.png The [Project Release](/en/docs/platform/platform) document explains the **global configuration** for texture export in detail. If the Overwrite option is selected here, this asset will follow the **custom configuration** instead of the **global configuration** during export. diff --git a/docs/en/graphics/texture/compression.md b/docs/en/graphics/texture/compression.mdx similarity index 88% rename from docs/en/graphics/texture/compression.md rename to docs/en/graphics/texture/compression.mdx index c75635608e..b78dc27f2c 100644 --- a/docs/en/graphics/texture/compression.md +++ b/docs/en/graphics/texture/compression.mdx @@ -23,7 +23,7 @@ engine.resourceManager.load({ }) ``` - + Using ktx2 in glTF requires including the [KHR_texture_basisu](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_texture_basisu/README.md) extension. @@ -36,7 +36,7 @@ KTX2 can be generated using: When packaging the project, the editor can configure options to generate KTX2. Refer to the '[Project Release](/en/docs/platform/platform/)' document. The project export is a global configuration, and different compression formats can be configured independently for different texture resources. Check overwrite in the texture panel of the editor to override the global configuration: -image-20240705112419249 +image-20240705112419249 - ETC1S has a small size and minimal memory usage but lower quality, suitable for albedo, specular, and other maps. - UASTC has a larger size and higher quality, suitable for normal maps and similar textures. diff --git a/docs/en/graphics/texture/cube.md b/docs/en/graphics/texture/cube.mdx similarity index 81% rename from docs/en/graphics/texture/cube.md rename to docs/en/graphics/texture/cube.mdx index ed65606af6..623b66cdbe 100644 --- a/docs/en/graphics/texture/cube.md +++ b/docs/en/graphics/texture/cube.mdx @@ -8,13 +8,13 @@ label: Graphics/Texture The difference between a cube texture ([TextureCube](/apis/core/#TextureCube)) and a 2D texture is that it has 6 faces, which means a cube texture is composed of 6 2D textures. -![image.png](https://gw.alipayobjects.com/mdn/rms_d27172/afts/img/A*Omw8Qo0WzfYAAAAAAAAAAAAAARQnAQ) + -![image.png](https://gw.alipayobjects.com/mdn/rms_d27172/afts/img/A*r-XPSaUTEnEAAAAAAAAAAAAAARQnAQ) + The underlying sampling method of cube textures is slightly different from that of 2D textures. Textures use two-dimensional coordinates for sampling, while cube textures use three-dimensional coordinates, i.e., _direction vectors_ for sampling. For example, using an orange direction vector to sample a texture value from a cube texture would look like this: -![image.png](https://gw.alipayobjects.com/mdn/rms_d27172/afts/img/A*X752S5pQSB0AAAAAAAAAAAAAARQnAQ) + Because of this sampling characteristic, cube textures can be used to achieve effects such as skyboxes and environment reflections. @@ -24,7 +24,7 @@ Because of this sampling characteristic, cube textures can be used to achieve ef After preparing the HDR, follow the path **[Asset Panel](/en/docs/assets/interface)** -> **Right-click Upload** -> **Select TextureCube(.hdr)** -> **Choose the corresponding HDR map** -> **Cube texture asset creation completed**. -![image.png](https://mdn.alipayobjects.com/huamei_yo47yq/afts/img/A*Oi3FSLEEaYgAAAAAAAAAAAAADhuCAQ/original) + Similarly, in the script, you can also get the corresponding cube texture by loading six textures in the correct order. diff --git a/docs/en/graphics/texture/rtt.md b/docs/en/graphics/texture/rtt.mdx similarity index 97% rename from docs/en/graphics/texture/rtt.md rename to docs/en/graphics/texture/rtt.mdx index b02f026729..72ff24457f 100644 --- a/docs/en/graphics/texture/rtt.md +++ b/docs/en/graphics/texture/rtt.mdx @@ -51,4 +51,4 @@ class switchRTScript extends Script { cameraEntity.addComponent(switchRTScript); ``` - + diff --git a/docs/en/graphics/texture/texture.md b/docs/en/graphics/texture/texture.mdx similarity index 90% rename from docs/en/graphics/texture/texture.md rename to docs/en/graphics/texture/texture.mdx index 523c2459e5..f9dca4d1c9 100644 --- a/docs/en/graphics/texture/texture.md +++ b/docs/en/graphics/texture/texture.mdx @@ -34,14 +34,14 @@ This article will mainly introduce: Texture space is determined by the shape of the texture. 2D textures require 2D space vectors for texture sampling, while cube textures require 3D space vectors for texture sampling. -
-
- Texture 2D -
Texture 2D
+
+
+ Texture 2D +
Texture 2D
-
- Texture Cube -
Texture Cube
+
+ Texture Cube +
Texture Cube
@@ -66,7 +66,7 @@ The texture sampling range is `[0,1]`. When the texture UV coordinates exceed th | Repeat | Resamples from [0,1] when out of range | | Mirror | Mirrors sampling from [1,0] when out of range | - + ### Filter Mode @@ -78,13 +78,13 @@ Generally, texels and screen pixels do not correspond exactly. We can control th | Bilinear | Uses the average value of the nearest 2\*2 texel matrix | | Trilinear | Applies average filtering to the mipmap levels based on bilinear filtering | - + ### Anisotropic Filtering Level Anisotropic filtering technology can make textures appear clearer when viewed at oblique angles. As shown in the figure below, the end of the texture becomes clearer as the anisotropic filtering level increases. However, use it with caution; the higher the value, the greater the GPU computation. - + ## General Settings @@ -99,7 +99,7 @@ Anisotropic filtering technology can make textures appear clearer when viewed at **The engine enables [mipmap](/apis/core/#Texture-generateMipmaps)** (multi-level texture gradient) by default. Mipmap is used to solve the precision and performance issues when sampling high-resolution textures on low-resolution screens, allowing the selection of different resolution textures at appropriate distances, as shown below: -![image.png](https://gw.alipayobjects.com/mdn/rms_d27172/afts/img/A*mTBvTJ7Czt4AAAAAAAAAAAAAARQnAQ) + It should be noted that WebGL2.0 supports textures of **any resolution** and will generate mip levels based on the [mipmap](http://download.nvidia.com/developer/Papers/2005/NP2_Mipmapping/NP2_Mipmap_Creation.pdf) algorithm. However, if your environment is WebGL1.0, please ensure to upload **power-of-two textures**, such as textures with a resolution of 1024 \* 512. Otherwise, Galacean will detect that the environment cannot use mipmap and will automatically downgrade to disable the mipmap function, which may cause some unexpected visual effects. @@ -126,7 +126,7 @@ const cubeTexture = new TextureCube( ); // 第 4 个参数 ``` - + ### flipY diff --git a/docs/en/how-to-contribute.mdx b/docs/en/how-to-contribute.mdx index e702c68848..a527dcfa72 100644 --- a/docs/en/how-to-contribute.mdx +++ b/docs/en/how-to-contribute.mdx @@ -218,7 +218,7 @@ engine.resourceManager Ambient light emits from all directions and enters the eye, as shown in the example below: - + ... ```` diff --git a/docs/en/input/framebuffer-picker.md b/docs/en/input/framebuffer-picker.mdx similarity index 96% rename from docs/en/input/framebuffer-picker.md rename to docs/en/input/framebuffer-picker.mdx index 630d41080e..f2edddcac5 100644 --- a/docs/en/input/framebuffer-picker.md +++ b/docs/en/input/framebuffer-picker.mdx @@ -9,7 +9,7 @@ In 3D applications, it is often necessary to pick objects in the scene. [Ray-box When the picking frequency is not high, you can consider using the `FramebufferPicker` component with **pixel-level accuracy**. When the picking frequency is too high, developers need to evaluate whether the performance overhead is suitable for the business scenario, as this component involves CPU-GPU communication at the underlying level, i.e., calling `gl.readPixels`. - + ## Create Framebuffer Picking diff --git a/docs/en/input/input.md b/docs/en/input/input.mdx similarity index 89% rename from docs/en/input/input.md rename to docs/en/input/input.mdx index b6b6d2a036..81405e4865 100644 --- a/docs/en/input/input.md +++ b/docs/en/input/input.mdx @@ -15,7 +15,7 @@ Galacean provides a basic input system. Based on cross-end and cross-platform fe When initializing the engine, you can customize the listening sources for **touch**, **keyboard**, and **wheel**. -image.png +image.png ```typescript // 将触控事件的监听源设置为 document diff --git a/docs/en/input/keyboard.md b/docs/en/input/keyboard.mdx similarity index 98% rename from docs/en/input/keyboard.md rename to docs/en/input/keyboard.mdx index ff31ea727d..5cef7b7304 100644 --- a/docs/en/input/keyboard.md +++ b/docs/en/input/keyboard.mdx @@ -40,7 +40,7 @@ class KeyScript extends Script { This time, let's use the spacebar to control Angry Birds. - + ## State Dictionary diff --git a/docs/en/input/pointer.md b/docs/en/input/pointer.mdx similarity index 97% rename from docs/en/input/pointer.md rename to docs/en/input/pointer.mdx index 1f1bef3ee7..9bd31f139a 100644 --- a/docs/en/input/pointer.md +++ b/docs/en/input/pointer.mdx @@ -36,7 +36,7 @@ timeline …… ``` - + ### Touch Buttons @@ -56,7 +56,7 @@ Referring to the [W3C standard](https://www.w3.org/TR/uievents/#dom-mouseevent-b Combining touch buttons can easily detect the behavior of touch points triggered in this frame: - + ### Touch Callbacks @@ -79,7 +79,7 @@ Example: - The middle cube responds to Drag events, allowing you to drag the cube anywhere in space with the mouse. - The rightmost cube responds to Click events (first down, then up), changing color when the mouse clicks on it. - + ### Raycasting @@ -106,7 +106,7 @@ if (scene.physics.raycast(ray, 100, hitResult)) { The following example provides a more intuitive understanding of this process. The main camera is equipped with auxiliary lines, and the side view camera can fully observe the process of the main camera's raycasting detecting the collider. - + ## Compatibility diff --git a/docs/en/input/wheel.md b/docs/en/input/wheel.mdx similarity index 56% rename from docs/en/input/wheel.md rename to docs/en/input/wheel.mdx index fc7cf376b0..661e55a936 100644 --- a/docs/en/input/wheel.md +++ b/docs/en/input/wheel.mdx @@ -9,9 +9,9 @@ Galacean's wheel input is based on [WheelEvent](https://www.w3.org/TR/uievents/# ## Usage -image.png +image.png Here is an example of using the wheel to control the camera distance. - + diff --git a/docs/en/performance/scene-standard.md b/docs/en/performance/scene-standard.mdx similarity index 100% rename from docs/en/performance/scene-standard.md rename to docs/en/performance/scene-standard.mdx diff --git a/docs/en/performance/stats.md b/docs/en/performance/stats.mdx similarity index 91% rename from docs/en/performance/stats.md rename to docs/en/performance/stats.mdx index 90df4bbd05..8fdd7299c7 100644 --- a/docs/en/performance/stats.md +++ b/docs/en/performance/stats.mdx @@ -17,4 +17,4 @@ cameraEntity.addComponent(Stats); ## Example - + diff --git a/docs/en/physics/collider.md b/docs/en/physics/collider.mdx similarity index 87% rename from docs/en/physics/collider.md rename to docs/en/physics/collider.mdx index 00ecc01788..8d23a808b6 100644 --- a/docs/en/physics/collider.md +++ b/docs/en/physics/collider.mdx @@ -16,7 +16,7 @@ The biggest advantage of introducing a physics engine is that it allows objects Before adding a physics component to an object, the first thing to consider is whether the collider is static or dynamic, and then add the corresponding collider component, either a static collider [StaticCollider](/apis/core/#StaticCollider) or a dynamic collider [DynamicCollider](/apis/core/#DynamicCollider). -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*-E4USbdiH6sAAAAAAAAAAAAADsJ_AQ/original) + ### Selecting the Shape of the Collider @@ -35,19 +35,19 @@ The engine supports composite collider shapes, meaning the collider itself can b It is particularly emphasized here the positional relationship between `Collider` and `ColliderShape`. The posture of each `Collider` is consistent with the `Entity` it is attached to, and they are synchronized every frame. The `ColliderShape` can set an offset **relative to** the `Entity` through the `position` property. -![table](https://mdn.alipayobjects.com/huamei_vvspai/afts/img/A*erlGRKk7dNMAAAAAAAAAAAAADsqFAQ/original) + After adding the collider component, the collider shape is not added by default, so you need to click Add Item to add it. After adding, you will see the auxiliary rendering of the collider appear in the viewport. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*OUr-SIejEkoAAAAAAAAAAAAADsJ_AQ/original) + For each collider shape, you can design corresponding size properties. For example: -alt text +alt text No matter which collider shape is used, you can set the Local Position, which is the local offset relative to the Entity coordinates. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*p8UcRJ9Q0EIAAAAAAAAAAAAADsJ_AQ/original) + The `ColliderShape` also has a noteworthy property called `Trigger`, which can switch this `ColliderShape` from `collider mode` to `trigger mode`. @@ -57,7 +57,7 @@ Collider mode: The object has a rigid body shape, and when contact occurs, it ca ### Dynamic Collider Settings Unlike static colliders, dynamic colliders are subject to physical laws, so there are many additional physical properties to set. -alt text +alt text After modifying these parameters, the viewport will not change because dynamic colliders are subject to gravity by default, so you need to observe them in `preview mode`. @@ -99,7 +99,7 @@ For trigger mode, you first need to add a `Collider` to the `Entity` in the scen You can enable trigger mode through the `isTrigger` property on `ColliderShape`, but it is particularly emphasized that **trigger events will not be called between two StaticColliders**, unless one of them is a `DynamicCollider`. - + ### Collider Script Functions @@ -108,4 +108,4 @@ For collider mode, when `DynamicColliders` interact, three collision-related scr 2. [onCollisionStay](/en/docs/script#$1-oncollisionstay): *Loop* called during the collision. 3. [onCollisionExit](/en/docs/script#$1-oncollisionexit): Called when the collision ends. - + diff --git a/docs/en/physics/controller.md b/docs/en/physics/controller.mdx similarity index 98% rename from docs/en/physics/controller.md rename to docs/en/physics/controller.mdx index 7da4daa30b..2e91359370 100644 --- a/docs/en/physics/controller.md +++ b/docs/en/physics/controller.mdx @@ -48,4 +48,4 @@ export enum ControllerCollisionFlag { This determines how the character's next animation and movement will proceed. In the example below, you can control the character's movement via the keyboard, allowing it to climb or jump over specific obstacles. - + diff --git a/docs/en/physics/debug.md b/docs/en/physics/debug.mdx similarity index 96% rename from docs/en/physics/debug.md rename to docs/en/physics/debug.mdx index 6d19ea403d..cfe9da046f 100644 --- a/docs/en/physics/debug.md +++ b/docs/en/physics/debug.mdx @@ -15,4 +15,4 @@ It is also very easy to use, just mount the `WireframeManager` script and then s const wireframe = rootEntity.addComponent(WireframeManager); wireframe.addCollideWireframe(collider); ``` - + diff --git a/docs/en/physics/joint-basic.md b/docs/en/physics/joint-basic.mdx similarity index 86% rename from docs/en/physics/joint-basic.md rename to docs/en/physics/joint-basic.mdx index 6dbfe6c523..afce0bcfa2 100644 --- a/docs/en/physics/joint-basic.md +++ b/docs/en/physics/joint-basic.mdx @@ -9,13 +9,13 @@ Physics constraint components are very important physical components. By using c 1. Fixed Constraint Component - ![fixedJoint](https://gameworksdocs.nvidia.com/PhysX/4.1/documentation/physxguide/_images/fixedJoint.png) + 2. Spring Constraint Component - ![springJoint](https://gameworksdocs.nvidia.com/PhysX/4.1/documentation/physxguide/_images/distanceJoint.png) + 3. Hinge Constraint Component - ![hingeJoint](https://gameworksdocs.nvidia.com/PhysX/4.1/documentation/physxguide/_images/revoluteJoint.png) + All physics constraints have two acting objects. One represents the dynamic collider affected by the physical constraint (the physics constraint component is mounted on this node), and the other is the position where the constraint is mounted or another dynamic collider (set through component configuration). Therefore, the usage of these components is similar. Taking the fixed constraint component `FixedJoint` as an example: @@ -40,4 +40,4 @@ These two properties can be specified by configuring `axis` (the default directi The `swingOffset` is also a vector and can be understood as the offset from the rotation center determined by `connectedAnchor` and `connectedCollider`, where the dynamic collision is moved to this point to start rotating around the rotation axis. The usage of the above physics constraint components can be referred to: - + diff --git a/docs/en/physics/manager.md b/docs/en/physics/manager.mdx similarity index 96% rename from docs/en/physics/manager.md rename to docs/en/physics/manager.mdx index 1c413bddbd..2d531e76dd 100644 --- a/docs/en/physics/manager.md +++ b/docs/en/physics/manager.mdx @@ -45,11 +45,11 @@ When the physical scene is updated, in addition to calling this function, it wil ## Using Raycasting - + A ray can be understood as an infinite line emitted from a point in a certain direction in the 3D world. Raycasting is very widely used in 3D applications. Through raycasting, you can pick objects in the 3D scene when the user clicks the screen; it can also be used in shooting games to determine whether a bullet can hit the target. -![image.png](https://gw.alipayobjects.com/mdn/rms_7c464e/afts/img/A*SHM1RI49Bd4AAAAAAAAAAAAAARQnAQ) + (_Image source: Internet_) To use raycasting, you first need to import the [Ray](/apis/math/#Ray) module in the code; then generate a ray, which can be custom-generated or converted from screen input through the camera ([camera](/apis/core/#Camera-viewportPointToRay)); finally, call the [PhysicsManager.raycast](/apis/core/#PhysicsManager-raycast) method to detect the collision body hit by the ray. The code is as follows: diff --git a/docs/en/physics/overall.md b/docs/en/physics/overall.mdx similarity index 92% rename from docs/en/physics/overall.md rename to docs/en/physics/overall.mdx index 1728b31e7c..2ac9f04ddd 100644 --- a/docs/en/physics/overall.md +++ b/docs/en/physics/overall.mdx @@ -14,8 +14,8 @@ For scenarios that need to use various physics components and `InputManager` tha Developers can set the physics backend in the **Project Settings** panel opened from the [Main Menu](/en/docs/interface/menu) interface. -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*LO_FRIsaIzIAAAAAAAAAAAAADsJ_AQ/original) -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*ZvWdQqEfIKoAAAAAAAAAAAAADsJ_AQ/original) + + If initializing the engine through a script, you only need to pass the physics backend object into the `Engine`: diff --git a/docs/en/platform/h5.md b/docs/en/platform/h5.mdx similarity index 92% rename from docs/en/platform/h5.md rename to docs/en/platform/h5.mdx index 1c3f1e73f9..9d2f778585 100644 --- a/docs/en/platform/h5.md +++ b/docs/en/platform/h5.mdx @@ -13,7 +13,7 @@ When exporting to the H5 platform, there is no additional platform-related expor After selecting the H5 platform, click the download button at the bottom of the export panel to export the required project: - + After exporting to the local computer, the directory structure is as follows: @@ -47,11 +47,11 @@ npm run dev ``` After executing the above command, if successful, the following will appear: - + 3、In the browser, enter the above Local or Network URL to preview the actual running effect, as follows: - + ## Build diff --git a/docs/en/platform/platform.md b/docs/en/platform/platform.mdx similarity index 50% rename from docs/en/platform/platform.md rename to docs/en/platform/platform.mdx index f242642e5a..b7755c5a70 100644 --- a/docs/en/platform/platform.md +++ b/docs/en/platform/platform.mdx @@ -15,15 +15,15 @@ When we complete the project development and need to export it to a certain plat 1、Click the Export button on the left side of the editor: - + 2、On the left side of the export panel that appears, select the export platform: - + 3、On the right side of the export panel are some project-related export configurations, which are mainly divided into two parts: **General configuration** (in the red box) and **Platform-related configuration** (in the yellow box): - + ### Export Configuration Instructions @@ -35,13 +35,13 @@ The platform-related export configuration will be described separately in the pl | Main Scene | Project main scene | | Engine version | The engine version number used by the project | | Upload to CDN | Whether to upload assets to CDN | -| Texture Type | Texture type, supports KTX2 and Original:
**Original**:No processing is done on the texture
**KTX2**:Enable texture compression Selecting KTX2 allows you to choose different compression formats:
**ETC1S:** Small size, very small memory, but low quality, suitable for albedo, specular and other textures
**UASTC:** Large size, high quality, suitable for normal textures
If the ETC1S compression format is selected, you can set the compression quality through Quality (the larger the value, the better the rendering quality):| -| Tree shaking | Whether to crop the exported assets:
**None:** Export all assets without cropping
**Current Scene:** Export only the assets used in the current scene
**All Scene:** Treeshaking all scenes, exporting all the assets used by the scenes | -| WebGL Mode | Select the version to use with WebGL:
**Auto:** WebGL2.0 is preferred. If the operating environment does not support it, it will automatically switch to WebGL1.0
**WebGL1.0:** Using WebGL1.0
**WebGL2.0:** Using WebGL2.0 | +| Texture Type | Texture type, supports KTX2 and Original:
**Original**:No processing is done on the texture
**KTX2**:Enable texture compression Selecting KTX2 allows you to choose different compression formats:
**ETC1S:** Small size, very small memory, but low quality, suitable for albedo, specular and other textures
**UASTC:** Large size, high quality, suitable for normal textures
If the ETC1S compression format is selected, you can set the compression quality through Quality (the larger the value, the better the rendering quality):| +| Tree shaking | Whether to crop the exported assets:
**None:** Export all assets without cropping
**Current Scene:** Export only the assets used in the current scene
**All Scene:** Treeshaking all scenes, exporting all the assets used by the scenes | +| WebGL Mode | Select the version to use with WebGL:
**Auto:** WebGL2.0 is preferred. If the operating environment does not support it, it will automatically switch to WebGL1.0
**WebGL1.0:** Using WebGL1.0
**WebGL2.0:** Using WebGL2.0 | | Anti-Alias | Whether to enable anti-aliasing | | Alpha | Whether the canvas supports transparent background. If you want the content below the canvas to be visible, you can turn it on. | | Preserve Drawing Buffer | Controls whether the drawing buffer retains its contents after calling the gl.clear() method. | -| DPR Mode | [The pixel ratio of the device](/en/docs/core/canvas),Control the size of the canvas by calling engine.canvas.resizeByClientSize:
**Auto:** Automatic adaptation, that is, the parameter is window.devicePixelRatio
**Fixed:** Developers set their own parameters After selecting Fixed, developers can enter the parameters they need to set. | +| DPR Mode | [The pixel ratio of the device](/en/docs/core/canvas),Control the size of the canvas by calling engine.canvas.resizeByClientSize:
**Auto:** Automatic adaptation, that is, the parameter is window.devicePixelRatio
**Fixed:** Developers set their own parameters After selecting Fixed, developers can enter the parameters they need to set. | ## Supported export platforms Currently, Galacean supports exporting to the following platforms: diff --git a/docs/en/platform/wechatMiniGame.md b/docs/en/platform/wechatMiniGame.mdx similarity index 89% rename from docs/en/platform/wechatMiniGame.md rename to docs/en/platform/wechatMiniGame.mdx index 146cedadfc..0b417f5c98 100644 --- a/docs/en/platform/wechatMiniGame.md +++ b/docs/en/platform/wechatMiniGame.mdx @@ -9,7 +9,7 @@ label: Platform When exporting to the WeChat Mini Game platform, there are the following configuration items: - + | Configuration | Describe | Corresponding to the configuration file of WeChat Mini Games | Corresponding to the fields in WeChat Mini Games | ------------- | ------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------- | @@ -26,7 +26,7 @@ For more configuration details, see: [project.config.json](https://developers.we After selecting the WeChat Mini Game platform, click the download button at the bottom of the export panel to export the required project: - + ## Debug @@ -38,15 +38,15 @@ npm i 2、Open **WeChat Developer Tools**, select Mini Game, and import the project just now, as follows: - + 3、In WeChat Developer Tools, click **Tools->Build** npm, as follows: - + 4、After completing the above 3, you can preview the final result in the WeChat developer tool as follows: - + 5、For debugging in WeChat developer tools, see: [WeChat Mini Game Debugging](https://developers.weixin.qq.com/minigame/dev/guide/runtime/debug/) @@ -58,7 +58,7 @@ After local debugging is completed, you can publish it. For details on the publi The project directory exported to the local is as follows: - + **Project Catalog Description** |Directory or file|Describe| diff --git a/docs/zh/UI/overall.md b/docs/zh/UI/overall.mdx similarity index 100% rename from docs/zh/UI/overall.md rename to docs/zh/UI/overall.mdx diff --git a/docs/zh/UI/quickStart/button.md b/docs/zh/UI/quickStart/button.mdx similarity index 75% rename from docs/zh/UI/quickStart/button.md rename to docs/zh/UI/quickStart/button.mdx index 50444dbe5c..56ad03cb24 100644 --- a/docs/zh/UI/quickStart/button.md +++ b/docs/zh/UI/quickStart/button.mdx @@ -13,7 +13,7 @@ label: UI 在 **[层级面板](/docs/interface/hierarchy/)** 添加 `Button` 节点 - + > 若父亲或祖先节点没有画布组件,会自动添加上根画布节点。 @@ -21,7 +21,7 @@ label: UI 在编辑器中可以方便地设置按钮在不同状态下的过渡表现 - + ## 属性 @@ -41,4 +41,4 @@ label: UI ## 脚本开发 - + diff --git a/docs/zh/UI/quickStart/canvas.md b/docs/zh/UI/quickStart/canvas.mdx similarity index 85% rename from docs/zh/UI/quickStart/canvas.md rename to docs/zh/UI/quickStart/canvas.mdx index 0172440f7a..96b048a5f5 100644 --- a/docs/zh/UI/quickStart/canvas.md +++ b/docs/zh/UI/quickStart/canvas.mdx @@ -13,19 +13,19 @@ label: UI 在 **[层级面板](/docs/interface/hierarchy/)** 添加 Canvas 节点 - + ### 设置属性 选中添加了 `Canvas` 组件的节点,可以在 **[检查器面板](/docs/interface/inspector)** 设置相关的属性 - + ### 根画布 如果新添加的画布节点的父亲或祖先节点已经包含激活的 `UICanvas` 组件,那么此画布不包含任何渲染与交互的功能。 - + ## 属性 diff --git a/docs/zh/UI/quickStart/event.md b/docs/zh/UI/quickStart/event.mdx similarity index 96% rename from docs/zh/UI/quickStart/event.md rename to docs/zh/UI/quickStart/event.mdx index fd3ab23243..019a3edcd4 100644 --- a/docs/zh/UI/quickStart/event.md +++ b/docs/zh/UI/quickStart/event.mdx @@ -37,4 +37,4 @@ stateDiagram ## 脚本开发 - + diff --git a/docs/zh/UI/quickStart/group.md b/docs/zh/UI/quickStart/group.mdx similarity index 80% rename from docs/zh/UI/quickStart/group.md rename to docs/zh/UI/quickStart/group.mdx index 08a51af701..ff7aa8027e 100644 --- a/docs/zh/UI/quickStart/group.md +++ b/docs/zh/UI/quickStart/group.mdx @@ -11,7 +11,7 @@ label: UI 选中节点,在 **[检查器面板](/docs/interface/inspector)** 点击 **添加组件** 并选择 **UIGroup**,即可通过修改设置控制多个 UI 元素的透明度。 - + ## 属性 @@ -25,4 +25,4 @@ label: UI ## 脚本开发 - + diff --git a/docs/zh/UI/quickStart/image.md b/docs/zh/UI/quickStart/image.mdx similarity index 75% rename from docs/zh/UI/quickStart/image.md rename to docs/zh/UI/quickStart/image.mdx index 18528a6fc6..cbaa67b72f 100644 --- a/docs/zh/UI/quickStart/image.md +++ b/docs/zh/UI/quickStart/image.mdx @@ -13,7 +13,7 @@ label: UI 在 **[层级面板](/docs/interface/hierarchy/)** 添加 `Image` 节点 - + > 若父亲或祖先节点没有画布组件,会自动添加上根画布节点。 @@ -21,13 +21,13 @@ label: UI Image 的显示内容取决于设置的 [Sprite 资产]() ,选中添加了 `Image` 组件的节点,在 **[检查器面板](/docs/interface/inspector)** 的 Sprite 属性选择对应的精灵资产即可替换显示内容。 - + ### 修改渲染模式 `Image` 目前提供三种绘制模式,分别是普通绘制,九宫绘制与平铺绘制(默认为普通绘制),在不同的绘制模式下,修改绘制宽高可以直观地感受到各种模式之间的渲染差异。 - + ### 调整尺寸 @@ -45,4 +45,4 @@ Image 的显示内容取决于设置的 [Sprite 资产]() ,选中添加了 `Im ## 脚本开发 - + diff --git a/docs/zh/UI/quickStart/order.md b/docs/zh/UI/quickStart/order.mdx similarity index 100% rename from docs/zh/UI/quickStart/order.md rename to docs/zh/UI/quickStart/order.mdx diff --git a/docs/zh/UI/quickStart/text.md b/docs/zh/UI/quickStart/text.mdx similarity index 75% rename from docs/zh/UI/quickStart/text.md rename to docs/zh/UI/quickStart/text.mdx index 5fb43b01f3..11b6e7f11c 100644 --- a/docs/zh/UI/quickStart/text.md +++ b/docs/zh/UI/quickStart/text.mdx @@ -13,7 +13,7 @@ label: UI 在 **[层级面板](/docs/interface/hierarchy/)** 添加 `Text` 节点 - + > 若父亲或祖先节点没有画布组件,会自动添加上根画布节点。 @@ -21,19 +21,19 @@ label: UI 选中添加了 `Text` 组件的节点,在 **[检查器面板](/docs/interface/inspector)** 修改 `text` 属性可以改变 `Text` 元素的显示内容。 - + ### 设置字体 选中添加了 `Text` 组件的节点,在 **[检查器面板](/docs/interface/inspector)** 修改 `font` 属性可以改变 `Text` 元素的字体类型。 - + ### 修改字体大小 `Text` 组件可以通过调整 `FontSize` 修改渲染尺寸 - + > 修改 `UITransform` 的 `size` 不会改变 `Text` 的渲染尺寸。 @@ -54,4 +54,4 @@ label: UI ## 脚本开发 - + diff --git a/docs/zh/UI/quickStart/transform.md b/docs/zh/UI/quickStart/transform.mdx similarity index 92% rename from docs/zh/UI/quickStart/transform.md rename to docs/zh/UI/quickStart/transform.mdx index 37622e28bd..d4d6dfd808 100644 --- a/docs/zh/UI/quickStart/transform.md +++ b/docs/zh/UI/quickStart/transform.mdx @@ -11,7 +11,7 @@ label: UI 添加了 UI 组件的节点,会自动添加 `UITransform` 组件(替换原先旧的 [Transform](/apis/core/#Transform) 组件),在编辑器中,可以选中节点可以使用 `RectTool` (快捷键 `T` )快速设置属性,也可以在在 **[检查器面板](/docs/interface/inspector)** 设置精确属性。 - + > 当主画布的渲染模式为 `Screen` 时,编辑器侧会禁止修改它的 `transform` 避免屏幕适配异常,因此在脚本中,**开发者应当自己避免去篡改屏幕空间主画布 `transform` 的属性**。 diff --git a/docs/zh/UI/system.md b/docs/zh/UI/system.mdx similarity index 100% rename from docs/zh/UI/system.md rename to docs/zh/UI/system.mdx diff --git a/docs/zh/animation/animator.mdx b/docs/zh/animation/animator.mdx index 838b3f3038..9339be510e 100644 --- a/docs/zh/animation/animator.mdx +++ b/docs/zh/animation/animator.mdx @@ -28,24 +28,24 @@ label: Animation 如果模型内有动画,会为你自动绑定一个只读的 `动画控制器`。 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*WkafRagPFo8AAAAAAAAAAAAADsJ_AQ/original) + 如果没有 `动画控制组件` 可以按下图方式创建 -![image26](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*WFRXQIjZa0MAAAAAAAAAAAAADsJ_AQ/original) + 2. 创建一个 `动画控制器` 资产并绑定到模型上,创建 `动画控制器` 有两种方式: 1. 右键点击 **[资产面板](/docs/assets/interface)** 中的空白处,选择 `Create` -> `Animation Controller` - ![image9](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*61Q7S62IZxQAAAAAAAAAAAAADsJ_AQ/original) + 2. 点击添加资产按钮 `+`,选择 `Animation Controller` - ![image10](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*QqpxS6I9D90AAAAAAAAAAAAADsJ_AQ/original) + 3. 在`动画控制组件` 的动画控制器属性上替换为刚才创建的 `动画控制器` -![image27](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*Y0pBQae4UWQAAAAAAAAAAAAADsJ_AQ/original) + 4. 编辑 `动画控制器` 后(可以参考[动画控制器](/docs/animation/animatorController)文档)你就可以播放其中的动画了 diff --git a/docs/zh/animation/animatorController.mdx b/docs/zh/animation/animatorController.mdx index 77dbc38d2c..63f7bc711b 100644 --- a/docs/zh/animation/animatorController.mdx +++ b/docs/zh/animation/animatorController.mdx @@ -23,28 +23,28 @@ label: Animation 1. 准备好 `动画片段`([详细介绍](/docs/animation/clip)) -![1.jpg](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*lq8jQIgm_-cAAAAAAAAAAAAADsJ_AQ/original) + 2. 要组织播放这些 `动画片段` 我们需要创建一个 `动画控制器` 资产,创建 `动画控制器` 有两种方式: 1. 右键点击 **[资产面板](/docs/assets/interface)** 中的空白处,选择 `Create` -> `Animation Controller` - ![image9](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*61Q7S62IZxQAAAAAAAAAAAAADsJ_AQ/original) + 2. 点击添加资产按钮 `+`,选择 `Animation Controller` - ![image10](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*QqpxS6I9D90AAAAAAAAAAAAADsJ_AQ/original) + 3. 刚创建的 `动画控制器` 中没有任何数据,我们需要对他进行编辑,双击资产, 并为它添加一个 `动画状态`([详细介绍](/docs/animation/state-machine/#动画状态)) -![2.jpg](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*7bZmS4iZ10gAAAAAAAAAAAAADsJ_AQ/original) + 4. 点击添加的 `动画状态` 为它绑定一个 `动画片段`([详细介绍](/docs/animation/clip)) -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*xfPTRJg-hOMAAAAAAAAAAAAADsJ_AQ/original) + 5. 在 `动画控制组件`([详细介绍](/docs/animation/animator))上绑定该 `动画控制器` 资产 -![3.jpg](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*H_ShSaWEXtIAAAAAAAAAAAAADsJ_AQ/original) + 6. 至此你在导出的项目中就可以通过 `animator.play("New State")` 播放 `Idle` 动画了 diff --git a/docs/zh/animation/clip-for-artist.md b/docs/zh/animation/clip-for-artist.md deleted file mode 100644 index ccbed3045a..0000000000 --- a/docs/zh/animation/clip-for-artist.md +++ /dev/null @@ -1,103 +0,0 @@ ---- -order: 8 -title: 美术动画切片 -type: 动画 -label: Animation ---- - -动画切片(**AnimationClip**) 为**一段时间轴上的动画组合**,可以是多个物体的旋转、位移、缩放、权重动画,如**走路、跑步、跳跃**可以分别导出 3 个动画切片;Galacean 引擎可以选择播放哪一个动画切片,前提是建模软件导出的 FBX 或者 glTF 里面包含多个动画切片。 - -为减少沟通成本,本文列举了几种常见的动画切片方法,导出 glTF 方便 Galacean 引擎直接使用,也可以通过 [glTF 预览](https://galacean.antgroup.com/engine/gltf-viewer) 页面进行功能校验。 - -Blender 的动画编辑页面非常友好,能够清晰地可视化显示受动画影响的节点,并且在时间轴上显示关键帧,因此推荐使用 Blender 进行动画切片。 - -### Blender - -1. 打开 Blender,导入 Blender 支持的模型格式,然后切换到 **动画编辑** 窗口: - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/6922d329-6cfa-473d-9fd1-312592e7c307/1622617152228-2c30967c-9203-4ad2-b239-6033cb004bc3.png) - -2. 通过上图的 “新建动画切片”按钮,可以快速的复制当前动画切片,然后进行独有的操作,如果没有显示该按钮,请确保打开了 “**动作编辑器**”: - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/53cc73a1-17b2-4a4f-ad42-9a8b059fb69c/1622617514416-e0b83cd6-439f-4003-aa23-f85ca0df04dc.png) - -举例,新建了一个名为 **animation_copy** 的动画切片,然后只保留最后 5 帧动画: - -image.png - -image.png - -image.png - -导出的切片时间轴必须一致,可以通过右下角或者输出属性两个地方进行配置: - -image.png - -image.png - -3. 因为时间轴必须一致,因此需要将刚才切的动画切片,都移到起始帧,拖拽即可: - -image.png - -image.png - -4. 至此,动画切片已经准备完成,导出 glTF 或者 FBX ,接入 Galacean 引擎即可: - -image.png - -image.png - -Unity 也可以导出动画切片,但是效率比较低。 - -### Unity - -插件:[AntG-Unity-Plugin.unitypackage.zip](https://www.yuque.com/attachments/yuque/0/2021/zip/381718/1622541632701-4f33e890-5295-4430-8798-d979b8df504f.zip?_lake_card=%7B%22src%22%3A%22https%3A%2F%2Fwww.yuque.com%2Fattachments%2Fyuque%2F0%2F2021%2Fzip%2F381718%2F1622541632701-4f33e890-5295-4430-8798-d979b8df504f.zip%22%2C%22name%22%3A%22AntG-Unity-Plugin.unitypackage.zip%22%2C%22size%22%3A490677%2C%22type%22%3A%22application%2Fzip%22%2C%22ext%22%3A%22zip%22%2C%22status%22%3A%22done%22%2C%22taskId%22%3A%22u4c98eaae-9ce5-43c7-ae94-c26f4ce0c0f%22%2C%22taskType%22%3A%22upload%22%2C%22id%22%3A%22uef3d6075%22%2C%22card%22%3A%22file%22%7D) - -1. 下载插件。 - -2. 打开 Unity 。 - -3. 双击插件, **Import** 默认框选选项: - -image.png - -若安装成功,可以看到菜单栏多出 **AntG** 选项: - -image.png - -4. 把需要切片的 FBX 文件拖拽进资源栏: - -image.png - -5. 单击该资源,出现动画调试预览框。增加动画切片,并根据需求调整每个切片的时间轴 **start**、**end**,如果预览动画效果异常,确认没有勾选 **Resample Curves** 这个默认开启选项,切片完成后,记得点击右下角的 **Apply** 确认按钮。 - -image.png - -image.png - -6. 至此,动画切片资源已经制作完毕,接下来介绍如何导出,先将该资源拖拽到节点树中: - -image.png - -7. 然后给该节点增加 **Animator** Component: - -image.png - -8. 可以看到,Animator 组件需要绑定一个 Animator Controller 资源,因此我们需要在资源栏新建一个 Animator Controller 资源: - -image.png - -9. 双击该 controller 资源,将我们之前的动画切片拖拽进去: - -image.png - -10. Animator Controller 资源制作完毕,绑定到刚才的 Component 上: - -image.png - -11. 右键该节点,选择导出 AntG: - -image.png - -12. 至此,制作的动画切片 glTF 文件导出完毕,可以访问 Galacean 的 [glTF 预览](https://galacean.antgroup.com/engine/gltf-viewer) 进行功能校验。 - diff --git a/docs/zh/animation/clip-for-artist.mdx b/docs/zh/animation/clip-for-artist.mdx new file mode 100644 index 0000000000..de0f31fbf5 --- /dev/null +++ b/docs/zh/animation/clip-for-artist.mdx @@ -0,0 +1,103 @@ +--- +order: 8 +title: 美术动画切片 +type: 动画 +label: Animation +--- + +动画切片(**AnimationClip**) 为**一段时间轴上的动画组合**,可以是多个物体的旋转、位移、缩放、权重动画,如**走路、跑步、跳跃**可以分别导出 3 个动画切片;Galacean 引擎可以选择播放哪一个动画切片,前提是建模软件导出的 FBX 或者 glTF 里面包含多个动画切片。 + +为减少沟通成本,本文列举了几种常见的动画切片方法,导出 glTF 方便 Galacean 引擎直接使用,也可以通过 [glTF 预览](https://galacean.antgroup.com/engine/gltf-viewer) 页面进行功能校验。 + +Blender 的动画编辑页面非常友好,能够清晰地可视化显示受动画影响的节点,并且在时间轴上显示关键帧,因此推荐使用 Blender 进行动画切片。 + +### Blender + +1. 打开 Blender,导入 Blender 支持的模型格式,然后切换到 **动画编辑** 窗口: + + + +2. 通过上图的 “新建动画切片”按钮,可以快速的复制当前动画切片,然后进行独有的操作,如果没有显示该按钮,请确保打开了 “**动作编辑器**”: + + + +举例,新建了一个名为 **animation_copy** 的动画切片,然后只保留最后 5 帧动画: + +image.png + +image.png + +image.png + +导出的切片时间轴必须一致,可以通过右下角或者输出属性两个地方进行配置: + +image.png + +image.png + +3. 因为时间轴必须一致,因此需要将刚才切的动画切片,都移到起始帧,拖拽即可: + +image.png + +image.png + +4. 至此,动画切片已经准备完成,导出 glTF 或者 FBX ,接入 Galacean 引擎即可: + +image.png + +image.png + +Unity 也可以导出动画切片,但是效率比较低。 + +### Unity + +插件:[AntG-Unity-Plugin.unitypackage.zip](https://www.yuque.com/attachments/yuque/0/2021/zip/381718/1622541632701-4f33e890-5295-4430-8798-d979b8df504f.zip?_lake_card=%7B%22src%22%3A%22https%3A%2F%2Fwww.yuque.com%2Fattachments%2Fyuque%2F0%2F2021%2Fzip%2F381718%2F1622541632701-4f33e890-5295-4430-8798-d979b8df504f.zip%22%2C%22name%22%3A%22AntG-Unity-Plugin.unitypackage.zip%22%2C%22size%22%3A490677%2C%22type%22%3A%22application%2Fzip%22%2C%22ext%22%3A%22zip%22%2C%22status%22%3A%22done%22%2C%22taskId%22%3A%22u4c98eaae-9ce5-43c7-ae94-c26f4ce0c0f%22%2C%22taskType%22%3A%22upload%22%2C%22id%22%3A%22uef3d6075%22%2C%22card%22%3A%22file%22%7D) + +1. 下载插件。 + +2. 打开 Unity 。 + +3. 双击插件, **Import** 默认框选选项: + +image.png + +若安装成功,可以看到菜单栏多出 **AntG** 选项: + +image.png + +4. 把需要切片的 FBX 文件拖拽进资源栏: + +image.png + +5. 单击该资源,出现动画调试预览框。增加动画切片,并根据需求调整每个切片的时间轴 **start**、**end**,如果预览动画效果异常,确认没有勾选 **Resample Curves** 这个默认开启选项,切片完成后,记得点击右下角的 **Apply** 确认按钮。 + +image.png + +image.png + +6. 至此,动画切片资源已经制作完毕,接下来介绍如何导出,先将该资源拖拽到节点树中: + +image.png + +7. 然后给该节点增加 **Animator** Component: + +image.png + +8. 可以看到,Animator 组件需要绑定一个 Animator Controller 资源,因此我们需要在资源栏新建一个 Animator Controller 资源: + +image.png + +9. 双击该 controller 资源,将我们之前的动画切片拖拽进去: + +image.png + +10. Animator Controller 资源制作完毕,绑定到刚才的 Component 上: + +image.png + +11. 右键该节点,选择导出 AntG: + +image.png + +12. 至此,制作的动画切片 glTF 文件导出完毕,可以访问 Galacean 的 [glTF 预览](https://galacean.antgroup.com/engine/gltf-viewer) 进行功能校验。 + diff --git a/docs/zh/animation/clip.mdx b/docs/zh/animation/clip.mdx index 50d7b3bb3a..43db9704c7 100644 --- a/docs/zh/animation/clip.mdx +++ b/docs/zh/animation/clip.mdx @@ -11,7 +11,7 @@ label: Animation 1. 导入用第三方工具(例如 Autodesk® 3ds Max®, Autodesk® Maya®, Blender)创建的带动画的模型,详见[美术制作动画片段](/docs/animation/clip-for-artist) -![1](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*Qc8sQ6iJd8IAAAAAAAAAAAAADsJ_AQ/original) + 2. 在 Galacean 中创建 `动画片段`(下文会介绍编辑器和脚本这两种创建方式) @@ -19,7 +19,7 @@ label: Animation 动画片段编辑器目前支持除物理相关组件的所有可插值属性的编辑,如果你需要编辑其他属性,要在实体上添加对应的组件。 -![image-25](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*NRHNTIhBA18AAAAAAAAAAAAADsJ_AQ/original) + | 序号 | 说明 | 备注 | | ---- | -------------------------| ------- | @@ -42,39 +42,39 @@ label: Animation 1. 在 **[资产面板](/docs/assets/interface)** 中 右键或者点击 `+` 创建 `动画片段` 资产 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*j4FMRKx91nEAAAAAAAAAAAAADsJ_AQ/original) + 2. 双击 `动画片段` 资产,并选择一个实体作为 `动画片段` 的编辑对象 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*_E1kRqt8LroAAAAAAAAAAAAADsJ_AQ/original) + 点击 `创建` 按钮编辑器会自动为你的 `实体` 添加 `动画控制组件`([详细介绍](/docs/animation/animator))并将该 `动画片段` 添加到 `动画控制器` 中 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*q46SRrV6WfsAAAAAAAAAAAAADsJ_AQ/original) -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*C2a4SZDGG_4AAAAAAAAAAAAADsJ_AQ/original) + + 3. 添加要做动画的属性(这里我添加了两个) -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*69xIS7ABJJkAAAAAAAAAAAAADsJ_AQ/original) -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*-4bnQI-LcLsAAAAAAAAAAAAADsJ_AQ/original) + + 4. 给属性添加关键帧 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*QnQwR6tLRYMAAAAAAAAAAAAADsJ_AQ/original) + 当我们点击添加关键帧按钮时,关键帧会存入当前指定属性的值,所以当我们什么都未改变时,关键帧存入的是此刻这个实体的 `position` 值。我们希望他 60 帧后移动到 (3, 0, 0)的位置,所以先将这个正方体通过属性面板修改到(3, 0, 0) 再添加关键帧 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*ClTgSriu4-8AAAAAAAAAAAAADsJ_AQ/original) + 同理我们也为 `rotation` 属性添加关键帧 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*hOkoRKlNfeYAAAAAAAAAAAAADsJ_AQ/original) + ### 录制模式 我们提供了录制模式以方便开发者快速的添加关键帧。开启录制模式,当对应的属性修改时就会自动添加关键帧 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*sFwtSLOlyhoAAAAAAAAAAAAADsJ_AQ/original) + ### 操作关键帧 @@ -83,23 +83,23 @@ label: Animation 选中关键帧并拖动即可 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*_vZSR4YEDqMAAAAAAAAAAAAADsJ_AQ/original) + 可以滑动 `鼠标滚轮` 缩放时间轴 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*BTgPS45hkNYAAAAAAAAAAAAADsJ_AQ/original) + #### 修改关键帧的值 开启录制模式,把时间线移动到指定关键帧上,然后重新输入值即可, 在不开启录制模式的情况,需要重新点击添加关键帧按钮。 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*MiSXQZ4q7DMAAAAAAAAAAAAADsJ_AQ/original) + #### 删除关键帧 选中关键帧右键选择删除,也可以按键盘上的删除键/退格键删除 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*MpPMRK2WaEMAAAAAAAAAAAAADsJ_AQ/original) + ### 编辑子实体 @@ -107,43 +107,43 @@ label: Animation 1. 我们为刚才的立方体添加一个子`实体` -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*6RYIQpG7DPwAAAAAAAAAAAAADsJ_AQ/original) + 2. 我们再点击添加属性就可以看到子`实体`的属性可以添加了 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*j7rfRq0REKIAAAAAAAAAAAAADsJ_AQ/original) + 3. 开启录制模式,编辑子`实体`添加关键帧即可 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*j7rfRq0REKIAAAAAAAAAAAAADsJ_AQ/original) + ### 编辑动画曲线 `动画片段编辑器` 支持动画曲线编辑,点击右上角的曲线Icon即可切换 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*luV0QaDUAQAAAAAAAAAAAAAADsJ_AQ/original) + 曲线模式的纵轴为属性的数值 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*luV0QaDUAQAAAAAAAAAAAAAADsJ_AQ/original) + 你可以按 `shift+鼠标滚轮` 调整纵轴的比例 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*SjO2TaubiuIAAAAAAAAAAAAADsJ_AQ/original) + 属性对应曲线的颜色与按钮的颜色相同 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*OS3uSbdB36AAAAAAAAAAAAAADsJ_AQ/original) + 选择关键帧会出现两个控制点,调整控制点即可调整曲线 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*kikYQoiYMLoAAAAAAAAAAAAADsJ_AQ/original) + 也可以通过右键关键帧直接设置内置的预设值 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*KRzoT5Pocc4AAAAAAAAAAAAADsJ_AQ/original) + 选择属性面板的属性可以仅编辑指定属性的曲线 diff --git a/docs/zh/animation/examples/blending.mdx b/docs/zh/animation/examples/blending.mdx index 8aeea995b1..d34d3fda26 100644 --- a/docs/zh/animation/examples/blending.mdx +++ b/docs/zh/animation/examples/blending.mdx @@ -22,9 +22,9 @@ label: Animation/Examples 2. 我们要有一个已编辑好的 `动画控制器` 。请参考:[编辑动画控制器](/docs/animation/examples/crossFade/#3-编辑动画控制器)。 -![image-1](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*dsGnQ4JIC7MAAAAAAAAAAAAADsJ_AQ/original) + -![image](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*1x7zS7WqTasAAAAAAAAAAAAADsJ_AQ/original) + ## 1. 添加一个动画层 @@ -33,28 +33,28 @@ label: Animation/Examples 在 `Layers` 面板点击 `+` 添加一个 `动画层` -![2024-11-08 16.31.39.gif](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*GWQ4Tr2rhY4AAAAAAAAAAAAADsJ_AQ/original) + ## 2. 编辑动画层 添加一个 `动画状态`(如果你不知道如何添加,请参考:[播放模型中的动画](/docs/animation/examples/playAnimation/)),绑定模型中的 **"shakeHead"** `动画片段`,并从 `entry` 连接到这个 `动画状态`,可以根据需要调整 `entry` 到这个 `动画状态`的过渡时间。 -![2024-11-08 16.44.11.gif](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*sdC9TbG6-VgAAAAAAAAAAAAADsJ_AQ/original) + 编辑之后为模型绑定此 `动画控制器` 。 -![image](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*mUWWRqdmjAAAAAAAAAAAAAAADsJ_AQ/original) + ## 3. 调整动画层权重 新添加的 `动画层` 的默认混合模式是 `Override`,我们先预览下效果。 -![2024-11-08 16.53.23.gif](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*37UZRpesQywAAAAAAAAAAAAADsJ_AQ/original) + 可以看到我们之前在 `Base` 动画层添加的 `动画状态` 都失效了,因为混合模式是 `Override`,它会覆盖掉它下面的所有 `动画层` ,我们可以调整 `Layer1` 的权重看看权重对其的影响。 -![2024-11-08 17.02.30.gif](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*fI18TKITqSUAAAAAAAAAAAAADsJ_AQ/original) + 可以看到随着权重减少 `Layer1` 对动画的影响越小,而 `Base` 对动画的影响越大。 @@ -62,10 +62,10 @@ label: Animation/Examples 在本示例中,我们不希望 `Layer1` 的权重影响到 `Base` 动画层,因此我们将 `Layer1` 的混合模式修改为 `Additive`。 -![image-2](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*Tt8sQKnTDq4AAAAAAAAAAAAADsJ_AQ/original) + 这样 `Layer1` 的动画会叠加到 `Base` 动画层上,它的权重修改只影响自身,而不会影响 `Base` 层的动画。 为了更好的观察 `Additve` 的效果,我们删掉 `Base` 层 `run` 到 `exit` 的过渡。 -![2024-11-08 17.20.12.gif](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*oZY8RaivVWMAAAAAAAAAAAAADsJ_AQ/original) + diff --git a/docs/zh/animation/examples/controlAnimationByInput.mdx b/docs/zh/animation/examples/controlAnimationByInput.mdx index b9a24e95ff..2cafbf621d 100644 --- a/docs/zh/animation/examples/controlAnimationByInput.mdx +++ b/docs/zh/animation/examples/controlAnimationByInput.mdx @@ -21,9 +21,9 @@ label: Animation/Examples 2. 我们要有一个已编辑好动画过渡的 `动画控制器` 。请参考:[编辑动画控制器](/docs/animation/examples/crossFade/#3-编辑动画控制器)。 -![image-0](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*WUbLQbY8qiAAAAAAAAAAAAAADsJ_AQ/original) + -![image](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*1x7zS7WqTasAAAAAAAAAAAAADsJ_AQ/original) + ## 1. 添加动画控制参数 @@ -31,11 +31,11 @@ label: Animation/Examples 1. 切换到 `Parameters` 面板 -![image-5](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*rzRbRoI8_zEAAAAAAAAAAAAADsJ_AQ/original) + 2. 点击 `+` 添加一个浮点参数 `speed`,并将默认值设置为 0。 -![image-4](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*o6IhT6KdSZoAAAAAAAAAAAAADsJ_AQ/original) + ## 2. 添加过渡条件 @@ -43,17 +43,17 @@ label: Animation/Examples 1. 在 `动画状态机` 中,选中从 `idle` 到 `walk` 的过渡,点击 `Add Condition` 添加一个 `Condition`。 -![2024-11-08 10.53.40.gif](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*Z-P8SqQynhMAAAAAAAAAAAAADsJ_AQ/original) + `Condition` 的默认值刚好符合我们的需求,当 `speed` 大于 0 时,就会从 `idle` 过渡到 `walk`。 2. 同样的,选中从 `walk` 到 `run` 的过渡,添加一个 `Condition`,使其 `speed` 大于 5 时,从 `walk` 过渡到 `run`。 -![2024-11-08 10.58.50.gif](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*an4WR66LO9kAAAAAAAAAAAAADsJ_AQ/original) + 3. 选中 `run` 到 `exit` 的过渡,添加一个 `Condition` ,使其 `speed` 为 0 时,从 `run` 退出动画,重新回到 `idle`。 -![2024-11-08 11.03.43.gif](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*YjqXSb1EDaIAAAAAAAAAAAAADsJ_AQ/original) + ### 3. 添加脚本 我们需要一个脚本来接收用户输入,并根据用户输入来修改 `speed` 参数的值,以触发动画状态的切换。 @@ -61,11 +61,11 @@ label: Animation/Examples 1. 右键点击 **[资产面板](/docs/assets/interface)** 中的空白处,选择 `Create` -> `New Empty Script` -![image-3](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*vcaYR6cXhyAAAAAAAAAAAAAADsJ_AQ/original) + 2. 点击添加资产按钮 `+`,选择 `New Empty Script` -![image-2](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*ukTPS6vXR54AAAAAAAAAAAAADsJ_AQ/original) + ### 4. 编辑并绑定脚本 1. 双击脚本,打开脚本编辑器,输入以下代码: @@ -105,32 +105,32 @@ export default class extends Script { 2. 找到 `Animator` 组件所在的实体,为其添加刚刚创建的脚本。 -![image-6](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*MOlaTKEGBYEAAAAAAAAAAAAADsJ_AQ/original) + ### 5. 预览动画 与之前的教程不同,因为本次我们为实体添加了脚本,仅点击预览动画按钮,脚本代码是不会生效的,我们需要点击项目预览(项目预览才会编译脚本文件)按钮来预览动画。 -![image-7](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*lAeHQITR98QAAAAAAAAAAAAADsJ_AQ/original) + 当角色处于 `idle` 状态时,按下 `W` 键,角色会从 `idle` 过渡到 `walk`,按住 `Shift` 键,角色会从 `walk` 过渡到 `run`,松开 `W` 键,角色会从 `run` 退出动画,重新回到 `idle`。 -![2024-11-08 15.43.37.gif](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*RQLbRZPlfUEAAAAAAAAAAAAADsJ_AQ/original) + ### 6. 优化动画 我们预览时会发现,如果我们在 `walk` 状态时松开 `W` 键,角色并不会切换到 `idle` 状态,而是继续播放 `walk` 动画。这是因为我们并没有从 `walk` 到 `idle` 的过渡。 而且从 `run` 到 `idle` 也没有过渡效果。因为我们是通过重新进入 `entry` 切换到 `idle` 的,而 `entry` 到 `idle` 的过渡的 `Duration` 是 0。想要从 `run` 过渡到 `idle` ,我们可以将 `run` 连接到 `idle`。 同理想要从 `run` 过渡到 `walk` 也需要添加过渡。 -![2024-11-08 14.26.00.gif](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*M-JsSawhoXUAAAAAAAAAAAAADsJ_AQ/original) + 再次预览,我们发现 `walk` 到 `idle` 和 `run` 到 `walk` 的过渡效果已经生效了。 -![2024-11-08 14.34.27.gif](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*b3b1QrhhzqkAAAAAAAAAAAAADsJ_AQ/original) + 但是从 `run` 到 `idle` 的过渡效果并没有生效,而是先到 `walk` 再由 `walk` 到 `idle`,这是因为当 `speed` 参数为 0 时,`run` 到 `walk ` 和 `run` 到 `idle` 的 `Condition` 都满足。 为了避免这种情况,我们可以给 `run` 到 `walk` 再添加一个 `Condition` 并将其设置为 `speed` 大于 0。 -![2024-11-08 14.38.41.gif](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*uqwGQb4AHeUAAAAAAAAAAAAADsJ_AQ/original) + 这样当我们同时松开 `W` 键和 `Shift` 键时,角色就会从 `run` 直接过渡到 `idle` 了。 diff --git a/docs/zh/animation/examples/crossFade.mdx b/docs/zh/animation/examples/crossFade.mdx index 574bebaabb..f8737dc1d8 100644 --- a/docs/zh/animation/examples/crossFade.mdx +++ b/docs/zh/animation/examples/crossFade.mdx @@ -27,11 +27,11 @@ label: Animation/Examples ## 1. 查看模型 点击模型资产上的展开按钮 -![image](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*uMXwRZDzOwkAAAAAAAAAAAAADsJ_AQ/original) + 可以看到模型中包含了三个 [动画片段](/docs/animation/clip) 资产, 以及一个 [动画控制器](/docs/animation/animatorController/) 资产 -![image-1](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*kyhMRYgmJJwAAAAAAAAAAAAADsJ_AQ/original) + ## 2. 创建动画控制资产 @@ -42,22 +42,22 @@ label: Animation/Examples 1. 打开动画控制器编辑器,添加三个 `动画状态` ,分别绑定模型中的三个 `动画片段` -![image-2](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*YQ8-S5XcK-wAAAAAAAAAAAAADsJ_AQ/original) + 如果你不知道如何创建 `动画状态` 并绑定 `动画片段` ,请参考:[编辑动画控制器](/docs/animation/examples/playAnimation/#3-编辑动画控制器) 2. 创建 `动画过渡`(关于动画过渡的详细介绍请参考 [动画状态机](/docs/animation/state-machine/#动画过渡) 文档的动画过渡部分):将 `idle` 动画连接到 `entry`,并点击连线将 `Duration` 改为 0,这样在这个动画控制器被应用时,角色就会播放 `idle` 动画。 -![2024-11-07 16.04.32](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*xONyQ76QzkMAAAAAAAAAAAAADsJ_AQ/original) + 3. 以同样的方式将 `idle` 连接到 `walk`,将 `walk` 连接到 `run`, 将 `run` 连接到 `exit`, 这样角色就会在播完 `idle` 动画后,自动过渡到 `walk` 动画,再过渡到 `run` 动画,最后到 `exit` 退出,重新进入 `entry`,来循环播放这段动画。 -![2024-11-07 16.11.51](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*LSECTqsXywUAAAAAAAAAAAAADsJ_AQ/original) + ## 4. 使用动画控制器并预览 绑定 `动画控制器`(如果你不知道如何绑定 `动画控制器` ,请参考:[使用动画控制器](/docs/animation/examples/playAnimation/#4-使用动画控制器)文档)之后点击播放按钮,可以看到模型从 `idle` 过渡到 `walk`,再过渡到 `run`,最后退出,重新回到 `idle` 状态。 -![2024-11-07 16.16.07](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*flHoR7W2aiwAAAAAAAAAAAAADsJ_AQ/original) + 实际项目中,将 `run` 连接到 `idle` 可能是更好的选择,这样角色在播完 `run` 动画后,会过渡到 `idle` 动画,而不是直接重新播放,本示例仅是为了演示 `exit` 的效果。 diff --git a/docs/zh/animation/examples/material-animation.mdx b/docs/zh/animation/examples/material-animation.mdx index caf5a2a2f0..aa32bf38bf 100644 --- a/docs/zh/animation/examples/material-animation.mdx +++ b/docs/zh/animation/examples/material-animation.mdx @@ -16,44 +16,44 @@ label: Animation/Examples ## 0. 准备工作 在开始之前,我们需要在 `实体` 上添加一个 `网格渲染器` 组件,刚创建的项目中默认会有一个立方体,它已经包含了 `网格渲染器` 组件。 -![1.jpg](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*pN-yRK0i-OIAAAAAAAAAAAAADsJ_AQ/original) + 除此以外,因为默认的 `材质` 是只读的,所以需要我们还需要创建一个 `材质`。 创建 `材质` 有两种方式: 1. 右键点击 **[资产面板](/docs/assets/interface)** 中的空白处,选择 `Create` -> `Material` -![2.jpg](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*1ox2RKV31u4AAAAAAAAAAAAADsJ_AQ/original) + 2. 点击添加资产按钮 `+`,选择 `Material` -![3.jpg](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*zt3PRb2LsagAAAAAAAAAAAAADsJ_AQ/original) + 将 `网格渲染器` 的 `材质` 属性替换为刚刚创建的 `材质`。 -![4.jpg](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*vISSRpxf6PUAAAAAAAAAAAAADsJ_AQ/original) + ## 1. 创建动画片段 添加好组件后, 我们需要创建一个 `动画片段`(关于动画片段的介绍,请参考 [动画片段](/docs/animation/clip) 文档)创建 `动画片段` 有两种方式: 1. 右键点击 **[资产面板](/docs/assets/interface)** 中的空白处,选择 `Create` -> `Animation Clip` -![1.jpg](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*XK28Qr2GX6UAAAAAAAAAAAAADsJ_AQ/original) + 2. 点击添加资产按钮 `+`,选择 `Animation Clip` -![2.jpg](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*Dws0TriVVakAAAAAAAAAAAAADsJ_AQ/original) + ## 2. 打开动画片段编辑器 1. 双击刚刚创建的 `动画片段` 资产 -![3.jpg](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*w4ReS7ijXgcAAAAAAAAAAAAADsJ_AQ/original) + 2. 选择 `实体`,根据提示,我们需要在 **[层级面板](/docs/interface/hierarchy)** 选择一个 `实体` 作为编辑动画的目标。 选择编辑器默认创建的 `实体`(你也可以点击层级面板的 `+` 按钮创建一个新的) -![image-15](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*zRAgTYOTU70AAAAAAAAAAAAADsJ_AQ/original) + 3. 点击动画片段编辑器的 `Create` 按钮,编辑器会为你做好一些准备工作,本示例你可以先忽略对这些概念的理解。 @@ -66,18 +66,18 @@ label: Animation/Examples 创建完成之后,你会打开动画片段编辑器,如图所示: -![image-17](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*dWJDSbxaYCYAAAAAAAAAAAAADsJ_AQ/original) + ## 3. 编辑动画片段 1. 开启 `动画片段` 编辑器的录制模式 -![image-22](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*S4jNRZ-Ia7AAAAAAAAAAAAAADsJ_AQ/original) + 2. 将时间线调到 `0:00`, 然后将 `网格渲染器` 组件的 `材质` 的颜色属性设置为红色,在录制模式下,编辑器会自动添加对应的属性及关键帧。 -![2024-11-20 17.56.29.gif](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*N6WqR4SRxCgAAAAAAAAAAAAADsJ_AQ/original) + 3. 分别在 `0:20`,`0:40` 处,将 `网格渲染器` 组件的 `材质` 的颜色属性设置为绿色, 蓝色。在 `1:00` 处,再设置回红色。 首尾的关键帧相同,动画就可以自然的循环播放了,点击播放按钮,可以预览这个 `动画片段`。 diff --git a/docs/zh/animation/examples/playAnimation.mdx b/docs/zh/animation/examples/playAnimation.mdx index 7cf435f2e1..2bd2507e56 100644 --- a/docs/zh/animation/examples/playAnimation.mdx +++ b/docs/zh/animation/examples/playAnimation.mdx @@ -16,15 +16,15 @@ label: Animation/Examples 1. 在 [mixamo](https://www.mixamo.com/#/?page=1&query=&type=Character) 中选择一个模型 -![image](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*UF2BTbu598EAAAAAAAAAAAAADsJ_AQ/original) + 2. 在 [动画Tab](https://www.mixamo.com/#/?page=1&query=&type=Motion%2CMotionPack) 中选择一个动画 -![image1](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*P_e2Q4D9AN4AAAAAAAAAAAAADsJ_AQ/original) + 3. 下载模型 -![image2](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*wpW8TI138SMAAAAAAAAAAAAADsJ_AQ/original) + 在实际项目中强烈建议将FBX模型通过Blender等第三方工具转换为GLB/GLTF格式。Galacean目前仅支持解析GLB/GLTF模型。虽然可以直接将FBX拖入编辑器进行自动转换,但这种方式可能会导致转换后的模型动画数据过大,并可能出现还原问题。使用专业工具进行转换可以更好地控制转换质量和文件大小。 @@ -34,30 +34,30 @@ label: Animation/Examples 有三种方式导入模型: 1. 将模型文件拖入编辑器的 **[资产面板](/docs/assets/interface)** 中 -![image3](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*EZ5ZRqABz4sAAAAAAAAAAAAADsJ_AQ/original) + 2. 右键点击 **[资产面板](/docs/assets/interface)** 中的空白处,选择 `Upload` -> `Model` -![image4](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*ggJdTrF7xP0AAAAAAAAAAAAADsJ_AQ/original) + 3. 点击上传按钮,选择 `Model` -![image5](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*e5X6Tbeygi8AAAAAAAAAAAAADsJ_AQ/original) + ## 1. 查看模型 点击模型资产上的展开按钮 -![image6](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*NBuoSbwLWeEAAAAAAAAAAAAADsJ_AQ/original) + 可以看到模型中包含了一个 `动画片段`([详细介绍](/docs/animation/clip))资产(如果模型中包含多个动画,这里会有多个 `动画片段` 资产) -![image7](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*_k9iSJJckgAAAAAAAAAAAAAADsJ_AQ/original) + 以及一个 `动画控制器`([详细介绍](/docs/animation/animatorController/))资产 -![image8](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*KCiLQbzUTp8AAAAAAAAAAAAADsJ_AQ/original) + ## 2. 创建动画控制资产 @@ -66,47 +66,47 @@ label: Animation/Examples 创建 `动画控制器` 有两种方式: 1. 右键点击 **[资产面板](/docs/assets/interface)** 中的空白处,选择 `Create` -> `Animation Controller` -![image9](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*61Q7S62IZxQAAAAAAAAAAAAADsJ_AQ/original) + 2. 点击添加资产按钮 `+`,选择 `Animation Controller` -![image10](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*QqpxS6I9D90AAAAAAAAAAAAADsJ_AQ/original) + ## 3. 编辑动画控制器 1. 双击 [动画控制器](/docs/animation/animatorController/) 资产,进入动画控制器编辑器(编辑器的各个功能介绍请参考 [动画控制器编辑器](/docs/animation/animatorController/) 文档) -![image11](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*v8aUR4McTA4AAAAAAAAAAAAADsJ_AQ/original) + 2. 点击添加动画状态按钮,添加一个动画状态 -![image12](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*G1moSpo20KcAAAAAAAAAAAAADsJ_AQ/original) + 3. 点击动画状态(动画状态的属性介绍请参考 [动画状态机](/docs/animation/state-machine/#动画状态) 文档的动画状态部分),绑定动画片段。 -![image13](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*GUdQQqCHE7cAAAAAAAAAAAAADsJ_AQ/original) + 4. 从 `entry` 连接到此 `动画状态` 并点击连线,并将 `Duration` 改为0(动画过渡的详细介绍请参考 [动画状态机](/docs/animation/state-machine/) 文档),这样在这个动画控制器被应用时,就会立即自动播放此动画状态。 -![1.gif](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*wgBgQor0c5wAAAAAAAAAAAAADsJ_AQ/original) + ## 4. 使用动画控制器并预览 1. 将模型拖入到场景中 -![2.gif](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*SMLQQLhOv-0AAAAAAAAAAAAADsJ_AQ/original) + 2. 找到`动画控制组件` ([详细介绍](/docs/animation/animator/) , 组件一般在模型实例的根 `实体` 上,也就是编辑器的模型 `实体` 下的第一个子 `实体` 上。 -![image14](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*IAAySr0iYkoAAAAAAAAAAAAADsJ_AQ/original) + 3. 在动画控制器属性上替换为刚才创建的`动画控制器` -![image15](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*yusHT5fj3r0AAAAAAAAAAAAADsJ_AQ/original) + 4. 点击播放按钮,就可以看到模型开始播放动画了 -![3.gif](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*EeXDQp4PVRkAAAAAAAAAAAAADsJ_AQ/original) + diff --git a/docs/zh/animation/examples/reuseAnimation.mdx b/docs/zh/animation/examples/reuseAnimation.mdx index 9b92aceb9c..86c2d7e701 100644 --- a/docs/zh/animation/examples/reuseAnimation.mdx +++ b/docs/zh/animation/examples/reuseAnimation.mdx @@ -19,17 +19,17 @@ label: Animation/Examples 1. 在 [mixamo](https://www.mixamo.com/#/?page=1&query=&type=Character) 中选择一个模型 -![image](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*UF2BTbu598EAAAAAAAAAAAAADsJ_AQ/original) + 直接点击下载 -![image-2](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*m9xuR4QewBEAAAAAAAAAAAAADsJ_AQ/original) + 2. 在 [动画Tab](https://www.mixamo.com/#/?page=1&query=&type=Motion%2CMotionPack) 中选择一个动画 -![image1](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*P_e2Q4D9AN4AAAAAAAAAAAAADsJ_AQ/original) + 选择 `Without Skin` 选项,然后点击下载 -![image-1](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*ktbtQrG9rNEAAAAAAAAAAAAADsJ_AQ/original) + 在实际项目中强烈建议将FBX模型通过Blender等第三方工具转换为GLB/GLTF格式。Galacean目前仅支持解析GLB/GLTF模型。虽然可以直接将FBX拖入编辑器进行自动转换,但这种方式可能会导致转换后的模型动画数据过大,并可能出现还原问题。使用专业工具进行转换可以更好地控制转换质量和文件大小。 @@ -39,7 +39,7 @@ label: Animation/Examples 如果你不知道如何导入模型,请参考:[导入模型](/docs/animation/examples/playAnimation/#导入模型) 将角色模型和动画模型导入到编辑器中。 -![image](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*xApDR4D-Ed0AAAAAAAAAAAAADsJ_AQ/original) + ## 1. 创建动画控制资产 @@ -50,41 +50,41 @@ label: Animation/Examples 1. 双击 [动画控制器](/docs/animation/animatorController/) 资产,进入动画控制器编辑器(编辑器的各个功能介绍请参考 [动画控制器编辑器](/docs/animation/animatorController/) 文档) -![image11](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*v8aUR4McTA4AAAAAAAAAAAAADsJ_AQ/original) + 2. 点击 `添加动画状态` 按钮,添加一个 `动画状态` -![image12](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*G1moSpo20KcAAAAAAAAAAAAADsJ_AQ/original) + 3. 点击 `动画状态`(动画状态的属性介绍请参考 [动画状态](/docs/animation/animatorState/) 文档),绑定动画模型中的 `动画片段` 。 -![image-3](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*72LhQ5gOBmgAAAAAAAAAAAAADsJ_AQ/original) + 4. 从 `entry` 连接到此 `动画状态` 并点击连线将 `Duration` 改为 0(动画状态及动画过渡的详细介绍请参考 [动画状态机](/docs/animation/state-machine/) 文档),这样在这个动画控制器被应用时,就会立即自动播放此 `动画状态` 。 -![1.gif](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*wgBgQor0c5wAAAAAAAAAAAAADsJ_AQ/original) -![2024-11-07 11.16.15.gif](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*NgW5QZ4vaFEAAAAAAAAAAAAADsJ_AQ/original) + + ## 3. 使用动画控制器并预览 1. 将模型拖入到场景中 -![2024-11-07 11.30.01.gif](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*uEGPTZfKEZwAAAAAAAAAAAAADsJ_AQ/original) + 2. 与直接播放模型中的动画不同,我们需要找到动画模型的 `动画控制组件`([详细介绍](/docs/animation/animator/))位置, 组件一般在模型实例的根实体上,也就是编辑器的模型实体下的第一个子实体上,因此我们需要将包含动画的模型也拖到节点树中 -![image-6](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*kjmDSZeyq4QAAAAAAAAAAAAADsJ_AQ/original) + 我们发现 `动画控制组件` 在动画模型的 `mixamorig:Hips` 实体上,因此我们需要在角色模型的`mixamorig:Hips`实体上添加 `动画控制组件` -![image-7](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*HCzWTrsp1isAAAAAAAAAAAAADsJ_AQ/original) + 3. 将动画控制器设置为刚才创建的` 动画控制器` -![image-8](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*dFGgRqk0tvgAAAAAAAAAAAAADsJ_AQ/original) + 4. 点击播放按钮,就可以看到模型开始播放动画了 -![3.gif](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*EeXDQp4PVRkAAAAAAAAAAAAADsJ_AQ/original) + diff --git a/docs/zh/animation/examples/sprite-sheet.mdx b/docs/zh/animation/examples/sprite-sheet.mdx index 9d583df8e6..6f8b009fa7 100644 --- a/docs/zh/animation/examples/sprite-sheet.mdx +++ b/docs/zh/animation/examples/sprite-sheet.mdx @@ -20,15 +20,15 @@ label: Animation/Examples 有三种方式导入 `纹理` : 1. 将图片拖入编辑器的 **[资产面板](/docs/assets/interface)** 中 -![image](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*U0uYR4_jFpAAAAAAAAAAAAAADsJ_AQ/original) + 2. 右键点击 **[资产面板](/docs/assets/interface)** 中的空白处,选择 `Upload` -> `Texture2D` -![image1](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*t_1vQ4RIz_AAAAAAAAAAAAAADsJ_AQ/original) + 3. 点击上传按钮,选择 `Texture2D` -![image2](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*yr_xSL2Q7qkAAAAAAAAAAAAADsJ_AQ/original) + ## 2. 创建精灵 关于 `精灵` 的详细介绍请参考 [精灵](/docs/graphics/2D/sprite) 文档 @@ -36,21 +36,21 @@ label: Animation/Examples 创建 `精灵` 有三种方式: 1. 右键点击 **[资产面板](/docs/assets/interface)** 中的空白处,选择 `Create` -> `Sprite` -![image3](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*oTfKT4VB5Y8AAAAAAAAAAAAADsJ_AQ/original) + 2. 点击添加资产按钮 `+`,选择 `Sprite` -![image4](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*f-JyT63i3tcAAAAAAAAAAAAADsJ_AQ/original) + 3. 如果你是单帧图片,可以右键点击 **[资产面板](/docs/assets/interface)** 中的空白处,选择 `Upload` -> `Sprite`,然后选择你的单帧图片。 这种方式,在导入 `纹理` 的同时会自动创建一个 `精灵` 资产并绑定此图片作为其 `纹理` 。 -![image5](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*1S9rTIEEL0IAAAAAAAAAAAAADsJ_AQ/original) + 创建三个 `精灵` 资产,分别对应雪碧图中的三帧。 -![image6](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*Nd7CT7mgWm8AAAAAAAAAAAAADsJ_AQ/original) + ## 3. 为精灵绑定纹理 @@ -58,48 +58,48 @@ label: Animation/Examples 1. 点击 `精灵` 资产,点击 `纹理` 属性,选择对应的纹理。 -![image7](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*XmbZRZsFutQAAAAAAAAAAAAADsJ_AQ/original) + 2. 根据帧数,配置合适的 `Region`,本示例共有三帧,并且只有一排, 所以每帧的 `Region` 的 `W` 为 1/3 (对应的纹理 `width` 也改为原来的1/3) `H` 为 1。 -![image8](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*Yu3oRr7qbrUAAAAAAAAAAAAADsJ_AQ/original) + 3. 修改另外两个 `精灵` 的 `Region`,与第一个 `精灵` 的 `Region` 不同的是,它们的 `Region` 的 `X` 值不同,分别为 0, 1/3, 2/3。 `Sprite1` : -![image9](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*XuJNTqF1e-IAAAAAAAAAAAAADsJ_AQ/original) + `Sprite2` : -![image10](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*AhPpTrX9d78AAAAAAAAAAAAADsJ_AQ/original) + 全部绑定好纹理后,`精灵` 资产会展示对应的图片,如图所示: -![image-11](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*Mf9-T79bofkAAAAAAAAAAAAADsJ_AQ/original) + ## 4. 创建动画片段 准备好 `精灵` 后, 我们需要创建一个 `动画片段`(关于动画片段的介绍,请参考 [动画片段](/docs/animation/clip) 文档)创建 `动画片段` 有两种方式: 1. 右键点击 **[资产面板](/docs/assets/interface)** 中的空白处,选择 `Create` -> `Animation Clip` -![image-12](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*OKfsTatDPfsAAAAAAAAAAAAADsJ_AQ/original) + 2. 点击添加资产按钮 `+`,选择 `Animation Clip` -![image-13](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*BhZVSaZgC9kAAAAAAAAAAAAADsJ_AQ/original) + ## 5. 打开动画片段编辑器 1. 双击刚刚创建的 `动画片段` 资产 -![image-14](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*521gRYB-O0IAAAAAAAAAAAAADsJ_AQ/original) + 2. 选择 `实体`,根据提示,我们需要在 **[层级面板](/docs/interface/hierarchy)** 选择一个 `实体` 作为编辑动画的目标。 选择编辑器默认创建的 `实体`(你也可以点击层级面板的 `+` 按钮创建一个新的) -![image-15](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*zRAgTYOTU70AAAAAAAAAAAAADsJ_AQ/original) + 3. 点击动画片段编辑器的 `Create` 按钮,编辑器会为你做好一些准备工作,本示例你可以先忽略对这些概念的理解。 @@ -112,40 +112,40 @@ label: Animation/Examples 创建完成之后,你会打开动画片段编辑器,如图所示: -![image-17](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*dWJDSbxaYCYAAAAAAAAAAAAADsJ_AQ/original) + ## 6. 设置实体并切换到2D视图 1. 删掉默认的 `网格渲染器` 组件(如果你是自己创建的, 忽略)。为选择的 `实体` 添加一个 `精灵渲染器` 组件, -![image-18](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*MsS8SZ1eNdQAAAAAAAAAAAAADsJ_AQ/original) + -![image-19](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*b-M1TbX4e18AAAAAAAAAAAAADsJ_AQ/original) + 2. 为 `精灵渲染器` 组件的 `精灵` 属性绑定一个我们刚刚创建的 `精灵` 资产, 作为默认的 `精灵`。 -![image-20](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*PkbjSYreGcYAAAAAAAAAAAAADsJ_AQ/original) + 3. 将 `实体` 默认的旋转重制,并切换到 `2D` 视图 -![image-21](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*rNXqRLdzDKEAAAAAAAAAAAAADsJ_AQ/original) + ## 7. 编辑动画片段 1. 开启 `动画片段` 编辑器的录制模式 -![image-22](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*S4jNRZ-Ia7AAAAAAAAAAAAAADsJ_AQ/original) + 2. 将时间线调到 `0:00`, 然后将 `精灵渲染器` 组件的 `精灵` 属性切换到第一帧的 `精灵` 资产。因为我们的第一帧与 `精灵渲染器` 组件的默认 `精灵` 相同,所以仍然选择此 `精灵`。 在录制模式下,编辑器会自动添加对应的属性及关键帧。 -![image-23](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*wFl9RphUx1gAAAAAAAAAAAAADsJ_AQ/original) + 3. 分别在 `0:20`, `0:40` 处,将 `精灵渲染器` 组件的 `精灵` 属性切换到第二帧,第三帧的 `精灵` 资产。在 `1:00` 处,再切换回第一帧的 `精灵` 资产。 首尾的关键帧相同,在循环播放时动画就不会出现抖动了,点击播放按钮,可以预览这个 `动画片段`。 -![2024-11-11 14.57.09.gif](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*TgLySYjLljAAAAAAAAAAAAAADsJ_AQ/original) + 这样我们的帧动画 `动画片段` 就制作完成了。关于动画编辑器的更多操作,请参考 [动画片段](/docs/animation/clip) 文档。 diff --git a/docs/zh/animation/examples/text-animation.mdx b/docs/zh/animation/examples/text-animation.mdx index a5818a785f..984fd9dea3 100644 --- a/docs/zh/animation/examples/text-animation.mdx +++ b/docs/zh/animation/examples/text-animation.mdx @@ -16,29 +16,29 @@ label: Animation/Examples ## 0. 准备工作 在开始之前,我们需要在 `实体` 上添加一个 `文本渲染器` 组件。 -![image28](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*QlyOTZOGt3cAAAAAAAAAAAAADsJ_AQ/original) + ## 1. 创建动画片段 添加好组件后, 我们需要创建一个 `动画片段`(关于动画片段的介绍,请参考 [动画片段](/docs/animation/clip) 文档)创建 `动画片段` 有两种方式: 1. 右键点击 **[资产面板](/docs/assets/interface)** 中的空白处,选择 `Create` -> `Animation Clip` -![1.jpg](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*XK28Qr2GX6UAAAAAAAAAAAAADsJ_AQ/original) + 2. 点击添加资产按钮 `+`,选择 `Animation Clip` -![2.jpg](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*Dws0TriVVakAAAAAAAAAAAAADsJ_AQ/original) + ## 2. 打开动画片段编辑器 1. 双击刚刚创建的 `动画片段` 资产 -![3.jpg](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*w4ReS7ijXgcAAAAAAAAAAAAADsJ_AQ/original) + 2. 选择 `实体`,根据提示,我们需要在 **[层级面板](/docs/interface/hierarchy)** 选择一个 `实体` 作为编辑动画的目标。 选择编辑器默认创建的 `实体`(你也可以点击层级面板的 `+` 按钮创建一个新的) -![4.jpg](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*UvZXSryjAngAAAAAAAAAAAAADsJ_AQ/original) + 3. 点击动画片段编辑器的 `Create` 按钮,编辑器会为你做好一些准备工作,本示例你可以先忽略对这些概念的理解。 @@ -51,28 +51,28 @@ label: Animation/Examples 创建完成之后,你会打开动画片段编辑器,如图所示: -![5.jpg](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*HD77QZgYEJoAAAAAAAAAAAAADsJ_AQ/original) + ## 3. 设置测试文字并切换到2D视图 1. 在 `实体` 上的 `文本渲染器` 组件的 `文本` 属性中输入 `Hello World`,并设置 `字体大小` 为 `200`。你也可以按需设置其他属性,关于文字的更多信息,请参考 [文本渲染器](/docs/graphics/2D/text/) 文档。 -![6.jpg](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*AlLoT5n2EswAAAAAAAAAAAAADsJ_AQ/original) + 2. 切换到 `2D` 视图 -![7.jpg](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*_oq3SIs5jN0AAAAAAAAAAAAADsJ_AQ/original) + ## 4. 编辑动画片段 1. 开启 `动画片段` 编辑器的录制模式 -![image-22](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*S4jNRZ-Ia7AAAAAAAAAAAAAADsJ_AQ/original) + 2. 将时间线调到 `0:00`, 然后将 `文本渲染器` 组件的 `字体大小` 属性设置为0,在录制模式下,编辑器会自动添加对应的属性及关键帧。 -![image-22](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*FXL-RYGP8YUAAAAAAAAAAAAADsJ_AQ/original) + 3. 分别在 `0:30`,`1:00` 处,将 `文本渲染器` 组件的 `字体大小` 属性设置为100, 200。点击播放按钮,可以预览这个 `动画片段`。 diff --git a/docs/zh/animation/layer.mdx b/docs/zh/animation/layer.mdx index 90d20e7abd..a9dfe962ab 100644 --- a/docs/zh/animation/layer.mdx +++ b/docs/zh/animation/layer.mdx @@ -21,7 +21,7 @@ label: Animation #### 使用示例 我们在编辑器添加一个 `动画层`,并将 `Blending` 选为 `Additive` 即可 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*JyqiQ6kvqBcAAAAAAAAAAAAADsJ_AQ/original) + ### 覆盖模式 覆盖模式下,较高层的动画会完全覆盖较低层的动画。这意味着在最终的动画输出中,较高层的动画会优先显示并替代较低层的动画效果(随着权重的增加,减少下层对动画的影响)。它常用于动画的分层控制。例如,你可能需要对不同身体部位的动作进行单独控制。`Override` 模式可以分离地控制各个部分,比如在跑步的同时调整上半身的姿势或动作。 @@ -32,7 +32,7 @@ label: Animation #### 使用示例 将 `Blending` 选为 `Override` 即可 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*5TfbQJjPZDMAAAAAAAAAAAAADsJ_AQ/original) + 可以看到角色的动画完全替换掉了第一层的动画 @@ -43,7 +43,7 @@ label: Animation #### 使用示例 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*HSxgTZIDqQ0AAAAAAAAAAAAADsJ_AQ/original) + 可以看到 `动画层` 的权重越高对动画效果的影响越大。 diff --git a/docs/zh/animation/overview.md b/docs/zh/animation/overview.mdx similarity index 100% rename from docs/zh/animation/overview.md rename to docs/zh/animation/overview.mdx diff --git a/docs/zh/animation/state-machine.mdx b/docs/zh/animation/state-machine.mdx index 7f88ce12cb..275b4b589a 100644 --- a/docs/zh/animation/state-machine.mdx +++ b/docs/zh/animation/state-machine.mdx @@ -55,7 +55,7 @@ Solo 和 Mute 通常用于调试,用于帮助开发者更高效地测试和调 #### 编辑器使用 将 `动画状态` 连接到`entry`上你导出的项目运行时就会自动播放其上的动画,而不需再调用 `animator.play`。点击 `动画控制组件`([详细介绍](/docs/animation/animator))绑定的 `实体` ,即可预览动画。 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*0_DkSoSAhmUAAAAAAAAAAAAADsJ_AQ/original) + #### 脚本使用 @@ -71,11 +71,11 @@ animatorStateMachine.addEntryStateTransition('Idle'); #### 编辑器使用 将两个想要过渡的 `动画状态` 连接即可实现动画过渡的效果, 点击两个 `动画状态` 间的连线,可以修改动画过渡的参数调整效果。 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*h3I4TZoxtnYAAAAAAAAAAAAADsJ_AQ/original) + 点击连线你可以设置 `动画过渡` 的参数,如添加条件: -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*vlmLQqR2k7QAAAAAAAAAAAAADsJ_AQ/original) + 若添加多个条件,只有所有条件都满足时,才会开始过渡。 @@ -190,7 +190,7 @@ class AnimationScriptExample extends Script { ### 动画状态机动画循环 将 `动画状态` 连接到 `exit` 状态,`动画状态机` 会退出并重新进入 `entry`,使得整体流程循环 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*1AfgS6S88SYAAAAAAAAAAAAADsJ_AQ/original) + #### 脚本使用 @@ -208,9 +208,9 @@ runState.addExitTransition(); ### 状态机脚本 你可以为每个 `动画状态` 添加 `状态机脚本` ,它可以让你在 `动画状态机` 的不同事件(如状态进入、退出、更新等)中接收到回调[详见](/apis/core/#StateMachineScript)。 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*VrCXQqS3w7QAAAAAAAAAAAAADsJ_AQ/original) + -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*A7I7QqiDCfkAAAAAAAAAAAAADsJ_AQ/original) + #### 脚本使用 `状态机脚本` 提供了三个动画状态周期: diff --git a/docs/zh/animation/system.md b/docs/zh/animation/system.mdx similarity index 100% rename from docs/zh/animation/system.md rename to docs/zh/animation/system.mdx diff --git a/docs/zh/art/bake-blender.md b/docs/zh/art/bake-blender.md deleted file mode 100644 index de4abb9ddb..0000000000 --- a/docs/zh/art/bake-blender.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -order: 0 -title: Blender 烘焙 -type: 美术 -label: Art ---- - -> **_特别感谢 扫地盲僧及 UU 跑腿效能团队 提供本篇教程_** - -美术在模型实际制作过程中,可能会使用较多的素材,材质等以达到更好的视觉效果。但在导出时会出现较大的渲染落差,有时还会丢失一些效果。 - -我们在最大程度还原 3D 模型渲染流程方面做了一些优化,希望能给大家带来帮助。 - -### Blender 烘焙 - -1. 选择模型,目前这个建筑由很多不同的模型组成,我们需要把它们合并成为一个模型 - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/062ab80a-f13e-4bde-b916-61ed65150540/1635163063741-2a68da6a-bb53-47ef-8404-7f52c127c802.png) - -2. 选中 2 个模型合并的快捷键是【ctrl+j】,如果遇到哪些模型有修改器,需要先把修改器应用了再合并,否则修改器做出来的效果会失效。 - -image.png - -image.png - -3. 开始烘焙,选择着色器视图,选中材质属性,在节点视图【shift+a】新建:纹理 -> 图像纹理。 - -image.png - -4. 点击新建>取一个合适的名字即可,左侧展开就能看到你刚新建的图像纹理。 - -image.png - -image.png - -5. 把你新建的这个图像纹理复制到建筑下的所有材质节点中,并且是选中状态。 - -image.png - -6. 配置烘焙参数,先不要点击烘焙,需要下一步的 UV - -image.png - -### 拆 UV - -1. 进入 UV 编辑视图,选中建筑模型,【tab 键】打开编辑模式,可以看到现在 UV 是混乱的 - -image.png - -2. 按【U】选择智能 UV 投射,点击确定,就能获得到一个还不错的 UV 展开图,当然如果美术有时间也可以手工 - -image.png - -image.png - -image.png - -3. 返回到着色器视图,选中模型图层和图层下所有材质,设置烘焙下参数不用改,点击烘焙。下面有进度条,耐心等待即可 - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/e8c439b1-4dc4-419e-abe4-ad7fb7a3b8e5/1635165107820-c9733262-2672-4d1a-ac01-0452ed71c440.png) - -4. 烘焙完成,左侧我们新建的图像纹理已经烘焙好了,【alt+s】可快速保存这个烘焙贴图 - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/96becab7-74e3-4b2b-94e8-0c74bc5929d5/1635165192308-88c6f55f-faa6-4aa2-91c5-2b7114dbc3e8.png) - -### 导出 glTF 文件 - -1. 将上述模型的所有材质都删掉,新建一个背景材质赋予上 - -image.png - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/a2d19c0a-79b9-4d51-b306-83a86d4388e4/1635165697839-5f88f82f-a66b-453d-970d-3398818ca8d8.png) - -2. 把房子的烘焙图拖进节点视图中,连接颜色 - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/ad28062c-09f0-4586-8ca0-a927f94e57d0/1635165825176-cb680c0b-9126-47f8-8ee2-920df3831a89.png) - -3. 导出 glTF 格式,确保这 2 个图层的眼睛和相机都开启状态 - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/1590d92c-54ba-4efa-b6ca-6c2c3e8b95de/1635165880957-933cc281-8848-436f-a2af-186d818202d1.png) - -4. 放入[glTF 查看器](https://galacean.antgroup.com/engine/gltf-viewer)预览效果 - -![image.png](https://gw.alipayobjects.com/zos/OasisHub/81cfd9e4-474a-45dc-8133-de27a9c08dd6/1635166016557-59978f7f-6c91-4f13-99b3-9907e5c8cd44.png) - -希望能给大家带来帮助~ diff --git a/docs/zh/art/bake-blender.mdx b/docs/zh/art/bake-blender.mdx new file mode 100644 index 0000000000..6387daa6f3 --- /dev/null +++ b/docs/zh/art/bake-blender.mdx @@ -0,0 +1,86 @@ +--- +order: 0 +title: Blender 烘焙 +type: 美术 +label: Art +--- + +> **_特别感谢 扫地盲僧及 UU 跑腿效能团队 提供本篇教程_** + +美术在模型实际制作过程中,可能会使用较多的素材,材质等以达到更好的视觉效果。但在导出时会出现较大的渲染落差,有时还会丢失一些效果。 + +我们在最大程度还原 3D 模型渲染流程方面做了一些优化,希望能给大家带来帮助。 + +### Blender 烘焙 + +1. 选择模型,目前这个建筑由很多不同的模型组成,我们需要把它们合并成为一个模型 + + + +2. 选中 2 个模型合并的快捷键是【ctrl+j】,如果遇到哪些模型有修改器,需要先把修改器应用了再合并,否则修改器做出来的效果会失效。 + +image.png + +image.png + +3. 开始烘焙,选择着色器视图,选中材质属性,在节点视图【shift+a】新建:纹理 -> 图像纹理。 + +image.png + +4. 点击新建>取一个合适的名字即可,左侧展开就能看到你刚新建的图像纹理。 + +image.png + +image.png + +5. 把你新建的这个图像纹理复制到建筑下的所有材质节点中,并且是选中状态。 + +image.png + +6. 配置烘焙参数,先不要点击烘焙,需要下一步的 UV + +image.png + +### 拆 UV + +1. 进入 UV 编辑视图,选中建筑模型,【tab 键】打开编辑模式,可以看到现在 UV 是混乱的 + +image.png + +2. 按【U】选择智能 UV 投射,点击确定,就能获得到一个还不错的 UV 展开图,当然如果美术有时间也可以手工 + +image.png + +image.png + +image.png + +3. 返回到着色器视图,选中模型图层和图层下所有材质,设置烘焙下参数不用改,点击烘焙。下面有进度条,耐心等待即可 + + + +4. 烘焙完成,左侧我们新建的图像纹理已经烘焙好了,【alt+s】可快速保存这个烘焙贴图 + + + +### 导出 glTF 文件 + +1. 将上述模型的所有材质都删掉,新建一个背景材质赋予上 + +image.png + + + +2. 把房子的烘焙图拖进节点视图中,连接颜色 + + + +3. 导出 glTF 格式,确保这 2 个图层的眼睛和相机都开启状态 + + + +4. 放入[glTF 查看器](https://galacean.antgroup.com/engine/gltf-viewer)预览效果 + + + +希望能给大家带来帮助~ diff --git a/docs/zh/art/bake-c4d.md b/docs/zh/art/bake-c4d.mdx similarity index 60% rename from docs/zh/art/bake-c4d.md rename to docs/zh/art/bake-c4d.mdx index ead1efbb31..c5c2bf94f0 100644 --- a/docs/zh/art/bake-c4d.md +++ b/docs/zh/art/bake-c4d.mdx @@ -13,11 +13,11 @@ label: Art 烘培首先需要两组模型:一个高模,一个低模。高模用于烘培精细程度较高的贴图,低模用于在进入引擎后使用贴图两者在制作时要保证 uv 的统一,所以先产生低模排布好 uv 然后进行细节加工产生高模,高模可以较多的制作细节来烘培出细节更丰富的贴图。 -![1.gif](https://gw.alipayobjects.com/mdn/rms_d27172/afts/img/A*pbduQosyOJwAAAAAAAAAAAAAARQnAQ) + 左边为低模 右边为高模 从布线信息可以看得出来,并且高模细的细节会多一些。 -![2.gif](https://gw.alipayobjects.com/mdn/rms_d27172/afts/img/A*SgbzSKngA2IAAAAAAAAAAAAAARQnAQ) + 随便布线细节有差异但是两者的可以被看到的部分要保持一致 被遮盖的部分不做考虑所以高模必须由低模产生来保证 uv 的一致。 @@ -25,32 +25,32 @@ label: Art 1.将准备好的高模用 C4D 进行调节材质渲染出来需要的效果,像面部使用的贴图也需要按照整体的 uv 排布来绘制贴图。调节好材质之后就可以准备进行烘培了。 -image.png +image.png 2. 烘培重要的一点是需要对摄像机的模式进行选择,对需要进行输出的摄像机进行标签指定,加入 OC 渲染器特有的摄像机标签。 - + 3. 点击添加好的摄像机标签进入标签属性摄像机类型会有很多选项其中一项为烘培,选择烘培。 -image.png +image.png 4. 在烘培菜单中将烘培群组 ID 设置为除 1 以外的数字这里设置为 2。 -image.png +image.png 5. 然后需要将需要烘培的模型并为一组,如下图所示将所有需要的模型打一个组并且加入 OC 对象标签。 -image.png +image.png 6. 点击标签出现标签属性选择对象图层,然后将里面的烘培 ID 设置为和烘培群组 ID 一样的数值这里是 2,然后点击渲染即可,这样就可以烘培出需要的图片。 -image.png +image.png -image.png +image.png 如果对烘焙的结果不是非常满意,C4D、Substance Painter 都能够涂刷修改贴图。真实感渲染不是唯一的选择,涂刷贴图也可以用来还原一些特殊的风格。 -image.png +image.png -image.png +image.png diff --git a/docs/zh/art/digital-human.md b/docs/zh/art/digital-human.mdx similarity index 91% rename from docs/zh/art/digital-human.md rename to docs/zh/art/digital-human.mdx index ab79ab13f7..75e1a5ed17 100644 --- a/docs/zh/art/digital-human.md +++ b/docs/zh/art/digital-human.mdx @@ -37,4 +37,4 @@ title: 数字人项目 编辑器和灵境的打通流程也非常简单,按照上述步骤制作完形象后,项目导出成一个 Project URL 交付给灵境平台即可进行预览和驱动。 -image.png +image.png diff --git a/docs/zh/art/lottie.md b/docs/zh/art/lottie.mdx similarity index 56% rename from docs/zh/art/lottie.md rename to docs/zh/art/lottie.mdx index b52b1f628e..927f6de75d 100644 --- a/docs/zh/art/lottie.md +++ b/docs/zh/art/lottie.mdx @@ -14,25 +14,25 @@ label: Art ## 怎样使用 Bodymovin - 到 Bodymovin 的 GitHub 首页(链接:airbnb/lottie-web)克隆项目到本地,或者下载 .zip 包。    - ![image.png](https://gw.alipayobjects.com/zos/OasisHub/429a17b1-19b3-41b8-902c-4992d722832f/1597673434824-27e06992-4a7d-486a-8514-62a470c53789.png) + - 在项目目录的“/build/extension”目录下找到“bodymovin.zxp”文件,这个就是插件包了。 - 下载安装 ZXP Installer。 ZXP 插件安装器地址: [https://aescripts.com/learn/zxp-installer](https://aescripts.com/learn/zxp-installer)
-![image.png](https://gw.alipayobjects.com/zos/OasisHub/1e996008-498c-4845-953b-8d39f05503e0/1597674042809-af5a084f-f21b-4bf4-b0d4-7404466b2a1e.png) + - 打开 AE,点击“编辑”>“首选项”>“常规”菜单项,选中“允许脚本写入文件和访问网络”,点击确定。 -![image.png](https://gw.alipayobjects.com/zos/OasisHub/22b31fcd-2b6e-4691-abd1-b173ccab87e7/1597674058269-f2242296-32c5-4ae9-973b-2943e04e94bc.png) + - 点击“窗口”>“扩展”>“Bodymovin”菜单项,就可以打开 Bodymovin 的界面使用插件了。 -![image.png](https://gw.alipayobjects.com/zos/OasisHub/cb002ffc-4b59-4dbd-a85d-56e0c1809475/1597674100420-41e2440c-fe9a-4280-8000-4f384ccdf9c3.png) + - 打开 Bodymovin 插件窗口,可以发现该项目的名称出现在了下面的列表中。选中该名称,设置好 json 文件输出位置,点击 “Render”。 -image.png +image.png - 点击上图中的 Settings,可以对导出的 json 进行配置: -image.png +image.png diff --git a/docs/zh/assets/custom.md b/docs/zh/assets/custom.mdx similarity index 95% rename from docs/zh/assets/custom.md rename to docs/zh/assets/custom.mdx index 6ad4f57247..6f88bcaba1 100644 --- a/docs/zh/assets/custom.md +++ b/docs/zh/assets/custom.mdx @@ -25,4 +25,4 @@ export class FBXLoader extends Loader { ## 参考 - \ No newline at end of file + \ No newline at end of file diff --git a/docs/zh/assets/gc.md b/docs/zh/assets/gc.mdx similarity index 81% rename from docs/zh/assets/gc.md rename to docs/zh/assets/gc.mdx index fc6dd8efbe..e537d9a68f 100644 --- a/docs/zh/assets/gc.md +++ b/docs/zh/assets/gc.mdx @@ -11,7 +11,7 @@ label: Resource 例如下图展示的实体包含 [MeshRenderer](/apis/core/#MeshRenderer) 组件,依赖于 [Material](/apis/core/#Material), _Material_ 可能被多个 _MeshRenderer_ 引用,如果释放 _Material_ ,那么引用此的其他 _MeshRenderer_ 则会找不到该 _Material_ 而报错。 -![image.png](https://gw.alipayobjects.com/mdn/mybank_yulibao/afts/img/A*wXmqRIwqI18AAAAAAAAAAAAAARQnAQ) + > 注意:JavaScript 无法追踪对象的引用。 一般在 JavaScript 等弱类型语言中,是没有提供给开发者内存管理的功能的,所有对象的内存都是通过垃圾回收机制来管理,你没有办法去判断对象什么时候会被释放,所以没有[析构函数(destructor)](https://zh.wikipedia.org/wiki/%E8%A7%A3%E6%A7%8B%E5%AD%90)去调用引用资源的释放。 @@ -25,13 +25,13 @@ engine.resourceManager.gc(); 如果您需要验证资产是否释放成功,可按照以下步骤,在空白页打开以下示例: - + 该示例在初始化时会通过创建 `Texture2D` 和 `Sprite` 渲染 2D 精灵,当点击右上角 GC 按钮后,`root` 节点被销毁,纹理和精灵资产的引用计数都被清空,此时这些资产会被真正销毁,分别在 `gc` 前后拍摄内存快照可以更直观地感受这个过程 1. gc 前: **开发者工具** -> **内存** -> **拍摄堆快照** 2. gc 后: **开发者工具** -> **内存** -> **拍摄堆快照** -> **比较** -> **选择 gc 前快照** -image-1 +image-1 -image-1 +image-1 diff --git a/docs/zh/assets/interface.md b/docs/zh/assets/interface.mdx similarity index 85% rename from docs/zh/assets/interface.md rename to docs/zh/assets/interface.mdx index f6bdad59e7..d3d1262ee6 100644 --- a/docs/zh/assets/interface.md +++ b/docs/zh/assets/interface.mdx @@ -5,7 +5,7 @@ type: 资产工作流 label: Resource --- -image-20240319102237183 +image-20240319102237183 资产面板是编辑器中一个重要的面板,它可以帮助你管理场景中使用到的所有资产。在资产面板中,你可以查看和管理场景中使用到的所有资产,例如材质、贴图、模型等等。通过资产面板,你可以添加或删除资产,以及对资产进行分类管理,从而更好的组织资产。 @@ -34,27 +34,27 @@ label: Resource 为了在场景中添加资产,你可以点击资产面板上的添加按钮,或者资产面板的右键菜单中的添加选项来添加新资产。添加资产后,你可以在 **[检查器面板](/docs/interface/inspector)** 中对资产的属性进行编辑。资产面板中的资产类型非常丰富,例如材质、贴图、模型、字体等等。具体可以参照上方的表格。 -image-20240319103341208 +image-20240319103341208 你还可以将文件拖动到资产面板中来添加资产,组合文件可以直接选中多个文件拖进资产面板即可。 -drag6 +drag6 ### 组织资产 资产面板中的资产可以通过分类来管理,以便更好的组织资产。你可以在资产面板中创建文件夹并将资产移动到对应的文件夹中(也可以移动到左侧目录的文件夹中),以实现分类管理。资产面板中的文件夹可以嵌套,你可以创建多层级的文件夹来更好的组织资产。 -drag7 +drag7 资产面板提供了对资产浏览友好的工具栏,帮助你快速地查找某个或某类资产。你也可以根据你的使用习惯,对资产的浏览模式、排序方式和缩略图大小进行修改。 -drag8 +drag8 组织完资产后,每个资产都有一个**相对路径**,我们可以右击某个资产拷贝路径。 -image-20240319132804611 +image-20240319132804611 这对项目开发来说很重要,因为项目中经常遇到需要异步加载资产的情况,即初始化不需要加载某个资产(甚至是场景),可以通过脚本来控制某个资产的加载。具体的语法可以看[资产](/docs/assets/load)和[场景](/docs/core/scene)的加载使用,以加载场景为例: @@ -78,14 +78,14 @@ this.engine.resourceManager.load({ url: "...", type: AssetType.Scene }); 在选中一个资产后, 右侧的 **[检查器面板](/docs/interface/inspector)** 会显示出此资产可配置的属性。不同的资产所对应的可配置项是不同的, 比如 glTF 资产会显示模型预览窗, 材质资产会显示出详细的材质配置选项 。 -image-20240319120017637 +image-20240319120017637 ### 使用资产 部分资产(如 glTF 资产)支持拖拽到场景中或节点树中。 -drag9 +drag9 diff --git a/docs/zh/assets/load.md b/docs/zh/assets/load.mdx similarity index 97% rename from docs/zh/assets/load.md rename to docs/zh/assets/load.mdx index cdcd1e629b..9b2f163c24 100644 --- a/docs/zh/assets/load.md +++ b/docs/zh/assets/load.mdx @@ -86,7 +86,7 @@ this.engine.resourceManager.load("Assets/texture.png"); > 在编辑器中可以通过 **[资产面板](/docs/assets/interface)** -> **右键资产** -> **Copy relative path** 快速复制资产的相对路径 -![image-20240717180517517](https://mdn.alipayobjects.com/rms/afts/img/A*yft2SLLgIyQAAAAAAAAAAAAAARQnAQ/original/image-20240717180517517.png) + ### baseUrl diff --git a/docs/zh/assets/overall.md b/docs/zh/assets/overall.mdx similarity index 100% rename from docs/zh/assets/overall.md rename to docs/zh/assets/overall.mdx diff --git a/docs/zh/basics/overview.md b/docs/zh/basics/overview.mdx similarity index 100% rename from docs/zh/basics/overview.md rename to docs/zh/basics/overview.mdx diff --git a/docs/zh/basics/quickStart/flappy-bird.md b/docs/zh/basics/quickStart/flappy-bird.mdx similarity index 87% rename from docs/zh/basics/quickStart/flappy-bird.md rename to docs/zh/basics/quickStart/flappy-bird.mdx index 832b7c1f93..df9e0c2826 100644 --- a/docs/zh/basics/quickStart/flappy-bird.md +++ b/docs/zh/basics/quickStart/flappy-bird.mdx @@ -10,7 +10,7 @@ label: Basics Flappy Bird 是一个 2D 项目,编辑器首页自带的 2D 模版便是按照此文档一步一步实现的,我们先通过编辑器的 `New Project` 创建一个 `2D Project`。(若遇到问题,可参照**首页**->**模版**->**像素小鸟**) -image-20231007170002181 +image-20231007170002181 ## 准备资源 @@ -22,25 +22,25 @@ Flappy Bird 依赖的资源是一堆图片,点击[这里](https://github.com/g - 草地、管道 - 游戏重新开始按钮 -image-20231007170002181 +image-20231007170002181 ### 上传资源 -回到场景编辑器,点击资源面板上的上传按钮 image-20231007145111353,选择 `Sprite`,此时会唤起操作系统的文件查看器,选中所有 FlappyBird 目录下的图片。上传之后,如下图所示,编辑器为每张图片创建了一个 [Texture](/docs/graphics/texture/texture/) 资源和 一个 [Sprite](/docs/graphics/2D/sprite) 资源(为了和 Texture 资源作区分,Sprite 对象带灰色圆角矩形背景)。在接下来的操作中,我们只需要关心 Sprite 资源。 +回到场景编辑器,点击资源面板上的上传按钮 image-20231007145111353,选择 `Sprite`,此时会唤起操作系统的文件查看器,选中所有 FlappyBird 目录下的图片。上传之后,如下图所示,编辑器为每张图片创建了一个 [Texture](/docs/graphics/texture/texture/) 资源和 一个 [Sprite](/docs/graphics/2D/sprite) 资源(为了和 Texture 资源作区分,Sprite 对象带灰色圆角矩形背景)。在接下来的操作中,我们只需要关心 Sprite 资源。 -image-20231007145451371 +image-20231007145451371 到这里,我们已经把资源上传完,但是有洁癖的你看到这散乱的资源可能已经按耐不住整理的冲动了。让我们创建一个文件夹,并重命名为 _Sprites_,把刚上传的资源批量选中后拖到 _Sprites_ 目录中。这样做的目的不仅是让资源面板更加整洁,还为我们下一步创建 [Atlas 图集](/docs/graphics/2D/spriteAtlas)资源做好了准备。 ### 创建图集 -为了达到更好的运行时性能,我们选择把这些 Sprite 资源打包到一个 Atlas 资源。我们点击 image-20231007152415467 按钮选择 `Sprite Atlas`,创建后选中它,通过 **[检查器面板](/docs/interface/inspector)** 上的 `Add to List` 按钮把所有 Sprite 资源都添加到列表中。 +为了达到更好的运行时性能,我们选择把这些 Sprite 资源打包到一个 Atlas 资源。我们点击 image-20231007152415467 按钮选择 `Sprite Atlas`,创建后选中它,通过 **[检查器面板](/docs/interface/inspector)** 上的 `Add to List` 按钮把所有 Sprite 资源都添加到列表中。 -image-20231007171348757 +image-20231007171348757 点击 `Pack and Preview` 按钮可以看到 Atlas 创建成功: -image-20231007153448666 +image-20231007153448666 恭喜你,到这里你已经完成了资源上传和管理的操作。接下去我们进行游戏场景搭建的环节。 @@ -48,13 +48,13 @@ Flappy Bird 依赖的资源是一堆图片,点击[这里](https://github.com/g 搭建 2D 场景就像玩拼图一样充满乐趣。首先,我们试着把游戏背景图从资源面板拖动场景中。不要怕拖的位置不准,只要拖到大概的位置,我们后面可以在 **[检查器面板](/docs/interface/inspector)** 中精细调整。 -![drag1](https://gw.alipayobjects.com/zos/OasisHub/6cabaeea-cc36-4fe1-8bb5-d7ed8a9a49b7/drag1.gif) + 选中层级树面板中的 `Camera` 节点,可以预览场景在各种设备上渲染的样子。 > 如果你发现画面太大或太小,可以调整正交相机的 `Orthographic Size` 来实现缩放。 -image-20231007162550749 +image-20231007162550749 ### 加上小鸟 @@ -64,19 +64,19 @@ Flappy Bird 依赖的资源是一堆图片,点击[这里](https://github.com/g 随着游戏的进行,管道会在画面中重复出现,并且是上下成对出现。这里有个小技巧,可以把上面的管道的 `Scale` 值设成 `-1`,这样就优雅地实现了翻转。 -image-20231007163240028 +image-20231007163240028 在游戏过程中,产生管道的高度也是随机的,但是我们手上的资产高度却是固定的。不用急,只需要调整一下`精灵渲染模式`即可,这样可以让我们`无损`拉伸某些资产哦。 - + 这里有个小技巧,将引用 `sprite` 资产的 `pivot` 属性设置为 `buttom` 就可以避免每次调整高度的时候重新锚定位置了。 -image-20231007163240028 +image-20231007163240028 考虑到管道会重复出现,我们在节点树中把一对管道设置成一个 `PipeMother` 的组,并把它放到 `Pipe` 节点下。这样,后面通过在 Pipe 上绑定脚本组件就可以获取 `PipeMother` 以实现管道的复用。 -image-20231007163400680 +image-20231007163400680 ### 加上草地 @@ -88,23 +88,23 @@ Flappy Bird 依赖的资源是一堆图片,点击[这里](https://github.com/g 2. 在 **[检查器面板](/docs/interface/inspector)** 中通过 `Add Component` 按钮添加 `Sprite Renderer` 组件,并且把 `SpriteRenderer DrawMode Info` 属性设置成 `Tiled`,并将宽度设置为 `8.14` - image-20231007173243980 + image-20231007173243980 3. 此时就得到了一个平铺完毕的地面,接下来我们可以通过创建动画片段来让它动起来!详见[动画片段编辑](/docs/animation/clip)。 - + ### 添加遮罩 添加完地面后发现,左右显示好像穿帮了!对于这种情况,只需要为精灵渲染器增加遮罩就好了,详见[精灵遮罩组件](/docs/graphics/2D/spriteMask) - + ### 加上 GUI GUI 包括分数显示和重新开始按钮。我们分数( `0.png`) 和重新开始按钮( `restart.png`) 两个精灵拖到场景中,并放到新建的 `GUI` 节点下。 -image-20231007180819265 +image-20231007180819265 至此,界面搭建完毕!观察一下左侧的节点树的完整结构,好的树结构对复杂场景管理来说很重要。 @@ -121,7 +121,7 @@ GUI 包括分数显示和重新开始按钮。我们分数( `0.png`) 和重 碰撞体描述了事物的位姿形态,因此在添加碰撞体时应该尽量贴合物体实际显示的大小。关于碰撞器的使用详见[碰撞器](/docs/physics/collider),此处演示为小鸟添加碰撞体。 - + #### 处理碰撞回调 @@ -255,7 +255,7 @@ timeline 经过拆解可以发现,如果我们简单地将动画分类为待机动画,飞行动画与坠落动画,考虑到待机的时候要播放精灵切换和上下缓动的动画,飞行的时候也需要播放精灵切换与抬头坠落的动画,他们重合的部分不仅会增加动画编辑时的工作量,还需要额外考虑这两个动画衔接时其中的精灵切换动画是否自然,因此我们更进一步,将各个动画状态原子化,拆分其中精灵切换与坐标改变的部分,并分别设置在不同的 `Layer` 中,不同的 `Layer` 相互独立,并可同时播放各自的动画,设置各自的叠加模式与权重,详情可参考[动画组件](/docs/animation/system/)。 -image-20231007180819265 +image-20231007180819265 让各个 `Layer` 分别控制各自的动画状态,可以逻辑更加清晰。 @@ -344,7 +344,7 @@ class Bird extends Script { 由于动画片段编辑只能编辑绝对的坐标或旋转变化,例如每次飞行的动画,他的旋转变化是绝对的,但坐标却是相对的,因此我们可以在 `StateMachineScript` 中实现,以 `Fly` 动画为例: - + 然后打开这个脚本,并在其中添加上自由落体的坐标变化: diff --git a/docs/zh/basics/quickStart/quick-start.md b/docs/zh/basics/quickStart/quick-start.mdx similarity index 68% rename from docs/zh/basics/quickStart/quick-start.md rename to docs/zh/basics/quickStart/quick-start.mdx index 8259a77e69..cf705d4b5a 100644 --- a/docs/zh/basics/quickStart/quick-start.md +++ b/docs/zh/basics/quickStart/quick-start.mdx @@ -10,11 +10,11 @@ label: Basics 在你登录之后,首先看到的是编辑器的首页,在这个页面中会显示所有你创建的项目。使用右上角的按钮来创建项目,点击后可以选择要创建的项目类型,2D 或 3D。我们选择 3D Project。 -image-20230921161225962 +image-20230921161225962 此时会打开一个新的空白工程,场景中内置了一个相机和一个平行光。 -image-20240705161613717 +image-20240705161613717 ## 搭建场景 @@ -33,49 +33,49 @@ label: Basics 首先,点击这个[链接](https://gw.alipayobjects.com/os/bmw-prod/6cb8f543-285c-491a-8cfd-57a1160dc9ab.glb)下载一个鸭子的 3D 模型。把下载到本地的模型拖到资产面板中,稍过片刻就会看到模型已经上传到了编辑器中: -image-20240705162025015 +image-20240705162025015 接着,把资产面板中的模型拖到场景视图中,就可以在场景中渲染这个 3D 模型了,此时场景的节点树中就增加了一个新的实体。 -image-20240705162359455 +image-20240705162359455 ### 调整鸭子的变换 首先,为了更好地预览最后在移动设备上的效果,我们可以选中**相机**实体,可以通过定位按钮明确当前预览的相机在场景中的位置,通过选择不同尺寸的移动设备来模拟真机预览,也可以选择锁定预览窗口,这样在选择其他实体的时候预览窗口就不会消失。 -image-20240705162931132 +image-20240705162931132 接着,我们选中鸭子,通过选择上方工具栏中的**移动**、**旋转**、**缩放**等[变换](/docs/core/transform)操作。切换不同的变换类型,鸭子身上也会随之切换不同的操作手柄。这些操作手柄和大部分 3D 软件的交互是类似的,如果你是第一次使用这类手柄,请不用担心,把鼠标移到手柄上,随意摆弄一下,就能很快上手。通过简单的变换操作,我们就能把鸭子的位置、角度、大小都调整到符合我们预期的效果。左上角的相机预览器会实时地展示你调整的效果。 -image-20240705163544657 +image-20240705163544657 ### 调整灯光 此时鸭子有点暗,我们选中节点树上的 `DirectLight` 灯光实体,在右侧的观察面板中拖动滑杆适当调整一下灯管的强度,让场景的照明更加亮一点。 -image-20240705164814972 +image-20240705164814972 ### 让小鸭子转起来 首先,我们在资产面板 中 *右键 → Create → New Empty Script* 创建一个 Script 资产。 -image-20240705170003841 +image-20240705170003841 创建完成之后,可以看到资产面板中多了一个 Script 资产。 -image-20240705170256694 +image-20240705170256694 接着,我们选中鸭子实体,在右侧的检查器面板中点击 **Add Component** 添加一个 [ Script ](/docs/script/class) 组件。 -image-20240705165619069 +image-20240705165619069 点击 **Select asset** 选择刚创建的 Script,这样脚本就绑定到该实体上了,也就是说脚本的生命周期函数会作用到该实体上。 -image-20240705170349805 +image-20240705170349805 创建脚本后,我们可以 **双击它** 来跳转到代码编辑器页面。 -image-20240705170853613 +image-20240705170853613 进入代码编辑器后,我们在 `onUpdate` 函数中加一行代码,让鸭子沿着 Y 轴旋转。写好代码后,保存(`⌘+s`), 右侧预览区就可以实时的看到整个场景的效果。 @@ -94,6 +94,6 @@ export default class extends Script { 我们已经完成了在编辑器中的开发工作,接下来我们来导出这个项目到本地。点击左侧工具栏的 **下载** 按钮,会唤起导出界面,我们这里把项目名改为 “duck”,然后点击 `Download` 按钮,编辑器就会把项目打包为一个 `duck.zip` 文件下载。 -image-20240705171230958 +image-20240705171230958 项目打包完成后,我们使用 VsCode 打开 box 项目,运行 `npm install` & `npm run dev` ,可以看到项目已经能够正常运行了。 \ No newline at end of file diff --git a/docs/zh/basics/version.md b/docs/zh/basics/version.mdx similarity index 96% rename from docs/zh/basics/version.md rename to docs/zh/basics/version.mdx index dbb4c75351..8c811f9937 100644 --- a/docs/zh/basics/version.md +++ b/docs/zh/basics/version.mdx @@ -61,7 +61,7 @@ Galacean 版本号格式是 `MAJOR.MINOR.PATCH-TAG.X` 。其中 `MAJOR.MINOR` Galacean 大部分包运行时会在 `Console` 输出版本信息, -image.png +image.png 通常也会以此为依据判断包版本依赖是否出现: diff --git a/docs/zh/core/scene.mdx b/docs/zh/core/scene.mdx index 6e901f9599..94a40860a4 100644 --- a/docs/zh/core/scene.mdx +++ b/docs/zh/core/scene.mdx @@ -94,7 +94,7 @@ engine.sceneManager.removeScene(scene2); 多场景渲染示例如下: - + ### 合并场景 diff --git a/docs/zh/core/transform.mdx b/docs/zh/core/transform.mdx index 0b0f605096..bc3fa3abc5 100644 --- a/docs/zh/core/transform.mdx +++ b/docs/zh/core/transform.mdx @@ -11,7 +11,7 @@ label: Core > 结合 Galacean 的 **[坐标系统](/docs/core/space)** 会有更深入地了解。 - + ## 编辑器使用 diff --git a/docs/zh/graphics/2D/2d.md b/docs/zh/graphics/2D/2d.mdx similarity index 82% rename from docs/zh/graphics/2D/2d.md rename to docs/zh/graphics/2D/2d.mdx index 9b67f1d5d7..d74459d976 100644 --- a/docs/zh/graphics/2D/2d.md +++ b/docs/zh/graphics/2D/2d.mdx @@ -8,11 +8,11 @@ label: Graphics/2D Galacean 是 3D/2D 的互动解决方案,您可以在**编辑器主页**的**菜单视图**侧依次**点击模版**->**像素小鸟**快速体验 2D 互动开发。 -image.png +image.png 也可以在**编辑器主页**的**项目视图**侧依次**点击新建项目**->**2D Project**创建一个空白的 2D 项目。 -image.png +image.png 在编辑器中, 2D 项目和 3D 项目没有太大的差别,只是在视角上从 3D 切换成了 2D,并将默认相机设置为**正交**。在**层级界面**依次**选中节点并右键**-> **2D 对象**可以快速创建一个 2D 子节点。 在 2D 项目中,您可以挂载**精灵渲染器**并设置**精灵资产**来渲染图像,可以通过**文字渲染器**来渲染 2D 文字,可以用 **SpriteMask** 实现 2D 元素的遮罩效果,还可以使用 Lottie 或 Spine( 2D 骨骼动画)表现 2D 特效,在最后性能优化时,您还可以将**精灵**打包成**精灵图集**从而提升请求和渲染的性能。 diff --git a/docs/zh/graphics/2D/lottie.md b/docs/zh/graphics/2D/lottie.mdx similarity index 91% rename from docs/zh/graphics/2D/lottie.md rename to docs/zh/graphics/2D/lottie.mdx index 6a45ab54ce..c1b3c787e6 100644 --- a/docs/zh/graphics/2D/lottie.md +++ b/docs/zh/graphics/2D/lottie.mdx @@ -16,17 +16,17 @@ label: Graphics/2D 开发者拿到 `.json` 文件后,首先需要把 `.json` 文件上传到 Galacean Editor。通过资产面板的上传按钮选择 “lottie” 资产,选择本地一个 [lottie json](https://github.com/galacean/galacean.github.io/files/14106485/_Lottie.3.json) 文件,然后上传: - + ### 添加组件 选择一个实体,添加 Lottie 组件,选择 resource 为上一步上传的资产,即可显示并且播放 Lottie 特效: -![lottie](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*ehFMT7vBaCAAAAAAAAAAAAAADjCHAQ/original) + 开发者可以通过调整属性面板中的各个参数来对 Lottie 进行相关设置: -![lottie](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*OswOQI837OkAAAAAAAAAAAAADjCHAQ/original) + | 属性 | 功能说明 | @@ -75,9 +75,9 @@ await lottie.play(); 编辑器提供了动画切片的功能,可以把设计师提供的整个片段切成多段,每个片段需要定义片段名、开始帧、结束帧三个字段。 - + - + 该操作会在 Lottie 协议中添加 `lolitaAnimations` 字段实现动画的切片: @@ -131,18 +131,18 @@ engine.resourceManager.load({ }); ``` - + ### 3D 变换 业务场景中经常会出现 3D 变换的需求,比如一些弹窗的入场动画。以旋转为例,由于传统的 lottie-web 方案只能沿着 **Z轴** 旋转(也就是说垂直于屏幕法线方向旋转),即使我们在 AE 中实现了沿着 **X轴** 或 **Y轴** 的旋转效果,使用 lottie-web 播放时也会被忽略。 -3D rotation +3D rotation 得益于 Galacean Engine 2D/3D 引擎统一架构的优势,轻松地实现 3D 变换功能。 - + ### 版本依赖 | 引擎版本 | Lottie 版本 | diff --git a/docs/zh/graphics/2D/spine/editor.md b/docs/zh/graphics/2D/spine/editor.mdx similarity index 64% rename from docs/zh/graphics/2D/spine/editor.md rename to docs/zh/graphics/2D/spine/editor.mdx index 548ea78603..880a38529f 100644 --- a/docs/zh/graphics/2D/spine/editor.md +++ b/docs/zh/graphics/2D/spine/editor.mdx @@ -21,29 +21,29 @@ Galacean 编辑器内置了对 Spine 动画的支持,无需额外下载或配 1. 完成动画制作后,单击 `Spine 菜单`>`导出` ,打开导出窗口 -Export panel in Spine editor +Export panel in Spine editor 2. 选择导出窗口左上角的**二进制** ( 推荐使用二进制,以二进制格式而不是JSON格式导出,会使文件体积更小,加载更快 -Export window in Spine editor +Export window in Spine editor 3. 勾选上**纹理图集**的打包复选框 -Click packing texture atlas button in Export window +Click packing texture atlas button in Export window 4. 点击 **打包设置** 这里的打包设置是指纹理的打包设置,打包配置参数可以参考[官方文档](https://zh.esotericsoftware.com/spine-texture-packer),完成打包设置后,点击**确定** -Texture pack window in Spine Editor +Texture pack window in Spine Editor 5. 回到导出窗口,选择导出文件夹后,点击**导出** -Click export button in texture pack window +Click export button in texture pack window 6. 将会得到三个如下文件: -Spine assets in folder +Spine assets in folder - spineboy.skel:包含骨骼结构(skeleton)和动画(animation)数据,是动画动作与骨骼绑定的核心信息。 - spineboy.atlas:存储纹理图集(texture atlas)的信息,包括每张纹理在图集中的位置、大小等细节。 @@ -54,32 +54,32 @@ Galacean 编辑器内置了对 Spine 动画的支持,无需额外下载或配 打开编辑器后,将导出的文件直接拖入到[资产面板](/docs/assets/interface/)中,即可完成上传,如下面的动图所示: -Drag spine assets into Galacean editor +Drag spine assets into Galacean editor 也可以点击资产面板的上传按钮,选择文件进行上传: -Use upload button to upload spine assets -
+Use upload button to upload spine assets + 上传完成后,在资产面板中能够看到上传后的 Spine 资产,包括:SpineSkeletonData 资产SpineAtlas 资产,以及纹理资产 ### SpineSkeletonData 资产 -Spine skeleton data asset icon +Spine skeleton data asset icon SpineSkeletonData 资产存储了 skeleton 数据,以及对生成的 SpineAtlas 资产的引用 点击资产后,能够在检查器中预览 Spine 动画,预览面板中能够切换`皮肤`和`动画片段`: -Spine skeleton data preview +Spine skeleton data preview ### SpineAtlas 资产 -Spine atlas asset +Spine atlas asset SpineAtlas 资产存储了texture atlas 文件,并包含了其对所需 Texture 资产的引用。 点击资产后,能够在检查器中查看其引用的 Texture 资产,以及 Spine 的图集信息。 -Spine atlas preview +Spine atlas preview ### 资产更新 如若需要更新你的 Spine 资产。从 Spine 编辑器中重新导出资产,并再次导入到 Galacean 编辑器中覆盖原有文件即可。 @@ -93,23 +93,23 @@ SpineAtlas 资产存储了texture atlas 文件,并包含了其对所需 Textur 拖入添加是最快捷的一种方式。点击 SpineSkeletonData 资产,按住后拖动到视图区,就能快速创建一个添加了 SpineAnimationRenderer 组件的实体,并指定资产为刚刚选中的 SpineSkeletonData 资产。 -Drag Spine skeleton data asset into viewport +Drag Spine skeleton data asset into viewport ### 快速添加 点击左上角的快速添加按钮,选择 `2D Object`>`SpineAnimationRenderer`, -Quick add Spine animation renderer +Quick add Spine animation renderer 添加完成后,能够看到一个新的实体,挂载了 SpineAnimationRenderer 组件;点击 Resource 属性,选择上传的 SpineSkeletonData 资产,就能看到 Spine 动画啦 -Select spine skeleton data asset in component panel +Select spine skeleton data asset in component panel ### 手动添加 手动添加的方式与快速添加类似,不过需要在节点树中手动创建一个新的实体,并通过检查器的 AddComponent 按钮添加 SpineAnimationRenderer 组件 -Use add component to add spine animation renderer +Use add component to add spine animation renderer 添加了 SpineAnimationRenderer 组件后,同样需要指定组件的 Resource,也就是 SpineAnimationRenderer 组件要渲染的 SpineSkeletonData 资产。 @@ -118,7 +118,7 @@ SpineAtlas 资产存储了texture atlas 文件,并包含了其对所需 Textur SpineAnimationRenderer 组件的配置如下: -Spine animation renderer component config +Spine animation renderer component config 通过 SpineAnimationRenderer 组件能够配置 Spine 动画的资产以及默认状态: @@ -132,5 +132,4 @@ SpineAnimationRenderer 组件的配置如下: ## 4. 项目导出 最终,完成场景编辑器后,可以参考[项目导出](/docs/platform/platform/)流程,导出编辑器项目。 -



下一章节:[在代码中使用](/docs/graphics/2D/spine/runtime) \ No newline at end of file diff --git a/docs/zh/graphics/2D/spine/example.md b/docs/zh/graphics/2D/spine/example.mdx similarity index 65% rename from docs/zh/graphics/2D/spine/example.md rename to docs/zh/graphics/2D/spine/example.mdx index 94260788c4..9b8c851ff1 100644 --- a/docs/zh/graphics/2D/spine/example.md +++ b/docs/zh/graphics/2D/spine/example.mdx @@ -9,59 +9,59 @@ label: Graphics/2D/Spine/example ## 模板 Galacean 编辑器提供了一系列教学模板,帮助大家更快的上手 Spine 动画的使用。 进入[编辑器](https://galacean.antgroup.com/editor/projects) 后,你可以点击左侧的 Templates Tab 进入查看这些模板。 -

+ **动画控制** 该模板通过展示了如何通过 AnimationState 的 setAnimation 与 addAnimation 两个 API 来编排 spine 动画: -spine-animation +spine-animation **动画过渡与混合** 该模板通过展示了 Spine 动画如何设置过渡以及不同轨道之间的动画混合: -spine-mix-blend +spine-mix-blend **混搭换装** 该模板展示了 Spine 混搭换装的能力,通过自由组合不同皮肤的附件,能够将不同皮肤的配件混搭起来: -mix-and-match +mix-and-match **动态局部换肤** 该模板展示了动态局部换肤的能力。我们能够基于一个额外上传的图集创建新的附件并进行替换。 -spine-dynamic-change +spine-dynamic-change ## 示例 **动画控制** 该示例展示了如何通过 setAnimation 与 addAnimation API 来编排 spine 动画队列: - + **跟踪射击** 该示例展示了通过修改 IK 骨骼位置,来实现瞄准射击的效果: - + **局部换肤** 该示例展示了修改插槽中的附件,实现局部换装的效果: - + **整体换肤** 该示例展示了通过 setSkin 方法,实现整体换肤的效果: - + **皮肤混搭** 该示例展示了在运行时,通过组合新的皮肤,实现混搭的效果: - + **物理** 该示例展示了 spine 4.2 版本,基于物理的动画效果: - + diff --git a/docs/zh/graphics/2D/spine/other.md b/docs/zh/graphics/2D/spine/other.mdx similarity index 98% rename from docs/zh/graphics/2D/spine/other.md rename to docs/zh/graphics/2D/spine/other.mdx index 7048312142..08f2ae4a3c 100644 --- a/docs/zh/graphics/2D/spine/other.md +++ b/docs/zh/graphics/2D/spine/other.mdx @@ -8,7 +8,7 @@ label: Graphics/2D/Spine/other ### 版本升级与变更 (1.4) 升级到编辑器 1.4 版本后。除了需要在编辑器的[项目设置](/docs/interface/menu/#项目设置)中升级引擎版本外,还需要注意 1.4 Spine API 的修改: -1. 我们不再推荐使用:添加组件`addComponent(SpineAnimationRenderer)` + 设置资源`set SpineResource` 的方式创建 Spine 动画了。
+1. 我们不再推荐使用:添加组件`addComponent(SpineAnimationRenderer)` + 设置资源`set SpineResource` 的方式创建 Spine 动画了。
1.4 版本,我们给 SpineResource 添加了一个实例化方法 `instantiate`。`instantiate`方法返回一个使用了该资源的 Spine 动画实体。这比过去的创建方式更加快捷方便~ 2. `defaultState` 更名为 `defaultConfig`。该参数的含义是 Spine 动画默认状态下的配置项。我们调整了参数命名,使其更加便于理解。 3. 删除了默认状态下的缩放`scale`配置。过去 scale 参数的目的其实是为了处理 Spine 动画的像素比例,让 Spine 动画大小与引擎中其他物体保持一致。1.4 版本,Spine 无需再通过设置默认缩放来修正其尺寸了。我们推荐大家通过修改 Entity 的 `scale`参数,来缩放 Spine 动画。 diff --git a/docs/zh/graphics/2D/spine/overview.md b/docs/zh/graphics/2D/spine/overview.mdx similarity index 100% rename from docs/zh/graphics/2D/spine/overview.md rename to docs/zh/graphics/2D/spine/overview.mdx diff --git a/docs/zh/graphics/2D/spine/runtime.md b/docs/zh/graphics/2D/spine/runtime.mdx similarity index 94% rename from docs/zh/graphics/2D/spine/runtime.md rename to docs/zh/graphics/2D/spine/runtime.mdx index e18644a25a..4b3ea41e2f 100644 --- a/docs/zh/graphics/2D/spine/runtime.md +++ b/docs/zh/graphics/2D/spine/runtime.mdx @@ -37,7 +37,7 @@ await engine.resourceManager.load({ 若未添加至场景中,则需要在代码中手动加载,步骤如下: 1. 拷贝 SkeletonDataAsset 资产链接 右键点击 SkeletonDataAsset 资产,点选 `Copy relative path` 拷贝资产路径 - + 2. 使用 ResourceManager 加载 @@ -71,10 +71,10 @@ const resource = await engine.resourceManager.load( ); ``` 加载自定义上传的资产时: -- 当传递参数为 url 时,需要保证文件在相同目录下,即:
-https://your.spineboy.json
-https://your.spineboy.atlas
-https://your.spineboy.png
+- 当传递参数为 url 时,需要保证文件在相同目录下,即: + - https://your.spineboy.json + - https://your.spineboy.atlas + - https://your.spineboy.png - 当传递参数为 urls (多链接)时,则无需满足相同目录的条件: @@ -91,10 +91,10 @@ const resource = await engine.resourceManager.load( ); ``` -- 若不传递 texture 地址,那么加载器会从 atlas 文件中读取 texture 的图片名称,并从 atlas 文件的目录下查找 texture 资源。
-- 若自定上传的资产没有文件后缀,可以通过给链接添加 URL query 参数,例如:
+- 若不传递 texture 地址,那么加载器会从 atlas 文件中读取 texture 的图片名称,并从 atlas 文件的目录下查找 texture 资源。 +- 若自定上传的资产没有文件后缀,可以通过给链接添加 URL query 参数,例如: https://your.spineboyjson?ext=.json, -https://your.spineboyatlas?ext=.atlas
+https://your.spineboyatlas?ext=.atlas - 如果 Spine 动画的 atlas 包含多张图片(如 a.png 和 b.png),则需要按照 atlas 文件中记录的图片顺序传入图片地址: ```typescript @@ -194,7 +194,7 @@ setAnimation 函数接受三个参数: - loop:是否循环播放 后两个参数很好理解,第一个参数则包含了 Spine 动画的一个概念:**Track** (轨道) -> Spine 动画在播放时,需要指定一个动画轨道。借助动画轨道,Spine 能够分层应用动画,每一个轨道都能够存储动画与播放参数,轨道的编号从 0 开始累加。在动画应用后,Spine 会从低轨道到高轨道依次应用动画,高轨道上的动画将会覆盖低轨道上的动画。
+> Spine 动画在播放时,需要指定一个动画轨道。借助动画轨道,Spine 能够分层应用动画,每一个轨道都能够存储动画与播放参数,轨道的编号从 0 开始累加。在动画应用后,Spine 会从低轨道到高轨道依次应用动画,高轨道上的动画将会覆盖低轨道上的动画。 #### **动画混合** 上面提到的轨道覆盖机制,大有用途。例如,轨道 0 可以有行走、奔跑、游泳或其他动画,轨道 1 可以有一个只为手臂和开枪设置了关键帧的射击动画。此外,为高层轨道设置TrackEntry alpha可使其与下面的轨道混合。例如,轨道 0 可以有一个行走动画,轨道 1 可以有一个跛行动画。当玩家受伤时,增加轨道 1 的alpha值,跛行就会加重。 @@ -241,26 +241,26 @@ delay 代表了前一个动画的持续时间。 当 delay > 0 时(假设 delay 为 1),前一个动画会在播放 1 秒后,切换到下一个动画。如下图所示: -animation delay > 0 + 如果动画 A 的时长小于 1 秒,则会根据是否设置了循环播放:循环播放直至 1 秒,或者播放完毕后,保持在动画播放完毕的状态直至 1 秒。 当 delay = 0 时,下一个动画会在前一个动画播放完毕后播放,如下图所示: -animation delay = 0 + 假设动画 A 的时长为 1 秒,过渡持续时间为 0.2 秒,当 delay 设置为 0 时,动画 B 会从 1 - 0.2 也就是 0.8 秒开始过渡到动画 B。 当 delay < 0 时,上一个动画未播放完毕前,下一个动画就会开始播放,如下图所示: 同样假设动画 A 的时长为 1 秒,过渡持续时间为 0.2 秒,动画 B 则会从 0.6 秒开始过渡到动画 B。 -animation delay < 0 + 除了 addAnimation 外,还能够通过 [addEmptyAnimation](https://zh.esotericsoftware.com/spine-api-reference#AnimationState-addEmptyAnimation) 方法添加空动画。空动画能够让动画回到初始状态。 addEmptyAnimation 接受三个参数:TrackIndex,mixDuration 和 delay。TrackIndex 和 delay 参数与 addAnimation 一样。 mixDuration 是过渡持续时间,动画会在 mixDuration 时间内逐渐回到初始状态。如下图所示(右侧棕色区域即是空动画), -Add empty animation api + #### **轨道参数** setAnimation 和 addAnimation 方法都会返回一个对象:TrackEntry。TrackEntry 提供了更多的参数来进行动画控制。 @@ -274,7 +274,7 @@ setAnimation 和 addAnimation 方法都会返回一个对象:TrackEntry。Trac 更多参数可以参考 [TrackEntry 官方文档](https://zh.esotericsoftware.com/spine-api-reference#TrackEntry) #### **动画事件** -Animation event diagram +Animation event diagram 当调用 AnimationState API 进行动画控制时,会触发如上图所示的事件。 在新的动画开始播放时,会触发 Start 事件,当动画在动画队列中移除或者中断时,会触发 End 事件。当动画播放完毕时,无论是否循环,都会触发 Complete 事件。 @@ -409,7 +409,7 @@ class YourAmazingScript { #### **动态加载图集并替换附件** -在传统 Spine 项目中,不同的皮肤通常会被打包到同一个图集中。但是,随着皮肤数量的不断增加,图集纹理数量的增长会导致加载耗时不断上涨。为了解决这一问题,可以通过在运行时加载额外的 Atlas 文件,并基于新图集创建附件并替换原有附件,从而灵活支持大规模皮肤扩展,同时避免对初始加载性能的影响。

+在传统 Spine 项目中,不同的皮肤通常会被打包到同一个图集中。但是,随着皮肤数量的不断增加,图集纹理数量的增长会导致加载耗时不断上涨。为了解决这一问题,可以通过在运行时加载额外的 Atlas 文件,并基于新图集创建附件并替换原有附件,从而灵活支持大规模皮肤扩展,同时避免对初始加载性能的影响。 比如,我们可以把不同皮肤的武器,头饰,眼镜等配件打包到一个额外的图集中,在运行时进行替换。 ```typescript @@ -452,7 +452,7 @@ class extends YourAmazingScript { return newAttachment; } ``` -

+ 下一个章节会给大家展示 [Spine的示例与模板](/docs/graphics/2D/spine/example) \ No newline at end of file diff --git a/docs/zh/graphics/2D/sprite.md b/docs/zh/graphics/2D/sprite.mdx similarity index 82% rename from docs/zh/graphics/2D/sprite.md rename to docs/zh/graphics/2D/sprite.mdx index 4291c3ca38..47800fe251 100644 --- a/docs/zh/graphics/2D/sprite.md +++ b/docs/zh/graphics/2D/sprite.mdx @@ -21,11 +21,11 @@ label: Graphics/2D region 决定精灵的显示内容,可以在纹理中选择一个矩形区域进行显示,超出部分会自动过滤掉,如下: -avatar +avatar pivot 代表精灵中心在 region 中的位置,如下: -avatar +avatar ## 使用 @@ -35,13 +35,13 @@ pivot 代表精灵中心在 region 中的位置,如下: 在 **[资产面板](/docs/assets/interface/)** 空白处依次 **右键** → **Upload** → **Sprite** → **选中对应图片** 即可上传精灵资产,上传成功后当前资产列表会同步添加一份名为 `图片名.png` 的纹理资产和一份 `图片名-spr.png` 的精灵资产 -avatar +avatar #### 创建空白精灵 在 **[资产面板](/docs/assets/interface/)** 空白处依次 **右键** → **Create** → **Sprite** 即可创建一份空白的精灵资产。 -avatar +avatar #### 脚本创建 @@ -58,8 +58,8 @@ const spriteWithTexture = new Sprite(engine, texture2D); 这里特别说明下 pivot 在编辑器中的设置。对于 pivot 来说,纹理左下角为 `(0, 0)`,X 轴从左到右,Y 轴从下到上。编辑器中内置了一些常用的 pivot 快捷值,如下: -avatar +avatar 如果内置值无法满足需求,可以自定义自己的 pivot,如下: -avatar +avatar diff --git a/docs/zh/graphics/2D/spriteAtlas.md b/docs/zh/graphics/2D/spriteAtlas.mdx similarity index 80% rename from docs/zh/graphics/2D/spriteAtlas.md rename to docs/zh/graphics/2D/spriteAtlas.mdx index 5de50be9c0..f10a8a4506 100644 --- a/docs/zh/graphics/2D/spriteAtlas.md +++ b/docs/zh/graphics/2D/spriteAtlas.mdx @@ -14,7 +14,7 @@ label: Graphics/2D 下图精灵图集例子里每帧只调用了一次绘制指令: - + ## 编辑器使用 @@ -22,11 +22,11 @@ label: Graphics/2D 在 **[资产面板](/docs/assets/interface/)** 内右键,选择`功能列表`中的`创建`,并选中`精灵图集`,此时,一个空白的精灵图集资产就创建成功了。 -buildBox +buildBox 选中`精灵图集`资产,可以在 **[检查器面板](/docs/interface/inspector)** 查看资产的详细信息。 -buildBox +buildBox ### 添加精灵 @@ -36,13 +36,13 @@ label: Graphics/2D 左键选中需要添加的`精灵`资产,可以在 **[检查器面板](/docs/interface/inspector)** 找到精灵的`从属关系`,选择`打包进图集`就可以选取希望打包进的`精灵图集`资产了。 -buildBox +buildBox #### 方式二:操作精灵图集 左键选中目标`精灵图集`资产,可以在 **[检查器面板](/docs/interface/inspector)** 找到图集打包的精灵列表,选择`添加精灵`就可以选取希望打包的`精灵`资产了。(若选取文件夹,则会添加文件夹目录下的所有精灵) -buildBox +buildBox ### 移除精灵 @@ -50,25 +50,25 @@ label: Graphics/2D 左键选中需要从图集中移除的的`精灵`资产,可以在 **[检查器面板](/docs/interface/inspector)** 找到精灵的`从属关系`(注意需确认目标图集的路径是否匹配),点击移除按钮就可以从目标图集中移除该精灵。 -buildBox +buildBox #### 方式二:操作精灵图集 左键选中需要操作的`精灵图集`资产,可以在 **[检查器面板](/docs/interface/inspector)** 找到图集的精灵列表,找到要移除的精灵对象并点击移除按钮即可。 -buildBox +buildBox ### 快速操作精灵 `精灵`资产被加入`精灵图集`后,可以在`精灵图集`的 **[检查器面板](/docs/interface/inspector)** 中快速操作精灵,他的属性会同步修改到`精灵`资产中 -buildBox +buildBox ### 设置 #### 打包设置 -image-20231208165843716 +image-20231208165843716 | 设置名称 | 释义 | | ------------------ | ---------------------------------------- | @@ -80,11 +80,11 @@ label: Graphics/2D 若打包遇到如下警告,说明图集结果的尺寸超过了纹理最大宽度和最大高度,此时可通过调整`纹理最大宽度`与`纹理最大高度`或**重新编排**打包的散图解决。 - + #### 导出设置 -image-20231208165430415 +image-20231208165430415 | 属性 | 值 | | --- | --- | @@ -98,7 +98,7 @@ label: Graphics/2D 点击`精灵图集`资产,通过调整`打包设置`的`纹理最大宽度`与`纹理最大高度`,同时调用`打包对象`中的`打包并预览`,可以保证图集利用率在一个较高的水平。 -![image-20210901171947471](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*lyhRSY63HJgAAAAAAAAAAAAADjCHAQ/original) + 预览图中左侧表示导出图片的大小信息,右侧表示图集利用率信息(代表所有散图面积的和占用最终大图的面积百分比),可依据此值调整打包设置以达到较佳的结果。 @@ -122,7 +122,7 @@ galacean-tool-atlas p inputPath -o outputName 其中 `inputPath` 表示需要打包的文件夹路径,而 `outputName` 则表示打包输出的精灵图集文件名,如果你得到下图所示结果,那么说明打包成功了。 -image.png +image.png | 属性 | 解释 | | -------------- | -------------------------------------------- | diff --git a/docs/zh/graphics/2D/spriteMask.md b/docs/zh/graphics/2D/spriteMask.mdx similarity index 84% rename from docs/zh/graphics/2D/spriteMask.md rename to docs/zh/graphics/2D/spriteMask.mdx index 4aa093ba2f..d98a8d6b47 100644 --- a/docs/zh/graphics/2D/spriteMask.md +++ b/docs/zh/graphics/2D/spriteMask.mdx @@ -8,7 +8,7 @@ label: Graphics/2D 精灵遮罩组件用于对 3D/2D 场景中的[精灵渲染器](/docs/graphics/2D/spriteRenderer/)和[文字渲染器](/docs/graphics/2D/text/)实现遮罩效果。 - + 通过 [SpriteMask](/apis/core/#SpriteMask) 提供的参数来控制和 [精灵](/docs/graphics/2D/sprite/) 发生作用。 @@ -21,7 +21,7 @@ label: Graphics/2D `SpriteMask` 的 `influenceLayers` 表示该 mask 对处于哪些遮罩层内的 `SpriteRenderer` 会起到遮罩作用,`SpriteRenderer` 的 `maskLayer` 表示该精灵处于哪些遮罩层,如下: -070C8B9F-14E2-4A9A-BFEC-4BC3F2BB564F +070C8B9F-14E2-4A9A-BFEC-4BC3F2BB564F 上图中,spriteMask 对处于 `Layer1` 和 `Layer30` 的精灵有遮罩作用,spriteRenderer0 处于 `Layer2`,不存在交集,所以 spriteRenderer0 不与 spriteMask 起作用,spriteRenderer1 处于 `Layer1`,和 spriteMask 影响的遮罩层有交集,所以 spriteRenderer1 与 spriteMask 起作用。 @@ -31,25 +31,25 @@ label: Graphics/2D 当我们需要对一个精灵进行遮罩的时候,首先需要创建一个实体,并添加精灵遮罩组件,如下: -![mask-create](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*GYVBTbTvqU4AAAAAAAAAAAAADjCHAQ/original) + ### 设置遮罩区域 精灵遮罩组件通过图片来表示遮罩区域,这里我们通过组件的 `sprite` 参数来设置精灵资源,如下: -![mask-sprite](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*k5GsSYqQTKoAAAAAAAAAAAAADjCHAQ/original) + ### 设置精灵的遮罩类型 通过以上两个步骤,会发现遮罩还是没有任何效果,这是因为当前的精灵的遮罩类型还是默认的(None),我们设置场景中精灵的 `mask interaction` 为内遮罩类型,效果如下: -![mask-interaction](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*GdxhSYLY4EIAAAAAAAAAAAAADjCHAQ/original) + ### 设置 alpha cutoff 这个参数表示当前 mask 有效 `alpha` 值的下限(范围:`0~1`),即 sprite 的纹理中 alpha 值小于 alpha cutoff 的将被丢弃(也就是不会当作遮罩区域)。我们可以通过动态调整这个属性的值来看下实际效果,如下: -![mask-alpha](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*2CLjT7UTVa8AAAAAAAAAAAAADjCHAQ/original) + 同样的,在脚本中我们可以用如下代码使用精灵遮罩: diff --git a/docs/zh/graphics/2D/spriteRenderer.md b/docs/zh/graphics/2D/spriteRenderer.mdx similarity index 81% rename from docs/zh/graphics/2D/spriteRenderer.md rename to docs/zh/graphics/2D/spriteRenderer.mdx index 18d1e0fc65..df9abafb8a 100644 --- a/docs/zh/graphics/2D/spriteRenderer.md +++ b/docs/zh/graphics/2D/spriteRenderer.mdx @@ -10,11 +10,11 @@ label: Graphics/2D > 注意:精灵渲染器默认在 XoY 平面上放置图片。 -avatar +avatar ## 属性 -![属性面板](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*pcbLSahH--YAAAAAAAAAAAAADjCHAQ/original) + | 属性名 | 属性类型 | 描述 | | :----------------------------------------------------------- | :-------------------------------------------------------- | :------------------------------------------------------------------------------------------------ | @@ -36,13 +36,13 @@ label: Graphics/2D 通过在 **[层级面板](/docs/interface/hierarchy)** 选中某个节点,依次 **右键** -> **2D Object** -> **Sprite Renderer** 即可快速为选中节点添加一个装载了精灵渲染器的子节点。 -avatar +avatar #### 为节点挂载精灵渲染器 为已存在的节点挂载精灵渲染器,只需在选中节点的 **[检查器面板](/docs/interface/inspector)** ,依次选择 **Add Component** -> **2D** -> **Sprite Renderer** 即可为该节点挂载精灵渲染器。 -avatar +avatar #### 脚本创建 @@ -57,33 +57,33 @@ spriteRenderer.sprite = sprite; 需要显示图片的时候,需要先给一个实体添加精灵组件,然后设置精灵资产,如下: -avatar +avatar ### 渲染尺寸 设置 `SpriteRenderer` 的 `width` 与 `height` 可以明确指定精灵在三维空间中显示的尺寸,若没有设置,则会将 `Sprite` 的尺寸作为默认值。 - + ### 设置颜色 可以通过设置 `color` 属性来调整颜色,从而实现一些淡入淡出的效果,如下: -avatar +avatar ### 图片翻转 除了基本的图片显示,`SpriteRenderer` 还支持图片的翻转,只需要通过设置属性 `flipX/flipY` 即可完成翻转,如下: -avatar +avatar - + ### 绘制模式 精灵渲染器目前提供三种绘制模式,分别是普通绘制,九宫绘制与平铺绘制(默认为普通绘制),在不同的绘制模式下,修改绘制宽高可以直观地感受到各种模式之间的渲染差异,如下: - + ### 遮罩 @@ -93,4 +93,4 @@ spriteRenderer.sprite = sprite; 请参考[自定义着色器](/docs/graphics/shader/custom/)文档。 - + diff --git a/docs/zh/graphics/2D/text.md b/docs/zh/graphics/2D/text.mdx similarity index 92% rename from docs/zh/graphics/2D/text.md rename to docs/zh/graphics/2D/text.mdx index 9babdc145b..c1595d3bc9 100644 --- a/docs/zh/graphics/2D/text.md +++ b/docs/zh/graphics/2D/text.mdx @@ -14,12 +14,12 @@ label: Graphics/2D 需要显示文本的时候,需要先给一个实体添加文本组件,如下: -![添加文本组件](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*3d5AQYTtcNkAAAAAAAAAAAAADjCHAQ/original) + ### 参数说明 选中一个带有 TextRenderer 组件的实体,可以在右侧 inspector 中设置所有相关属性来对文本组件进行各种设置: -![添加文本组件](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*9XKjSYHZQWsAAAAAAAAAAAAADjCHAQ/original) + 属性说明如下: | 属性 | 功能说明 | @@ -44,17 +44,17 @@ label: Graphics/2D 添加完文本组件后,可以设置 Text 属性来显示需要的文本,如下: -![设置显示文本](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*J6nKTJOOm4kAAAAAAAAAAAAADjCHAQ/original) + ### 设置自定义字体 为了让文本的显示更为丰富,开发者可以上传自己的字体文件,目前编辑器支持的字体文件格式有:**.ttf**、**.otf**、**.woff** -![设置字体](https://mdn.alipayobjects.com/huamei_w6ifet/afts/img/A*CgA5S5vneeMAAAAAAAAAAAAADjCHAQ/original) + ## 脚本使用 - + 1、创建 [TextRenderer](/apis/core/#TextRenderer) 组件显示文本 2、通过 font 设置 [Font](/apis/core/#Font) 对象 @@ -160,7 +160,7 @@ textRenderer.fontStyle = FontStyle.Bold | FontStyle.Italic; ### 多行文本 - + ### 自定义字体 @@ -182,4 +182,4 @@ const font = await engine.resourceManager.load({ }); ``` - + diff --git a/docs/zh/graphics/background/background.md b/docs/zh/graphics/background/background.mdx similarity index 85% rename from docs/zh/graphics/background/background.md rename to docs/zh/graphics/background/background.mdx index 66243ce810..d045ac2187 100644 --- a/docs/zh/graphics/background/background.md +++ b/docs/zh/graphics/background/background.mdx @@ -14,8 +14,8 @@ label: Graphics/Background 开发者可依据自己的需求设置不同的背景: - + 在[天空盒](/docs/graphics/background/sky/)模式下,通过设置特定的网格和材质,可以实现各种定制背景,如`视频背景`: - + diff --git a/docs/zh/graphics/background/sky.md b/docs/zh/graphics/background/sky.mdx similarity index 90% rename from docs/zh/graphics/background/sky.md rename to docs/zh/graphics/background/sky.mdx index 3c6642cd93..7119309a63 100644 --- a/docs/zh/graphics/background/sky.md +++ b/docs/zh/graphics/background/sky.mdx @@ -20,19 +20,19 @@ label: Graphics/Background 天空盒纹理就是一张[立方纹理](/docs/graphics/texture/cube/),首先在准备好 HDR 后,依照路径 **[资产面板](/docs/assets/interface)** -> **右键上传** -> **选择 TextureCube(.hdr)** -> **选择对应 HDR 贴图** -> **立方纹理资产创建完毕** 操作即可。 -![image.png](https://mdn.alipayobjects.com/huamei_yo47yq/afts/img/A*Oi3FSLEEaYgAAAAAAAAAAAAADhuCAQ/original) + ### 2. 创建天空盒材质 创建完立方纹理资产后,依照路径 **[资产面板](/docs/assets/interface)** -> **右键创建** -> **选择 Material** -> **选中生成的资产** -> **[检查器面板](/docs/interface/inspector)** -> **点击 Base 栏的 Shader 属性** -> **选择 Sky Box** -> **点击 Base 栏的 HDR** -> **选择第一步创建的立方纹理** 创建天空盒材质。 -![image.png](https://mdn.alipayobjects.com/huamei_yo47yq/afts/img/A*9j2eSYkwg8MAAAAAAAAAAAAADhuCAQ/original) + ### 3. 设置天空盒 最后只需依照路径 **[层级面板](/docs/interface/hierarchy)** -> **选中 Scene** -> **[检查器面板](/docs/interface/inspector)** -> **Background 栏** -> **Mode 设置 Sky** -> **Material 选择第二步创建的材质** -> **Mesh 设置内置的 Cuboid** 可以看到场景的背景变成了天空盒。 -![image.png](https://mdn.alipayobjects.com/huamei_yo47yq/afts/img/A*rqvsSpkGJ6UAAAAAAAAAAAAADhuCAQ/original) + ### 代码设置天空盒 @@ -63,7 +63,7 @@ background.sky.mesh = PrimitiveMesh.createCuboid(engine, 2, 2, 2); 程序化天空是编辑器在 3D 项目中的默认背景,您也可以依照路径 **[层级面板](/docs/interface/hierarchy)** -> **选中 Scene** -> **[检查器面板](/docs/interface/inspector)** -> **Background 栏** -> **Mode 设置 Sky** -> **Material 选择内置的 SkyMat 材质** -> **Mesh 设置内置的 Sphere** -![image.png](https://mdn.alipayobjects.com/huamei_yo47yq/afts/img/A*Qe3IRJ9ciNoAAAAAAAAAAAAADhuCAQ/original) + ### 代码设置程序化天空 @@ -81,7 +81,7 @@ background.sky.mesh = PrimitiveMesh.createSphere(engine); 在大气散射材质的 **[检查器面板](/docs/interface/inspector)** 可以看到很多可调整的属性: -image-4 +image-4 > 内置的大气散射材质无法随意调整属性,开发者可以自行创建并调整。 diff --git a/docs/zh/graphics/background/solidColor.md b/docs/zh/graphics/background/solidColor.mdx similarity index 91% rename from docs/zh/graphics/background/solidColor.md rename to docs/zh/graphics/background/solidColor.mdx index 6c691027e2..765918b6f6 100644 --- a/docs/zh/graphics/background/solidColor.md +++ b/docs/zh/graphics/background/solidColor.mdx @@ -12,7 +12,7 @@ label: Graphics/Background 依据路径 **[层级面板](/docs/interface/hierarchy)** -> **选中 Scene** -> **[检查器面板](/docs/interface/inspector)** -> **Background 栏** 设置 **Mode** 为 **Solid Color**,然后选择期望的背景色,可以看到场景的背景发生实时变化。 -![image.png](https://mdn.alipayobjects.com/huamei_yo47yq/afts/img/A*RDQ-T5h7YdEAAAAAAAAAAAAADhuCAQ/original) + 同样的,在脚本中也可通过如下代码进行设置: diff --git a/docs/zh/graphics/background/texture.md b/docs/zh/graphics/background/texture.mdx similarity index 96% rename from docs/zh/graphics/background/texture.md rename to docs/zh/graphics/background/texture.mdx index 3ca6e2a1f8..30b2d94a77 100644 --- a/docs/zh/graphics/background/texture.md +++ b/docs/zh/graphics/background/texture.mdx @@ -12,7 +12,7 @@ label: Graphics/Background 依据路径 **[层级面板](/docs/interface/hierarchy)** -> **选中 Scene** -> **[检查器面板](/docs/interface/inspector)** -> **Background 栏** 设置 **Mode** 为 **Texture**,然后选择期望的纹理,可以看到场景的背景发生实时变化。 -![](https://gw.alipayobjects.com/zos/OasisHub/2673b2a2-a87b-4707-b3fc-9af334231298/2024-07-18%25252017.50.16.gif) + 同样的,在脚本中也可通过如下代码进行设置: diff --git a/docs/zh/graphics/light/ambient.md b/docs/zh/graphics/light/ambient.mdx similarity index 79% rename from docs/zh/graphics/light/ambient.md rename to docs/zh/graphics/light/ambient.mdx index 98321ba1fc..b58d339957 100644 --- a/docs/zh/graphics/light/ambient.md +++ b/docs/zh/graphics/light/ambient.mdx @@ -8,13 +8,13 @@ label: Graphics/Light 除了实时计算的直接光源,我们一般还要提前离线烘焙光照作为环境光照来实时采样,这种方式可以有效地捕捉环境的全局光照和氛围,使物体更好地融入其环境。 -![image-20231227151844040](https://gw.alipayobjects.com/zos/OasisHub/23397353-5434-4bde-ace7-72c8731d5581/image-20231227151844040.png) + ## 编辑器使用 ### 1. 环境漫反射 -image-20240219163916257 +image-20240219163916257 | 属性 | 作用 | | :-- | :-- | @@ -23,7 +23,7 @@ label: Graphics/Light ### 2. 环境镜面反射 -image-20240219163941010 +image-20240219163941010 | 属性 | 作用 | | :-- | :-- | diff --git a/docs/zh/graphics/light/bake.md b/docs/zh/graphics/light/bake.mdx similarity index 65% rename from docs/zh/graphics/light/bake.md rename to docs/zh/graphics/light/bake.mdx index 0b32df552e..5b144c3f85 100644 --- a/docs/zh/graphics/light/bake.md +++ b/docs/zh/graphics/light/bake.mdx @@ -8,7 +8,7 @@ label: Graphics/Light 烘焙指 Galacean 提前执行光照计算并将结果烘焙到二进制文件(包含[漫反射球谐参数](https://www.wikiwand.com/zh-hans/%E7%90%83%E8%B0%90%E5%87%BD%E6%95%B0)和[预滤波环境贴图](https://learnopengl-cn.github.io/07%20PBR/03%20IBL/02%20Specular%20IBL/)),然后在运行时实时采样。 -bake +bake 我们在[编辑器](https://galacean.antgroup.com/editor) 和 [glTF 查看器](https://galacean.antgroup.com/engine/gltf-viewer) 提供了烘焙工具。 @@ -18,26 +18,26 @@ label: Graphics/Light 编辑器默认打开自动烘焙,会在修改背景(颜色、曝光、旋转等配置)或者修改烘焙分辨率等操作后,自动进行烘焙。 -image-20240219164704802 +image-20240219164704802 也可以关闭自动烘焙,在需要的时候进行手动烘焙。 -image-20240219164728187 +image-20240219164728187 ### 2. 烘焙分辨率 表示烘焙后的预滤波环境贴图的分辨率,默认 128 分辨率,烘焙产物约为 500KB;64 分辨率的烘焙产物约为 125KB,可以根据场景选择合适的烘焙分辨率。 -image-20240219164802607 +image-20240219164802607 ### 3. 设置背景 参考 [背景教程](/docs/graphics/background/sky/) 设置完场景的背景后,编辑器会根据上面设置的烘焙分辨率和烘焙开关进行光照烘焙,期间针对背景的修改(颜色、旋转、曝光、换 HDR 贴图等)都会根据烘焙开关来决定是否自动烘焙。**如果想要设置纯色背景或者透明背景,但是又不想要烘焙纯色背景,可以先关闭自动烘焙开关,然后再切换到[纯色背景](/docs/graphics/background/solidColor/)。** -image-20231009114455268 +image-20231009114455268 ## glTF 查看器 我们在官网的 [glTF 查看器](https://galacean.antgroup.com/engine/gltf-viewer) 也提供了烘焙工具,直接拖拽 HDR 贴图到网页即可自动下载烘焙产物 : -![gltf viewer](https://gw.alipayobjects.com/mdn/rms_7c464e/afts/img/A*9mGbSpQ4HngAAAAAAAAAAAAAARQnAQ) + diff --git a/docs/zh/graphics/light/directional.md b/docs/zh/graphics/light/directional.mdx similarity index 90% rename from docs/zh/graphics/light/directional.md rename to docs/zh/graphics/light/directional.mdx index 8620ea1043..93e52126ec 100644 --- a/docs/zh/graphics/light/directional.md +++ b/docs/zh/graphics/light/directional.mdx @@ -8,7 +8,7 @@ label: Graphics/Light **方向光**表示的是光线从以某个方向均匀射出,光线之间是平行的,太阳照射在地球表面的光可以认为是方向光,因为太阳和地球距离的远大于地球半径,所以照射在地球的阳光可以看作是来自同一个方向的一组平行光,即方向光。 -image-20240319173643671 +image-20240319173643671 方向光有 3 个主要个特性:_颜色_([color](/apis/core/#DirectLight-color))、_强度_([intensity](/apis/core/#DirectLight-intensity))、_方向_([direction](/apis/core/#DirectLight-direction))。_方向_ 则由方向光所在的节点的朝向表示。 diff --git a/docs/zh/graphics/light/light.md b/docs/zh/graphics/light/light.mdx similarity index 93% rename from docs/zh/graphics/light/light.md rename to docs/zh/graphics/light/light.mdx index bfc8c1e4be..aa8bd60067 100644 --- a/docs/zh/graphics/light/light.md +++ b/docs/zh/graphics/light/light.mdx @@ -24,13 +24,13 @@ label: Graphics/Light 直接光一般从一个区域或者朝特定方向照射,经过一次反射直接进入眼睛(相机),如下案例: - + ## 间接光 环境光从四周发射进入眼睛,如下案例: - + ## 实时光照和烘焙光照 diff --git a/docs/zh/graphics/light/point.md b/docs/zh/graphics/light/point.mdx similarity index 89% rename from docs/zh/graphics/light/point.md rename to docs/zh/graphics/light/point.mdx index a70e10953f..0563004ce5 100644 --- a/docs/zh/graphics/light/point.md +++ b/docs/zh/graphics/light/point.mdx @@ -8,7 +8,7 @@ label: Graphics/Light **点光源**存在于空间中的一点,由该点向四面八方发射光线,比如生活中的灯泡就是点光源。 -image-20240319174317201 +image-20240319174317201 点光源有 3 个主要特性:_颜色_([color](/apis/core/#PointLight-color))、_强度_([intensity](/apis/core/#PointLight-intensity))、_有效距离_([distance](/apis/core/#PointLight-distance)))。超过有效距离的地方将无法接受到点光源的光线,并且离光源越远光照强度也会逐渐降低。 diff --git a/docs/zh/graphics/light/shadow.md b/docs/zh/graphics/light/shadow.mdx similarity index 84% rename from docs/zh/graphics/light/shadow.md rename to docs/zh/graphics/light/shadow.mdx index 8711af683c..20bab68826 100644 --- a/docs/zh/graphics/light/shadow.md +++ b/docs/zh/graphics/light/shadow.mdx @@ -10,7 +10,7 @@ label: Graphics/Light ## 场景配置 -image-20240730114010025 +image-20240730114010025 场景中拥有一些配置能够影响全局阴影: @@ -25,7 +25,7 @@ label: Graphics/Light ## 灯光配置 -image-20240724183629537 +image-20240724183629537 要投射阴影,需要场景中有[方向光](/docs/graphics/light/directional),引擎目前只能为一盏方向光 `DirectLight` 开启阴影,这主要是因为阴影的渲染使得 DrawCall 翻倍,会严重影响渲染的性能。在没有确定[主光(scene.sun)](/apis/core/#Scene-sun)的情况下,引擎会默认选择光强最强的那一盏灯投射阴影: @@ -39,7 +39,7 @@ label: Graphics/Light ## 投射物与接受物 -image-20240724184711014 +image-20240724184711014 在 [网格渲染器组件](/docs/graphics/renderer/meshRenderer) 中,`receiveShadows` 能够决定该物体是否接受阴影,`castShadows` 能够决定该物体是否投射阴影。 @@ -47,4 +47,4 @@ label: Graphics/Light 从 `1.3` 版本开始,引擎支持投射透明裁剪(Alpha Cutoff)物体和透明(Transparent)物体的阴影,其中,透明物体投射阴影需要在场景面板中打开 `Transparent` 开关: -![](https://gw.alipayobjects.com/zos/OasisHub/3c972121-d072-4d2c-ba87-2a9ec88c9268/2024-07-30%25252011.36.32.gif) + diff --git a/docs/zh/graphics/light/spot.md b/docs/zh/graphics/light/spot.mdx similarity index 92% rename from docs/zh/graphics/light/spot.md rename to docs/zh/graphics/light/spot.mdx index 4e163c5af5..6c3341d35f 100644 --- a/docs/zh/graphics/light/spot.md +++ b/docs/zh/graphics/light/spot.mdx @@ -8,7 +8,7 @@ label: Graphics/Light **聚光灯**就像现实生活中的手电筒发出的光,从某个点朝特定方向锥形发射。 -image-20240319174652884 +image-20240319174652884 聚光灯有几个主要特性:_颜色_([color](/apis/core/#SpotLight-color))、_强度_([intensity](/apis/core/#SpotLight-intensity))、_有效距离_([distance](/apis/core/#SpotLight-distance))、_散射角度_([angle](/apis/core/#SpotLight-angle))、_半影衰减角度_([penumbra](/apis/core/#SpotLight-penumbra))。散射角度表示与光源朝向夹角小于多少时有光线,半影衰减角度表示在有效的夹角范围内,随着夹角增大光照强度逐渐衰减至 0 。 diff --git a/docs/zh/graphics/material/composition.md b/docs/zh/graphics/material/composition.mdx similarity index 100% rename from docs/zh/graphics/material/composition.md rename to docs/zh/graphics/material/composition.mdx diff --git a/docs/zh/graphics/material/editor.md b/docs/zh/graphics/material/editor.mdx similarity index 57% rename from docs/zh/graphics/material/editor.md rename to docs/zh/graphics/material/editor.mdx index 1ad26ad3fc..9d65d398fd 100644 --- a/docs/zh/graphics/material/editor.md +++ b/docs/zh/graphics/material/editor.mdx @@ -6,17 +6,17 @@ title: 编辑器使用 ### 1. 手动创建材质 -image-20240206163405147 +image-20240206163405147 ### 2. 导入模型 参考[模型的导入和使用](/docs/graphics/model/use/)教程,我们可以先将模型导入到编辑器,一般情况下,模型已经自动绑定好材质,用户可以不用做任何操作;如果想要修改材质,我们需要点击 `duplicate & remap` 按钮来生成一份该材质的副本,然后再编辑该材质副本。 -remap +remap 切换着色器时不会重置着色器数据,比如基础颜色为红色,那么即使切换着色器,基础颜色仍为红色。 -image-20231009112713870 +image-20231009112713870 ### 3. 调整材质 diff --git a/docs/zh/graphics/material/material.md b/docs/zh/graphics/material/material.mdx similarity index 68% rename from docs/zh/graphics/material/material.md rename to docs/zh/graphics/material/material.mdx index c22eaa9ece..bf7bde7bbd 100644 --- a/docs/zh/graphics/material/material.md +++ b/docs/zh/graphics/material/material.mdx @@ -4,7 +4,7 @@ title: 材质总览 材质是指用于描述物体外观和表面特性的属性集合。材质决定了模型在渲染过程中如何与光线交互,从而影响其视觉呈现效果。 -image-20240206153815596 +image-20240206153815596 本节包含以下相关信息: diff --git a/docs/zh/graphics/material/script.md b/docs/zh/graphics/material/script.mdx similarity index 100% rename from docs/zh/graphics/material/script.md rename to docs/zh/graphics/material/script.mdx diff --git a/docs/zh/graphics/mesh/bufferMesh.md b/docs/zh/graphics/mesh/bufferMesh.mdx similarity index 96% rename from docs/zh/graphics/mesh/bufferMesh.md rename to docs/zh/graphics/mesh/bufferMesh.mdx index 99a0c217d6..f8e36a73a5 100644 --- a/docs/zh/graphics/mesh/bufferMesh.md +++ b/docs/zh/graphics/mesh/bufferMesh.mdx @@ -12,7 +12,7 @@ label: Graphics/Mesh 我们先概览一下 `BufferMesh`  的原理图 -![image.png](https://gw.alipayobjects.com/mdn/rms_7c464e/afts/img/A*piB3Q4501loAAAAAAAAAAAAAARQnAQ) + `BufferMesh`  有三大核心元素分别是: @@ -30,7 +30,7 @@ label: Graphics/Mesh ### 交错顶点缓冲 - + 常用方式,比如自定义 Mesh、Particle 等实现,具有显存紧凑,每帧 CPU 数据上传至 GPU 次数少等优势。这个案例的主要特点是多个 [VertexElement](/apis/core/#VertexElement)  对应一个 *VertexBuffer* ([Buffer](/apis/core/#Buffer)),仅使用一个 *VertexBuffer*  就可以将不同顶点元素与 Shader 关联。 @@ -65,7 +65,7 @@ renderer.mesh = mesh; ### 独立顶点缓冲 - + 动态顶点 buffer 和静态顶点 buffer 混用时具有优势,比如 _position_ 为静态,但 _color_ 为动态,独立顶点缓冲可以仅更新颜色数据至 GPU。这个案例的主要特点是一个 [VertexElement](/apis/core/#VertexElement) 对应一个 _VertexBuffer_ ,可以分别调用 [Buffer](/apis/core/#Buffer)  对象的 [setData](/apis/core/#Buffer-setData)  方法独立更新数据。 @@ -109,7 +109,7 @@ renderer.mesh = mesh; ### Instance 渲染 - + GPU Instance 渲染是三维引擎的常用技术,比如可以把相同几何体形状的物体一次性渲染到不同的位置,可以大幅提升渲染性能。这个案例的主要特点是使用了 [VertexElement](/apis/core/#VertexElement) 的实例功能,其构造函数的最后一个参数表示实例步频(在缓冲中每前进一个顶点绘制的实例数量,非实例元素必须为 0),[BufferMesh](/apis/core/#BufferMesh)  的 [instanceCount](/apis/core/#BufferMesh-instanceCount)  表示实例数量。 diff --git a/docs/zh/graphics/mesh/mesh.md b/docs/zh/graphics/mesh/mesh.mdx similarity index 94% rename from docs/zh/graphics/mesh/mesh.md rename to docs/zh/graphics/mesh/mesh.mdx index 3a97ac0df4..37f70380f0 100644 --- a/docs/zh/graphics/mesh/mesh.md +++ b/docs/zh/graphics/mesh/mesh.mdx @@ -20,7 +20,7 @@ label: Graphics/Mesh 当需要为网格渲染器设置网格时,只需要选择对应的网格资产即可。 -import +import 相应的,在脚本中,网格的使用会更加自由,同时复杂度也会高一些,首先我们看下 diff --git a/docs/zh/graphics/mesh/modelMesh.md b/docs/zh/graphics/mesh/modelMesh.mdx similarity index 95% rename from docs/zh/graphics/mesh/modelMesh.md rename to docs/zh/graphics/mesh/modelMesh.mdx index 058e1c3166..aae3b24078 100644 --- a/docs/zh/graphics/mesh/modelMesh.md +++ b/docs/zh/graphics/mesh/modelMesh.mdx @@ -8,7 +8,7 @@ label: Graphics/Mesh [ModelMesh](/apis/core/#ModelMesh) 是一个用于描述几何体轮廓的网状渲染数据类,主要包含了顶点(位置、法线和 UV 等)、索引和混合形状等数据。不仅可以使用建模软件制作并导出 glTF 在引擎中解析还原,还可以方便的使用脚本直接写入数据创建。 - + ## 代码示例 @@ -85,7 +85,7 @@ modelMesh.uploadData(false); 相比于高级数据,通过低级接口设置数据可以自由操作顶点缓冲数据,不仅灵活还可能带来性能提升。但需要理解 Vertex Buffer 和 Vertex Element 之间的关系,如下图: -![image.png](https://mdn.alipayobjects.com/huamei_jvf0dp/afts/img/A*68IjSo2kwUAAAAAAAAAAAAAADleLAQ/original) + ```typescript const pos = new Float32Array([1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0]); @@ -134,7 +134,7 @@ modelMesh.uploadData(true); modelMesh.uploadData(false); ``` - + ### **读取高级数据** @@ -173,10 +173,10 @@ const result = mesh.getPositions(); `BlendShape` 通常用于制作精细程度非常高的动画,比如表情动画等。其原理也比较简单,主要通过权重混合基础形状和目标形状的网格数据来表现形状之间过渡的动画效果。 **glTF 导入 BlendShape 动画案例:** - + **脚本自定义 BlendShape 动画案例:** - + ### 详细步骤 diff --git a/docs/zh/graphics/mesh/primitiveMesh.md b/docs/zh/graphics/mesh/primitiveMesh.mdx similarity index 86% rename from docs/zh/graphics/mesh/primitiveMesh.md rename to docs/zh/graphics/mesh/primitiveMesh.mdx index e039ae0b9c..8208d0123b 100644 --- a/docs/zh/graphics/mesh/primitiveMesh.md +++ b/docs/zh/graphics/mesh/primitiveMesh.mdx @@ -12,19 +12,19 @@ label: Graphics/Mesh 编辑器已经内置了`立方体`、`球`、`圆柱体` 等基础几何体,可以直接在左侧节点树点击 `+` 置入模型: -image-20231009111916680 +image-20231009111916680 当然,我们也可以在组件面板点击 `1` 添加 `Mesh Renderer`组件,点击 `2` 绑定想要的基础几何体: -image-20231009112014068 +image-20231009112014068 内置几何体无法满足需求?您可以在 **[资产面板](/docs/assets/interface)** 中 **右键** → **Create** → **PrimitiveMesh** 创建一个 `Mesh` 资产,并通过调整 `Mesh` 的各项参数来满足需求。 -image-20231009111916680 +image-20231009111916680 ## 脚本使用 - + 目前提供的几何体如下: diff --git a/docs/zh/graphics/model/assets.md b/docs/zh/graphics/model/assets.mdx similarity index 70% rename from docs/zh/graphics/model/assets.md rename to docs/zh/graphics/model/assets.mdx index 1c658e9de6..c5a4a7ed7b 100644 --- a/docs/zh/graphics/model/assets.md +++ b/docs/zh/graphics/model/assets.mdx @@ -8,7 +8,7 @@ label: Graphics/Model 模型导入完毕后, **[资产面板](/docs/assets/interface)** 中会新增导入的模型资产,点击资产缩略图,可以看到这个模型的基本信息。 -image-20231009112328575 +image-20231009112328575 | 区域 | 功能 | 解释 | | :--------- | :--------------- | :----------------------------------------------------------------- | @@ -25,13 +25,13 @@ label: Graphics/Model 将鼠标悬停在模型资产缩略图上,点击右侧出现的三角按钮,模型资产包含的网格、贴图、动画、材质等子资产信息都会被展示在资源面板当中。 -image-20231009112328575 +image-20231009112328575 ### 网格子资产 点击网格子资产缩略图,可以看到网格的基本信息如下: -image-20231009112328575 +image-20231009112328575 | 区域 | 功能 | 解释 | | :------- | :----------- | :----------------------- | @@ -42,20 +42,20 @@ label: Graphics/Model 纹理子资产的基本信息与[纹理](/docs/graphics/texture/texture/)资产唯一的区别是纹理信息基本都是只读的。 -image-20231009112328575 +image-20231009112328575 ### 材质子资产 同理,[材质](/docs/graphics/material/material/)子资产也是如此: -image-20231009112328575 +image-20231009112328575 一般情况下,用户不用对模型自带的材质做任何操作;但是在一定场景下,开发者可能想要手动微调材质,比如修改颜色,那么我们可以将原材质进行复制,即点击 **duplicate & remap**,然后就可以在原材质参数的基础上进行修改: -image-20231009112328575 +image-20231009112328575 ### 动画子资产 动画子资产以[动画片段](/docs/animation/clip)的形式出现在模型资产中,它也是**只读**的。 -image-20231009112328575 +image-20231009112328575 diff --git a/docs/zh/graphics/model/glTF.md b/docs/zh/graphics/model/glTF.mdx similarity index 97% rename from docs/zh/graphics/model/glTF.md rename to docs/zh/graphics/model/glTF.mdx index e05b638fff..e9337e049a 100644 --- a/docs/zh/graphics/model/glTF.md +++ b/docs/zh/graphics/model/glTF.mdx @@ -12,7 +12,7 @@ label: Graphics/Model ## 生态 -image-20231009112129853 +image-20231009112129853 ## 导出产物 @@ -35,7 +35,7 @@ glTF 的导出产物一般分为两种: glTF 拥有非常多的特性,官网提供了大量的[示例](https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0)进行参考,Galacean 也提供了一份复刻版本进行快速浏览,可以通过以下 **glTF List** 切换不同的 glTF 模型。 - + ### 插件支持 diff --git a/docs/zh/graphics/model/importGlTF.md b/docs/zh/graphics/model/importGlTF.mdx similarity index 71% rename from docs/zh/graphics/model/importGlTF.md rename to docs/zh/graphics/model/importGlTF.mdx index f478e0d529..b9d0d952d0 100644 --- a/docs/zh/graphics/model/importGlTF.md +++ b/docs/zh/graphics/model/importGlTF.mdx @@ -20,19 +20,18 @@ label: Graphics/Model 把模型文件,或者压缩成的 **.zip** 文件拖进资源面板: -import +import ## 按钮上传 点击右上角 **资源面板** -> **GLTF/GLB/FBX** -image-20231009112129853 +image-20231009112129853 ## 右键上传 依照 **资源面板** -> **右键** -> **Upload** -> **GLTF/GLB/FBX** -image-20231009112129853 +image-20231009112129853 导入完毕后, **[资产面板](/docs/assets/interface)** 中就会新增导入的模型资产,让我们[看看模型资产包含了什么内容](/docs/graphics/model/assets/)吧。 diff --git a/docs/zh/graphics/model/model.md b/docs/zh/graphics/model/model.mdx similarity index 100% rename from docs/zh/graphics/model/model.md rename to docs/zh/graphics/model/model.mdx diff --git a/docs/zh/graphics/model/opt.md b/docs/zh/graphics/model/opt.mdx similarity index 83% rename from docs/zh/graphics/model/opt.md rename to docs/zh/graphics/model/opt.mdx index 7516ed5d51..e5b1abf406 100644 --- a/docs/zh/graphics/model/opt.md +++ b/docs/zh/graphics/model/opt.mdx @@ -19,6 +19,6 @@ label: Graphics/Model 1. 使用 [Quantize](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_mesh_quantization/README.md) 来压缩网格数据,在导出项目时勾选 GlTF Quantize 选项, 对网格进行量化压缩 1. 使用 [Meshopt](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_meshopt_compression/README.md) 进一步压缩网格数据 -image-20240228171935612 +image-20240228171935612 压缩可能会对模型网格精度造成一些影响,不过大部分情况下,肉眼很难区分。 diff --git a/docs/zh/graphics/model/restoration.md b/docs/zh/graphics/model/restoration.mdx similarity index 76% rename from docs/zh/graphics/model/restoration.md rename to docs/zh/graphics/model/restoration.mdx index ae7e7479b8..f61131116f 100644 --- a/docs/zh/graphics/model/restoration.md +++ b/docs/zh/graphics/model/restoration.mdx @@ -6,7 +6,7 @@ group: 模型 label: Graphics/Model --- -![image.png](https://gw.alipayobjects.com/zos/OasisHub/5dd84590-7c37-4156-bb1a-498207880c75/1635493348596-92184a82-6aaa-4ab8-95e5-2d88762df213.png) + ## 背景 @@ -46,25 +46,25 @@ Galacean 引擎目前有 3 种方式调试材质: 值得一提的是,虽然算法不同会造成一定的视觉差异,但是其物理规律还是一致的。比如,金属度越大,环境反射越强,漫反射越弱;粗糙度越大,环境反射越模糊,如下图: -![image.png](https://gw.alipayobjects.com/zos/OasisHub/ddfe44e2-c9ab-4692-b62f-b43b8965ee4c/1635432936926-b26c9652-6d95-4160-9743-b954025dfe32.png) + ### 光照差异 跟现实世界一样,3D 场景也可以添加[直接光与环境光](/docs/graphics/light/light/)。Galacean 场景中默认是**没有**光源的,只有一个偏向蓝色的[纯色漫反射](/apis/core/#AmbientLight-diffuseSolidColor),如下图左一;而很多建模软件中是自带光源的: -![image.png](https://gw.alipayobjects.com/zos/OasisHub/391e9bd9-945d-474d-b3fb-8cb0490e2b6f/1635434650361-60d7f40f-9f22-4e48-8865-141415d638f9.png) + 环境光基于 [立方纹理](/docs/graphics/texture/cube) 开启 IBL 模式,需要绑定一张 HDRI 贴图用来模拟周边环境,可以从[网上下载](https://polyhaven.com/hdris)。Galacean 场景中默认是没有绑定 HDRI 贴图的,而很多建模软件是自带了一张比较好看的周边环境的: -![image.png](https://gw.alipayobjects.com/zos/OasisHub/61c2287b-0793-4763-a5f5-70567fcdf106/1635477315862-08b0c680-029b-400b-8600-1d8cf7a20c60.png) + ### glTF 支持度差异 Galacean 引擎和建模软件的连通渠道是 [glTF 文件](/docs/graphics/model/glTF/)。glTF 支持标准的 [PBR 属性](https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#reference-material-pbrmetallicroughness)和[通用材质属性](https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#reference-material),并支持 [ClearCoat](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_clearcoat) 等插件,如下图。因此建模软件中的操作只要能导出到 glTF,引擎都能通过加载器加载,而那些额外的操作,比如 [vRay](https://www.chaosgroup.com/cn/vray/3ds-max) 材质的一些参数,是无法导出到 glTF 文件的。 -![image.png](https://gw.alipayobjects.com/zos/OasisHub/2010b748-ab8b-4e46-8b15-3aee4daa71f9/1635434775734-f8454efe-d268-4f80-87ab-40f1cddf96ea.png) + -![image.png](https://gw.alipayobjects.com/zos/OasisHub/acd35018-dc09-404b-a735-85a981384df1/1635434736607-cc408f27-a7d7-4a30-a7ea-e083f209d2c9.png) + ## 解决方法 @@ -76,11 +76,11 @@ Galacean 引擎和建模软件的连通渠道是 [glTF 文件](/docs/graphics/mo 前面说到,引擎默认不带直接光,那么保持还原度最简单的方法,就是删除建模软件中的灯光,保证建模软件和 Galacean 引擎中都只有环境光(性能最好)。 -image.png +image.png 如果某些场景确实需要添加直接光,那么请保证建模软件可以导出 [glTF 灯光插件](https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_lights_punctual) (Google 搜索关键词 "\***\* 建模软件 KHR_lights_punctual" ),比如 Blender 导出 glTF 的时候勾选上 **Punctual Lights。\*\* -image.png +image.png 如果建模软件不支持导出该光照插件,可以中转到 Blender 进行导出,或者和开发人员口头描述一下光照数据。 @@ -88,13 +88,13 @@ Galacean 引擎和建模软件的连通渠道是 [glTF 文件](/docs/graphics/mo 前面说到,引擎默认不带环境贴图,即 HDRI 贴图,但是建模软件一般都是自带的,比如 Blender: -image.png +image.png 我们可以先从[网上下载](https://polyhaven.com/hdris)喜欢的 HDRI 图片,然后在建模软件中进行调试,觉得满意后,将该最终 HDRI 交付给开发人员(因为 glTF 不支持导出 HDR)。 在建模软件中绑定环境贴图的方法很简单,可以 Google 搜索关键词 "\*\*\* 建模软件 environment IBL" ,拿 Blender 举例: -image.png +image.png ### 实时渲染方案 @@ -106,19 +106,19 @@ Galacean 引擎和建模软件的连通渠道是 [glTF 文件](/docs/graphics/mo 前面说到 Galacean PBR 使用的是 **Cook-Torrance BRDF** 反射率方程,在 Blender 中比较接近的是 Principled BSDF - GGX 算法: -image.png +image.png 可以通过 [Blender 官网教程](https://docs.blender.org/manual/en/2.80/addons/io_scene_gltf2.html#)参考如何调试可以导出到 glTF 的材质参数,其他建模软件同理,可以 Google 搜索关键词 “\*\*\* 建模软件 export glTF”。 还有一个比较简便的参考方式,就是在建模软件里面导入 glTF demo([点击下载](https://gw.alipayobjects.com/os/bmw-prod/85faf9f8-8030-45b2-8ba3-09a61b3db0c3.glb)),这个 demo 里面的 PBR 属性比较全面,可以参考着调试,比如 Blender 导入后,材质面板显示如下: -![image.png](https://gw.alipayobjects.com/zos/OasisHub/6643f12a-6226-490f-b853-f962a38cb09b/1635499476109-753aae7a-5ffa-4d52-ace1-4eaaef81919f.png) + - 校验导出 导出 glTF 后,可以将文件拖拽到 [glTF 查看器](https://galacean.antgroup.com/engine/gltf-viewer) 中,查看相应的颜色、纹理、参数等是否正确: -image.png +image.png ### 烘焙方案 diff --git a/docs/zh/graphics/model/use.md b/docs/zh/graphics/model/use.mdx similarity index 89% rename from docs/zh/graphics/model/use.md rename to docs/zh/graphics/model/use.mdx index 15fea2188b..3b7d7c7336 100644 --- a/docs/zh/graphics/model/use.md +++ b/docs/zh/graphics/model/use.mdx @@ -15,7 +15,7 @@ label: Graphics/Model > 编辑器不能直接调整模型节点的 scale 属性, 所以通常情况下, 你需要把模型节点拖拽到一个 entity 节点下, 然后调整 entity 节点的 scale 属性。 -import +import 这种情况下,在运行时只需寻找场景中特定的节点即可获取对应的模型对象。 @@ -43,7 +43,7 @@ engine.resourceManager 在编辑器中,可以直接获取模型资产的 URL ( **[资产面板](/docs/assets/interface)** -> **右键模型资产缩略图** -> **Copy file info / Copy relative path**): -import +import 没有导入编辑器的模型,对应的 URL 就是存放模型资产的路径。 @@ -63,13 +63,13 @@ this.engine.resourceManager } ``` -image-20240313112859472 +image-20240313112859472 ## 使用模型 加载完毕的模型对象会返回包含了渲染信息和动画信息的根节点,它的使用和普通节点没有什么区别。 - + ### 1. 选择场景根节点 diff --git a/docs/zh/graphics/particle/renderer-animation-module.md b/docs/zh/graphics/particle/renderer-animation-module.mdx similarity index 91% rename from docs/zh/graphics/particle/renderer-animation-module.md rename to docs/zh/graphics/particle/renderer-animation-module.mdx index 17bcbdb528..4d1852e607 100644 --- a/docs/zh/graphics/particle/renderer-animation-module.md +++ b/docs/zh/graphics/particle/renderer-animation-module.mdx @@ -8,7 +8,7 @@ label: Graphics/Particle [`TextureSheetAnimationModule`](/apis/core/#TextureSheetAnimationModule) 继承自 `ParticleGeneratorModule`,用于控制粒子系统的纹理表动画。 -avatar +avatar ## 属性 diff --git a/docs/zh/graphics/particle/renderer-color-module.md b/docs/zh/graphics/particle/renderer-color-module.mdx similarity index 71% rename from docs/zh/graphics/particle/renderer-color-module.md rename to docs/zh/graphics/particle/renderer-color-module.mdx index 0c7d93cb48..e6b8461153 100644 --- a/docs/zh/graphics/particle/renderer-color-module.md +++ b/docs/zh/graphics/particle/renderer-color-module.mdx @@ -8,7 +8,7 @@ label: Graphics/Particle [`ColorOverLifetimeModule`](/apis/core/#ColorOverLifetimeModule) 继承自 `ParticleGeneratorModule`,用于处理粒子系统的生命周期内的颜色变化。 -avatar +avatar ## 属性 @@ -20,4 +20,4 @@ label: Graphics/Particle 对于 [ParticleCompositeGradient](/apis/core/#ParticleCompositeGradient) 对象,编辑器内置了渐变编辑器。渐变条上方代表颜色 key,下方代表 alpha 值 key。每个 key 在渐变条的位置代表其时间。双击现有 key 可以新建 key,长按 key 并向下拖动可以删除 key。 -avatar avatar +avatar avatar diff --git a/docs/zh/graphics/particle/renderer-emission-module.md b/docs/zh/graphics/particle/renderer-emission-module.mdx similarity index 95% rename from docs/zh/graphics/particle/renderer-emission-module.md rename to docs/zh/graphics/particle/renderer-emission-module.mdx index d8717ba3de..c1df47fecd 100644 --- a/docs/zh/graphics/particle/renderer-emission-module.md +++ b/docs/zh/graphics/particle/renderer-emission-module.mdx @@ -8,7 +8,7 @@ label: Graphics/Particle [EmissionModule](/apis/core/#EmissionModule) 是 `ParticleGeneratorModule` 的发射模块。该模块用于处理粒子系统的发射行为,包括粒子发射速率、发射形状以及爆破(burst)行为等。 -avatar +avatar ## 属性 diff --git a/docs/zh/graphics/particle/renderer-main-module.md b/docs/zh/graphics/particle/renderer-main-module.mdx similarity index 96% rename from docs/zh/graphics/particle/renderer-main-module.md rename to docs/zh/graphics/particle/renderer-main-module.mdx index 7a5053a6a0..0068319291 100644 --- a/docs/zh/graphics/particle/renderer-main-module.md +++ b/docs/zh/graphics/particle/renderer-main-module.mdx @@ -8,11 +8,11 @@ label: Graphics/Particle [MainModule](/apis/core/#MainModule) 是 `ParticleGeneratorModule` 的主模块,包含了最基本的粒子生成参数。这些属性大多用于控制新创建的粒子的初始状态。 -avatar +avatar ## 属性 - + 你可以在提供的示例中逐个调试各项属性,帮助你更好地理解和掌控粒子住模块,从而实现各种复杂和精美的视觉效果。 diff --git a/docs/zh/graphics/particle/renderer-rotation-module.md b/docs/zh/graphics/particle/renderer-rotation-module.mdx similarity index 90% rename from docs/zh/graphics/particle/renderer-rotation-module.md rename to docs/zh/graphics/particle/renderer-rotation-module.mdx index 2721b936b0..6e518a11bf 100644 --- a/docs/zh/graphics/particle/renderer-rotation-module.md +++ b/docs/zh/graphics/particle/renderer-rotation-module.mdx @@ -8,7 +8,7 @@ label: Graphics/Particle [`RotationOverLifetimeModule`](/apis/core/#RotationOverLifetimeModule) 继承自 `ParticleGeneratorModule`,用于控制粒子系统的生命周期内的旋转变化。 -avatar +avatar ## 属性 diff --git a/docs/zh/graphics/particle/renderer-size-module.md b/docs/zh/graphics/particle/renderer-size-module.mdx similarity index 87% rename from docs/zh/graphics/particle/renderer-size-module.md rename to docs/zh/graphics/particle/renderer-size-module.mdx index 586f55a871..b36a08752b 100644 --- a/docs/zh/graphics/particle/renderer-size-module.md +++ b/docs/zh/graphics/particle/renderer-size-module.mdx @@ -8,7 +8,7 @@ label: Graphics/Particle [`SizeOverLifetimeModule`](/apis/core/#SizeOverLifetimeModule) 是 `ParticleGeneratorModule` 的子类,用于处理粒子系统的生命周期内的大小变化。 -avatar +avatar ## 属性 @@ -24,7 +24,7 @@ label: Graphics/Particle 针对[ ParticleCompositeCurve](/apis/core/#ParticleCompositeCurve) 对象,在编辑器内置了折线编辑器,可视化调整曲线。 -avatar +avatar 或者在代码中: diff --git a/docs/zh/graphics/particle/renderer-velocity-module.md b/docs/zh/graphics/particle/renderer-velocity-module.mdx similarity index 90% rename from docs/zh/graphics/particle/renderer-velocity-module.md rename to docs/zh/graphics/particle/renderer-velocity-module.mdx index 6ce5f6dcec..50bab5099c 100644 --- a/docs/zh/graphics/particle/renderer-velocity-module.md +++ b/docs/zh/graphics/particle/renderer-velocity-module.mdx @@ -10,7 +10,7 @@ label: Graphics/Particle [`VelocityOverLifetimeModule`](/apis/core/#VelocityOverLifetimeModule) 继承自 `ParticleGeneratorModule`,用于控制粒子系统的生命周期内的速度变化。 -avatar +avatar ## 属性 diff --git a/docs/zh/graphics/particle/renderer.md b/docs/zh/graphics/particle/renderer.mdx similarity index 82% rename from docs/zh/graphics/particle/renderer.md rename to docs/zh/graphics/particle/renderer.mdx index 7b97bcc907..0ad33b6c86 100644 --- a/docs/zh/graphics/particle/renderer.md +++ b/docs/zh/graphics/particle/renderer.mdx @@ -8,17 +8,17 @@ label: Graphics/Particle Galacean Engine 的粒子(粒子渲染器) [ParticleRenderer](/apis/core/#ParticleRenderer) 是常用的渲染组件,具备丰富的属性,通过调节各个属性值达到绚丽多彩的粒子效果。 -![avatar](https://mdn.alipayobjects.com/huamei_qbugvr/afts/img/A*oPEmTqfD_asAAAAAAAAAAAAADtKFAQ/original) + ## 组件 粒子组件可以通过层级树面板上方的快捷方式,或检查器面板的添加组件挂载于场景中已激活的 Entity 上。 -![avatar](https://mdn.alipayobjects.com/huamei_qbugvr/afts/img/A*fD8iTZUbiI4AAAAAAAAAAAAADtKFAQ/original) + 添加完毕后,可以在检查器面板查看粒子属性。视图窗口的左下角的粒子面板可以控制粒子效果的在视图窗口的播放。 -![avatar](https://mdn.alipayobjects.com/huamei_qbugvr/afts/img/A*KekfSb89BSIAAAAAAAAAAAAADtKFAQ/original) + 您也可以在脚本中挂载粒子组件。 @@ -35,7 +35,7 @@ let particleRenderer = particleEntity.addComponent(ParticleRenderer); 编辑器中通过 添加材质 - 选择粒子材质 创建。编辑完成后回到粒子观察器面板中选择该材质进行使用。 -avatar +avatar 或者在脚本中: @@ -56,7 +56,7 @@ particleRenderer.setMaterial(material); 需要注意的是,在该面板上对粒子播放的调整,仅为视图窗口的预览服务,并不改变该粒子组件的属性。如果需要改变粒子的播放相关属性,需要在观察器面板调整。 -avatar +avatar | 预览播放选项 | 释义 | | ------------ | ------------------------------------------ | @@ -83,7 +83,7 @@ particleRenderer.generator.main.simulationSpeed = 2; ## 其他参数 -avatar +avatar | 属性 | 释义 | | --- | --- | diff --git a/docs/zh/graphics/renderer/meshRenderer.md b/docs/zh/graphics/renderer/meshRenderer.mdx similarity index 93% rename from docs/zh/graphics/renderer/meshRenderer.md rename to docs/zh/graphics/renderer/meshRenderer.mdx index 5516b52073..c57cb47e14 100644 --- a/docs/zh/graphics/renderer/meshRenderer.md +++ b/docs/zh/graphics/renderer/meshRenderer.mdx @@ -8,7 +8,7 @@ label: Graphics/Renderer [MeshRenderer](/apis/core/#MeshRenderer) 是网格渲染器组件, 使用网格对象(如立方体)作为几何体轮廓的数据源。当一个实体挂载了网格渲染组件,只需设置它的 `mesh` 与 `material` 即可渲染物体。 - + ## 使用 @@ -33,7 +33,7 @@ cube.setMaterial(new BlinnPhongMaterial(engine)); 在编辑器中,可以很方便地设置网格渲染器的属性。 -image-20231007153753006 +image-20231007153753006 | 设置 | 解释 | | :--------------- | :------------------------------------------------- | diff --git a/docs/zh/graphics/renderer/order.md b/docs/zh/graphics/renderer/order.mdx similarity index 92% rename from docs/zh/graphics/renderer/order.md rename to docs/zh/graphics/renderer/order.mdx index e6f77b0dd3..c4bcf1a983 100644 --- a/docs/zh/graphics/renderer/order.md +++ b/docs/zh/graphics/renderer/order.mdx @@ -48,7 +48,7 @@ flowchart TD 渲染器组件包围盒到相机距离的计算方式取决于[相机](/docs/graphics/camera/camera/)的类型。在正交相机中,是渲染器包围盒中心点与摄像机沿着摄像机视图方向的距离,在透视相机中,是渲染器包围盒中心点与摄像机位置的直接距离。 -到相机距离示意图 +到相机距离示意图 > 需要注意的是,不同渲染队列中,距离对渲染顺序的影响规则是不同的,在非透明渲染队列和透明裁剪渲染队列中中,渲染的顺序都是**由近到远**,而在透明渲染队列中,渲染的顺序则为**由远到近**。 diff --git a/docs/zh/graphics/renderer/renderer.md b/docs/zh/graphics/renderer/renderer.mdx similarity index 98% rename from docs/zh/graphics/renderer/renderer.md rename to docs/zh/graphics/renderer/renderer.mdx index e51420c3f9..13ccb1682d 100644 --- a/docs/zh/graphics/renderer/renderer.md +++ b/docs/zh/graphics/renderer/renderer.mdx @@ -50,7 +50,7 @@ console.log("isCulled", renderer.isCulled); 下方展示如何获取多个 `Renderer` 的整体包围盒: - + ## 方法 diff --git a/docs/zh/graphics/renderer/skinnedMeshRenderer.md b/docs/zh/graphics/renderer/skinnedMeshRenderer.mdx similarity index 89% rename from docs/zh/graphics/renderer/skinnedMeshRenderer.md rename to docs/zh/graphics/renderer/skinnedMeshRenderer.mdx index 0020081680..11fcb81edc 100644 --- a/docs/zh/graphics/renderer/skinnedMeshRenderer.md +++ b/docs/zh/graphics/renderer/skinnedMeshRenderer.mdx @@ -23,8 +23,8 @@ label: Graphics/Renderer ## 骨骼动画 - + ## BlendShape - + diff --git a/docs/zh/graphics/shader/builtins/blinnPhong.md b/docs/zh/graphics/shader/builtins/blinnPhong.mdx similarity index 91% rename from docs/zh/graphics/shader/builtins/blinnPhong.md rename to docs/zh/graphics/shader/builtins/blinnPhong.mdx index e4b827ab4f..c172570110 100644 --- a/docs/zh/graphics/shader/builtins/blinnPhong.md +++ b/docs/zh/graphics/shader/builtins/blinnPhong.mdx @@ -4,11 +4,11 @@ title: Blinn Phong [BlinnPhongMaterial](/apis/core/#BlinnPhongMaterial) 材质是经典的材质之一,虽然不是基于物理渲染,但是其高效的渲染算法和基本齐全的光学部分,流传至今仍可以适用很多的场景。 - + ## 编辑器使用 -blinn +blinn ## 参数介绍 diff --git a/docs/zh/graphics/shader/builtins/unlit.md b/docs/zh/graphics/shader/builtins/unlit.mdx similarity index 62% rename from docs/zh/graphics/shader/builtins/unlit.md rename to docs/zh/graphics/shader/builtins/unlit.mdx index 456b1282f7..720457ce89 100644 --- a/docs/zh/graphics/shader/builtins/unlit.md +++ b/docs/zh/graphics/shader/builtins/unlit.mdx @@ -4,11 +4,11 @@ title: Unlit 在一些简单的场景中,可能不希望计算光照,引擎提供了 [UnlitMaterial](/apis/core/#UnlitMaterial),使用了最精简的 shader 代码,只需要提供颜色或者纹理即可渲染。Unlit 材质适用于烘焙好的模型渲染,它只需要设置一张基本纹理或者颜色,即可展现离线渲染得到的高质量渲染结果,但是缺点是无法实时展现光影交互,因为 Unlit 由纹理决定渲染,不受任何光照影响。 - + ## 编辑器使用 -unlit +unlit ## 参数介绍 @@ -24,7 +24,7 @@ title: Unlit 如[烘焙教程](/docs/art/bake-blender)介绍,如果我们已经制作完了烘焙贴图,希望有一种**便捷材质**,颜色只由烘焙纹理影响,不用添加灯光,不用调试法线,也不用调试金属粗糙度等高阶属性,那么你可以试试 Galacean 的 [UnlitMaterial](/apis/core/#UnlitMaterial), glTF 有专门的[KHR_materials_unlit ](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit)插件,Galacean 会解析插件,生成 Unlit 材质。 -image.png +image.png 测试模型:[TREX.zip](https://www.yuque.com/attachments/yuque/0/2021/zip/381718/1623651429048-7f6a3610-d5cb-4a73-97f5-0d37d0c63b2c.zip?_lake_card=%7B%22src%22%3A%22https%3A%2F%2Fwww.yuque.com%2Fattachments%2Fyuque%2F0%2F2021%2Fzip%2F381718%2F1623651429048-7f6a3610-d5cb-4a73-97f5-0d37d0c63b2c.zip%22%2C%22name%22%3A%22TREX.zip%22%2C%22size%22%3A499161%2C%22type%22%3A%22application%2Fx-zip-compressed%22%2C%22ext%22%3A%22zip%22%2C%22status%22%3A%22done%22%2C%22taskId%22%3A%22u458bcbec-d647-4328-8036-3d5eb12860f%22%2C%22taskType%22%3A%22upload%22%2C%22id%22%3A%22ua8a5baad%22%2C%22card%22%3A%22file%22%7D) @@ -32,34 +32,34 @@ title: Unlit 1. 导入模型 -![image.png](https://gw.alipayobjects.com/zos/OasisHub/e5dbfb61-5c0c-4ca5-8c7f-bde353d4c211/1623651809057-138f49cf-6fe7-4f54-8161-c7e157ec85fd-20210614150752343.png) + 2. 修改 Shader 默认的 shader 类型为 BSDF ,我们需要将材质属性栏 surface 里面的 shader 类型修改为 **Background**。 -![image.png](https://gw.alipayobjects.com/zos/OasisHub/abf1e279-1f78-4d21-8c1f-d58d7f74992c/1623652169374-7f39e5f0-6639-4795-8565-b8f0b09420ed-20210614150804567.png) + -![image.png](https://gw.alipayobjects.com/zos/OasisHub/c8c51e5f-c7c6-44a3-87e2-dc649e13fddb/1623652230768-69cd6f7e-175d-4f9f-9042-b3629d422b8e.png) + 3. 添加烘焙纹理 添加烘焙好的纹理,将 Color 和 Shader 连接在一起 -![image.png](https://gw.alipayobjects.com/zos/OasisHub/50c69e7b-c099-4a2d-b546-8a55ff4f9309/1623652264008-7ae4c13c-6430-44b0-995e-2c23c9f117a7-20210614150846797.png) + -![image.png](https://gw.alipayobjects.com/zos/OasisHub/6ed13e19-a9e5-4454-a0d5-ad27b3cabe14/1623652368637-6dda44be-4cde-4f65-a72f-d39b5d3f60ce.png) + -![image.png](https://gw.alipayobjects.com/zos/OasisHub/e9a99c9c-f661-4666-86bc-d8e91030c0f7/1623652380351-501dd929-7f96-4578-b49a-11724a0782a7.png) + 4. 导出 glTF 若预览正常,导出 glTF 。 -![image.png](https://gw.alipayobjects.com/zos/OasisHub/4b6b5f8f-ebd2-46af-85c7-9a26b5f66a2e/1623652403568-450291a8-1a0b-4cf4-8e71-c183a05632b0-20210614150902221.png) + -![image.png](https://gw.alipayobjects.com/zos/OasisHub/1fe38185-399e-4f56-bff4-c39ba4ae3a2a/1623652462007-85b065a3-69fa-4d80-9dfd-834ef66da12a.png) + 将刚才导出来的 glTF 文件拖入编辑器或者 [glTF 预览器](https://galacean.antgroup.com/engine/gltf-viewer),若材质类型为 **UnlitMaterial**,说明已经导出了 glTF 的 [KHR_materials_unlit](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit) 插件,且 Galacean 已经解析成 Unlit 材质。 -![image.png](https://gw.alipayobjects.com/zos/OasisHub/fbb6ba43-f7d7-4757-a1d3-590083d30573/1623652636074-d8bb8437-f885-43fd-8957-8e14ae9fd8c0-20210614150914493.png) + diff --git a/docs/zh/graphics/shader/custom.md b/docs/zh/graphics/shader/custom.mdx similarity index 98% rename from docs/zh/graphics/shader/custom.md rename to docs/zh/graphics/shader/custom.mdx index 3b77d31833..7c91435c6d 100644 --- a/docs/zh/graphics/shader/custom.md +++ b/docs/zh/graphics/shader/custom.mdx @@ -4,7 +4,7 @@ title: 自定义着色器 业务中可能有一些特殊的渲染需求,例如水流特效,这时候就需要通过**自定义着色器** (Shader)去实现。 - + ## 创建着色器 @@ -111,7 +111,7 @@ const material = new Material(engine, Shader.find("demo")); 除了内置的变量,我们可以在着色器中上传任何自定义名字的变量,我们唯一要做的就是根据着色器数据类型,使用正确的接口。上传的接口全部保存在 [ShaderData](/apis/core/#ShaderData) 中,而 shaderData 实例对象又分别保存在引擎的四大类 [Scene](/apis/core/#Scene)、[Camera](/apis/core/#Camera)、[Renderer](/apis/core/#Renderer)、[Material](/apis/core/#Material) 中,我们只需要分别往这些 shaderData 中调用接口,上传变量,引擎便会在底层自动帮我们组装这些数据,并进行判重等性能的优化。 -![](https://mdn.alipayobjects.com/huamei_jvf0dp/afts/img/A*ijQMQJM_Vy0AAAAAAAAAAAAADleLAQ/original) + ### 着色器数据分开的好处 diff --git a/docs/zh/graphics/shader/shaderLab/intro.md b/docs/zh/graphics/shader/shaderLab/intro.mdx similarity index 96% rename from docs/zh/graphics/shader/shaderLab/intro.md rename to docs/zh/graphics/shader/shaderLab/intro.mdx index 9818338ee9..ddd93d4416 100644 --- a/docs/zh/graphics/shader/shaderLab/intro.md +++ b/docs/zh/graphics/shader/shaderLab/intro.mdx @@ -15,4 +15,4 @@ flowchart LR 以下是一个简单的 ShaderLab 使用示例,其中包含了两个 Shader。`normal` Shader 定义了一个只实现 MVP 转换的顶点着色器,并且通过 Uniform 变量指定了像素颜色的片元着色器。另外,`lines` Shader 是一个使用 ShaderLab 进行改造的 [shadertoy](https://www.shadertoy.com/view/DtXfDr) 示例。 - + diff --git a/docs/zh/graphics/shader/shaderLab/usage.md b/docs/zh/graphics/shader/shaderLab/usage.mdx similarity index 58% rename from docs/zh/graphics/shader/shaderLab/usage.md rename to docs/zh/graphics/shader/shaderLab/usage.mdx index a21409b64f..73248627f8 100644 --- a/docs/zh/graphics/shader/shaderLab/usage.md +++ b/docs/zh/graphics/shader/shaderLab/usage.mdx @@ -4,14 +4,14 @@ title: "使用" 有了使用 `ShaderLab` 编写的自定义着色器资产后,我们可以通过将着色器绑定到新建的材质实现用户自定义材质。 - + - `ShaderLab`反射材质属性 如果我们在 `ShaderLab` 中编写了`材质属性定义`模块,模块中定义的属性会暴露在绑定该 Shader 的材质资产 Inspector 面板中 - + ## 一个利用多 Pass 技术实现平面阴影的示例 - + diff --git a/docs/zh/graphics/texture/2d.md b/docs/zh/graphics/texture/2d.mdx similarity index 86% rename from docs/zh/graphics/texture/2d.md rename to docs/zh/graphics/texture/2d.mdx index 3f7468c3cb..1953235545 100644 --- a/docs/zh/graphics/texture/2d.md +++ b/docs/zh/graphics/texture/2d.mdx @@ -12,7 +12,7 @@ label: Graphics/Texture 在编辑器中可以方便地导入一张 2D 纹理,按照路径 **[资产面板](/docs/assets/interface)** -> **右键上传** -> **选择 Texture2D** -> **选择对应贴图** -> **2D 纹理资产创建完毕** 操作即可。 -image.png +image.png 同样的,在脚本中可以通过 [ResourceManager](/apis/core/#ResourceManager) 加载图片获取对应的 2D 纹理: @@ -55,7 +55,7 @@ texture.setImageSource(video); 对于视频这类需要频繁更新纹理内容的使用场景,创建纹理的时候需要关闭 mipmap 并设置纹理使用方式为 Dynamic,以获得更好的性能,示例代码如下: - + ### setPixelBuffer @@ -85,7 +85,7 @@ texture.getPixelBuffer(0, 0, width, height, 0, data); 将纹理赋予材质球的相应属性,可以开启不同的渲染功能,如添加基础颜色纹理,可以决定模型的基本色调。在编辑器中,只需在对应属性选择相应纹理即可。 -image.png +image.png 对应的,在脚本中,可以这样设置: @@ -98,7 +98,7 @@ material.baseTexture = texture; ## 色彩膨胀 -image.png +image.png 为了解决带透明像素图片在 Alpha 值突变处出现黑边的问题,编辑器内置了色彩膨胀功能。该功能是通过将图片中所有透明像素的 RGB 值改写为与其最临近非完全透明像素的 RGB 值,达到去除图片黑边的效果。 @@ -109,6 +109,6 @@ material.baseTexture = texture; ## 导出配置 -image.png +image.png [项目发布](/docs/platform/platform)文档中详细说明了纹理导出时的**全局配置**,若此处勾选 Overwrite 选项时,此资产导出时将遵循**自定义配置**将非**全局配置**。 diff --git a/docs/zh/graphics/texture/compression.md b/docs/zh/graphics/texture/compression.mdx similarity index 90% rename from docs/zh/graphics/texture/compression.md rename to docs/zh/graphics/texture/compression.mdx index 5c1c42296e..0f7fdd0d16 100644 --- a/docs/zh/graphics/texture/compression.md +++ b/docs/zh/graphics/texture/compression.mdx @@ -25,7 +25,7 @@ engine.resourceManager }); ``` - + glTF 中使用 ktx2 需要包含 [KHR_texture_basisu](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_texture_basisu/README.md) 扩展。 @@ -38,7 +38,7 @@ KTX2 的生成可以使用: 编辑器在项目打包时,可以配置选项生成 KTX2,可以参考『[项目发布](/docs/platform/platform/)』文档。项目导出是全局的配置,也可以独立给不同的纹理资源配置不同的压缩格式。在编辑器的纹理面板下勾选 overwrite 可以覆盖全局配置: -image-20240705112419249 +image-20240705112419249 - ETC1S 尺寸小,内存极小,但是质量较低,适合 albedo, specular 等贴图 - UASTC 尺寸大,质量高,适合 normal 这类贴图 diff --git a/docs/zh/graphics/texture/cube.md b/docs/zh/graphics/texture/cube.mdx similarity index 80% rename from docs/zh/graphics/texture/cube.md rename to docs/zh/graphics/texture/cube.mdx index 809447fa4c..1e453f0733 100644 --- a/docs/zh/graphics/texture/cube.md +++ b/docs/zh/graphics/texture/cube.mdx @@ -8,13 +8,13 @@ label: Graphics/Texture 立方纹理([TextureCube](/apis/core/#TextureCube))和 2D 纹理的区别是它有 6 个面,即用 6 张 2D 纹理组成了一个立方纹理。 -![image.png](https://gw.alipayobjects.com/mdn/rms_d27172/afts/img/A*Omw8Qo0WzfYAAAAAAAAAAAAAARQnAQ) + -![image.png](https://gw.alipayobjects.com/mdn/rms_d27172/afts/img/A*r-XPSaUTEnEAAAAAAAAAAAAAARQnAQ) + 立方纹理和 2D 纹理的底层采样方式略有不同,纹理使用二维坐标进行采样,而立方纹理使用三维坐标,即 _方向向量_ 进行采样,如使用一个橘黄色的方向向量来从立方纹理上采样一个纹理值会像是这样: -![image.png](https://gw.alipayobjects.com/mdn/rms_d27172/afts/img/A*X752S5pQSB0AAAAAAAAAAAAAARQnAQ) + 正因为这种采样特性,所以立方纹理可以用来实现天空盒、环境反射等特效。 @@ -24,7 +24,7 @@ label: Graphics/Texture 在准备好 HDR 后,依照路径 **[资产面板](/docs/assets/interface)** -> **右键上传** -> **选择 TextureCube(.hdr)** -> **选择对应 HDR 贴图** -> **立方纹理资产创建完毕** 操作即可。 -![image.png](https://mdn.alipayobjects.com/huamei_yo47yq/afts/img/A*Oi3FSLEEaYgAAAAAAAAAAAAADhuCAQ/original) + 同样的,在脚本中可以通过加载六张对应顺序的纹理也能得到相应的立方纹理。 diff --git a/docs/zh/graphics/texture/rtt.md b/docs/zh/graphics/texture/rtt.mdx similarity index 97% rename from docs/zh/graphics/texture/rtt.md rename to docs/zh/graphics/texture/rtt.mdx index 6e7049e3e1..26e8b08f14 100644 --- a/docs/zh/graphics/texture/rtt.md +++ b/docs/zh/graphics/texture/rtt.mdx @@ -51,4 +51,4 @@ class switchRTScript extends Script { cameraEntity.addComponent(switchRTScript); ``` - + diff --git a/docs/zh/graphics/texture/texture.md b/docs/zh/graphics/texture/texture.mdx similarity index 90% rename from docs/zh/graphics/texture/texture.md rename to docs/zh/graphics/texture/texture.mdx index cf4e70eae1..5482c8d57e 100644 --- a/docs/zh/graphics/texture/texture.md +++ b/docs/zh/graphics/texture/texture.mdx @@ -34,14 +34,14 @@ label: Graphics/Texture 纹理空间是由纹理形状决定的, 2D 纹理对应需要使用二维空间向量进行纹理采样,相应地,立方纹理需要使用三维空间向量进行纹理采样。 -
-
- Texture 2D -
Texture 2D
+
+
+ Texture 2D +
Texture 2D
-
- Texture Cube -
Texture Cube
+
+ Texture Cube +
Texture Cube
@@ -66,7 +66,7 @@ label: Graphics/Texture | Repeat | 超出范围从 [0,1] 开始重新采样 | | Mirror | 超出范围从 [1,0] 开始镜像采样 | - + ### 过滤模式 @@ -78,13 +78,13 @@ label: Graphics/Texture | Bilinear | 使用距离最近的 2\*2 纹素矩阵的平均值 | | Trilinear | 在双线性过滤的基础上,对 mipmap 层级也进行了平均值过滤 | - + ### 各向异性过滤等级 各向异性过滤技术可以使纹理在倾斜角度下观看会更加清晰。如下图,纹理的尽头随着各向异性过滤等级的增加会愈加清晰。但请慎重使用,数值越大,GPU 的计算量就会越大。 - + ## 通用设置 @@ -99,7 +99,7 @@ label: Graphics/Texture **引擎默认开启 [mipmap](/apis/core/#Texture-generateMipmaps)**(多级纹理渐变),mipmap 用来解决从低分辨率屏幕中采样高分辨率纹理时的精度和性能问题,即能在合适的距离时选取不同分辨率的纹理,如下图: -![image.png](https://gw.alipayobjects.com/mdn/rms_d27172/afts/img/A*mTBvTJ7Czt4AAAAAAAAAAAAAARQnAQ) + 需要注意的是,WebGL2.0 支持**任意分辨率**的纹理,会根据 [mipmap](http://download.nvidia.com/developer/Papers/2005/NP2_Mipmapping/NP2_Mipmap_Creation.pdf) 算法进行一层层的 mip,但是如果您的环境是在 WebGL1.0 环境,那么请务必上传**2 次幂纹理**,如 1024 \* 512 这种分辨率的纹理,否则 Galacean 会检测到环境不可使用 mipmap,自动降级关闭 mipmap 功能,在视觉上带来一些意外情况。 @@ -126,7 +126,7 @@ const cubeTexture = new TextureCube( ); // 第 4 个参数 ``` - + ### flipY diff --git a/docs/zh/input/framebuffer-picker.md b/docs/zh/input/framebuffer-picker.mdx similarity index 96% rename from docs/zh/input/framebuffer-picker.md rename to docs/zh/input/framebuffer-picker.mdx index 4c964a20d6..c1fda18a76 100644 --- a/docs/zh/input/framebuffer-picker.md +++ b/docs/zh/input/framebuffer-picker.mdx @@ -9,7 +9,7 @@ label: Interact 当拾取频率不高时,可以考虑使用**像素级精度**的 `FramebufferPicker` 组件;当拾取频率过高时,需要开发者评估好性能开销是否适合业务场景,因为该组件底层会进行 CPU-GPU 通信,即调用 `gl.readPixels` 。 - + ## 创建帧缓冲拾取 diff --git a/docs/zh/input/input.md b/docs/zh/input/input.mdx similarity index 88% rename from docs/zh/input/input.md rename to docs/zh/input/input.mdx index f0a9ecb5a6..34b43020cc 100644 --- a/docs/zh/input/input.md +++ b/docs/zh/input/input.mdx @@ -16,7 +16,7 @@ Galacean 提供了基本的输入系统,基于跨端跨平台的特性,交 在初始化引擎时,可以自定义**触控**,**键盘**与**滚轮**的监听源。 -image.png +image.png ```typescript // 将触控事件的监听源设置为 document diff --git a/docs/zh/input/keyboard.md b/docs/zh/input/keyboard.mdx similarity index 98% rename from docs/zh/input/keyboard.md rename to docs/zh/input/keyboard.mdx index f4de7224bb..56e2c5c0d1 100644 --- a/docs/zh/input/keyboard.md +++ b/docs/zh/input/keyboard.mdx @@ -40,7 +40,7 @@ class KeyScript extends Script { 这次就用空格键来控制愤怒的小鸟吧。 - + ## 状态字典 diff --git a/docs/zh/input/pointer.md b/docs/zh/input/pointer.mdx similarity index 97% rename from docs/zh/input/pointer.md rename to docs/zh/input/pointer.mdx index cfd9bb78c0..38389da130 100644 --- a/docs/zh/input/pointer.md +++ b/docs/zh/input/pointer.mdx @@ -36,7 +36,7 @@ timeline …… ``` - + ### 触控按键 @@ -56,7 +56,7 @@ timeline 结合触控按键可以方便地检测触控点在本帧触发的行为: - + ### 触控回调 @@ -82,7 +82,7 @@ timeline - 中间的立方体添加了对 Drag 的响应,你可以用鼠标拖拽这个立方体在空间内任意移动。 - 最右边的立方体添加了对 Click 的响应(先 down 后 up ),当鼠标点击时会触发它颜色的改变。 - + ### 射线检测 @@ -109,7 +109,7 @@ if (scene.physics.raycast(ray, 100, hitResult)) { 通过下方示例可以更直观地理解此过程,示例中为主相机添加了辅助线,侧视相机可以完整观察到主相机射线检测到碰撞体的过程。 - + ## 兼容性 diff --git a/docs/zh/input/wheel.md b/docs/zh/input/wheel.mdx similarity index 56% rename from docs/zh/input/wheel.md rename to docs/zh/input/wheel.mdx index eab8748aa1..84602862a1 100644 --- a/docs/zh/input/wheel.md +++ b/docs/zh/input/wheel.mdx @@ -9,8 +9,8 @@ Galacean 的滚轮输入是基于 [WheelEvent](https://www.w3.org/TR/uievents/#i ## 使用 -image.png +image.png 可以依此实现用滚轮控制相机距离的示例。 - + diff --git a/docs/zh/performance/scene-standard.md b/docs/zh/performance/scene-standard.mdx similarity index 100% rename from docs/zh/performance/scene-standard.md rename to docs/zh/performance/scene-standard.mdx diff --git a/docs/zh/performance/stats.md b/docs/zh/performance/stats.mdx similarity index 90% rename from docs/zh/performance/stats.md rename to docs/zh/performance/stats.mdx index e86a91cdf6..fe05cad1e7 100644 --- a/docs/zh/performance/stats.md +++ b/docs/zh/performance/stats.mdx @@ -17,4 +17,4 @@ cameraEntity.addComponent(Stats); ## 示例 - + diff --git a/docs/zh/physics/collider.md b/docs/zh/physics/collider.mdx similarity index 86% rename from docs/zh/physics/collider.md rename to docs/zh/physics/collider.mdx index 2c366eb3bd..97604abb9b 100644 --- a/docs/zh/physics/collider.md +++ b/docs/zh/physics/collider.mdx @@ -16,7 +16,7 @@ label: Physics 为一个物体添加物理组件之前,首先需要考虑的是,碰撞器是静态的还是动态的,然后添加对应的碰撞器组件,静态碰撞器 [StaticCollider](/apis/core/#StaticCollider) 或者 [DynamicCollider](/apis/core/#DynamicCollider) -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*-E4USbdiH6sAAAAAAAAAAAAADsJ_AQ/original) + ### 选择碰撞器的外形 @@ -35,19 +35,19 @@ label: Physics 这里特别强调的是 `Collider` 与 `ColliderShape` 的位置关系。每一个 `Collider` 的姿态和其挂载的 `Entity` 是一致的,每一帧两者都会进行同步。而 `ColliderShape` 上则可以通过 `position` 属性设置 **相对于** `Entity` 的偏移。 -![table](https://mdn.alipayobjects.com/huamei_vvspai/afts/img/A*erlGRKk7dNMAAAAAAAAAAAAADsqFAQ/original) + 在加入碰撞器组件后,不会默认添加碰撞器外形,因此需要点击 Add Item 进行添加,添加后会在视口中看到碰撞器的辅助渲染出现。 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*OUr-SIejEkoAAAAAAAAAAAAADsJ_AQ/original) + 对于每一个碰撞器外形,都可以设计对应的一些大小属性。例如 -alt text +alt text 无论哪个碰撞器外形,都可以设置 Local Position,即相对于 Entity 坐标的局部偏移 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*p8UcRJ9Q0EIAAAAAAAAAAAAADsJ_AQ/original) + `ColliderShape` 上还有一个值得注意的属性 `Trigger`,它可以将这个 `ColliderShape` 由 `碰撞器模式` 转为 `触发器模式`。 @@ -57,7 +57,7 @@ label: Physics ### 动态碰撞器设置 和静态碰撞器不同,动态碰撞器会受到物理规律的作用,因此有许多附加的物理属性进行设置 -alt text +alt text 在修改这些参数后,视口不会发生变化,因为动态碰撞器默认会受到重力的作用,因此需要在`预览模式`下才能进行观察。 @@ -99,7 +99,7 @@ label: Physics 可以通过 `ColliderShape` 上的 `isTrigger` 开启触发器模式,但需要特别强调的是,**两个 StaticCollider 之间不会调用触发器事件**,除非其中一个是 `DynamicCollider`。 - + ### 碰撞器脚本函数 @@ -108,4 +108,4 @@ label: Physics 2. [onCollisionStay](/docs/script/class/#oncollisionstay):碰撞过程中*循环*调用 3. [onCollisionExit](/docs/script/class/#oncollisionexit):碰撞结束时调用 - + diff --git a/docs/zh/physics/controller.md b/docs/zh/physics/controller.mdx similarity index 97% rename from docs/zh/physics/controller.md rename to docs/zh/physics/controller.mdx index d71ea1145d..f19d4ccb46 100644 --- a/docs/zh/physics/controller.md +++ b/docs/zh/physics/controller.mdx @@ -50,4 +50,4 @@ export enum ControllerCollisionFlag { 由此角色接下来的动画和运动要怎么进行。在下面的例子当中,可以通过键盘控制角色的运动,使其爬上或者跳过特定的障碍物。 - + diff --git a/docs/zh/physics/debug.md b/docs/zh/physics/debug.mdx similarity index 95% rename from docs/zh/physics/debug.md rename to docs/zh/physics/debug.mdx index 69cb2861e2..b9190acfe4 100644 --- a/docs/zh/physics/debug.md +++ b/docs/zh/physics/debug.mdx @@ -15,4 +15,4 @@ label: Physics const wireframe = rootEntity.addComponent(WireframeManager); wireframe.addCollideWireframe(collider); ``` - + diff --git a/docs/zh/physics/joint-basic.md b/docs/zh/physics/joint-basic.mdx similarity index 83% rename from docs/zh/physics/joint-basic.md rename to docs/zh/physics/joint-basic.mdx index 40c4d7443e..011893988d 100644 --- a/docs/zh/physics/joint-basic.md +++ b/docs/zh/physics/joint-basic.mdx @@ -9,13 +9,13 @@ label: Physics 1. 固定约束组件 - ![fixedJoint](https://gameworksdocs.nvidia.com/PhysX/4.1/documentation/physxguide/_images/fixedJoint.png) + 2. 弹性约束组件 - ![springJoint](https://gameworksdocs.nvidia.com/PhysX/4.1/documentation/physxguide/_images/distanceJoint.png) + 3. 铰链约束组件 - ![hingeJoint](https://gameworksdocs.nvidia.com/PhysX/4.1/documentation/physxguide/_images/revoluteJoint.png) + 所有的物理约束都有两个作用对象,其中代表受到物理约束作用的动态碰撞器(在该节点上挂载物理约束组件),另外一个是约束挂载的位置或者是另外一个动态碰撞器(通过组件配置来设置)。 因此,这些组件的使用方法类似,以固定约束组件`FixedJoint`为例: @@ -40,4 +40,4 @@ fixedJoint.connectedCollider = prevCollider; 其中 `swingOffset` 也是一个向量,可以理解成从 `connectedAnchor` 和 `connectedCollider` 共同确定的旋转中心出发的偏移,动态碰撞就被挪到该点开始绕着旋转轴旋转。 上述物理约束组件的使用,可以参照: - + diff --git a/docs/zh/physics/manager.md b/docs/zh/physics/manager.mdx similarity index 96% rename from docs/zh/physics/manager.md rename to docs/zh/physics/manager.mdx index 4d1a02b656..33443937a5 100644 --- a/docs/zh/physics/manager.md +++ b/docs/zh/physics/manager.mdx @@ -46,11 +46,11 @@ export class Script extends Component { ## 使用射线检测 - + 射线可以理解成 3D 世界中一个点向一个方向发射的一条无终点的线。射线投射在 3D 应用中非常广泛。通过射线投射,可以在用户点击屏幕时,拾取 3D 场景中的物体;也可以在射击游戏中,判断子弹能否射中目标。 -![image.png](https://gw.alipayobjects.com/mdn/rms_7c464e/afts/img/A*SHM1RI49Bd4AAAAAAAAAAAAAARQnAQ) + (_图片来源于网络_) 在使用射线投射,首先要在代码中引入 [Ray](/apis/math/#Ray) 模块;然后生成射线,射线可以自定义生成,也可以通过相机([camera](/apis/core/#Camera-viewportPointToRay) diff --git a/docs/zh/physics/overall.md b/docs/zh/physics/overall.mdx similarity index 91% rename from docs/zh/physics/overall.md rename to docs/zh/physics/overall.mdx index e2997ef81a..9afb3b26dd 100644 --- a/docs/zh/physics/overall.md +++ b/docs/zh/physics/overall.mdx @@ -17,8 +17,8 @@ label: Physics 开发者可以在 [主菜单](/docs/interface/menu) 界面打开的 **项目设置** 面板中设置物理后端。 -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*LO_FRIsaIzIAAAAAAAAAAAAADsJ_AQ/original) -![alt text](https://mdn.alipayobjects.com/huamei_3zduhr/afts/img/A*ZvWdQqEfIKoAAAAAAAAAAAAADsJ_AQ/original) + + 若通过脚本初始化引擎,只需要将物理后端对象传入 `Engine` 中即可: diff --git a/docs/zh/platform/h5.md b/docs/zh/platform/h5.mdx similarity index 91% rename from docs/zh/platform/h5.md rename to docs/zh/platform/h5.mdx index 553390683b..0b5fd60233 100644 --- a/docs/zh/platform/h5.md +++ b/docs/zh/platform/h5.mdx @@ -13,7 +13,7 @@ label: Platform 选择好 H5 平台后,点击导出面板最下方的下载按钮,即可导出所需工程: - + 导出到本地后,目录结构如下: @@ -47,11 +47,11 @@ npm run dev ``` 执行完上述命令后,如果成功,将出现如下内容: - + 3、在浏览器中,输入上述 Local 或者 Network 的 URL 即可预览实际运行效果,如下: - + ## 构建 diff --git a/docs/zh/platform/platform.md b/docs/zh/platform/platform.md deleted file mode 100644 index 542d7fa6e2..0000000000 --- a/docs/zh/platform/platform.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -order: 0 -title: 多平台导出总览 -type: 多平台导出 -label: Platform ---- - -为了满足广大开发者对各个平台上线的诉求,真正做到一处开发,处处运行,1.4 版本开始支持多平台导出。开发者通过编辑器制作的项目,可以快速的导出到不同的平台所需的工程。 - -## 前置准备 -项目在编辑器中开发完成后,就可以导出各个平台的工程并进行发布了。在导出之前,我们先来了解一下导出面板和导出设置。 - -### 导出面板 -当我们完成项目开发,需要导出到某个平台(以导出至微信小游戏平台为例)的时候,可以按如下步骤操作: - -1、点击编辑器左侧的导出按钮: - - - -2、在唤出的导出面板的左侧,选择导出平台: - - - -3、导出面板的右侧为项目相关的一些导出配置,主要分为 2 块:**通用配置**(红色框内)和**平台相关配置**(黄色框内): - - - -### 导出配置说明 - -平台相关的导出配置将在平台导出的文档里单独说明,这里重点介绍下和平台无关的**通用配置**。 - -| 配置 | 描述 | -| ------------- | --------------------------------------------------------------------------------------------------------------------------------- | -| Project Name | 项目名称,导出到本地的根目录名就是项目名称 | -| Main Scene | 项目主场景 | -| Engine version | 项目使用的引擎版本号 | -| Upload to CDN | 是否将资产上传至 CDN | -| Texture Type | 纹理类型,支持 KTX2 和 Original:
**Original**:不对纹理做任何处理
**KTX2**:开启纹理压缩 选择 KTX2 可以选择不同的压缩格式:
**ETC1S:** 尺寸小,内存极小,但是质量较低,适合 albedo, specular 等贴图
**UASTC:** 尺寸大,质量高,适合 normal 这类贴图
如果选择了 ETC1S 压缩格式,可以通过 Quality 来设置压缩质量(值越大,渲染质量越好):| -| Tree shaking | 是否对导出的资产进行裁剪:
**None:** 不进行裁剪,导出所有资产
**Current Scene:** 只导出当前场景用到的资产
**All Scene:** 对所有场景 treeshaking,导出全量场景用到的资产 | -| WebGL Mode | 选择使用 WebGL 的版本:
**Auto:** 优先使用 WebGL2.0, 如果运行环境不支持自动切到 WebGL1.0
**WebGL1.0:** 使用 WebGL1.0
**WebGL2.0:** 使用 WebGL2.0 | -| Anti-Alias | 是否开启抗锯齿 | -| Alpha | 画布是否支持透明背景,如果希望画布下方的内容可以透出可以开启 | -| Preserve Drawing Buffer | 用于控制在调用 gl.clear() 方法后,绘图缓冲区是否保留其内容 | -| DPR Mode | [设备的像素比](/docs/core/canvas),通过调用 engine.canvas.resizeByClientSize 来控制画布的尺寸
**Auto:** 自动适配,即参数为 window.devicePixelRatio
**Fixed:** 开发者自行设置参数 选择 Fixed 后,开发者可以自行输入需要设置的参数 | - -## 支持的导出平台 -目前 Galacean 支持导出的平台如下: - -[导出至 H5 平台](/docs/platform/h5/) - -[导出至微信小游戏平台](/docs/platform/wechatMiniGame/) - diff --git a/docs/zh/platform/platform.mdx b/docs/zh/platform/platform.mdx new file mode 100644 index 0000000000..e6522de456 --- /dev/null +++ b/docs/zh/platform/platform.mdx @@ -0,0 +1,52 @@ +--- +order: 0 +title: 多平台导出总览 +type: 多平台导出 +label: Platform +--- + +为了满足广大开发者对各个平台上线的诉求,真正做到一处开发,处处运行,1.4 版本开始支持多平台导出。开发者通过编辑器制作的项目,可以快速的导出到不同的平台所需的工程。 + +## 前置准备 +项目在编辑器中开发完成后,就可以导出各个平台的工程并进行发布了。在导出之前,我们先来了解一下导出面板和导出设置。 + +### 导出面板 +当我们完成项目开发,需要导出到某个平台(以导出至微信小游戏平台为例)的时候,可以按如下步骤操作: + +1、点击编辑器左侧的导出按钮: + + + +2、在唤出的导出面板的左侧,选择导出平台: + + + +3、导出面板的右侧为项目相关的一些导出配置,主要分为 2 块:**通用配置**(红色框内)和**平台相关配置**(黄色框内): + + + +### 导出配置说明 + +平台相关的导出配置将在平台导出的文档里单独说明,这里重点介绍下和平台无关的**通用配置**。 + +| 配置 | 描述 | +| ------------- | --------------------------------------------------------------------------------------------------------------------------------- | +| Project Name | 项目名称,导出到本地的根目录名就是项目名称 | +| Main Scene | 项目主场景 | +| Engine version | 项目使用的引擎版本号 | +| Upload to CDN | 是否将资产上传至 CDN | +| Texture Type | 纹理类型,支持 KTX2 和 Original:
**Original**:不对纹理做任何处理
**KTX2**:开启纹理压缩 选择 KTX2 可以选择不同的压缩格式:
**ETC1S:** 尺寸小,内存极小,但是质量较低,适合 albedo, specular 等贴图
**UASTC:** 尺寸大,质量高,适合 normal 这类贴图
如果选择了 ETC1S 压缩格式,可以通过 Quality 来设置压缩质量(值越大,渲染质量越好):| +| Tree shaking | 是否对导出的资产进行裁剪:
**None:** 不进行裁剪,导出所有资产
**Current Scene:** 只导出当前场景用到的资产
**All Scene:** 对所有场景 treeshaking,导出全量场景用到的资产 | +| WebGL Mode | 选择使用 WebGL 的版本:
**Auto:** 优先使用 WebGL2.0, 如果运行环境不支持自动切到 WebGL1.0
**WebGL1.0:** 使用 WebGL1.0
**WebGL2.0:** 使用 WebGL2.0 | +| Anti-Alias | 是否开启抗锯齿 | +| Alpha | 画布是否支持透明背景,如果希望画布下方的内容可以透出可以开启 | +| Preserve Drawing Buffer | 用于控制在调用 gl.clear() 方法后,绘图缓冲区是否保留其内容 | +| DPR Mode | [设备的像素比](/docs/core/canvas),通过调用 engine.canvas.resizeByClientSize 来控制画布的尺寸
**Auto:** 自动适配,即参数为 window.devicePixelRatio
**Fixed:** 开发者自行设置参数 选择 Fixed 后,开发者可以自行输入需要设置的参数 | + +## 支持的导出平台 +目前 Galacean 支持导出的平台如下: + +[导出至 H5 平台](/docs/platform/h5/) + +[导出至微信小游戏平台](/docs/platform/wechatMiniGame/) + diff --git a/docs/zh/platform/wechatMiniGame.md b/docs/zh/platform/wechatMiniGame.mdx similarity index 88% rename from docs/zh/platform/wechatMiniGame.md rename to docs/zh/platform/wechatMiniGame.mdx index 3bdd5a228c..4a160236c2 100644 --- a/docs/zh/platform/wechatMiniGame.md +++ b/docs/zh/platform/wechatMiniGame.mdx @@ -9,7 +9,7 @@ label: Platform 在导出到微信小游戏平台的时候,有以下这些配置项: - + | 配置 | 描述 | 对应到微信小游戏的配置文件 | 对应到微信小游戏中的字段 | ------------- | ------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------- | @@ -26,7 +26,7 @@ label: Platform 选择好微信小游戏平台后,点击导出面板最下方的下载按钮,即可导出所需工程: - + ## 调试 @@ -38,15 +38,15 @@ npm i 2、打开**微信开发者工具** ,选择小游戏,并导入刚才的工程,如下: - + 3、在微信开发者工具中,点击**工具->构建 npm**,如下: - + 4、完成上述 3 后,即可在微信开发者工具中预览最终的结果,如下: - + 5、在微信开发者工具中的调试,详见:[微信小游戏调试](https://developers.weixin.qq.com/minigame/dev/guide/runtime/debug/) @@ -58,7 +58,7 @@ npm i 导出到本地的工程目录如下: - + **工程目录说明** |目录或文件|说明|