-
-
Notifications
You must be signed in to change notification settings - Fork 152
docs(app): light-shadows and shaders docs examples #506
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
Conversation
✅ Deploy Preview for tresjs-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @JaimeTorrealba the guide needs some work, please take a look to the comments, any question let me now
docs/examples/lights-shadows.md
Outdated
|
||
We could divide this into three steps. | ||
|
||
**Number 1**: Set the shadows on the renderer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**Number 1**: Set the shadows on the renderer | |
### Set the shadows on the renderer |
docs/examples/lights-shadows.md
Outdated
//... | ||
</template> | ||
``` | ||
**Number 2**: Set the light to cast shadow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**Number 2**: Set the light to cast shadow | |
### Set the light to cast shadow |
docs/examples/lights-shadows.md
Outdated
//... | ||
</template> | ||
``` | ||
**Number 3**: Set the objects to cast or receive shadows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**Number 3**: Set the objects to cast or receive shadows | |
### Set the objects to cast or receive shadows |
docs/examples/lights-shadows.md
Outdated
We will build a simple scene with three meshes and a plane but only two will have shadows. | ||
<SandboxDemo url="https://play.tresjs.org/#eNqVVt1y2jwQfRUN30WSKdimhLbjL3Qo9GfaadpM4K7uhbAXUGpLGkn8pJm8e1eSDXZCMmRCGGv37NHZ1XrFXWuqQH+QMlivoBW3LnSqmDREg1lJklO+GCQto5PW+4SzQgplyB3RS5rnYnMNc3JP5koU5ASjT/6vQSzrmPI11W2y0nANPAP1XQhZBQwNIm50mArVjPypZsyMBTdK5HrHv4Mz4EboRsSIapZOljQ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P8TJX2mfWC3q7g9/8AWlN6bg==" /> | ||
|
||
## Let's first setup our scene (optional) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try being more concise with titles ex:
Setting up the scene (optional)
The "let's first setup..." is a narrative for tutorials or articles. If you still want to include it do it on the paragraph but not in the title
docs/examples/lights-shadows.md
Outdated
</template> | ||
``` | ||
|
||
_Note that I intentionally did not apply `cast-shadow` to the ``Cone` so it doesn't cast any shadow_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_Note that I intentionally did not apply `cast-shadow` to the ``Cone` so it doesn't cast any shadow_ | |
_Note that I intentionally did not apply `cast-shadow` to the `Cone` so it doesn't cast any shadow_ |
docs/examples/lights-shadows.md
Outdated
_Note that I intentionally did not apply `cast-shadow` to the ``Cone` so it doesn't cast any shadow_ | ||
|
||
::: warning | ||
The overuse of shadows in this way could drop your performance. However, there are ways to increase your performance, for more information please check out [this video](https://youtu.be/WGNvVGrS0kY?si=q7XyL5eABKUh3gbS&t=1256) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The warning feels misplaced at the end of the guide, specially because the immediate text above doesn't add context about performance.
@JaimeTorrealba please add it below Lights and shadows explanation
docs/examples/lights-shadows.md
Outdated
|
||
There are also many types of shadows, for example the "soft shadow" is generated automatially when an object receives more light from one side, but in summary a "ThreeJS default shadow" that is directed towards another surface needs to be cast by a mesh and another mesh needs to receive it. As we see in our example, the `Plane` is receiving a shadow but not casting it. Please note that not all materials can cast or receive shadows. | ||
|
||
Internally, ThreeJS automatically generates a new mesh with a (ShadowMaterial)[https://threejs.org/docs/index.html?q=shado#api/en/materials/ShadowMaterial] which gets updated in each frame, that is why if you apply animations, the shadow also is animated, but also why you have to use shadows carefully, because they could slow your performance down. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The links format for markdown are incorrect.
@alvarosabu thanks for pay attention to these details, I believe we're ready, let me know |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JaimeTorrealba way better now, I just added some quick suggestions for the wording of the Shadows setup, we were using the same terms everywhere, was redundant to read.
docs/examples/lights-shadows.md
Outdated
|
||
## Setting our lights and shadow | ||
|
||
We could divide this into three steps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could divide this into three steps. | |
We could divide this into three steps: |
docs/examples/lights-shadows.md
Outdated
|
||
We could divide this into three steps. | ||
|
||
### Set the shadows on the renderer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Set the shadows on the renderer | |
### Activate shadows on the renderer |
docs/examples/lights-shadows.md
Outdated
The overuse of shadows in this way could drop your performance. However, there are ways to increase your performance, for more information please check out [this video](https://youtu.be/WGNvVGrS0kY?si=q7XyL5eABKUh3gbS&t=1256) | ||
::: | ||
|
||
## Setting our lights and shadow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Setting our lights and shadow | |
## Enabling shadows |
docs/examples/lights-shadows.md
Outdated
//... | ||
</template> | ||
``` | ||
### Set the light to cast shadow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Set the light to cast shadow | |
### Set the light to cast shadows |
closes #476