Esempio n. 1
0
        public void DOFPostEffectsetShaderConsts(coPostEffect posteffect)
            {
            if (posteffect["autoFocusEnabled"].AsBool())
                DOFPostEffectautoFocus(posteffect);


            double fd = posteffect["focalDist"].AsFloat()/fGlobal["$Param::FarDist"];
            double range = Util.mLerp(posteffect["minRange"].AsFloat(), posteffect["maxRange"].AsFloat(), (float) fd)/fGlobal["$Param::FarDist"]*.5;
            // We work in "depth" space rather than real-world units for the
            // rest of this method...

            // Given the focal distance and the range around it we want in focus
            // we can determine the near-end-distance and far-start-distance

            double ned = Util.getMax((float) fd - (float) range, (float) 0.0);
            double fsd = Util.getMin((float) fd + (float) range, (float) 1.0);
            // near slope
            float nsl = posteffect["nearSlope"].AsFloat();
            // Given slope of near blur equation and the near end dist and amount (x2,y2)
            // solve for the y-intercept
            // y = mx + b
            // so...
            // y - mx = b

            float b = (float) 0.0 - nsl*(float) ned;
            string eqNear = nsl.AsString() + " " + b.AsString() + " 0.0";

            // Do the same for the far blur equation...

            float fsl = posteffect["farSlope"].AsFloat();
            b = (float) 0.0 - fsl*(float) fsd;

            string eqFar = fsl.AsString() + " " + b.AsString() + " " + "1.0";

            coPostEffect DOFFinalPFX = "DOFFinalPFX";

            posteffect.setShaderConst("$dofEqWorld", eqNear);
            DOFFinalPFX.setShaderConst("$dofEqFar", eqFar);
            posteffect.setShaderConst("$maxWorldCoC", posteffect["nearBlurMax"]);
            DOFFinalPFX.setShaderConst("$maxFarCoC", posteffect["farBlurMax"]);
            DOFFinalPFX.setShaderConst("$dofLerpScale", posteffect["lerpScale"]);
            DOFFinalPFX.setShaderConst("$dofLerpBias", posteffect["lerpBias"]);
            }
Esempio n. 2
0
 public void MLAAFxsetShaderConsts(coPostEffect thisobj)
     {
     thisobj.setShaderConst("$lumaCoefficients", thisobj["lumaCoefficients"]);
     thisobj.setShaderConst("$threshold", thisobj["threshold"]);
     thisobj.setShaderConst("$depthThreshold", thisobj["depthThreshold"]);
     }
Esempio n. 3
0
 public void LuminanceVisPostFXsetShaderConsts(coPostEffect thisobj)
     {
     thisobj.setShaderConst("$brightPassThreshold", sGlobal["$HDRPostFX::brightPassThreshold"]);
     }
 public void ChromaticLensPostFXsetShaderConsts(coPostEffect posteffect)
     {
     posteffect.setShaderConst("$distCoeff", sGlobal["$CAPostFx::distCoeffecient"]);
     posteffect.setShaderConst("$cubeDistort", sGlobal["$CAPostFx::cubeDistortionFactor"]);
     posteffect.setShaderConst("$colorDistort", sGlobal["$CAPostFx::colorDistortionFactor"]);
     }
Esempio n. 5
0
        public void HDRPostFXsetShaderConsts(coPostEffect thisobj)
            {
            thisobj.setShaderConst("$brightPassThreshold", sGlobal["$HDRPostFX::brightPassThreshold"]);
            thisobj.setShaderConst("$g_fMiddleGray", sGlobal["$HDRPostFX::keyValue"]);
            coPostEffect bloomh = thisobj.findObjectByInternalName("bloomH", true);

            bloomh.setShaderConst("$gaussMultiplier", sGlobal["$HDRPostFX::gaussMultiplier"]);
            bloomh.setShaderConst("$gaussMean", sGlobal["$HDRPostFX::gaussMean"]);
            bloomh.setShaderConst("$gaussStdDev", sGlobal["$HDRPostFX::gaussStdDev"]);

            coPostEffect bloomV = thisobj.findObjectByInternalName("bloomV", true);

            bloomV.setShaderConst("$gaussMultiplier", sGlobal["$HDRPostFX::gaussMultiplier"]);
            bloomV.setShaderConst("$gaussMean", sGlobal["$HDRPostFX::gaussMean"]);
            bloomV.setShaderConst("$gaussStdDev", sGlobal["$HDRPostFX::gaussStdDev"]);

            double minLuminace = dGlobal["$HDRPostFX::minLuminace"];

            if (minLuminace <= 0.0)
                minLuminace = 0.00001;

            ((coPostEffect)thisobj.findObjectByInternalName("adaptLum", true)).setShaderConst("$g_fMinLuminace", minLuminace.AsString());
            ((coPostEffect)thisobj.findObjectByInternalName("finalLum", true)).setShaderConst("$adaptRate", sGlobal["$HDRPostFX::adaptRate"]);

            coPostEffect combinePass = thisobj.findObjectByInternalName("combinePass", true);
            combinePass.setShaderConst("$g_fEnableToneMapping", sGlobal["$HDRPostFX::enableToneMapping"]);
            combinePass.setShaderConst("$g_fMiddleGray", sGlobal["$HDRPostFX::keyValue"]);

            combinePass.setShaderConst("$g_fBloomScale", sGlobal["$HDRPostFX::enableBloom"]);
            combinePass.setShaderConst("$g_fEnableBlueShift", sGlobal["$HDRPostFX::enableBlueShift"]);
            combinePass.setShaderConst("$g_fBlueShiftColor", sGlobal["$HDRPostFX::blueShiftColor"]);

            float clampedGamma = Util.mClamp(fGlobal["$pref::Video::Gamma"], (float) 0.001, (float) 2.2);
            combinePass.setShaderConst("$g_fOneOverGamma", (1/clampedGamma).AsString());
            float whiteCutoff = fGlobal["$HDRPostFX::whiteCutoff"]*fGlobal["$HDRPostFX::whiteCutoff"]*fGlobal["$HDRPostFX::whiteCutoff"]*fGlobal["$HDRPostFX::whiteCutoff"];
            combinePass.setShaderConst("$g_fWhiteCutoff", whiteCutoff.AsString());
            }
Esempio n. 6
0
        public void FlashFxsetShaderConsts(coPostEffect thisobj)
            {
            coGameConnection serverConnection = "ServerConnection";

            if (console.isObject(thisobj))
                {
                thisobj.setShaderConst("$damageFlash", serverConnection.getDamageFlash().AsString());
                thisobj.setShaderConst("$whiteOut", serverConnection.getWhiteOut().AsString());
                }
            else
                {
                thisobj.setShaderConst("$damageFlash", "0");
                thisobj.setShaderConst("$whiteOut", "0");
                }
            }
Esempio n. 7
0
        public void SSAOPostFxsetShaderConsts(coPostEffect thisobj)
            {
            //thisobj.setShaderConst("$",);
            thisobj.setShaderConst("$sRadius", sGlobal["$SSAOPostFx::sRadius"]);
            thisobj.setShaderConst("$sStrength", sGlobal["$SSAOPostFx::sStrength"]);
            thisobj.setShaderConst("$sDepthMin", sGlobal["$SSAOPostFx::sDepthMin"]);
            thisobj.setShaderConst("$sDepthMax", sGlobal["$SSAOPostFx::sDepthMax"]);
            thisobj.setShaderConst("$sDepthPow", sGlobal["$SSAOPostFx::sDepthPow"]);
            thisobj.setShaderConst("$sNormalTol", sGlobal["$SSAOPostFx::sNormalTol"]);
            thisobj.setShaderConst("$sNormalPow", sGlobal["$SSAOPostFx::sNormalPow"]);
            thisobj.setShaderConst("$lRadius", sGlobal["$SSAOPostFx::lRadius"]);
            thisobj.setShaderConst("$lStrength", sGlobal["$SSAOPostFx::lStrength"]);
            thisobj.setShaderConst("$lDepthMin", sGlobal["$SSAOPostFx::lDepthMin"]);
            thisobj.setShaderConst("$lDepthMax", sGlobal["$SSAOPostFx::lDepthMax"]);
            thisobj.setShaderConst("$lDepthPow", sGlobal["$SSAOPostFx::lDepthPow"]);
            thisobj.setShaderConst("$lNormalTol", sGlobal["$SSAOPostFx::lNormalTol"]);
            thisobj.setShaderConst("$lNormalPow", sGlobal["$SSAOPostFx::lNormalPow"]);

            coPostEffect blur = thisobj.findObjectByInternalName("blurY", false);
            blur.setShaderConst("$blurDepthTol", sGlobal["$SSAOPostFx::blurDepthTol"]);
            blur.setShaderConst("$blurNormalTol", sGlobal["$SSAOPostFx::blurNormalTol"]);

            blur = thisobj.findObjectByInternalName("blurX", false);
            blur.setShaderConst("$blurDepthTol", sGlobal["$SSAOPostFx::blurDepthTol"]);
            blur.setShaderConst("$blurNormalTol", sGlobal["$SSAOPostFx::blurNormalTol"]);

            blur = thisobj.findObjectByInternalName("blurY2", false);
            blur.setShaderConst("$blurDepthTol", sGlobal["$SSAOPostFx::blurDepthTol"]);
            blur.setShaderConst("$blurNormalTol", sGlobal["$SSAOPostFx::blurNormalTol"]);

            blur = thisobj.findObjectByInternalName("blurX2", false);
            blur.setShaderConst("$blurDepthTol", sGlobal["$SSAOPostFx::blurDepthTol"]);
            blur.setShaderConst("$blurNormalTol", sGlobal["$SSAOPostFx::blurNormalTol"]);
            }
 public void GammaPostFXsetShaderConsts(coPostEffect thisobj)
     {
     float clampedGamma = Util.mClamp(fGlobal["$pref::Video::Gamma"], (float) 0.001, (float) 2.2);
     thisobj.setShaderConst("$OneOverGamma", (1/clampedGamma).AsString());
     }
Esempio n. 9
0
        public void LightRayPostFXsetShaderConsts(coPostEffect thisobj)
            {
            thisobj.setShaderConst("$brightScalar", sGlobal["$LightRayPostFX::brightScalar"]);
            coPostEffect pfx = thisobj.findObjectByInternalName("final", true);

            pfx.setShaderConst("$numSamples", sGlobal["$LightRayPostFX::numSamples"]);
            pfx.setShaderConst("$density", sGlobal["$LightRayPostFX::density"]);
            pfx.setShaderConst("$weight", sGlobal["$LightRayPostFX::weight"]);
            pfx.setShaderConst("$decay", sGlobal["$LightRayPostFX::decay"]);
            pfx.setShaderConst("$exposure", sGlobal["$LightRayPostFX::exposure"]);
            }