Example #1
0
 public ProbeVolumeArtistParameters(Color debugColor)
 {
     this.debugColor               = debugColor;
     this.drawProbes               = false;
     this.payloadIndex             = -1;
     this.size                     = Vector3.one;
     this.m_PositiveFade           = Vector3.zero;
     this.m_NegativeFade           = Vector3.zero;
     this.m_UniformFade            = 0;
     this.advancedFade             = false;
     this.distanceFadeStart        = 10000.0f;
     this.distanceFadeEnd          = 10000.0f;
     this.scale                    = Vector3.zero;
     this.bias                     = Vector3.zero;
     this.octahedralDepthScaleBias = Vector4.zero;
     this.probeSpacingMode         = ProbeSpacingMode.Density;
     this.resolutionX              = 4;
     this.resolutionY              = 4;
     this.resolutionZ              = 4;
     this.densityX                 = (float)this.resolutionX / this.size.x;
     this.densityY                 = (float)this.resolutionY / this.size.y;
     this.densityZ                 = (float)this.resolutionZ / this.size.z;
     this.volumeBlendMode          = VolumeBlendMode.Normal;
     this.weight                   = 1;
     this.normalBiasWS             = 0.0f;
     this.dilationIterations       = 2;
     this.backfaceTolerance        = 0.25f;
     this.lightLayers              = LightLayerEnum.LightLayerDefault;
 }
Example #2
0
        internal static uint PackProbeVolumeSortKey(VolumeBlendMode volumeBlendMode, float logVolume, int probeVolumeIndex)
        {
            // 1 bit blendMode, 20 bit volume, 11 bit index
            Debug.Assert(logVolume >= 0.0f && (uint)logVolume < (1 << 20));
            Debug.Assert(probeVolumeIndex >= 0 && (uint)probeVolumeIndex < (1 << 11));
            const uint VOLUME_MASK = (1 << 20) - 1;
            const uint INDEX_MASK  = (1 << 11) - 1;

            // Sort probe volumes primarily by blend mode, and secondarily by size.
            // In the lightloop, this means we will evaluate all Additive and Subtractive blending volumes first,
            // and finally our Normal (over) blending volumes.
            // This allows us to early out during the Normal blend volumes if opacity has reached 1.0 across all threads.
            uint blendModeBits = ((volumeBlendMode != VolumeBlendMode.Normal) ? 0u : 1u) << 31;
            uint logVolumeBits = ((uint)logVolume & VOLUME_MASK) << 11;
            uint indexBits     = (uint)probeVolumeIndex & INDEX_MASK;

            return(blendModeBits | logVolumeBits | indexBits);
        }