Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance ShaderLab documents #2331

Merged
merged 3 commits into from
Sep 10, 2024

Conversation

Sway007
Copy link
Member

@Sway007 Sway007 commented Aug 13, 2024

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

What is the current behavior? (You can also link to an open issue here)

What is the new behavior (if this is a feature change)?

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

Other information:

Summary by CodeRabbit

  • Documentation Improvements
    • Updated terminology in shader documentation for clarity, including standardized headers and improved phrasing.
    • Enhanced accessibility by translating comments from Chinese to English.
    • Improved formatting and structure of ShaderLab syntax documentation for better readability and consistency.
    • Added new callouts for practical guidance on configuring render states and queues through the material API.

@Sway007 Sway007 added the documentation Improvements or additions to documentation label Aug 13, 2024
@Sway007 Sway007 self-assigned this Aug 13, 2024
Copy link

coderabbitai bot commented Aug 13, 2024

Walkthrough

This update enhances the clarity and professionalism of the Galacean engine's shader documentation by standardizing terminology, improving formatting, and ensuring consistency across various shader types. Key terms have been refined, comments translated to English, and structural adjustments made for better readability, all while maintaining the original functionality and content.

Changes

File Path Change Summary
docs/en/graphics/shader/builtins/intro.mdx Replaced "material" with "Shader" for better clarity in Unlit, Blinn Phong, and PBR shader docs.
docs/en/graphics/shader/shaderLab/syntax/pass.mdx Updated comments to English, restructured code examples, added practical callout for render state configuration.
docs/en/graphics/shader/shaderLab/syntax/shader.mdx Translated comments to English, improved header formats for structure and readability.
docs/zh/graphics/shader/builtins/intro.mdx Clarified shader descriptions by standardizing terminology and making minor formatting adjustments.
docs/zh/graphics/shader/shaderLab/syntax/pass.mdx Removed unnecessary line breaks, added hyperlinks for better navigation, included callout for render states.
docs/zh/graphics/shader/shaderLab/syntax/shader.mdx Restructured rendering states documentation for clarity and enhanced examples for user understanding.

Poem

🐇 In the grass where bunnies play,
Our shaders shine, bright as day!
With words now clear and meanings fine,
We hop along in code's design.
So let’s rejoice, both near and far,
For clarity is our guiding star! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Sway007 Sway007 linked an issue Aug 13, 2024 that may be closed by this pull request
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bec9ffa and b18317a.

Files selected for processing (6)
  • docs/en/graphics/shader/builtins/intro.mdx (1 hunks)
  • docs/en/graphics/shader/shaderLab/syntax/pass.mdx (3 hunks)
  • docs/en/graphics/shader/shaderLab/syntax/shader.mdx (5 hunks)
  • docs/zh/graphics/shader/builtins/intro.mdx (2 hunks)
  • docs/zh/graphics/shader/shaderLab/syntax/pass.mdx (3 hunks)
  • docs/zh/graphics/shader/shaderLab/syntax/shader.mdx (1 hunks)
Files skipped from review due to trivial changes (5)
  • docs/en/graphics/shader/builtins/intro.mdx
  • docs/en/graphics/shader/shaderLab/syntax/pass.mdx
  • docs/en/graphics/shader/shaderLab/syntax/shader.mdx
  • docs/zh/graphics/shader/builtins/intro.mdx
  • docs/zh/graphics/shader/shaderLab/syntax/pass.mdx
Additional comments not posted (4)
docs/zh/graphics/shader/shaderLab/syntax/shader.mdx (4)

107-109: Improved Clarity in Rendering States Section.

The reorganization into separate subsections for each rendering state enhances clarity and readability. The consistent format across subsections is beneficial.


175-201: Clear Explanation of BlendState Assignment Methods.

The example and accompanying explanation effectively clarify the distinction between constant and variable assignments. This enhances the user's understanding of practical implementation.


202-210: Concise Explanation of Structs, Functions, and Single Variables.

The section provides a clear and concise explanation, aligning with GLSL syntax. The example for single variable declaration is accurate and helpful.


212-212: Clear Explanation of Global Variable Scope and Overriding.

The notes provide a clear and valuable explanation of the scope and overriding principles for global variables in ShaderLab.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (3)
docs/zh/graphics/shader/shaderLab/syntax/pass.mdx (3)

31-33: Improve code snippet formatting.

The code snippet for BlendState should be formatted consistently with other code snippets in the document.

BlendState = blendState;

Consider using a code block for better readability:

BlendState = blendState;

37-41: Improve code snippet formatting.

The code snippet for BlendState declaration should be formatted consistently with other code snippets in the document.

BlendState {
  渲染状态属性 = 属性值;
}

Consider using a code block for better readability:

BlendState {
  渲染状态属性 = 属性值;
}

88-101: Add missing code block formatting.

The new section providing additional information about setting render states and render queues through the material API should use code blocks for better readability.

<Callout type="info">
除了可以在 ShaderLab 中对渲染状态和渲染队列进行设置,开发者同样可以通过材质的API进行设置,如
```ts
// 渲染队列设置
material.renderQueueType = RenderQueueType.Opaque;

// 渲染状态设置
const renderState = material.renderState.depthState;
depthState.writeEnabled = false;

当 ShaderLab 中声明了渲染状态和渲染队列,材质相应的设置会被忽略。


Consider using a code block for better readability:

```diff
<Callout type="info">
除了可以在 ShaderLab 中对渲染状态和渲染队列进行设置,开发者同样可以通过材质的API进行设置,如
```ts
// 渲染队列设置
material.renderQueueType = RenderQueueType.Opaque;

// 渲染状态设置
const renderState = material.renderState.depthState;
depthState.writeEnabled = false;

当 ShaderLab 中声明了渲染状态和渲染队列,材质相应的设置会被忽略。


</blockquote></details>

</blockquote></details>

<details>
<summary>Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: CHILL**

<details>
<summary>Commits</summary>

Files that changed from the base of the PR and between b18317ade8e85c23995b81af64b8c71df90cfdaa and 62ef48357b1b035951c1d6b0a1b40cc0c3ef020e.

</details>


<details>
<summary>Files selected for processing (2)</summary>

* docs/en/graphics/shader/shaderLab/syntax/pass.mdx (4 hunks)
* docs/zh/graphics/shader/shaderLab/syntax/pass.mdx (3 hunks)

</details>






<details>
<summary>Files skipped from review due to trivial changes (1)</summary>

* docs/en/graphics/shader/shaderLab/syntax/pass.mdx

</details>




<details>
<summary>Additional comments not posted (1)</summary><blockquote>

<details>
<summary>docs/zh/graphics/shader/shaderLab/syntax/pass.mdx (1)</summary><blockquote>

`56-66`: **Enhance clarity of varying variable declaration.**

The explanation regarding the declaration of varying variables has been refined by adding a link to the structure function documentation, improving the contextual understanding for users.


The code changes are approved.

</blockquote></details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 62ef483 and 28c446b.

Files selected for processing (1)
  • docs/en/graphics/shader/shaderLab/syntax/pass.mdx (4 hunks)
Files skipped from review due to trivial changes (1)
  • docs/en/graphics/shader/shaderLab/syntax/pass.mdx

Copy link
Collaborator

@cptbtptpbcptdtptp cptbtptpbcptdtptp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@cptbtptpbcptdtptp cptbtptpbcptdtptp merged commit 7cd0cfe into galacean:main Sep 10, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Doc: 着色器文档增强
2 participants