Share via


PrtEngine.ComputeDirectLightingSphericalHarmonicsGpu(Device,GpuSimulatorOption,Int32,Single,Single,PrtBuffer) Method (Microsoft.DirectX.Direct3D)

Uses the graphics processing unit (GPU) to compute the direct-lighting contribution to 3-D objects where the source radiance is represented by a spherical harmonic (SH) approximation. Computing the lighting on the GPU will generally be much faster than on the CPU.

Definition

Visual Basic Public Sub ComputeDirectLightingSphericalHarmonicsGpu( _
    ByVal device As Device, _
    ByVal flags As GpuSimulatorOption, _
    ByVal shOrder As Integer, _
    ByVal zbias As Single, _
    ByVal zangleBias As Single, _
    ByVal data As PrtBuffer _
)
C# public void ComputeDirectLightingSphericalHarmonicsGpu(
    Device device,
    GpuSimulatorOption flags,
    int shOrder,
    float zbias,
    float zangleBias,
    PrtBuffer data
);
C++ public:
void ComputeDirectLightingSphericalHarmonicsGpu(
    Devicedevice,
    GpuSimulatorOption flags,
    int shOrder,
    float zbias,
    float zangleBias,
    PrtBufferdata
);
JScript public function ComputeDirectLightingSphericalHarmonicsGpu(
    device : Device,
    flags : GpuSimulatorOption,
    shOrder : int,
    zbias : float,
    zangleBias : float,
    data : PrtBuffer
);

Parameters

device Microsoft.DirectX.Direct3D.Device
The Device used to run the simulation on the GPU. The device must support pixel shader version 2.0 or higher.
flags Microsoft.DirectX.Direct3D.GpuSimulatorOption
The GPU simulation parameter that defines the resolution of the shadow z-buffer. Should be set to one of the GpuSimulatorOption enumeration values. To specifiy higher precision simulation, the GpuSimulatorOption.HighQuality value may be combined with one of the GpuSimulatorOption.ShadowResxxxx values.
shOrder System.Int32
Order of the SH evaluation. Must be in the range of SphericalHarmonics.MinimumOrder to SphericalHarmonics.MaximumOrder, inclusive. The evaluation generates shOrder2 coefficients. The degree of the evaluation is shOrder - 1.
zbias System.Single
Bias in the normal direction.
zangleBias System.Single
Bias in the normal direction, scaled by one minus the cosine of the angle with the light ray.
data Microsoft.DirectX.Direct3D.PrtBuffer
A PrtBuffer object that contains the output data. This buffer must have the proper number of color channels allocated for the simulation.

Remarks

In this method, the albedo is not multiplied by the light signal, and only incoming light is integrated in the simulator. By not multiplying the albedo, you can model albedo variation at a finer scale than the source radiance, thereby yielding more accurate results from compression.

Call PrtEngine.MultiplyAlbedo to multiply each precomputed radiance transfer (PRT) vector by the albedo.

Exceptions

InvalidCallException

The method call is invalid. For example, a method's parameter might contain an invalid value.

OutOfMemoryExceptionLeave Site

Microsoft Direct3D could not allocate sufficient memory to complete the call.