godotengine / godot-docs

Godot Engine official documentation
https://docs.godotengine.org
Other
3.92k stars 3.2k forks source link

Animating Thousands of Fish - skipping key material shader setup steps #6428

Open KooIaIa opened 1 year ago

KooIaIa commented 1 year ago

Your Godot version: v4.0.beta6 Official

Issue description: The tutorial skips many difficult steps so it can't easily be followed.

  1. Finding and downloading the model (simple)
  2. Setting up the vertex shader (complicated) image

The fish model has 3 different materials. It's isn't obvious how to set up a Vertex shader from scratch where the fish can look like its supposed to as in the tutorial.

URL to the documentation page (if already existing): https://docs.godotengine.org/en/latest/tutorials/performance/vertex_animation/animating_thousands_of_fish.html

Calinou commented 1 year ago
  1. Finding and downloading the model (simple)

I don't see any download link for the model within the page. This should be added.

  1. Setting up the vertex shader (complicated)

The documentation page is probably unclear on the fact that you need to use a single material for the mesh here. This is both for performance reasons and convenience (so you don't need to create multiple shader materials all using the same shader).

If you want different parts of a model to use different colors without having to use different materials, use a texture or (preferably in this case) vertex colors.

clayjohn commented 1 year ago

When writing the tutorial I used my own version of the fish which is a single mesh with a single material. The tutorial itself is on how to animate an object in a vertex shader, its not a tutorial on how to make this exact fish look likes its swimming. Such a content-specific tutorial is not suitable for the docs.

In my opinion, instead of making the tutorial more complex (albeit with the aim of allowing users to get a nice end product), we should simplify the tutorial by using either a different fish model, or a different model altogether (i.e. a butterfly)

KooIaIa commented 1 year ago

I really love how awesome the tutorial is at explaining really cool complex shader steps so really don't want it to be more complicated. As a noob, its hard to know everything I don't know when learning so I got totally stuck. I'm not sure how to merge the materials into one or convert it to be vertex colors in Godot. With a download link, it could fix that by making the fish or butterfly ready to go. My screenshot is from finding the Obj + Mtl file online and dragging it into Godot.

The other step that may not be covered in a doc example already is needing to convert the Standard shader into a Shader script so the tutorial code snippets can be added in. Another noob thing, I tried using a Overlay material instead of doing this but it didn't work how I hoped since shaders can't work in tandem. The idea of editing the Standard shader was really intimidating to me since I wasn't 100% sure I needed to do it. If the tutorial does explain each necessary operation so a noob can follow along - it could be a great overview of all the steps of running a shader on a real normal model in Godot.

I looked at the other vertex shader tutorial - the Water shader - and its geometry made from scratch so it doesn't get into the details of using a shader on a normal model with a normal existing material. I also think this tutorial is way more interesting than the Water tutorial since Water shaders are really overly done and specific. But learning to shade a model can apply to way way more things that just Water or a Fish.

Ignawesome commented 6 months ago

Ok, as a beginner, I just followed this tutorial and I have a few notes. I'm not sure if this is the best place to report them, but maybe someone is going through the same problems I did and finds it useful.

First, upon setting up the shader material in the material override property, the fish loses its colors. I could not find a way to fix this easily as the colors are divided in three surfaces and I don't know how to access them through the shader.

Second, upon setting the positions of each instance of fish in the school multimesh, the fish were rotated downwards. I fixed it with this line: position = position.rotated(Vector3.RIGHT, -PI/2)

Third, upon editing the multimesh properties, in particular activating "Use Colors" and "Use Custom Data" and then increasing the Instance Count, all the fish get stretched to infinity: image This is fixed by clicking on "Populate Surface" in the top menu, but then "Use Colors" and "Use Custom Data" are turned off...

I'm probably doing things wrong, but the tutorial could be a little more specific. Nevertheless, I learned a lot and I appreciate it being available, as it is a very interesting effect to dissect like this.