godot-docs icon indicating copy to clipboard operation
godot-docs copied to clipboard

Style consistency pass on Spatial, Fog, CanvasItem, Sky, Particle shader pages

Open tetrapod00 opened this issue 1 year ago • 5 comments

Resolves https://github.com/godotengine/godot-docs/issues/9745 Also looking at the text in https://github.com/godotengine/godot-docs/pull/9691 as a guide for some of these changes.

Formalized style guidelines:

  • Use sentence case for built-in descriptions. Avoid random capitalizations and title case.
  • Shader built-ins should always be styled as code: VERTEX.
  • Built-in bool descriptions should start with "true if...", "true when...", etc.
  • Literal values should almost always be styled as code: 1.0, false, ENUM_VALUE. Ints are 1. Floats are styled as 1.0. Exception: listing ranges in built-in descriptions can be styled as "(0..1)" even if floats.
  • Processor functions should usually be styled as "the light() function" in the body and in built-in tables. Use of "the light function" or "a light function" are also okay, if it improves readability. Avoid "the light() function" (without code style).
  • Always capitalize "UV".
  • When referring to classes or properties, link to the class reference if possible.
  • Use "model space" instead of "local space" or "local coordinates". Exception: refer to "model/local space" at least a couple times to establish the connection. Exception: CanvasItem page consistently uses "local space" and I left it alone, since I'm not deeply familiar with 2D spaces.
  • https://github.com/godotengine/godot-docs/pull/9757 may let us standardize completely on "model space" except for in the definition table for coordinate spaces.
  • In built-in descriptions, try to describe the space as "in world space". For example: NODE_POSITION_WORLD is "Node position, in world space", not "Node world space position".
  • Render modes should be stylized as "using the render mode unshaded", "using the unshaded render mode", or. Avoid "render_mode" in the body of the page.

Other, opinionated, changes made by this PR:

  • In description of VERTEX, call it "vertex position" where possible. ctrl+f "position" should surface VERTEX.
  • Similarly, get the word "color" into ALBEDO's description somehow.
  • Link to Standard Material 3D from Spatial shaders. It's the best documentation for alpha modes among other things.
  • A few small style, clarity, or grammar changes

tetrapod00 avatar Aug 14 '24 04:08 tetrapod00

Looks great so far! I agree with your style guideline

clayjohn avatar Aug 14 '24 05:08 clayjohn

Does Godot have a standard term for local/model space? Within the Spatial Vertex Built-ins table, I see both "local coordinates" and "model space".

I suppose if both are commonly used, it's better to keep references to both in the docs?

tetrapod00 avatar Aug 14 '24 07:08 tetrapod00

  • In the descriptions of MODEL_MATRIX and MODELVIEW_MATRIX, refer to "Model/local space". It's fine if "model space" and "local coordinates" are used interchangeably elsewhere if they are established as the same at least once or twice.

I would standardize on "model space" because it matches the naming of MODEL_MATRIX and MODELVIEW_MATRIX. Using the term local space was likely done without much thought

clayjohn avatar Aug 14 '24 18:08 clayjohn

"Local space" or "local coordinates" does match the naming convention for local coordinates in CPU-side transforms. If we standardize on "model space", there should still be a few mentions of "model / local space" to make the connection.

At some point all the different spaces should be documented in one place, so that single explanation can be linked to.

Another complication: the CanvasItem page uses "local space" as the main description. Should a different standard be applied to CanvasItem shaders since they are more of an on-ramp for new shader users?

In any case, I'll put the maximal standardization of "model space" into the draft and we can see how it looks.

tetrapod00 avatar Aug 14 '24 18:08 tetrapod00

This one's ready for review.

I can also clean up the guidelines themselves if we think we'll be reusing them. I think it's a fine outcome if these pages get cleaned up once and we don't formalize the style guidelines anywhere.

tetrapod00 avatar Aug 18 '24 04:08 tetrapod00

I made another round of changes for all of the outstanding comments. Would appreciate another correctness check on the changes!

tetrapod00 avatar Sep 14 '24 22:09 tetrapod00

Besides the resolved comments, I also changed how ranges were described in most cases in the spatial shader built-in tables. Before, a range between 0 and 1 was described as "(0..1)". Now, it's "range of [0.0, 1.0]".

  • Use code styling for the literals.
  • Use square brackets to describe range, to avoid confusion with vector literals.
  • Explicitly mention "range of". It's wordy, but increases clarity.

tetrapod00 avatar Sep 20 '24 19:09 tetrapod00

Oh, forgot to resolve a couple entries in the spatial shaders light() table.

tetrapod00 avatar Sep 20 '24 19:09 tetrapod00

Thanks!

skyace65 avatar Sep 26 '24 02:09 skyace65