chromaticLens postFx?

Materials, textures, lighting, postfx
7 posts Page 1 of 1
Posts: 997
Joined: Sun Feb 08, 2015 1:51 am
  by Duion » Sat Jan 14, 2017 1:50 pm
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.
Jason Campbell
Posts: 268
Joined: Fri Feb 13, 2015 2:51 am
by Jason Campbell » Sat Jan 21, 2017 8:46 pm
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 );
Posts: 997
Joined: Sun Feb 08, 2015 1:51 am
by Duion » Sat Jan 21, 2017 9:55 pm
How you made it work? And what is it good for? And why is it in the default template?
Jason Campbell
Posts: 268
Joined: Fri Feb 13, 2015 2:51 am
by Jason Campbell » Sun Jan 22, 2017 1:10 am
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?
Steering Committee
Steering Committee
Posts: 814
Joined: Tue Feb 03, 2015 9:49 pm
by JeffR » Mon Jan 23, 2017 3:44 am
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.
Jason Campbell
Posts: 268
Joined: Fri Feb 13, 2015 2:51 am
by Jason Campbell » Tue Jan 24, 2017 1:49 am
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.
Posts: 252
Joined: Tue Feb 03, 2015 10:30 pm
by Steve_Yorkshire » Tue Jan 24, 2017 8:43 pm
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.
7 posts Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests