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"]); }
public void DOFPostEffectonAdd(coPostEffect thisobj) { // The weighted distribution of CoC value to the three blur textures // in the order small, medium, large. Most likely you will not need to // change this value. DOFPostEffectsetLerpDist(thisobj, "0.2", "0.3", "0.5"); thisobj["autoFocusEnabled"] = false.AsString(); thisobj["focalDist"] = "0"; thisobj["nearBlurMax"] = ".5"; thisobj["farBlurMax"] = ".5"; thisobj["minRange"] = "50"; thisobj["maxRange"] = "500"; thisobj["nearSlope"] = "-5"; thisobj["farSlope"] = "5"; }
public void DOFPostEffectsetLerpDist(coPostEffect thisobj, string d0, string d1, string d2) { thisobj["lerpScale"] = (-1.0/d0.AsFloat()).AsString() + " " + (-1.0/d1.AsFloat()).AsString() + " " + (-1.0/d2.AsFloat()).AsString() + " " + (1.0/d2.AsFloat()).AsString(); string lerpbias = "1.0 "; lerpbias += ((1 - d2.AsFloat())/d1.AsFloat()).AsString() + " "; lerpbias += (1.0/d2.AsFloat()).AsString() + " "; lerpbias += ((d2.AsFloat() - 1.0)/d2.AsFloat()).AsString(); thisobj["lerpBias"] = lerpbias; }
public void DOFPostEffectsetAutoFocus(coPostEffect thisobj, bool enabled) { thisobj["autoFocusEnabled"] = enabled.AsString(); }
public void DOFPostEffectsetFocusParams(coPostEffect thisobj, float nearBlurMax, float farBlurMax, float minRange, float maxRange, float nearSlope, float farSlope) { thisobj["nearBlurMax"] = nearBlurMax.AsString(); thisobj["farBlurMax"] = farBlurMax.AsString(); thisobj["minRange"] = minRange.AsString(); thisobj["maxRange"] = maxRange.AsString(); thisobj["nearSlope"] = nearSlope.AsString(); thisobj["farSlope"] = farSlope.AsString(); }
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()); }
public void DOFPostEffectsetFocalDist(coPostEffect thisobj, string dist) { thisobj["focalDist"] = dist; }
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()); }
public void LuminanceVisPostFXsetShaderConsts(coPostEffect thisobj) { thisobj.setShaderConst("$brightPassThreshold", sGlobal["$HDRPostFX::brightPassThreshold"]); }
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 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"); } }
public void SSAOPostFxpreProcess(coPostEffect thisobj) { if (sGlobal["$SSAOPostFx::quality"] != thisobj["quality"]) { thisobj["quality"] = Util.mClamp(Util.mRound(console.GetVarFloat("$SSAOPostFx::quality")), 0, 2).AsString(); thisobj.setShaderMacro("QUALITY", thisobj["quality"]); } thisobj["targetScale"] = sGlobal["$SSAOPostFx::targetScale"]; }
public void SSAOPostFxonAdd(coPostEffect thisobj) { thisobj["wasVis"] = "Uninitialized"; thisobj["quality"] = "Uninitialized"; }
public void GammaPostFXpreProcess(coPostEffect thisobj) { if (thisobj["texture[1]"] != sGlobal["$HDRPostFX::colorCorrectionRamp"]) thisobj.setTexture(1, sGlobal["$HDRPostFX::colorCorrectionRamp"]); }
public void DOFPostEffectautoFocus(coPostEffect thisobj) { try { coGameConnection serverconnection = "ServerConnection"; coCamera camera = serverconnection.getCameraObject(); uint mask = (uint) (WinterLeaf.Enums.SceneObjectTypesAsUint.StaticObjectType | WinterLeaf.Enums.SceneObjectTypesAsUint.TerrainObjectType); //string control = GameConnection.getCameraObject("ServerConnection"); //console.Call("ServerConnection", "getCameraObject"); Point3F fvec = camera.getEyeVector(); Point3F start = camera.getEyePoint(); //Point3F fvec = ShapeBase.getEyeVector(control); // console.Call(control, "getEyeVector"); //Point3F start = ShapeBase.getEyePoint(control); // console.Call(control, "getEyePoint"); Point3F end = Util.VectorAdd(start, Util.VectorScale(fvec, fGlobal["$Param::FarDist"])); string result = Util.containerRayCast(start, end, mask, camera, true); string hitPos = Util.getWords(result, 1, 3); string focDist = sGlobal["$Param::FarDist"]; if (hitPos != "") focDist = Util.VectorDist(new Point3F(hitPos), start).AsString(); thisobj["focalDist"] = focDist; } catch (Exception) { //Do nothing, this only gets hit when it can't find the serverconnection or the camera. } }
public void ChromaticLensPostFXsetShaderConsts(coPostEffect posteffect) { posteffect.setShaderConst("$distCoeff", sGlobal["$CAPostFx::distCoeffecient"]); posteffect.setShaderConst("$cubeDistort", sGlobal["$CAPostFx::cubeDistortionFactor"]); posteffect.setShaderConst("$colorDistort", sGlobal["$CAPostFx::colorDistortionFactor"]); }
public void MLAAFxsetShaderConsts(coPostEffect thisobj) { thisobj.setShaderConst("$lumaCoefficients", thisobj["lumaCoefficients"]); thisobj.setShaderConst("$threshold", thisobj["threshold"]); thisobj.setShaderConst("$depthThreshold", thisobj["depthThreshold"]); }
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"]); }