Skip to content

Commit

Permalink
Merge pull request #319 from stride3d/master
Browse files Browse the repository at this point in the history
Initiating deployment of latest docs updates to staging
  • Loading branch information
VaclavElias authored Sep 1, 2024
2 parents e7d7bbd + 74eb466 commit 827769c
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 39 deletions.
19 changes: 5 additions & 14 deletions en/manual/graphics/materials/shading-attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ The **diffuse** is the basic color of the material. A pure diffuse material is c
The final diffuse contribution is calculated like this:

- the **diffuse** defines the color used by the diffuse model

- the **diffuse model** defines which shading model is used for rendering the diffuse component (see below)

Currently, the diffuse attribute supports only a **diffuse map**.
Expand All @@ -42,7 +41,7 @@ Under the Lambert model, light is reflected equally in all directions with an in
| Property | Description
| ------------- | -----------
| Diffuse map | The diffuse map color provider
| Diffuse map | The diffuse map color provider
| Diffuse model | The shading model for diffuse lighting

## Specular
Expand All @@ -62,10 +61,8 @@ By taking into into account the fact that almost all materials always have some
The final specular color is calculated by mixing a fixed low-reflection color and the diffuse color.

- With the metalness color at `0.0`, the effective specular color is equal to `0.02`, while the diffuse color is unchanged. The material is not metal but exhibits some reflectance and is sensitive to the Fresnel effect.

- With the metalness color at `1.0`, the effective specular color is equal to the diffuse color, and the diffuse color is set to `0`. The material is considered a pure metal.

![media/material-attributes-26.png](media/material-attributes-26.png)
![media/material-attributes-26.png](media/material-attributes-26.png)

The screenshots below show the result of the metalness factor on a material with the following attributes:

Expand Down Expand Up @@ -100,15 +97,9 @@ The microfacet is defined by the following formula, where Rs is the resulting sp

| Property | Description
| ------------------- | -------
| Fresnel | Defines the amount of light that is reflected and transmitted. The models supported are: <br><p>**Schlick**: An approximation of the Fresnel effect (default)</br> <br><p>**Thin glass**: A simulation of light passing through glass</br> <br><p>**None**: The material as-is with no Fresnel effect</br>
| Visibility | Defines the visibility between of the microfacets between (0, 1). Also known as the geometry attenuation - Shadowing and Masking - in the original Cook-Torrance. Stride simplifies the formula to use the visibility term instead: <br><p>![media/material-attributes-35.png](media/material-attributes-35.png)</br> <br><p>and <br><p>![media/material-attributes-36.png](media/material-attributes-36.png)</br> <br><p>**Schlick GGX** (default)</br> <br><p> **Implicit**: The microsurface is always visible and generates no shadowing or masking</br> <br><p>**Cook-Torrance**</br> <br><p>**Kelemen**</br> <br><p>**Neumann**</br> <br><p>**Smith-Beckmann**</br> <br><p>**Smith-GGX correlated**</br> <br><p>**Schlick-Beckmann**</br>
| Normal Distribution | <br><p>Defines how the normal is distributed. The gloss attribute is used by this part of the function to modify the distribution of the normal.</br> <br><p>**GGX** (default) </br> <br><p>**Beckmann**</br> <br><p>**Blinn-Phong**</br>
| Fresnel | Defines the amount of light that is reflected and transmitted. The models supported are: <br><p>**Schlick**: An approximation of the Fresnel effect (default)</br> <br><p>**Thin glass**: A simulation of light passing through glass</br> <br><p>**None**: The material as-is with no Fresnel effect</br>
| Visibility | Defines the visibility between of the microfacets between (0, 1). Also known as the geometry attenuation - Shadowing and Masking - in the original Cook-Torrance. Stride simplifies the formula to use the visibility term instead: <br><p>![media/material-attributes-35.png](media/material-attributes-35.png)</br> <br><p>and <br><p>![media/material-attributes-36.png](media/material-attributes-36.png)</br> <br><p>**Schlick GGX** (default)</br> <br><p> **Implicit**: The microsurface is always visible and generates no shadowing or masking</br> <br><p>**Cook-Torrance**</br> <br><p>**Kelemen**</br> <br><p>**Neumann**</br> <br><p>**Smith-Beckmann**</br> <br><p>**Smith-GGX correlated**</br> <br><p>**Schlick-Beckmann**</br>
| Normal Distribution | <br><p>Defines how the normal is distributed. The gloss attribute is used by this part of the function to modify the distribution of the normal.</br> <br><p>**GGX** (default) </br> <br><p>**Beckmann**</br> <br><p>**Blinn-Phong**</br>
| Fresnel | Defines the amount of light that is reflected and transmitted. The models supported are: <p><br>**Schlick**: An approximation of the Fresnel effect (default)</p></br> <p><br>**Thin glass**: A simulation of light passing through glass</p></br> <p><br>**None**: The material as-is with no Fresnel effect</p></br>
| Visibility | Defines the visibility between of the microfacets between (0, 1). Also known as the geometry attenuation - Shadowing and Masking - in the original Cook-Torrance. Stride simplifies the formula to use the visibility term instead: <p><br>![media/material-attributes-35.png](media/material-attributes-35.png)</p></br> <p><br>and <p><br>![media/material-attributes-36.png](media/material-attributes-36.png)</p></br> <p><br>**Schlick GGX** (default)</p></br> <p><br> **Implicit**: The microsurface is always visible and generates no shadowing or masking</p></br> <p><br>**Cook-Torrance**</p></br> <p><br>**Kelemen**</p></br> <p><br>**Neumann**</p></br> <p><br>**Smith-Beckmann**</p></br> <p><br>**Smith-GGX correlated**</p></br> <p><br>**Schlick-Beckmann**</p></br>
| Normal Distribution | <p><br>Defines how the normal is distributed. The gloss attribute is used by this part of the function to modify the distribution of the normal.</p></br> <p><br>**GGX** (default) </p></br> <p><br>**Beckmann**</p></br> <p><br>**Blinn-Phong**</p></br>
| Fresnel | Defines the amount of light that is reflected and transmitted. The models supported are: <br>**Schlick**: An approximation of the Fresnel effect (default)<br>**Thin glass**: A simulation of light passing through glass<br>**None**: The material as-is with no Fresnel effect
| Visibility | Defines the visibility between of the microfacets between (0, 1). Also known as the geometry attenuation - Shadowing and Masking - in the original Cook-Torrance. Stride simplifies the formula to use the visibility term instead: <br>![media/material-attributes-35.png](media/material-attributes-35.png)<br>and<br>![media/material-attributes-36.png](media/material-attributes-36.png)<br>**Schlick GGX** (default)<br>**Implicit**: The microsurface is always visible and generates no shadowing or masking<br>**Cook-Torrance**<br>**Kelemen**<br>**Neumann**<br>**Smith-Beckmann**<br>**Smith-GGX correlated**<br>**Schlick-Beckmann**
| Normal Distribution | Defines how the normal is distributed. The gloss attribute is used by this part of the function to modify the distribution of the normal.<br>**GGX** (default)<br>**Beckmann**<br>**Blinn-Phong**

## Emissive

Expand Down
6 changes: 4 additions & 2 deletions en/manual/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ These pages contain information about how to use Stride, an open-source C# game
## Latest documentation

### Recent updates
- <span class="badge text-bg-info">New</span> [Scripts - Gizmos](scripts/gizmos.md) - Description and example of the Flexible Processing system
- <span class="badge text-bg-info">New</span> [ECS - Flexible Processing](engine/entity-component-system/flexible-processing.md) - Description and example of the Flexible Processing system

- <span class="badge text-bg-info">Updated</span> [Scripts - Types of script](scripts/types-of-script.md) - Asynchronous script example improved
- <span class="badge text-bg-success">New</span> [Scripts - Gizmos](scripts/gizmos.md) - Description and example of the Flexible Processing system
- <span class="badge text-bg-success">New</span> [ECS - Flexible Processing](engine/entity-component-system/flexible-processing.md) - Description and example of the Flexible Processing system
- <span class="badge text-bg-info">Updated</span> [Linux - Setup and requirements](platforms/linux/setup-and-requirements.md) - Fedora OS option added
- <span class="badge text-bg-success">New</span> [Scripts - Serialization](scripts/serialization.md) - Explanation of serialization
- <span class="badge text-bg-info">Updated</span> [Scripts - Public properties and fields](scripts/public-properties-and-fields.md) - Content improvements and additions
Expand Down
61 changes: 38 additions & 23 deletions en/manual/scripts/types-of-script.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ Example:
```cs
public class StartUpScriptExample : StartupScript
{
public override void Start()
{
// Do some stuff during initialization
}
public override void Start()
{
// Do some stuff during initialization
}
}
```

Expand All @@ -36,10 +36,10 @@ The following script performs updates every frame, no matter what:
```cs
public class SampleSyncScript : SyncScript
{
public override void Update()
{
// Performs the update on the entity — this code is executed every frame
}
public override void Update()
{
// Performs the update on the entity — this code is executed every frame
}
}
```

Expand All @@ -48,30 +48,45 @@ public class SampleSyncScript : SyncScript
Asynchronous scripts are initialized only once, then canceled when removed from the scene.

* Asynchronous code goes in the [Execute](xref:Stride.Engine.AsyncScript.Execute) function.

* Code performing the cancellation goes in the [Cancel](xref:Stride.Engine.ScriptComponent.Cancel) method.

The following script performs actions that depend on events and triggers:

```cs
public class SampleAsyncScript : AsyncScript
{
public override async Task Execute()
{
// The initialization code should come here, if necessary
while (Game.IsRunning) // loop until the game ends (optional depending on the script)
{
await MyEvent;

// Do some stuff
await Script.NextFrame(); // wait for the next frame (optional depending on the script)
}
}
public override async Task Execute()
{
// The initialization code should come here, if necessary
// This method starts running on the main thread
while (Game.IsRunning) // loop until the game ends (optionalpendingon the script)
{
// We're still on the main thread
// Task.Run will pause the execution of this method until the task is completed,
// while that's going on, the game will continue running, it will display new frames and process inputs appropriately
var lobbies = await Task.Run(() => GetMultiplayerLobbies());

// After awaiting a task, the thread the method runs on will have changed,
// this method now runs on a thread pool thread instead of the main thread
// You can manipulate the data returned by the task here if needed
// But if you want to interact with the engine safely, you have to make sure the method runs on the main thread
// await Script.NextFrame() yields execution of this method to the main thread,
// meaning that this method is paused, and once the main thread processes the next frame,
// it will pick that method up and run it
await Script.NextFrame();
// So after this call, this method is back on the main thread
// You can now safely interact with the engine's systems by displaying the lobbies retrieved above in a UI for example
}
}
}
```

Check out an example from our [Async scripts tutorial](../../tutorials/csharpintermediate/async-scripts.md).

## See also

* [Create a script](create-a-script.md)
Expand All @@ -80,4 +95,4 @@ public class SampleAsyncScript : AsyncScript
* [Scheduling and priorities](scheduling-and-priorities.md)
* [Events](events.md)
* [Debugging](debugging.md)
* [Preprocessor variables](preprocessor-variables.md)
* [Preprocessor variables](preprocessor-variables.md)

0 comments on commit 827769c

Please sign in to comment.