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

Improve shader function descriptions #9338

Open
wants to merge 28 commits into
base: master
Choose a base branch
from

Conversation

AshbyGeek
Copy link

Adds much detail to the documentation on built-in shader functions, copied from (with a few modifications) and linked to official GLSL documentation.

That documentation was moved into a separate file due to its verbosity, and organized into smaller sections following the organizational comments in https://github.com/godotengine/godot/blob/master/servers/rendering/shader_language.cpp.

Style tries to generally follow the styling used in class documentation, but differences between .gdshader and .gdscript meant some changes had to be made.

@AshbyGeek
Copy link
Author

Pull request for issue #9310

@AThousandShips AThousandShips changed the title Ashbygeek/shader funcs Improve shader function descriptions May 7, 2024
@AThousandShips AThousandShips requested a review from a team May 7, 2024 09:31
@skyace65 skyace65 added enhancement area:manual Issues and PRs related to the Manual/Tutorials section of the documentation topic:shaders labels May 8, 2024
@AshbyGeek AshbyGeek marked this pull request as ready for review May 8, 2024 20:40
@skyace65
Copy link
Contributor

skyace65 commented May 9, 2024

CC @clayjohn

@clayjohn
Copy link
Member

clayjohn commented May 9, 2024

That was unbelievably fast. I'm going to need a few days to review this. But I am very excited!

Copy link
Member

@AThousandShips AThousandShips left a comment

Choose a reason for hiding this comment

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

This looks good, gonna go through it for style again but this was some that stuck out for now

tutorials/shaders/shader_reference/shader_functions.rst Outdated Show resolved Hide resolved
tutorials/shaders/shader_reference/shader_functions.rst Outdated Show resolved Hide resolved
AshbyGeek and others added 2 commits May 10, 2024 10:45
Co-authored-by: Yuri Rubinsky <[email protected]>
Co-authored-by: A Thousand Ships <[email protected]>
Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

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

Amazing work! This looks really good so far.

I think I just have two general comments:

  1. I agree with Chaosus' comment earlier that, in most cases, functions with the same name should be grouped instead of duplicated. Especially for functions with really long descriptions.
  2. I like how you kept the short description in the table. But I think it needs to be truly a short description. Some of the entries have the entire description copied in the table and that ends up making the table bloated in hard to navigate.

See DfDx for example
image

In these cases, the table actually has more information than the long description below.

tutorials/shaders/shader_reference/shader_functions.rst Outdated Show resolved Hide resolved
tutorials/shaders/shader_reference/shader_functions.rst Outdated Show resolved Hide resolved
tutorials/shaders/shader_reference/shading_language.rst Outdated Show resolved Hide resolved
tutorials/shaders/shader_reference/shader_functions.rst Outdated Show resolved Hide resolved
@AshbyGeek
Copy link
Author

Awesome! I'm glad you like it. I'm pushing hard to finish a project milestone this week, but I should be able to work on an update next week.

Copy link
Contributor

@skyace65 skyace65 left a comment

Choose a reason for hiding this comment

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

Did a grammar and spelling check and everything looks good.

@tetrapod00
Copy link
Contributor

tetrapod00 commented Sep 12, 2024

I didn't do a whole review, but I skimmed and caught some typos.

I also noticed no consistency of "Return" vs "Returns" or "Calculate" vs "Calculates" in the descriptions of functions, but I don't think that's really worth the effort to standardize.

@AshbyGeek
Copy link
Author

@tetrapod00 Any thoughts on the conversation @clayjohn and I were having about functions working on arrays piecewise?

@AshbyGeek
Copy link
Author

AshbyGeek commented Sep 19, 2024

Latest commit addresses concerns about component-wise functions and operators. It also improves some formatting and fixes some oddities with the navigation tree. Here's a bulleted list of what I changed:

  • Use appropriate header so that the navigation tree will work correctly (accidentally used some subsubheaders I think)
  • Make the classref-method styling apply to entries with multiple overloads
  • Use a single table row for entries with multiple overloads
  • 2nd column of each table disables text wrapping (had to add to static/custom.css) so that table rows with multiple entries will keep those entries aligned with their return types
  • Fixed some function names in the descriptions that weren't bold
  • Fixed a couple entries that failed to include the on-hover tooltip for vec_type
  • Improve wording of note about operators being piece-wise and move it to underneath the actual operators
  • Improve wording of note about functions being piece-wise

Copy link
Member

@AThousandShips AThousandShips left a comment

Choose a reason for hiding this comment

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

Otherwise I think this looks good

tutorials/shaders/shader_reference/shader_functions.rst Outdated Show resolved Hide resolved
tutorials/shaders/shader_reference/shading_language.rst Outdated Show resolved Hide resolved
tutorials/shaders/shader_reference/shading_language.rst Outdated Show resolved Hide resolved
@tetrapod00
Copy link
Contributor

I see a lot of places where style can be improved in a minor way, like styling literals as code and with a decimal marker for floats (e.g. 0.0 instead of 0 or "0.0" for a float value of 0). I'll do a detail-oriented review on this (or a followup PR if we'd rather not block merging).

@tetrapod00
Copy link
Contributor

tetrapod00 commented Sep 25, 2024

I started on a nitpicky style review but I think it would be better as a followup PR - making all the required changes is annoying as suggestions.
It's a lot of stuff like:
"if x < -1" vs "if x is less than 0.0" vs "if x ≤ 0"
(e^x + e^-x)/2 vs "x=2\ :sup:y"
This stuff should be standardized, and I can do the work, but it will be annoying to do as a bunch of individual suggestions on the web UI.

IMO the style inconsistency is not bad enough to prevent merging as is.

Should have stated functions are based on GLSL ES 3.0 (GLSL != GLSL ES)
@AshbyGeek
Copy link
Author

Ok, fixed the couple things you already mentioned since I needed to fix my GLSL 4.0 mistake. I'm more than happy to let you fix the rest of the tedious formatting issues in another PR.

What does the merge process look like from here? We wait for ClayJohn or some such to come give a final approval and pull it in?

@tetrapod00
Copy link
Contributor

tetrapod00 commented Sep 25, 2024

Yeah, now you're waiting on another review from clayjohn or someone else with shader-specific knowledge to do a high-level review including whatever other style nitpicks come up in that review, then it should be merge-able. IMO this PR is already so much better than the current state of the function docs that this PR is merge-able as-is.

(Also I believe in most cases we would address the style consistency in this PR, not a followup, but it is really tedious work on a large PR, it's not blocking, and I'm volunteering to do it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:manual Issues and PRs related to the Manual/Tutorials section of the documentation enhancement topic:shaders
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants