protected override void OnEnable()
        {
            base.OnEnable();

            // These shaders don't need to be reference by RenderPipelineResource as they are not use at runtime
            m_ProfileMaterial       = CoreUtils.CreateEngineMaterial("Hidden/HDRP/DrawDiffusionProfile");
            m_TransmittanceMaterial = CoreUtils.CreateEngineMaterial("Hidden/HDRP/DrawTransmittanceGraph");

            var serializedProfile = properties.Find(x => x.profile);

            var rp = new RelativePropertyFetcher <DiffusionProfile>(serializedProfile);

            m_Profile = new Profile
            {
                self         = serializedProfile,
                objReference = m_Target.profile,

                scatteringDistance = rp.Find(x => x.scatteringDistance),
                transmissionTint   = rp.Find(x => x.transmissionTint),
                texturingMode      = rp.Find(x => x.texturingMode),
                transmissionMode   = rp.Find(x => x.transmissionMode),
                thicknessRemap     = rp.Find(x => x.thicknessRemap),
                worldScale         = rp.Find(x => x.worldScale),
                ior = rp.Find(x => x.ior)
            };

            Undo.undoRedoPerformed += UpdateProfile;
        }
Esempio n. 2
0
        CloudMapParameter UnpackCloudMap(SerializedProperty serializedProperty)
        {
            var p = new RelativePropertyFetcher <CloudLayer.CloudMap>(serializedProperty);

            return(new CloudMapParameter
            {
                cloudMap = Unpack(p.Find(x => x.cloudMap)),
                opacities = new SerializedDataParameter[]
                {
                    Unpack(p.Find(x => x.opacityR)),
                    Unpack(p.Find(x => x.opacityG)),
                    Unpack(p.Find(x => x.opacityB)),
                    Unpack(p.Find(x => x.opacityA))
                },

                rotation = Unpack(p.Find(x => x.rotation)),
                tint = Unpack(p.Find(x => x.tint)),
                exposure = Unpack(p.Find(x => x.exposure)),
                distortion = Unpack(p.Find(x => x.distortionMode)),
                scrollDirection = Unpack(p.Find(x => x.scrollDirection)),
                scrollSpeed = Unpack(p.Find(x => x.scrollSpeed)),
                flowmap = Unpack(p.Find(x => x.flowmap)),

                lighting = Unpack(p.Find(x => x.lighting)),
                steps = Unpack(p.Find(x => x.steps)),
                thickness = Unpack(p.Find(x => x.thickness)),
                castShadows = Unpack(p.Find(x => x.castShadows)),
            });
        }
        protected override void OnEnable()
        {
            base.OnEnable();

            // These shaders don't need to be reference by RenderPipelineResource as they are not use at runtime
            m_ProfileMaterial       = CoreUtils.CreateEngineMaterial("Hidden/HDRenderPipeline/DrawDiffusionProfile");
            m_TransmittanceMaterial = CoreUtils.CreateEngineMaterial("Hidden/HDRenderPipeline/DrawTransmittanceGraph");

            int count = DiffusionProfileConstants.DIFFUSION_PROFILE_COUNT - 1;

            m_Profiles = new List <Profile>();

            var serializedProfiles = properties.Find(x => x.profiles);

            for (int i = 0; i < count; i++)
            {
                var serializedProfile = serializedProfiles.GetArrayElementAtIndex(i);
                var rp = new RelativePropertyFetcher <DiffusionProfile>(serializedProfile);

                var profile = new Profile
                {
                    self         = serializedProfile,
                    objReference = m_Target.profiles[i],

                    name = rp.Find(x => x.name),

                    scatteringDistance = rp.Find(x => x.scatteringDistance),
                    transmissionTint   = rp.Find(x => x.transmissionTint),
//forest-begin: Tweakable transmission
                    transmissionDirectScale   = rp.Find(x => x.transmissionDirectScale),
                    transmissionIndirectScale = rp.Find(x => x.transmissionIndirectScale),
//forest-end:
                    texturingMode    = rp.Find(x => x.texturingMode),
                    transmissionMode = rp.Find(x => x.transmissionMode),
                    thicknessRemap   = rp.Find(x => x.thicknessRemap),
                    worldScale       = rp.Find(x => x.worldScale),
                    ior = rp.Find(x => x.ior),

                    scatterDistance1 = rp.Find(x => x.scatterDistance1),
                    scatterDistance2 = rp.Find(x => x.scatterDistance2),
                    lerpWeight       = rp.Find(x => x.lerpWeight)
                };

                m_Profiles.Add(profile);
            }
        }
        protected override void OnEnable()
        {
            base.OnEnable();

            // These shaders don't need to be reference by RenderPipelineResource as they are not use at runtime
            m_ProfileMaterial       = CoreUtils.CreateEngineMaterial("Hidden/HDRenderPipeline/DrawSssProfile");
            m_TransmittanceMaterial = CoreUtils.CreateEngineMaterial("Hidden/HDRenderPipeline/DrawTransmittanceGraph");

            int count = SssConstants.SSS_N_PROFILES - 1;

            m_Profiles = new List <Profile>();

            m_UseDisneySSS = properties.Find(x => x.useDisneySSS);
            var serializedProfiles = properties.Find(x => x.profiles);

            for (int i = 0; i < count; i++)
            {
                var serializedProfile = serializedProfiles.GetArrayElementAtIndex(i);
                var rp = new RelativePropertyFetcher <SubsurfaceScatteringProfile>(serializedProfile);

                var profile = new Profile
                {
                    self         = serializedProfile,
                    objReference = m_Target.profiles[i],

                    name = rp.Find(x => x.name),

                    scatteringDistance = rp.Find(x => x.scatteringDistance),
                    transmissionTint   = rp.Find(x => x.transmissionTint),
                    texturingMode      = rp.Find(x => x.texturingMode),
                    transmissionMode   = rp.Find(x => x.transmissionMode),
                    thicknessRemap     = rp.Find(x => x.thicknessRemap),
                    worldScale         = rp.Find(x => x.worldScale),
                    fresnel0           = rp.Find(x => x.fresnel0),

                    scatterDistance1 = rp.Find(x => x.scatterDistance1),
                    scatterDistance2 = rp.Find(x => x.scatterDistance2),
                    lerpWeight       = rp.Find(x => x.lerpWeight)
                };

                m_Profiles.Add(profile);
            }
        }