more detailed sampler section
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
a9b29023d0
commit
bfdc99601e
|
@ -29,6 +29,16 @@ var mySamplerState = new SamplerState
|
||||||
var mySampler = new Sampler(GraphicsDevice, mySamplerState);
|
var mySampler = new Sampler(GraphicsDevice, mySamplerState);
|
||||||
```
|
```
|
||||||
|
|
||||||
The same sampler can be used in conjunction with as many different textures as you like. We will discuss this more when we get into command buffers.
|
There are three kinds of sample filters: Nearest, Linear, and Cubic. Nearest is the cheapest and doesn't do any kind of filtering. This filter is ideal for upscaling pixel games - Linear will make your pixel art look terrible. Cubic is the most expensive filter but upscales and downscales in decent quality.
|
||||||
|
|
||||||
|
MinFilter describes which filter to use when the result image is smaller than the sampled image - MagFilter, likewise, is used when the result image is larger.
|
||||||
|
|
||||||
|
Anisotropic filtering can be used in conjunction with mipmaps to reduce aliasing and blur on obliquely-rendered textures. Explaning this is beyond the scope of this tutorial but I encourage you to look into the technique if you are planning to make 3D games.
|
||||||
|
|
||||||
|
When you look up pixels using a sampler, you generally look them up using coordinates in the range of [0, 1]. This coordinate space is often referred to as "texture coordinate space" or "UV space". SamplerAddressMode refers to the behavior that will occur if the texture is sampled *outside* of [0, 1] coordinates. ClampToEdge will just take the pixel at the nearest edge. Repeat will loop the image, and MirroredRepeat will mirror the image.
|
||||||
|
|
||||||
|
U-coordinates are horizontal, V-coordinates are vertical, and W-coordinates correspond to depth. You can use different address spaces for each of these directions.
|
||||||
|
|
||||||
|
The same sampler can be used in conjunction with as many different textures as you like. We will discuss this more when we get into "binding" resources using command buffers.
|
||||||
|
|
||||||
There are some common `SamplerState`s that are provided for you, for example `SamplerState.PointClamp`. Have a look at the `SamplerState` definition to see them all.
|
There are some common `SamplerState`s that are provided for you, for example `SamplerState.PointClamp`. Have a look at the `SamplerState` definition to see them all.
|
||||||
|
|
Loading…
Reference in New Issue