Page 1 of 1

chromaticLens postFx?

Posted: Sat Jan 14, 2017 1:50 pm
by Duion
I noticed there is a chromaticLens PostFx shader in the folder, but it is not active or implemented into the system, so I tried to enable it, just to find that I cannot see anything.
Does anyone know how to enable it and what values are supposed to be used for the variables? Since I tried several values up to extreme numbers and still could not see any difference.

Re: chromaticLens postFx?

Posted: Sat Jan 21, 2017 8:46 pm
by Jason Campbell
It seems to do something. Adds the effect to everything.

Image link:

$CAPostFx::enabled = true;

/// The lens distortion coefficient.
$CAPostFx::distCoeffecient =  -0.05;

/// The cubic distortion value.
$CAPostFx::cubeDistortionFactor =  -0.1;

/// The amount and direction of the maxium shift for
/// the red, green, and blue channels.
$CAPostFx::colorDistortionFactor = "0.005 -0.005 0.01";

singleton GFXStateBlockData( PFX_DefaultChromaticLensStateBlock )
   zDefined = true;
   zEnable = true;
   zWriteEnable = false;
   samplersDefined = true;
   samplerStates[0] = SamplerClampPoint;

singleton ShaderData( PFX_ChromaticLensShader )
   DXVertexShaderFile 	= "shaders/common/postFx/postFxV.hlsl";
   DXPixelShaderFile 	= "shaders/common/postFx/chromaticLens.hlsl";

   OGLVertexShaderFile  = "shaders/common/postFx/gl/postFxV.glsl";
   OGLPixelShaderFile   = "shaders/common/postFx/gl/chromaticLens.glsl";

   samplerNames[0] = "$backBuffer";

   pixVersion = 3.0;

singleton PostEffect( ChromaticLensPostFX )
   renderTime = "PFXAfterDiffuse";
   renderPriority = 0.2;
   isEnabled = true;
   allowReflectPass = true;

   shader = PFX_ChromaticLensShader;
   stateBlock = PFX_DefaultChromaticLensStateBlock;
   texture[0] = "$backBuffer";
   target = "$backBuffer";

function ChromaticLensPostFX::setShaderConsts( %this )
   %this.setShaderConst( "$distCoeff", $CAPostFx::distCoeffecient );
   %this.setShaderConst( "$cubeDistort", $CAPostFx::cubeDistortionFactor );
   %this.setShaderConst( "$colorDistort", $CAPostFx::colorDistortionFactor );

Re: chromaticLens postFx?

Posted: Sat Jan 21, 2017 9:55 pm
by Duion
How you made it work? And what is it good for? And why is it in the default template?

Re: chromaticLens postFx?

Posted: Sun Jan 22, 2017 1:10 am
by Jason Campbell
That code is from chromaticFX.cs in core/scripts/client/postFX I think. I just changed some falses to trues. Just paste that over yours. However the real question is, what use is this? I admit it hurts to look at and apparently it just recreates an artifact created in a camera lens. Your guess is as good as mine. Maybe created back at GG?

Re: chromaticLens postFx?

Posted: Mon Jan 23, 2017 3:44 am
by JeffR
It's an increasingly common graphical effect used to make scenes feel more 'real' in terms of how accurate an image looks to how it'd look as taken by a camera. It's also occasionally utilized in conjunction with taking damage or the like to help convey it being bad.

But yes, the effect on it's own if used too much looks bad, and IS replicating a camera artifact, it still can be useful in achieving a certain look one may be going for.

Re: chromaticLens postFx?

Posted: Tue Jan 24, 2017 1:49 am
by Jason Campbell
Yeah, I didn't think about it much. It could be used to show a security camera feed also or a cut scene that is supposed to be in the past or something.

Re: chromaticLens postFx?

Posted: Tue Jan 24, 2017 8:43 pm
by Steve_Yorkshire
And what is it good for?
Invoking satan and his many little wizards ... Chromotic Abberation is literally the devil ...
I think it's from the big library of postFX shaders which is still available via the download in the resource on GG.

EDIT: If you're gonna use any of those you might want to swap the renderBin = "glowBin" to "ObjTranslucentBin". Just sayin'.

EDIT2: actually you probably want to swap renderTime= "PFXAfterBin" to renderTime = "PFXAfterDiffuse" or particles and transparent objects won't get affected by them. Anyhow, it's still a useful resource.