# ShaderEffect.DdxUvDdyUvRegisterIndex Property

**Silverlight**

Gets or sets a value that indicates the shader register to use for the partial derivatives of the texture coordinates with respect to screen space.

**Namespace:**System.Windows.Media.Effects

**Assembly:**System.Windows (in System.Windows.dll)

This value can be set and used in an HLSL shader as a constant that defines a sampling rate or step size into a texture for use in a shader program.

Use the DdxUvDdyUvRegisterIndex property to specify the shader register that contains the partial derivatives of the texture coordinates with respect to screen space. For example, if DdxUvDdyUvRegisterIndex is set to 4, the shader register c4 is used. Register c4 contains four float fields. The following HLSL code shows how this register is used. The nextPixelUV value represents the next pixel to the right.

float4 ddxUvDdyUv : register(c4); SamplerState sampler : register(S0); ... float2 nextPixelUV; nextPixelUV.u = ddxUvDdyUv.x + u; nextPixelUV.v = ddxUvDdyUv.y + v; tex2D(sampler, nextPixelUV);

The following table shows how the register specified for DdxUvDdyUvRegisterIndex is filled.

Register Constant | Derivative Value |
---|---|

x component | ddx(u) |

y component | ddx(v) |

z component | ddy(u) |

w component | ddy(v) |

Texture coordinates are denoted as (u, v). ddx(u) is the constant partial derivative of the texture coordinate component u with respect to the screen-space x-coordinate. ddy(u) is the partial derivative of the texture coordinate u with respect to the screen-space y-coordinate. Similarly, ddx(v) and ddy(v) are the corresponding screen-space derivatives for the texture coordinate component v.

Note: |
---|

HLSL has the ddx and ddy instructions to calculate these values, but these instructions are not available on all PixelShader 2.0 hardware. |

You may think of these constants in the following way. If you step 1 pixel to the right in screen space (in the x direction), then ddx(u) is the amount that u changes in texture space, and ddx(v) is the amount that v changes in texture space. If the effect is axis-aligned when it is rendered, then ddx(v) is 0. If the effect is rotated when it is rendered, then ddx(v) is non-zero.

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.