Not
Bu sayfaya erişim yetkilendirme gerektiriyor. Oturum açmayı veya dizinleri değiştirmeyi deneyebilirsiniz.
Bu sayfaya erişim yetkilendirme gerektiriyor. Dizinleri değiştirmeyi deneyebilirsiniz.
3B arama tablosu, efektin tüm giriş değerlerinin bir alt kümesi için girişleri çıkışlara nasıl eşlediğini önceden hesaplayarak herhangi bir 1:1 görüntüleme efektini kapsüllemek için kullanılan genel amaçlı bir etkidir.
3B Arama Tablosu (LUT) efekti, bir 3B dokuyu dizine almak için görüntünün RGB renk değerini kullanarak bir giriş görüntüsünü değiştirir ve burada doku rastgele bir efekt işlem hattının önceden derlenmiş çıkış değerini içerir.
3B LUT'un işlenmek için bir GPU doku kaynağına yüklenmesi gerekir ve doku boyutuna ve cihaz özelliklerine bağlı olarak bu pahalı olabilir. Uygulama geliştiricileri ID2D1LookupTable3D D2D kaynağını kullanarak bu maliyetin ne zaman ödeneceğini belirtebilir. id2D1LookupTable3D aşağıdaki özniteliklere sahiptir:
- 3B LUT'un GPU kaynağının soyut bir gösterimini sağlar.
- Cihaz özelliklerine bağlı olarak, 2B veya 3B doku oluşturulur ve sağlanan LUT verileriyle doldurulur.
- İşleme için 3B LUT efektinin özelliğine geçirilebilir.
Bu etki için CLSID CLSID_D2D1LookupTable3D.
Örnek resim
efekt çıkışıörneği
Örnek kod
//
// 1. Generate the lookup table data and create an ID2D1LookupTable3D.
//
// Create a 16x16x16 LUT of arbitrary data type T.
UINT extents[] = { 16, 16, 16 };
UINT cElements = extents[0] * extents[1] * extents[2] * 4;
UINT cbElements = cElements * formatSize;
// Compute the step size in each direction to vary the RGB
// channels uniformly over the range [0, 1]
float steps[] =
{
1.0f / static_cast<float>(extents[0] - 1),
1.0f / static_cast<float>(extents[1] - 1),
1.0f / static_cast<float>(extents[2] - 1),
};
CArray<BYTE> lutData;
IFR(lutData.Resize(cbElements));
T* pData = reinterpret_cast<T *>(lutData.GetData());
T oneValue = ConvertValue<T>(1.0f);
// Generate the LUT by applying an imaging pipeline to RGB values.
for (UINT iR = 0; iR < extents[2]; iR++)
{
for (UINT iG = 0; iG < extents[1]; iG++)
{
for (UINT iB = 0; iB < extents[0]; iB++)
{
T outputColor[3];
ApplyPipeline(iR * steps[2], iG * steps[1], iB * steps[0], &outputColor);
pData[0] = outColor[0];
pData[1] = outColor[1];
pData[2] = outColor[2];
// Set opaque alpha in the output
pData[3] = oneValue;
// Advance the pointer
pData += sizeof(T) * 4;
}
}
}
// Compute the strides of the LUT data.
UINT strides[2];
IFR(UIntMult(sizeof(T) * 4, extents[0], &strides[0]));
IFR(UIntMult(strides[0], extents[1], &strides[1]));
D2D1_BUFFER_PRECISION precision = GetBufferPrecision<T>();
// Create an ID2D1LookupTable3D from the LUT data.
CComPtr<ID2D1LookupTable3D> sp3dLut;
IFR(_spEffectContext1->CreateLookupTable3D(
precision,
extents,
lutData.GetData(),
lutData.GetCount(),
strides,
&sp3dLut
));
//
// 2. To apply the lookup table to an input image, create a LookupTable3D effect
// and pass the ID2D1LookupTable3D to the effect as a property.
//
// Create a 3D LUT effect to render our LUT.
CComPtr<ID2D1Effect> sp3dLutEffect;
IFR(pEffectContext->CreateEffect(CLSID_D2D1LookupTable3D, &sp3dLutEffect));
// Set the LUT as a property on the effect.
IFR(sp3dLutEffect->SetValue(D2D1_LOOKUPTABLE3D_PROP_LUT, _spLut));
Efekt özellikleri
3B arama tablosu efektinin özellikleri D2D1_LOOKUPTABLE3D_PROP numaralandırması tarafından tanımlanır.
Gereksinim -leri
| Gereksinim | Değer |
|---|---|
| Desteklenen en düşük istemci | Windows 10 [masaüstü uygulamaları | Windows Mağazası uygulamaları] |
| Desteklenen en düşük sunucu | Windows 10 [masaüstü uygulamaları | Windows Mağazası uygulamaları] |
| Üstbilgi | d2d1effects_2.h |
| Kütüphane | d2d1.lib, dxguid.lib |