mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 07:04:36 +00:00
Merge branch 'development' into walkabout
Conflicts: Templates/Empty/game/tools/worldEditor/scripts/editors/creator.ed.cs Templates/Full/game/tools/worldEditor/scripts/editors/creator.ed.cs
This commit is contained in:
commit
7ab6731f51
1453 changed files with 95576 additions and 14818 deletions
|
|
@ -29,6 +29,11 @@ new ShaderData( BasicRibbonShader )
|
|||
DXVertexShaderFile = "shaders/common/ribbons/basicRibbonShaderV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/ribbons/basicRibbonShaderP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/ribbons/gl/basicRibbonShaderV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/ribbons/gl/basicRibbonShaderP.glsl";
|
||||
|
||||
samplerNames[0] = "$ribTex";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
|
|
@ -44,5 +49,39 @@ singleton CustomMaterial( BasicRibbonMat )
|
|||
BlendOp = AddAlpha;
|
||||
translucentBlendOp = AddAlpha;
|
||||
|
||||
preload = true;
|
||||
};
|
||||
|
||||
// This material can render a texture on top of a ribbon.
|
||||
|
||||
//Texture ribbon shader/////////////////////////////////////////////
|
||||
|
||||
new ShaderData( TexturedRibbonShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/ribbons/texRibbonShaderV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/ribbons/texRibbonShaderP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/ribbons/gl/texRibbonShaderV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/ribbons/gl/texRibbonShaderP.glsl";
|
||||
|
||||
samplerNames[0] = "$ribTex";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton CustomMaterial( TexturedRibbonMat )
|
||||
{
|
||||
shader = TexturedRibbonShader;
|
||||
version = 2.0;
|
||||
|
||||
emissive[0] = true;
|
||||
|
||||
doubleSided = true;
|
||||
translucent = true;
|
||||
BlendOp = AddAlpha;
|
||||
translucentBlendOp = AddAlpha;
|
||||
|
||||
sampler["ribTex"] = "art/ribbons/ribTex.png";
|
||||
|
||||
preload = true;
|
||||
};
|
||||
|
|
@ -68,8 +68,8 @@ function onStart()
|
|||
|
||||
if ($platform $= "macos")
|
||||
$pref::Video::displayDevice = "OpenGL";
|
||||
else
|
||||
$pref::Video::displayDevice = "D3D9";
|
||||
//else
|
||||
//$pref::Video::displayDevice = "D3D9";
|
||||
|
||||
// Initialise stuff.
|
||||
exec("./scripts/client/core.cs");
|
||||
|
|
|
|||
|
|
@ -239,27 +239,26 @@ function sfxCompareProvider( %providerA, %providerB )
|
|||
case "FMOD":
|
||||
return 1;
|
||||
|
||||
case "XAudio":
|
||||
if( %providerB !$= "FMOD" )
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
|
||||
// Prefer OpenAL over anything but FMOD.
|
||||
case "OpenAL":
|
||||
if( %providerB $= "FMOD" )
|
||||
if( %providerB $= "FMOD" && %providerB !$= "XAudio")
|
||||
return -1;
|
||||
else
|
||||
return 1;
|
||||
|
||||
// As long as the XAudio SFX provider still has issues,
|
||||
// choose stable DSound over it.
|
||||
// DSound is just about deprecated, so make that one the last fallback
|
||||
case "DirectSound":
|
||||
if( %providerB $= "FMOD" || %providerB $= "OpenAL" )
|
||||
if( %providerB $= "FMOD" || %providerB $= "OpenAL" && %providerB !$= "XAudio")
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
|
||||
case "XAudio":
|
||||
if( %providerB !$= "FMOD" && %providerB !$= "OpenAL" && %providerB !$= "DirectSound" )
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ singleton ShaderData( CloudLayerShader )
|
|||
OGLVertexShaderFile = "shaders/common/gl/cloudLayerV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/gl/cloudLayerP.glsl";
|
||||
|
||||
samplerNames[0] = "$normalHeightMap";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
|
|
@ -44,8 +46,10 @@ singleton ShaderData( BasicCloudsShader )
|
|||
DXVertexShaderFile = "shaders/common/basicCloudsV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/basicCloudsP.hlsl";
|
||||
|
||||
//OGLVertexShaderFile = "shaders/common/gl/basicCloudsV.glsl";
|
||||
//OGLPixelShaderFile = "shaders/common/gl/basicCloudsP.glsl";
|
||||
OGLVertexShaderFile = "shaders/common/gl/basicCloudsV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/gl/basicCloudsP.glsl";
|
||||
|
||||
samplerNames[0] = "$diffuseMap";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ new ShaderData( AL_DepthVisualizeShader )
|
|||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/lighting/advanced/dbgDepthVisualizeP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/postFxV.glsl";
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgDepthVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "prepassBuffer";
|
||||
|
|
@ -90,10 +90,10 @@ new ShaderData( AL_NormalsVisualizeShader )
|
|||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/lighting/advanced/dbgNormalVisualizeP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/postFxV.glsl";
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgNormalVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "prepassTex";
|
||||
samplerNames[0] = "prepassBuffer";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
|
@ -126,8 +126,8 @@ new ShaderData( AL_LightColorVisualizeShader )
|
|||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/lighting/advanced/dbgLightColorVisualizeP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/dl/dbgLightColorVisualizeP.glsl";
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgLightColorVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "lightInfoBuffer";
|
||||
|
||||
|
|
@ -161,8 +161,8 @@ new ShaderData( AL_LightSpecularVisualizeShader )
|
|||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/lighting/advanced/dbgLightSpecularVisualizeP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/dl/dbgLightSpecularVisualizeP.glsl";
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgLightSpecularVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "lightInfoBuffer";
|
||||
|
||||
|
|
|
|||
|
|
@ -61,6 +61,11 @@ new ShaderData( AL_VectorLightShader )
|
|||
OGLVertexShaderFile = "shaders/common/lighting/advanced/gl/farFrustumQuadV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/vectorLightP.glsl";
|
||||
|
||||
samplerNames[0] = "$prePassBuffer";
|
||||
samplerNames[1] = "$ShadowMap";
|
||||
samplerNames[2] = "$ssaoMask";
|
||||
samplerNames[3] = "$gTapRotationTex";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
|
|
@ -121,6 +126,11 @@ new ShaderData( AL_PointLightShader )
|
|||
OGLVertexShaderFile = "shaders/common/lighting/advanced/gl/convexGeometryV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/pointLightP.glsl";
|
||||
|
||||
samplerNames[0] = "$prePassBuffer";
|
||||
samplerNames[1] = "$shadowMap";
|
||||
samplerNames[2] = "$cookieMap";
|
||||
samplerNames[3] = "$gTapRotationTex";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
|
|
@ -131,7 +141,7 @@ new CustomMaterial( AL_PointLightMaterial )
|
|||
|
||||
sampler["prePassBuffer"] = "#prepass";
|
||||
sampler["shadowMap"] = "$dynamiclight";
|
||||
sampler["cookieTex"] = "$dynamiclightmask";
|
||||
sampler["cookieMap"] = "$dynamiclightmask";
|
||||
|
||||
target = "lightinfo";
|
||||
|
||||
|
|
@ -147,6 +157,11 @@ new ShaderData( AL_SpotLightShader )
|
|||
OGLVertexShaderFile = "shaders/common/lighting/advanced/gl/convexGeometryV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/spotLightP.glsl";
|
||||
|
||||
samplerNames[0] = "$prePassBuffer";
|
||||
samplerNames[1] = "$shadowMap";
|
||||
samplerNames[2] = "$cookieMap";
|
||||
samplerNames[3] = "$gTapRotationTex";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
|
|
@ -157,7 +172,7 @@ new CustomMaterial( AL_SpotLightMaterial )
|
|||
|
||||
sampler["prePassBuffer"] = "#prepass";
|
||||
sampler["shadowMap"] = "$dynamiclight";
|
||||
sampler["cookieTex"] = "$dynamiclightmask";
|
||||
sampler["cookieMap"] = "$dynamiclightmask";
|
||||
|
||||
target = "lightinfo";
|
||||
|
||||
|
|
@ -210,6 +225,8 @@ new ShaderData( AL_ParticlePointLightShader )
|
|||
|
||||
OGLVertexShaderFile = "shaders/common/lighting/advanced/gl/convexGeometryV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/pointLightP.glsl";
|
||||
|
||||
samplerNames[0] = "$prePassBuffer";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@ new ShaderData( AL_ShadowVisualizeShader )
|
|||
OGLVertexShaderFile = "shaders/common/gl/guiMaterialV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgShadowVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "$shadowMap";
|
||||
samplerNames[1] = "$depthViz";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ singleton ShaderData( BL_ProjectedShadowShaderData )
|
|||
OGLVertexShaderFile = "shaders/common/gl/projectedShadowV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/gl/projectedShadowP.glsl";
|
||||
|
||||
samplerNames[0] = "inputTex";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ singleton ShaderData( BL_ShadowFilterShaderV )
|
|||
DXVertexShaderFile = "shaders/common/lighting/basic/shadowFilterV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/lighting/basic/shadowFilterP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/lighting/basic/gl/shadowFilterV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/basic/gl/shadowFilterP.glsl";
|
||||
OGLVertexShaderFile = "shaders/common/lighting/basic/gl/shadowFilterV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/basic/gl/shadowFilterP.glsl";
|
||||
|
||||
samplerNames[0] = "$diffuseMap";
|
||||
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ singleton ShaderData( PFX_PassthruShader )
|
|||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/passthruP.hlsl";
|
||||
|
||||
// OGLVertexShaderFile = "shaders/common/postFx/gl//postFxV.glsl";
|
||||
// OGLPixelShaderFile = "shaders/common/postFx/gl/passthruP.glsl";
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/gl/passthruP.glsl";
|
||||
|
||||
samplerNames[0] = "$inputTex";
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,12 @@ singleton ShaderData( GammaShader )
|
|||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/gammaP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/gl/gammaP.glsl";
|
||||
|
||||
samplerNames[0] = "$backBuffer";
|
||||
samplerNames[1] = "$colorCorrectionTex";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,11 @@ singleton ShaderData( MLAA_EdgeDetectionShader )
|
|||
DXVertexShaderFile = "shaders/common/postFx/mlaa/offsetV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/mlaa/edgeDetectionP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/mlaa/gl/offsetV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/mlaa/gl/edgeDetectionP.glsl";
|
||||
|
||||
samplerNames[0] = "$colorMapG";
|
||||
samplerNames[1] = "$prepassMap";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
|
@ -72,6 +76,9 @@ singleton ShaderData( MLAA_BlendWeightCalculationShader )
|
|||
DXVertexShaderFile = "shaders/common/postFx/mlaa/passthruV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/mlaa/blendWeightCalculationP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/mlaa/gl/passthruV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/mlaa/gl/blendWeightCalculationP.glsl";
|
||||
|
||||
samplerNames[0] = "$edgesMap";
|
||||
samplerNames[1] = "$edgesMapL";
|
||||
samplerNames[2] = "$areaMap";
|
||||
|
|
@ -98,6 +105,9 @@ singleton ShaderData( MLAA_NeighborhoodBlendingShader )
|
|||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/mlaa/offsetV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/mlaa/neighborhoodBlendingP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/mlaa/gl/offsetV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/mlaa/gl/neighborhoodBlendingP.glsl";
|
||||
|
||||
samplerNames[0] = "$blendMap";
|
||||
samplerNames[1] = "$colorMapL";
|
||||
|
|
|
|||
|
|
@ -25,6 +25,12 @@ singleton ShaderData( PFX_MotionBlurShader )
|
|||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl"; //we use the bare-bones postFxV.hlsl
|
||||
DXPixelShaderFile = "shaders/common/postFx/motionBlurP.hlsl"; //new pixel shader
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/gl/motionBlurP.glsl";
|
||||
|
||||
samplerNames[0] = "$backBuffer";
|
||||
samplerNames[1] = "$prepassTex";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -38,9 +38,13 @@ singleton ShaderData( PFX_CausticsShader )
|
|||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/caustics/causticsP.hlsl";
|
||||
|
||||
//OGLVertexShaderFile = "shaders/common/postFx/gl//postFxV.glsl";
|
||||
//OGLPixelShaderFile = "shaders/common/postFx/gl/passthruP.glsl";
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl//postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/caustics/gl/causticsP.glsl";
|
||||
|
||||
samplerNames[0] = "$prepassTex";
|
||||
samplerNames[1] = "$causticsTex0";
|
||||
samplerNames[2] = "$causticsTex1";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,12 @@ 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;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,10 @@ $PostFXManager::Settings::HDR::keyValue = "0.18";
|
|||
$PostFXManager::Settings::HDR::minLuminace = "0.001";
|
||||
$PostFXManager::Settings::HDR::whiteCutoff = "1";
|
||||
$PostFXManager::Settings::LightRays::brightScalar = "0.75";
|
||||
$PostFXManager::Settings::LightRays::decay = "1.0";
|
||||
$PostFXManager::Settings::LightRays::density = "0.94";
|
||||
$PostFXManager::Settings::LightRays::numSamples = "40";
|
||||
$PostFXManager::Settings::LightRays::weight = "5.65";
|
||||
$PostFXManager::Settings::SSAO::blurDepthTol = "0.001";
|
||||
$PostFXManager::Settings::SSAO::blurNormalTol = "0.95";
|
||||
$PostFXManager::Settings::SSAO::lDepthMax = "2";
|
||||
|
|
|
|||
|
|
@ -320,6 +320,13 @@ singleton ShaderData( PFX_DOFDownSampleShader )
|
|||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/dof/DOF_DownSample_V.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/dof/DOF_DownSample_P.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/dof/gl/DOF_DownSample_V.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/dof/gl/DOF_DownSample_P.glsl";
|
||||
|
||||
samplerNames[0] = "$colorSampler";
|
||||
samplerNames[1] = "$depthSampler";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
|
|
@ -327,6 +334,12 @@ singleton ShaderData( PFX_DOFBlurYShader )
|
|||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/dof/DOF_Gausian_V.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/dof/DOF_Gausian_P.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/dof/gl/DOF_Gausian_V.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/dof/gl/DOF_Gausian_P.glsl";
|
||||
|
||||
samplerNames[0] = "$diffuseMap";
|
||||
|
||||
pixVersion = 2.0;
|
||||
defines = "BLUR_DIR=float2(0.0,1.0)";
|
||||
};
|
||||
|
|
@ -340,6 +353,13 @@ singleton ShaderData( PFX_DOFCalcCoCShader )
|
|||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/dof/DOF_CalcCoC_V.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/dof/DOF_CalcCoC_P.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/dof/gl/DOF_CalcCoC_V.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/dof/gl/DOF_CalcCoC_P.glsl";
|
||||
|
||||
samplerNames[0] = "$shrunkSampler";
|
||||
samplerNames[1] = "$blurredSampler";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
|
|
@ -347,6 +367,12 @@ singleton ShaderData( PFX_DOFSmallBlurShader )
|
|||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/dof/DOF_SmallBlur_V.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/dof/DOF_SmallBlur_P.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/dof/gl/DOF_SmallBlur_V.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/dof/gl/DOF_SmallBlur_P.glsl";
|
||||
|
||||
samplerNames[0] = "$colorSampler";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
|
|
@ -354,6 +380,15 @@ singleton ShaderData( PFX_DOFFinalShader )
|
|||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/dof/DOF_Final_V.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/dof/DOF_Final_P.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/dof/gl/DOF_Final_V.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/dof/gl/DOF_Final_P.glsl";
|
||||
|
||||
samplerNames[0] = "$colorSampler";
|
||||
samplerNames[1] = "$smallBlurSampler";
|
||||
samplerNames[2] = "$largeBlurSampler";
|
||||
samplerNames[3] = "$depthSampler";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -37,10 +37,10 @@ singleton ShaderData( PFX_EdgeAADetectShader )
|
|||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/edgeaa/edgeDetectP.hlsl";
|
||||
|
||||
//OGLVertexShaderFile = "shaders/common/postFx/gl//postFxV.glsl";
|
||||
//OGLPixelShaderFile = "shaders/common/postFx/gl/passthruP.glsl";
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/edgeaa/gl/edgeDetectP.glsl";
|
||||
|
||||
samplerNames[0] = "$inputTex";
|
||||
samplerNames[0] = "$prepassBuffer";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
|
@ -50,10 +50,11 @@ singleton ShaderData( PFX_EdgeAAShader )
|
|||
DXVertexShaderFile = "shaders/common/postFx/edgeaa/edgeAAV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/edgeaa/edgeAAP.hlsl";
|
||||
|
||||
//OGLVertexShaderFile = "shaders/common/postFx/gl//postFxV.glsl";
|
||||
//OGLPixelShaderFile = "shaders/common/postFx/gl/passthruP.glsl";
|
||||
OGLVertexShaderFile = "shaders/common/postFx/edgeaa/gl/edgeAAV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/edgeaa/gl/edgeAAP.glsl";
|
||||
|
||||
samplerNames[0] = "$inputTex";
|
||||
samplerNames[0] = "$edgeBuffer";
|
||||
samplerNames[1] = "$backBuffer";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
|
@ -63,10 +64,10 @@ singleton ShaderData( PFX_EdgeAADebugShader )
|
|||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/edgeaa/dbgEdgeDisplayP.hlsl";
|
||||
|
||||
//OGLVertexShaderFile = "shaders/common/postFx/gl//postFxV.glsl";
|
||||
//OGLPixelShaderFile = "shaders/common/postFx/gl/passthruP.glsl";
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/edgeaa/gl/dbgEdgeDisplayP.glsl";
|
||||
|
||||
samplerNames[0] = "$inputTex";
|
||||
samplerNames[0] = "$edgeBuffer";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,6 +24,11 @@ singleton ShaderData( PFX_FlashShader )
|
|||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/flashP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/gl/flashP.glsl";
|
||||
|
||||
samplerNames[0] = "$backBuffer";
|
||||
|
||||
defines = "WHITE_COLOR=float4(1.0,1.0,1.0,0.0);MUL_COLOR=float4(1.0,0.25,0.25,0.0)";
|
||||
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ singleton ShaderData( FogPassShader )
|
|||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/fogP.hlsl";
|
||||
|
||||
// OGLVertexShaderFile = "shaders/common/postFx/gl//postFxV.glsl";
|
||||
// OGLPixelShaderFile = "shaders/common/postFx/gl/fogP.glsl";
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/gl/fogP.glsl";
|
||||
|
||||
samplerNames[0] = "$prepassTex";
|
||||
|
||||
|
|
@ -75,10 +75,12 @@ singleton ShaderData( UnderwaterFogPassShader )
|
|||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/underwaterFogP.hlsl";
|
||||
|
||||
// OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
// OGLPixelShaderFile = "shaders/common/postFx/gl/fogP.glsl";
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/gl/underwaterFogP.glsl";
|
||||
|
||||
samplerNames[0] = "$prepassTex";
|
||||
samplerNames[1] = "$backbuffer";
|
||||
samplerNames[2] = "$waterDepthGradMap";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -39,6 +39,9 @@ singleton ShaderData( FXAA_ShaderData )
|
|||
DXVertexShaderFile = "shaders/common/postFx/fxaa/fxaaV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/fxaa/fxaaP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/fxaa/gl/fxaaV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/fxaa/gl/fxaaP.glsl";
|
||||
|
||||
samplerNames[0] = "$colorTex";
|
||||
|
||||
pixVersion = 3.0;
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ singleton ShaderData( PFX_GlowBlurVertShader )
|
|||
DXVertexShaderFile = "shaders/common/postFx/glowBlurV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/glowBlurP.hlsl";
|
||||
|
||||
// OGLVertexShaderFile = "shaders/common/postFx/glowBlurV.glsl";
|
||||
// OGLPixelShaderFile = "shaders/common/postFx/glowBlurP.glsl";
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/glowBlurV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/gl/glowBlurP.glsl";
|
||||
|
||||
defines = "BLUR_DIR=float2(0.0,1.0)";
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,13 @@ $HDRPostFX::colorCorrectionRamp = "core/scripts/client/postFx/null_color_ramp.pn
|
|||
singleton ShaderData( HDR_BrightPassShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/hdr/brightPassFilterP.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/hdr/brightPassFilterP.hlsl";
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/hdr/gl/brightPassFilterP.glsl";
|
||||
|
||||
samplerNames[0] = "$inputTex";
|
||||
samplerNames[1] = "$luminanceTex";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
|
|
@ -85,6 +91,11 @@ singleton ShaderData( HDR_DownScale4x4Shader )
|
|||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/hdr/downScale4x4V.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/hdr/downScale4x4P.hlsl";
|
||||
OGLVertexShaderFile = "shaders/common/postFx/hdr/gl/downScale4x4V.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/hdr/gl/downScale4x4P.glsl";
|
||||
|
||||
samplerNames[0] = "$inputTex";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
|
|
@ -92,6 +103,11 @@ singleton ShaderData( HDR_BloomGaussBlurHShader )
|
|||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/hdr/bloomGaussBlurHP.hlsl";
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/hdr/gl/bloomGaussBlurHP.glsl";
|
||||
|
||||
samplerNames[0] = "$inputTex";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
|
|
@ -99,6 +115,11 @@ singleton ShaderData( HDR_BloomGaussBlurVShader )
|
|||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/hdr/bloomGaussBlurVP.hlsl";
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/hdr/gl/bloomGaussBlurVP.glsl";
|
||||
|
||||
samplerNames[0] = "$inputTex";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
|
|
@ -106,6 +127,11 @@ singleton ShaderData( HDR_SampleLumShader )
|
|||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/hdr/sampleLumInitialP.hlsl";
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/hdr/gl/sampleLumInitialP.glsl";
|
||||
|
||||
samplerNames[0] = "$inputTex";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
|
|
@ -113,6 +139,11 @@ singleton ShaderData( HDR_DownSampleLumShader )
|
|||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/hdr/sampleLumIterativeP.hlsl";
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/hdr/gl/sampleLumIterativeP.glsl";
|
||||
|
||||
samplerNames[0] = "$inputTex";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
|
|
@ -120,6 +151,12 @@ singleton ShaderData( HDR_CalcAdaptedLumShader )
|
|||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/hdr/calculateAdaptedLumP.hlsl";
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/hdr/gl/calculateAdaptedLumP.glsl";
|
||||
|
||||
samplerNames[0] = "$currLum";
|
||||
samplerNames[1] = "$lastAdaptedLum";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
|
|
@ -127,6 +164,14 @@ singleton ShaderData( HDR_CombineShader )
|
|||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/hdr/finalPassCombineP.hlsl";
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/hdr/gl/finalPassCombineP.glsl";
|
||||
|
||||
samplerNames[0] = "$sceneTex";
|
||||
samplerNames[1] = "$luminanceTex";
|
||||
samplerNames[2] = "$bloomTex";
|
||||
samplerNames[3] = "$colorCorrectionTex";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
|
|
@ -421,6 +466,11 @@ singleton ShaderData( LuminanceVisShader )
|
|||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/hdr/luminanceVisP.hlsl";
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/hdr/gl/luminanceVisP.glsl";
|
||||
|
||||
samplerNames[0] = "$inputTex";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,12 @@ singleton ShaderData( LightRayOccludeShader )
|
|||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/lightRay/lightRayOccludeP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/lightRay/gl/lightRayOccludeP.glsl";
|
||||
|
||||
samplerNames[0] = "$backBuffer";
|
||||
samplerNames[1] = "$prepassTex";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
|
@ -42,6 +48,12 @@ singleton ShaderData( LightRayShader )
|
|||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/lightRay/lightRayP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/lightRay/gl/lightRayP.glsl";
|
||||
|
||||
samplerNames[0] = "$frameSampler";
|
||||
samplerNames[1] = "$backBuffer";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -32,6 +32,11 @@ singleton ShaderData( OVRMonoToStereoShader )
|
|||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/oculusvr/monoToStereoP.hlsl";
|
||||
|
||||
//OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.hlsl";
|
||||
//OGLPixelShaderFile = "shaders/common/postFx/oculusvr/gl/monoToStereoP.glsl";
|
||||
|
||||
samplerNames[0] = "$backBuffer";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
|
@ -40,6 +45,11 @@ singleton ShaderData( OVRBarrelDistortionShader )
|
|||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/oculusvr/barrelDistortionP.hlsl";
|
||||
|
||||
//OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
//OGLPixelShaderFile = "shaders/common/postFx/oculusvr/gl/barrelDistortionP.glsl";
|
||||
|
||||
samplerNames[0] = "$backBuffer";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1689,12 +1689,56 @@
|
|||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiSliderCtrl(ppOptionsLightRaysBrightScalar) {
|
||||
new GuiSliderCtrl(ppOptionsLightRaysBrightScalar) {
|
||||
range = "0 5";
|
||||
ticks = "1000";
|
||||
snap = "0";
|
||||
value = "0.75";
|
||||
position = "96 96";
|
||||
position = "96 46";
|
||||
extent = "264 17";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiSliderBoxProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextCtrl(ppOptionsLightRaysBrightnessScalarLabel) {
|
||||
text = "Brightness";
|
||||
maxLength = "1024";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "26 48";
|
||||
extent = "87 15";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiTextProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
tooltip = "Controls how bright the rays and the object casting them are in the scene.";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
|
||||
new GuiSliderCtrl(ppOptionsLightRaysSampleScalar) {
|
||||
range = "20 512";
|
||||
ticks = "512";
|
||||
snap = "0";
|
||||
value = "40";
|
||||
position = "96 75";
|
||||
extent = "264 17";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
|
|
@ -1708,16 +1752,17 @@
|
|||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextCtrl(ppOptionsLightRaysBrightnessScalarLabel) {
|
||||
text = "Brightness";
|
||||
maxLength = "1024";
|
||||
|
||||
new GuiTextCtrl(ppOptionsLightRaysSampleScalarLabel) {
|
||||
text = "Samples";
|
||||
maxLength = "512";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "26 98";
|
||||
position = "26 76";
|
||||
extent = "87 15";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
|
|
@ -1726,7 +1771,143 @@
|
|||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
tooltip = "Controls how bright the rays and the object casting them are in the scene.";
|
||||
tooltip = "Controls the number of samples for the shader.";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
|
||||
new GuiSliderCtrl(ppOptionsLightRaysDensityScalar) {
|
||||
range = "0.01 1";
|
||||
ticks = "1000";
|
||||
snap = "0";
|
||||
value = "0.94";
|
||||
position = "96 105";
|
||||
extent = "264 17";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiSliderBoxProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
|
||||
new GuiTextCtrl(ppOptionsLightRaysDensityScalarLabel) {
|
||||
text = "Density";
|
||||
maxLength = "1000";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "26 106";
|
||||
extent = "87 15";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiTextProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
tooltip = "Controls the density of the rays.";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
|
||||
new GuiSliderCtrl(ppOptionsLightRaysWeightScalar) {
|
||||
range = "0.1 10";
|
||||
ticks = "1000";
|
||||
snap = "0";
|
||||
value = "5.65";
|
||||
position = "96 135";
|
||||
extent = "264 17";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiSliderBoxProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
|
||||
new GuiTextCtrl(ppOptionsLightRaysWeightScalarLabel) {
|
||||
text = "Weight";
|
||||
maxLength = "1000";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "26 136";
|
||||
extent = "87 15";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiTextProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
tooltip = "Controls the weight of the rays.";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
|
||||
|
||||
new GuiSliderCtrl(ppOptionsLightRaysDecayScalar) {
|
||||
range = "0.01 1";
|
||||
ticks = "1000";
|
||||
snap = "0";
|
||||
value = "1.0";
|
||||
position = "96 165";
|
||||
extent = "264 17";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiSliderBoxProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
|
||||
new GuiTextCtrl(ppOptionsLightRaysDecayScalarLabel) {
|
||||
text = "Decay";
|
||||
maxLength = "1000";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "26 166";
|
||||
extent = "87 15";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiTextProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
tooltip = "Controls the decay of the rays.";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
canSave = "1";
|
||||
|
|
|
|||
|
|
@ -301,12 +301,37 @@ function ppOptionsHDREffectsBlueShiftColorBaseColor::onAction(%this)
|
|||
}
|
||||
|
||||
|
||||
//Light rays Slider Controls
|
||||
//Light rays Brightness Slider Controls
|
||||
function ppOptionsLightRaysBrightScalar::onMouseDragged(%this)
|
||||
{
|
||||
$LightRayPostFX::brightScalar = %this.value;
|
||||
%this.ToolTip = "Value : " @ %this.value;
|
||||
}
|
||||
//Light rays Number of Samples Slider Control
|
||||
function ppOptionsLightRaysSampleScalar::onMouseDragged(%this)
|
||||
{
|
||||
$LightRayPostFX::numSamples = %this.value;
|
||||
%this.ToolTip = "Value : " @ %this.value;
|
||||
}
|
||||
//Light rays Density Slider Control
|
||||
function ppOptionsLightRaysDensityScalar::onMouseDragged(%this)
|
||||
{
|
||||
$LightRayPostFX::density = %this.value;
|
||||
%this.ToolTip = "Value : " @ %this.value;
|
||||
}
|
||||
//Light rays Weight Slider Control
|
||||
function ppOptionsLightRaysWeightScalar::onMouseDragged(%this)
|
||||
{
|
||||
$LightRayPostFX::weight = %this.value;
|
||||
%this.ToolTip = "Value : " @ %this.value;
|
||||
}
|
||||
//Light rays Decay Slider Control
|
||||
function ppOptionsLightRaysDecayScalar::onMouseDragged(%this)
|
||||
{
|
||||
$LightRayPostFX::decay = %this.value;
|
||||
%this.ToolTip = "Value : " @ %this.value;
|
||||
}
|
||||
|
||||
|
||||
function ppOptionsUpdateDOFSettings()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -186,6 +186,11 @@ function PostFXManager::settingsRefreshLightrays(%this)
|
|||
ppOptionsEnableLightRays.setValue($PostFXManager::PostFX::EnableLightRays);
|
||||
|
||||
ppOptionsLightRaysBrightScalar.setValue($LightRayPostFX::brightScalar);
|
||||
|
||||
ppOptionsLightRaysSampleScalar.setValue($LightRayPostFX::numSamples);
|
||||
ppOptionsLightRaysDensityScalar.setValue($LightRayPostFX::density);
|
||||
ppOptionsLightRaysWeightScalar.setValue($LightRayPostFX::weight);
|
||||
ppOptionsLightRaysDecayScalar.setValue($LightRayPostFX::decay);
|
||||
}
|
||||
|
||||
function PostFXManager::settingsRefreshDOF(%this)
|
||||
|
|
@ -280,6 +285,11 @@ function PostFXManager::settingsApplyFromPreset(%this)
|
|||
//Light rays settings
|
||||
$LightRayPostFX::brightScalar = $PostFXManager::Settings::LightRays::brightScalar;
|
||||
|
||||
$LightRayPostFX::numSamples = $PostFXManager::Settings::LightRays::numSamples;
|
||||
$LightRayPostFX::density = $PostFXManager::Settings::LightRays::density;
|
||||
$LightRayPostFX::weight = $PostFXManager::Settings::LightRays::weight;
|
||||
$LightRayPostFX::decay = $PostFXManager::Settings::LightRays::decay;
|
||||
|
||||
//DOF settings
|
||||
$DOFPostFx::EnableAutoFocus = $PostFXManager::Settings::DOF::EnableAutoFocus;
|
||||
$DOFPostFx::BlurMin = $PostFXManager::Settings::DOF::BlurMin;
|
||||
|
|
@ -357,6 +367,11 @@ function PostFXManager::settingsApplyLightRays(%this)
|
|||
{
|
||||
$PostFXManager::Settings::LightRays::brightScalar = $LightRayPostFX::brightScalar;
|
||||
|
||||
$PostFXManager::Settings::LightRays::numSamples = $LightRayPostFX::numSamples;
|
||||
$PostFXManager::Settings::LightRays::density = $LightRayPostFX::density;
|
||||
$PostFXManager::Settings::LightRays::weight = $LightRayPostFX::weight;
|
||||
$PostFXManager::Settings::LightRays::decay = $LightRayPostFX::decay;
|
||||
|
||||
postVerbose("% - PostFX Manager - Settings Saved - Light Rays");
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,6 +152,14 @@ singleton ShaderData( SSAOShader )
|
|||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/ssao/SSAO_P.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/ssao/gl/SSAO_P.glsl";
|
||||
|
||||
samplerNames[0] = "$prepassMap";
|
||||
samplerNames[1] = "$randNormalTex";
|
||||
samplerNames[2] = "$powTable";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
|
|
@ -159,6 +167,13 @@ singleton ShaderData( SSAOBlurYShader )
|
|||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/ssao/SSAO_Blur_V.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/ssao/SSAO_Blur_P.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/ssao/gl/SSAO_Blur_V.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/ssao/gl/SSAO_Blur_P.glsl";
|
||||
|
||||
samplerNames[0] = "$occludeMap";
|
||||
samplerNames[1] = "$prepassMap";
|
||||
|
||||
pixVersion = 3.0;
|
||||
|
||||
defines = "BLUR_DIR=float2(0.0,1.0)";
|
||||
|
|
@ -266,6 +281,10 @@ singleton ShaderData( SSAOPowTableShader )
|
|||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/ssao/SSAO_PowerTable_V.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/ssao/SSAO_PowerTable_P.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/ssao/gl/SSAO_PowerTable_V.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/ssao/gl/SSAO_PowerTable_P.glsl";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,10 @@ singleton ShaderData( PFX_TurbulenceShader )
|
|||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/turbulenceP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/gl/turbulenceP.glsl";
|
||||
|
||||
samplerNames[0] = "$inputTex";
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -44,5 +44,7 @@ singleton ShaderData( ScatterSkyShaderData )
|
|||
OGLVertexShaderFile = "shaders/common/gl/scatterSkyV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/gl/scatterSkyP.glsl";
|
||||
|
||||
samplerNames[0] = "$nightSky";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -33,6 +33,10 @@ singleton ShaderData( ParticlesShaderData )
|
|||
OGLVertexShaderFile = "shaders/common/gl/particlesV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/gl/particlesP.glsl";
|
||||
|
||||
samplerNames[0] = "$diffuseMap";
|
||||
samplerNames[1] = "$prepassTex";
|
||||
samplerNames[2] = "$paraboloidLightMap";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
|
|
@ -44,6 +48,9 @@ singleton ShaderData( OffscreenParticleCompositeShaderData )
|
|||
OGLVertexShaderFile = "shaders/common/gl/particleCompositeV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/gl/particleCompositeP.glsl";
|
||||
|
||||
samplerNames[0] = "$colorSource";
|
||||
samplerNames[1] = "$edgeSource";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
|
|
@ -55,8 +62,8 @@ new ShaderData( ReflectBump )
|
|||
DXVertexShaderFile = "shaders/common/planarReflectBumpV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/planarReflectBumpP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/gl/planarReflectBumpV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/gl/planarReflectBumpP.glsl";
|
||||
OGLVertexShaderFile = "shaders/common/gl/planarReflectBumpV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/gl/planarReflectBumpP.glsl";
|
||||
|
||||
samplerNames[0] = "$diffuseMap";
|
||||
samplerNames[1] = "$refractMap";
|
||||
|
|
@ -70,8 +77,8 @@ new ShaderData( Reflect )
|
|||
DXVertexShaderFile = "shaders/common/planarReflectV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/planarReflectP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/gl/planarReflectV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/gl/planarReflectP.glsl";
|
||||
OGLVertexShaderFile = "shaders/common/gl/planarReflectV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/gl/planarReflectP.glsl";
|
||||
|
||||
samplerNames[0] = "$diffuseMap";
|
||||
samplerNames[1] = "$refractMap";
|
||||
|
|
|
|||
|
|
@ -29,5 +29,8 @@ singleton ShaderData( TerrainBlendShader )
|
|||
OGLVertexShaderFile = "shaders/common/terrain/gl/blendV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/terrain/gl/blendP.glsl";
|
||||
|
||||
samplerNames[0] = "layerTex";
|
||||
samplerNames[1] = "textureMap";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -34,6 +34,14 @@ singleton ShaderData( WaterShader )
|
|||
OGLVertexShaderFile = "shaders/common/water/gl/waterV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/water/gl/waterP.glsl";
|
||||
|
||||
samplerNames[0] = "$bumpMap"; // noise
|
||||
samplerNames[1] = "$prepassTex"; // #prepass
|
||||
samplerNames[2] = "$reflectMap"; // $reflectbuff
|
||||
samplerNames[3] = "$refractBuff"; // $backbuff
|
||||
samplerNames[4] = "$skyMap"; // $cubemap
|
||||
samplerNames[5] = "$foamMap"; // foam
|
||||
samplerNames[6] = "$depthGradMap"; // depthMap ( color gradient )
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
|
|
@ -73,6 +81,14 @@ singleton CustomMaterial( WaterMat )
|
|||
sampler["prepassTex"] = "#prepass";
|
||||
sampler["reflectMap"] = "$reflectbuff";
|
||||
sampler["refractBuff"] = "$backbuff";
|
||||
// These samplers are set in code not here.
|
||||
// This is to allow different WaterObject instances
|
||||
// to use this same material but override these textures
|
||||
// per instance.
|
||||
//sampler["bumpMap"] = "";
|
||||
//sampler["skyMap"] = "";
|
||||
//sampler["foamMap"] = "";
|
||||
//sampler["depthGradMap"] = "";
|
||||
|
||||
shader = WaterShader;
|
||||
stateBlock = WaterStateBlock;
|
||||
|
|
@ -85,16 +101,9 @@ singleton CustomMaterial( WaterMat )
|
|||
// Underwater
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
singleton ShaderData( UnderWaterShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/water/waterV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/water/waterP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/water/gl/waterV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/water/gl/waterP.glsl";
|
||||
|
||||
singleton ShaderData( UnderWaterShader : WaterShader )
|
||||
{
|
||||
defines = "UNDERWATER";
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
singleton CustomMaterial( UnderwaterMat )
|
||||
|
|
@ -125,8 +134,14 @@ singleton ShaderData( WaterBasicShader )
|
|||
DXVertexShaderFile = "shaders/common/water/waterBasicV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/water/waterBasicP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/water/gl/waterBasicV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/water/gl/waterBasicP.glsl";
|
||||
OGLVertexShaderFile = "shaders/common/water/gl/waterBasicV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/water/gl/waterBasicP.glsl";
|
||||
|
||||
samplerNames[0] = "$bumpMap";
|
||||
samplerNames[2] = "$reflectMap";
|
||||
samplerNames[3] = "$refractBuff";
|
||||
samplerNames[4] = "$skyMap";
|
||||
samplerNames[5] = "$depthGradMap";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
|
@ -170,16 +185,9 @@ singleton CustomMaterial( WaterBasicMat )
|
|||
// Basic UnderWater
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
singleton ShaderData( UnderWaterBasicShader )
|
||||
singleton ShaderData( UnderWaterBasicShader : WaterBasicShader)
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/water/waterBasicV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/water/waterBasicP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/water/gl/waterBasicV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/water/gl/waterBasicP.glsl";
|
||||
|
||||
defines = "UNDERWATER";
|
||||
pixVersion = 2.0;
|
||||
defines = "UNDERWATER";
|
||||
};
|
||||
|
||||
singleton CustomMaterial( UnderwaterBasicMat )
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
uniform sampler2D diffuseMap;
|
||||
in vec4 color;
|
||||
in vec2 texCoord;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_col = vec4(color.rgb, color.a * texture(diffuseMap, texCoord).a);
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
|
||||
in vec4 vPosition;
|
||||
in vec4 vColor;
|
||||
in vec2 vTexCoord0;
|
||||
|
||||
uniform mat4 modelview;
|
||||
out vec4 color;
|
||||
out vec2 texCoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = tMul(modelview, vPosition);
|
||||
correctSSP(gl_Position);
|
||||
color = vColor;
|
||||
texCoord = vTexCoord0.st;
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
in vec4 color;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_col = color;
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
|
||||
in vec4 vPosition;
|
||||
in vec4 vColor;
|
||||
|
||||
uniform mat4 modelview;
|
||||
out vec4 color;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = tMul(modelview, vPosition);
|
||||
correctSSP(gl_Position);
|
||||
color = vColor;
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
uniform sampler2D diffuseMap;
|
||||
in vec4 color;
|
||||
in vec2 texCoord;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_col = texture(diffuseMap, texCoord) * color;
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
|
||||
in vec4 vPosition;
|
||||
in vec4 vColor;
|
||||
in vec2 vTexCoord0;
|
||||
|
||||
uniform mat4 modelview;
|
||||
out vec4 color;
|
||||
out vec2 texCoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = tMul(modelview, vPosition);
|
||||
correctSSP(gl_Position);
|
||||
color = vColor;
|
||||
texCoord = vTexCoord0.st;
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
uniform sampler2D colorTarget0Texture ;
|
||||
|
||||
vec4 main( vec2 ScreenPos : VPOS ) : COLOR0
|
||||
{
|
||||
vec2 TexCoord = ScreenPos;
|
||||
vec4 diffuse;
|
||||
asm { tfetch2D diffuse, TexCoord, colorTarget0Texture, UnnormalizedTextureCoords = true };
|
||||
return diffuse;
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
uniform sampler2D diffuseMap;
|
||||
in vec2 texCoord;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_col = texture(diffuseMap, texCoord);
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
|
||||
in vec4 vPosition;
|
||||
in vec2 vTexCoord0;
|
||||
|
||||
uniform mat4 modelview;
|
||||
out vec2 texCoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = tMul(modelview, vPosition);
|
||||
correctSSP(gl_Position);
|
||||
texCoord = vTexCoord0.st;
|
||||
}
|
||||
39
Templates/Empty/game/shaders/common/gl/basicCloudsP.glsl
Normal file
39
Templates/Empty/game/shaders/common/gl/basicCloudsP.glsl
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "torque.glsl"
|
||||
#include "hlslCompat.glsl"
|
||||
|
||||
//ConnectData
|
||||
in vec2 texCoord;
|
||||
#define IN_texCoord texCoord
|
||||
|
||||
|
||||
uniform sampler2D diffuseMap ;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 col = texture( diffuseMap, IN_texCoord );
|
||||
OUT_col = hdrEncode( col );
|
||||
}
|
||||
53
Templates/Empty/game/shaders/common/gl/basicCloudsV.glsl
Normal file
53
Templates/Empty/game/shaders/common/gl/basicCloudsV.glsl
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "hlslCompat.glsl"
|
||||
|
||||
//CloudVert
|
||||
in vec4 vPosition;
|
||||
in vec2 vTexCoord0;
|
||||
|
||||
#define IN_pos vPosition
|
||||
#define IN_uv0 vTexCoord0
|
||||
|
||||
uniform mat4 modelview;
|
||||
uniform float accumTime;
|
||||
uniform float texScale;
|
||||
uniform vec2 texDirection;
|
||||
uniform vec2 texOffset;
|
||||
|
||||
out vec2 texCoord;
|
||||
#define OUT_texCoord texCoord
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = tMul(modelview, IN_pos);
|
||||
|
||||
vec2 uv = IN_uv0;
|
||||
uv += texOffset;
|
||||
uv *= texScale;
|
||||
uv += accumTime * texDirection;
|
||||
|
||||
OUT_texCoord = uv;
|
||||
|
||||
correctSSP(gl_Position);
|
||||
}
|
||||
|
|
@ -28,10 +28,12 @@ uniform sampler2D diffuseMap;
|
|||
|
||||
in vec2 texc0, texc1, texc2, texc3;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_FragColor0 = texture(diffuseMap, texc0) * kernel.x;
|
||||
OUT_FragColor0 += texture(diffuseMap, texc1) * kernel.y;
|
||||
OUT_FragColor0 += texture(diffuseMap, texc2) * kernel.z;
|
||||
OUT_FragColor0 += texture(diffuseMap, texc3) * kernel.w;
|
||||
OUT_col = texture(diffuseMap, texc0) * kernel.x;
|
||||
OUT_col += texture(diffuseMap, texc1) * kernel.y;
|
||||
OUT_col += texture(diffuseMap, texc2) * kernel.z;
|
||||
OUT_col += texture(diffuseMap, texc3) * kernel.w;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ uniform float cloudCoverage;
|
|||
uniform vec3 cloudBaseColor;
|
||||
uniform float cloudExposure;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Globals
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -141,5 +143,5 @@ void main()
|
|||
|
||||
cResultColor.a = mix( cResultColor.a, 0.0, 1.0 - pow(IN_worldDist,2.0) );
|
||||
|
||||
OUT_FragColor0 = cResultColor;
|
||||
OUT_col = cResultColor;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,12 +29,14 @@ uniform vec4 groundAlpha;
|
|||
in vec4 color, groundAlphaCoeff;
|
||||
in vec2 outTexCoord, alphaLookup;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Main
|
||||
//-----------------------------------------------------------------------------
|
||||
void main()
|
||||
{
|
||||
vec4 alpha = texture(alphaMap, alphaLookup);
|
||||
OUT_FragColor0 = color * texture(diffuseMap, outTexCoord);
|
||||
OUT_FragColor0.a = OUT_FragColor0.a * min(alpha, groundAlpha + groundAlphaCoeff.x).x;
|
||||
OUT_col = color * texture(diffuseMap, outTexCoord);
|
||||
OUT_col.a = OUT_col.a * min(alpha, groundAlpha + groundAlphaCoeff.x).x;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,14 +48,14 @@
|
|||
|
||||
#define lerp mix
|
||||
|
||||
void tSetMatrixRow(out float3x3 m, int row, float3 value)
|
||||
void tSetMatrixRow(inout float3x3 m, int row, float3 value)
|
||||
{
|
||||
m[0][row] = value.x;
|
||||
m[1][row] = value.y;
|
||||
m[2][row] = value.z;
|
||||
}
|
||||
|
||||
void tSetMatrixRow(out float4x4 m, int row, float4 value)
|
||||
void tSetMatrixRow(inout float4x4 m, int row, float4 value)
|
||||
{
|
||||
m[0][row] = value.x;
|
||||
m[1][row] = value.y;
|
||||
|
|
@ -100,6 +100,4 @@ mat4 mat4FromRow( float r0c0, float r0c1, float r0c2, float r0c3,
|
|||
|
||||
#ifdef TORQUE_PIXEL_SHADER
|
||||
void clip(float a) { if(a < 0) discard;}
|
||||
|
||||
out vec4 OUT_FragColor0;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ uniform sampler2D edgeSource;
|
|||
uniform vec4 edgeTargetParams;
|
||||
#endif
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -57,5 +58,5 @@ void main()
|
|||
#endif
|
||||
|
||||
// Sample offscreen target and return
|
||||
OUT_FragColor0 = texture( colorSource, uvScene.xy );
|
||||
OUT_col = texture( colorSource, uvScene.xy );
|
||||
}
|
||||
|
|
@ -78,6 +78,8 @@ vec4 lmSample( vec3 nrm )
|
|||
uniform float alphaFactor;
|
||||
uniform float alphaScale;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
float softBlend = 1;
|
||||
|
|
@ -100,12 +102,12 @@ void main()
|
|||
|
||||
vec4 diffuse = texture( diffuseMap, IN_uv0 );
|
||||
|
||||
//OUT_FragColor0 = vec4( lmSample(vec3(0, 0, -1)).rgb, IN_color.a * diffuse.a * softBlend * alphaScale);
|
||||
//OUT_col = vec4( lmSample(vec3(0, 0, -1)).rgb, IN_color.a * diffuse.a * softBlend * alphaScale);
|
||||
|
||||
// Scale output color by the alpha factor (turn LerpAlpha into pre-multiplied alpha)
|
||||
vec3 colorScale = ( alphaFactor < 0.0 ? IN_color.rgb * diffuse.rgb : vec3( alphaFactor > 0.0 ? IN_color.a * diffuse.a * alphaFactor * softBlend : softBlend ) );
|
||||
|
||||
OUT_FragColor0 = hdrEncode( vec4( IN_color.rgb * diffuse.rgb * colorScale,
|
||||
OUT_col = hdrEncode( vec4( IN_color.rgb * diffuse.rgb * colorScale,
|
||||
IN_color.a * diffuse.a * softBlend * alphaScale ) );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ uniform vec4 shadeColor;
|
|||
in vec2 TEX0;
|
||||
in vec4 TEX1;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Fade edges of axis for texcoord passed in
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -64,5 +66,5 @@ void main()
|
|||
vec4 diffuseColor = texture( diffuseMap, TEX0 );
|
||||
vec4 reflectColor = textureProj( refractMap, texIndex );
|
||||
|
||||
OUT_FragColor0 = diffuseColor + reflectColor * diffuseColor.a;
|
||||
OUT_col = diffuseColor + reflectColor * diffuseColor.a;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ uniform vec4 shadeColor;
|
|||
in vec2 TEX0;
|
||||
in vec4 TEX1;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Main
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -37,5 +39,5 @@ void main()
|
|||
vec4 diffuseColor = texture( diffuseMap, TEX0 );
|
||||
vec4 reflectColor = textureProj( refractMap, TEX1 );
|
||||
|
||||
OUT_FragColor0 = diffuseColor + reflectColor * diffuseColor.a;
|
||||
OUT_col = diffuseColor + reflectColor * diffuseColor.a;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@ uniform sampler2D diffuseMap;
|
|||
in vec4 color;
|
||||
in vec2 texCoord;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Main
|
||||
//-----------------------------------------------------------------------------
|
||||
void main()
|
||||
{
|
||||
OUT_FragColor0 = texture(diffuseMap, texCoord) * color;
|
||||
OUT_col = texture(diffuseMap, texCoord) * color;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ in vec2 texCoord;
|
|||
in vec4 color;
|
||||
in float fade;
|
||||
|
||||
out vec4 OUT_FragColor0;
|
||||
out vec4 OUT_col;
|
||||
|
||||
uniform sampler2D inputTex;
|
||||
uniform vec4 ambient;
|
||||
|
|
@ -33,5 +33,5 @@ uniform vec4 ambient;
|
|||
void main()
|
||||
{
|
||||
float shadow = texture( inputTex, texCoord ).a * color.a;
|
||||
OUT_FragColor0 = ( ambient * shadow ) + ( 1 - shadow );
|
||||
OUT_col = ( ambient * shadow ) + ( 1 - shadow );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ uniform float useCubemap;
|
|||
uniform vec3 lightDir;
|
||||
uniform vec3 sunDir;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
|
|
@ -62,7 +64,7 @@ void main()
|
|||
|
||||
float fac = dot( normalize( pos ), sunDir );
|
||||
fac = max( nightInterpAndExposure.y, pow( clamp( fac, 0.0, 1.0 ), 2 ) );
|
||||
OUT_FragColor0 = mix( color, nightSkyColor, nightInterpAndExposure.y );
|
||||
OUT_col = mix( color, nightSkyColor, nightInterpAndExposure.y );
|
||||
|
||||
// Clip based on the camera-relative
|
||||
// z position of the vertex, passed through
|
||||
|
|
@ -70,6 +72,6 @@ void main()
|
|||
if(zPosition < 0.0)
|
||||
discard;
|
||||
|
||||
OUT_FragColor0.a = 1;
|
||||
OUT_FragColor0 = hdrEncode( OUT_FragColor0 );
|
||||
OUT_col.a = 1;
|
||||
OUT_col = hdrEncode( OUT_col );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -267,6 +267,6 @@ void fizzle(vec2 vpos, float visibility)
|
|||
/// @param condition This should be a bvec[2-4]. If any items is false, condition is considered to fail.
|
||||
/// @param color The color that should be outputted if the condition fails.
|
||||
/// @note This macro will only work in the void main() method of a pixel shader.
|
||||
#define assert(condition, color) { if(!any(condition)) { OUT_FragColor0 = color; return; } }
|
||||
#define assert(condition, color) { if(!any(condition)) { OUT_col = color; return; } }
|
||||
|
||||
#endif // _TORQUE_GLSL_
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ in vec4 outLightVec;
|
|||
in vec3 outPos;
|
||||
in vec3 outEyePos;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 texOffset;
|
||||
|
|
@ -45,11 +47,11 @@ void main()
|
|||
vec4 bumpNorm = texture(bumpMap, texOffset) * 2.0 - 1.0;
|
||||
vec4 diffuse = texture(diffMap, texOffset);
|
||||
|
||||
OUT_FragColor0 = diffuse * (clamp(dot(outLightVec.xyz, bumpNorm.xyz), 0.0, 1.0) + ambient);
|
||||
OUT_col = diffuse * (clamp(dot(outLightVec.xyz, bumpNorm.xyz), 0.0, 1.0) + ambient);
|
||||
|
||||
vec3 eyeVec = normalize(outEyePos - outPos);
|
||||
vec3 halfAng = normalize(eyeVec + outLightVec.xyz);
|
||||
float specular = clamp(dot(bumpNorm.xyz, halfAng), 0.0, 1.0) * outLightVec.w;
|
||||
specular = pow(specular, specularPower);
|
||||
OUT_FragColor0 += specularColor * specular;
|
||||
OUT_col += specularColor * specular;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,10 @@ in vec2 uv0;
|
|||
uniform sampler2D prepassBuffer;
|
||||
uniform sampler1D depthViz;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
float depth = prepassUncondition( prepassBuffer, uv0 ).w;
|
||||
OUT_FragColor0 = vec4( texture( depthViz, depth ).rgb, 1.0 );
|
||||
OUT_col = vec4( texture( depthViz, depth ).rgb, 1.0 );
|
||||
}
|
||||
|
|
@ -26,10 +26,12 @@
|
|||
in vec2 uv0;
|
||||
uniform sampler2D lightInfoBuffer;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 lightcolor;
|
||||
float nl_Att, specular;
|
||||
lightinfoUncondition( texture( lightInfoBuffer, uv0 ), lightcolor, nl_Att, specular );
|
||||
OUT_FragColor0 = vec4( lightcolor, 1.0 );
|
||||
OUT_col = vec4( lightcolor, 1.0 );
|
||||
}
|
||||
|
|
@ -26,10 +26,12 @@
|
|||
in vec2 uv0;
|
||||
uniform sampler2D lightInfoBuffer;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 lightcolor;
|
||||
float nl_Att, specular;
|
||||
lightinfoUncondition( texture( lightInfoBuffer, uv0 ), lightcolor, nl_Att, specular );
|
||||
OUT_FragColor0 = vec4( specular, specular, specular, 1.0 );
|
||||
OUT_col = vec4( specular, specular, specular, 1.0 );
|
||||
}
|
||||
|
|
@ -26,8 +26,10 @@
|
|||
in vec2 uv0;
|
||||
uniform sampler2D prepassBuffer;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 normal = prepassUncondition( prepassBuffer, uv0 ).xyz;
|
||||
OUT_FragColor0 = vec4( ( normal + 1.0 ) * 0.5, 1.0 );
|
||||
OUT_col = vec4( ( normal + 1.0 ) * 0.5, 1.0 );
|
||||
}
|
||||
|
|
@ -25,8 +25,10 @@ in vec2 uv0;
|
|||
uniform sampler2D shadowMap;
|
||||
uniform sampler1D depthViz;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
float depth = saturate( texture( shadowMap, uv0 ).r );
|
||||
OUT_FragColor0 = vec4( texture( depthViz, depth ).rgb, 1 );
|
||||
OUT_col = vec4( texture( depthViz, depth ).rgb, 1 );
|
||||
}
|
||||
|
|
@ -122,6 +122,7 @@ uniform mat3 viewToLightProj;
|
|||
uniform vec4 lightParams;
|
||||
uniform float shadowSoftness;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -229,5 +230,5 @@ void main()
|
|||
addToResult = ( 1.0 - shadowed ) * abs(lightMapParams);
|
||||
}
|
||||
|
||||
OUT_FragColor0 = lightinfoCondition( lightColorOut, Sat_NL_Att, specular, addToResult );
|
||||
OUT_col = lightinfoCondition( lightColorOut, Sat_NL_Att, specular, addToResult );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ uniform mat4 viewToLightProj;
|
|||
uniform vec4 lightParams;
|
||||
uniform float shadowSoftness;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
// Compute scene UV
|
||||
|
|
@ -162,5 +164,5 @@ void main()
|
|||
addToResult = ( 1.0 - shadowed ) * abs(lightMapParams);
|
||||
}
|
||||
|
||||
OUT_FragColor0 = lightinfoCondition( lightColorOut, Sat_NL_Att, specular, addToResult );
|
||||
OUT_col = lightinfoCondition( lightColorOut, Sat_NL_Att, specular, addToResult );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ uniform vec4 farPlaneScalePSSM;
|
|||
uniform vec4 overDarkPSSM;
|
||||
uniform float shadowSoftness;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
// Sample/unpack the normal/z data
|
||||
|
|
@ -227,6 +229,6 @@ void main()
|
|||
lightColorOut = debugColor;
|
||||
#endif
|
||||
|
||||
OUT_FragColor0 = lightinfoCondition( lightColorOut, Sat_NL_Att, specular, addToResult );
|
||||
OUT_col = lightinfoCondition( lightColorOut, Sat_NL_Att, specular, addToResult );
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,16 +31,16 @@ uniform vec2 oneOverTargetSize;
|
|||
const float offset[3] = float[]( 0.0, 1.3846153846, 3.2307692308 );
|
||||
const float weight[3] = float[]( 0.2270270270, 0.3162162162, 0.0702702703 );
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 OUT = texture( diffuseMap, uv ) * weight[0];
|
||||
OUT_col = texture( diffuseMap, uv ) * weight[0];
|
||||
|
||||
for ( int i=1; i < 3; i++ )
|
||||
{
|
||||
vec2 _sample = (BLUR_DIR * offset[i]) * oneOverTargetSize;
|
||||
OUT += texture( diffuseMap, uv + _sample ) * weight[i];
|
||||
OUT += texture( diffuseMap, uv - _sample ) * weight[i];
|
||||
OUT_col += texture( diffuseMap, uv + _sample ) * weight[i];
|
||||
OUT_col += texture( diffuseMap, uv - _sample ) * weight[i];
|
||||
}
|
||||
|
||||
OUT_FragColor0 = OUT;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ uniform vec2 blurDimension;
|
|||
|
||||
in vec2 tex0;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
// Preshader
|
||||
|
|
@ -43,5 +45,5 @@ void main()
|
|||
accum += texture(diffuseMap0, BaseTexCoord + float(i) * SampleOffset);
|
||||
}
|
||||
accum /= blurSamples;
|
||||
OUT_FragColor0 = accum;
|
||||
OUT_col = accum;
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../../gl/hlslCompat.glsl"
|
||||
#include "../../gl/postFX.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
uniform vec3 eyePosWorld;
|
||||
uniform vec4 rtParams0;
|
||||
uniform vec4 waterFogPlane;
|
||||
uniform float accumTime;
|
||||
|
||||
uniform sampler2D prepassTex;
|
||||
uniform sampler2D causticsTex0;
|
||||
uniform sampler2D causticsTex1;
|
||||
uniform vec2 targetSize;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
float distanceToPlane(vec4 plane, vec3 pos)
|
||||
{
|
||||
return (plane.x * pos.x + plane.y * pos.y + plane.z * pos.z) + plane.w;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
//Sample the pre-pass
|
||||
vec4 prePass = prepassUncondition( prepassTex, IN_uv0 );
|
||||
|
||||
//Get depth
|
||||
float depth = prePass.w;
|
||||
if(depth > 0.9999)
|
||||
{
|
||||
OUT_col = vec4(0,0,0,0);
|
||||
return;
|
||||
}
|
||||
|
||||
//Get world position
|
||||
vec3 pos = eyePosWorld + IN_wsEyeRay * depth;
|
||||
|
||||
// Check the water depth
|
||||
float waterDepth = -distanceToPlane(waterFogPlane, pos);
|
||||
if(waterDepth < 0)
|
||||
{
|
||||
OUT_col = vec4(0,0,0,0);
|
||||
return;
|
||||
}
|
||||
waterDepth = saturate(waterDepth);
|
||||
|
||||
//Use world position X and Y to calculate caustics UV
|
||||
vec2 causticsUV0 = mod(abs(pos.xy * 0.25), vec2(1, 1));
|
||||
vec2 causticsUV1 = mod(abs(pos.xy * 0.2), vec2(1, 1));
|
||||
|
||||
//Animate uvs
|
||||
float timeSin = sin(accumTime);
|
||||
causticsUV0.xy += vec2(accumTime*0.1, timeSin*0.2);
|
||||
causticsUV1.xy -= vec2(accumTime*0.15, timeSin*0.15);
|
||||
|
||||
//Sample caustics texture
|
||||
vec4 caustics = texture(causticsTex0, causticsUV0);
|
||||
caustics *= texture(causticsTex1, causticsUV1);
|
||||
|
||||
//Use normal Z to modulate caustics
|
||||
//float waterDepth = 1 - saturate(pos.z + waterFogPlane.w + 1);
|
||||
caustics *= saturate(prePass.z) * pow(1-depth, 64) * waterDepth;
|
||||
|
||||
OUT_col = caustics;
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../../gl/hlslCompat.glsl"
|
||||
#include "../../gl/postFX.glsl"
|
||||
|
||||
// These are set by the game engine.
|
||||
uniform sampler2D shrunkSampler; // Output of DofDownsample()
|
||||
uniform sampler2D blurredSampler; // Blurred version of the shrunk sampler
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
// This is the pixel shader function that calculates the actual
|
||||
// value used for the near circle of confusion.
|
||||
// "texCoords" are 0 at the bottom left pixel and 1 at the top right.
|
||||
void main()
|
||||
{
|
||||
vec3 color;
|
||||
float coc;
|
||||
half4 blurred;
|
||||
half4 shrunk;
|
||||
|
||||
shrunk = texture( shrunkSampler, IN_uv0 );
|
||||
blurred = texture( blurredSampler, IN_uv1 );
|
||||
color = shrunk.rgb;
|
||||
//coc = shrunk.a;
|
||||
//coc = blurred.a;
|
||||
//coc = max( blurred.a, shrunk.a );
|
||||
coc = 2 * max( blurred.a, shrunk.a ) - shrunk.a;
|
||||
|
||||
|
||||
//OUT_col = vec4( coc.rrr, 1.0 );
|
||||
//OUT_col = vec4( color, 1.0 );
|
||||
OUT_col = vec4( color, coc );
|
||||
//OUT_col = vec4( 1.0, 0.0, 1.0, 1.0 );
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../../gl/hlslCompat.glsl"
|
||||
#include "../../../gl/torque.glsl"
|
||||
#include "../../gl/postFX.glsl"
|
||||
|
||||
uniform vec4 rtParams0;
|
||||
uniform vec4 rtParams1;
|
||||
uniform vec4 rtParams2;
|
||||
uniform vec4 rtParams3;
|
||||
|
||||
void main()
|
||||
{
|
||||
/*
|
||||
OUT_hpos = IN.pos;
|
||||
OUT_uv0 = IN_uv;
|
||||
OUT_uv1 = IN_uv;
|
||||
OUT_uv2 = IN_uv;
|
||||
OUT_uv3 = IN_uv;
|
||||
*/
|
||||
|
||||
/*
|
||||
OUT_hpos = IN_pos;
|
||||
OUT_uv0 = IN_uv + rtParams0.xy;
|
||||
OUT_uv1 = IN_uv + rtParams1.xy;
|
||||
OUT_uv2 = IN_uv + rtParams2.xy;
|
||||
OUT_uv3 = IN_uv + rtParams3.xy;
|
||||
*/
|
||||
|
||||
/*
|
||||
OUT_hpos = IN_pos;
|
||||
OUT_uv0 = IN_uv * rtParams0.zw;
|
||||
OUT_uv1 = IN_uv * rtParams1.zw;
|
||||
OUT_uv2 = IN_uv * rtParams2.zw;
|
||||
OUT_uv3 = IN_uv * rtParams3.zw;
|
||||
*/
|
||||
|
||||
|
||||
OUT_hpos = IN_pos;
|
||||
OUT_uv0 = viewportCoordToRenderTarget( IN_uv, rtParams0 );
|
||||
OUT_uv1 = viewportCoordToRenderTarget( IN_uv, rtParams1 );
|
||||
OUT_uv2 = viewportCoordToRenderTarget( IN_uv, rtParams2 );
|
||||
OUT_uv3 = viewportCoordToRenderTarget( IN_uv, rtParams3 );
|
||||
|
||||
|
||||
OUT_wsEyeRay = IN_wsEyeRay;
|
||||
|
||||
correctSSP(gl_Position);;
|
||||
}
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../../gl/hlslCompat.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
// These are set by the game engine.
|
||||
// The render target size is one-quarter the scene rendering size.
|
||||
uniform sampler2D colorSampler;
|
||||
uniform sampler2D depthSampler;
|
||||
uniform vec2 dofEqWorld;
|
||||
uniform float depthOffset;
|
||||
uniform vec2 targetSize;
|
||||
uniform float maxWorldCoC;
|
||||
//uniform vec2 dofEqWeapon;
|
||||
//uniform vec2 dofRowDelta; // vec2( 0, 0.25 / renderTargetHeight )
|
||||
|
||||
in vec2 tcColor0;
|
||||
#define IN_tcColor0 tcColor0
|
||||
in vec2 tcColor1;
|
||||
#define IN_tcColor1 tcColor1
|
||||
in vec2 tcDepth0;
|
||||
#define IN_tcDepth0 tcDepth0
|
||||
in vec2 tcDepth1;
|
||||
#define IN_tcDepth1 tcDepth1
|
||||
in vec2 tcDepth2;
|
||||
#define IN_tcDepth2 tcDepth2
|
||||
in vec2 tcDepth3;
|
||||
#define IN_tcDepth3 tcDepth3
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
//return vec4( 1.0, 0.0, 1.0, 1.0 );
|
||||
|
||||
vec2 dofRowDelta = vec2( 0, 0.25 / targetSize.y );
|
||||
|
||||
//vec2 dofEqWorld = vec2( -60, 1.0 );
|
||||
|
||||
half3 color;
|
||||
half maxCoc;
|
||||
vec4 depth;
|
||||
half4 viewCoc;
|
||||
half4 sceneCoc;
|
||||
half4 curCoc;
|
||||
half4 coc;
|
||||
vec2 rowOfs[4];
|
||||
|
||||
// "rowOfs" reduces how many moves PS2.0 uses to emulate swizzling.
|
||||
rowOfs[0] = vec2(0);
|
||||
rowOfs[1] = dofRowDelta.xy;
|
||||
rowOfs[2] = dofRowDelta.xy * 2;
|
||||
rowOfs[3] = dofRowDelta.xy * 3;
|
||||
|
||||
// Use bilinear filtering to average 4 color samples for free.
|
||||
color = half3(0);
|
||||
color += texture( colorSampler, IN_tcColor0.xy + rowOfs[0] ).rgb;
|
||||
color += texture( colorSampler, IN_tcColor1.xy + rowOfs[0] ).rgb;
|
||||
color += texture( colorSampler, IN_tcColor0.xy + rowOfs[2] ).rgb;
|
||||
color += texture( colorSampler, IN_tcColor1.xy + rowOfs[2] ).rgb;
|
||||
color /= 4;
|
||||
|
||||
// Process 4 samples at a time to use vector hardware efficiently.
|
||||
// The CoC will be 1 if the depth is negative, so use "min" to pick
|
||||
// between "sceneCoc" and "viewCoc".
|
||||
|
||||
coc = half4(0);
|
||||
for ( int i = 0; i < 4; i++ )
|
||||
{
|
||||
depth[0] = prepassUncondition( depthSampler, ( IN_tcDepth0.xy + rowOfs[i] ) ).w;
|
||||
depth[1] = prepassUncondition( depthSampler, ( IN_tcDepth1.xy + rowOfs[i] ) ).w;
|
||||
depth[2] = prepassUncondition( depthSampler, ( IN_tcDepth2.xy + rowOfs[i] ) ).w;
|
||||
depth[3] = prepassUncondition( depthSampler, ( IN_tcDepth3.xy + rowOfs[i] ) ).w;
|
||||
|
||||
// @todo OPENGL INTEL need review
|
||||
coc = max( coc, clamp( half4(dofEqWorld.x) * depth + half4(dofEqWorld.y), half4(0.0), half4(maxWorldCoC) ) );
|
||||
}
|
||||
|
||||
/*
|
||||
depth[0] = texture( depthSampler, pixel.tcDepth0.xy + rowOfs[0] ).r;
|
||||
depth[1] = texture( depthSampler, pixel.tcDepth1.xy + rowOfs[0] ).r;
|
||||
depth[2] = texture( depthSampler, pixel.tcDepth2.xy + rowOfs[0] ).r;
|
||||
depth[3] = texture( depthSampler, pixel.tcDepth3.xy + rowOfs[0] ).r;
|
||||
viewCoc = saturate( dofEqWeapon.x * -depth + dofEqWeapon.y );
|
||||
sceneCoc = saturate( dofEqWorld.x * depth + dofEqWorld.y );
|
||||
curCoc = min( viewCoc, sceneCoc );
|
||||
coc = curCoc;
|
||||
|
||||
depth[0] = texture( depthSampler, pixel.tcDepth0.xy + rowOfs[1] ).r;
|
||||
depth[1] = texture( depthSampler, pixel.tcDepth1.xy + rowOfs[1] ).r;
|
||||
depth[2] = texture( depthSampler, pixel.tcDepth2.xy + rowOfs[1] ).r;
|
||||
depth[3] = texture( depthSampler, pixel.tcDepth3.xy + rowOfs[1] ).r;
|
||||
viewCoc = saturate( dofEqWeapon.x * -depth + dofEqWeapon.y );
|
||||
sceneCoc = saturate( dofEqWorld.x * depth + dofEqWorld.y );
|
||||
curCoc = min( viewCoc, sceneCoc );
|
||||
coc = max( coc, curCoc );
|
||||
|
||||
depth[0] = texture( depthSampler, pixel.tcDepth0.xy + rowOfs[2] ).r;
|
||||
depth[1] = texture( depthSampler, pixel.tcDepth1.xy + rowOfs[2] ).r;
|
||||
depth[2] = texture( depthSampler, pixel.tcDepth2.xy + rowOfs[2] ).r;
|
||||
depth[3] = texture( depthSampler, pixel.tcDepth3.xy + rowOfs[2] ).r;
|
||||
viewCoc = saturate( dofEqWeapon.x * -depth + dofEqWeapon.y );
|
||||
sceneCoc = saturate( dofEqWorld.x * depth + dofEqWorld.y );
|
||||
curCoc = min( viewCoc, sceneCoc );
|
||||
coc = max( coc, curCoc );
|
||||
|
||||
depth[0] = texture( depthSampler, pixel.tcDepth0.xy + rowOfs[3] ).r;
|
||||
depth[1] = texture( depthSampler, pixel.tcDepth1.xy + rowOfs[3] ).r;
|
||||
depth[2] = texture( depthSampler, pixel.tcDepth2.xy + rowOfs[3] ).r;
|
||||
depth[3] = texture( depthSampler, pixel.tcDepth3.xy + rowOfs[3] ).r;
|
||||
viewCoc = saturate( dofEqWeapon.x * -depth + dofEqWeapon.y );
|
||||
sceneCoc = saturate( dofEqWorld.x * depth + dofEqWorld.y );
|
||||
curCoc = min( viewCoc, sceneCoc );
|
||||
coc = max( coc, curCoc );
|
||||
*/
|
||||
|
||||
maxCoc = max( max( coc[0], coc[1] ), max( coc[2], coc[3] ) );
|
||||
|
||||
//OUT_col = half4( 1.0, 0.0, 1.0, 1.0 );
|
||||
OUT_col = half4( color, maxCoc );
|
||||
//OUT_col = half4( color, 1.0f );
|
||||
//OUT_col = half4( maxCoc.rrr, 1.0 );
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../../gl/hlslCompat.glsl"
|
||||
#include "../../../gl/torque.glsl"
|
||||
|
||||
in vec4 vPosition;
|
||||
in vec2 vTexCoord0;
|
||||
in vec3 vTexCoord1;
|
||||
|
||||
#define IN_pos vPosition
|
||||
#define IN_tc vTexCoord0
|
||||
#define IN_wsEyeRay vTexCoord1
|
||||
|
||||
#define OUT_position gl_Position
|
||||
|
||||
out vec2 tcColor0;
|
||||
#define OUT_tcColor0 tcColor0
|
||||
out vec2 tcColor1;
|
||||
#define OUT_tcColor1 tcColor1
|
||||
out vec2 tcDepth0;
|
||||
#define OUT_tcDepth0 tcDepth0
|
||||
out vec2 tcDepth1;
|
||||
#define OUT_tcDepth1 tcDepth1
|
||||
out vec2 tcDepth2;
|
||||
#define OUT_tcDepth2 tcDepth2
|
||||
out vec2 tcDepth3;
|
||||
#define OUT_tcDepth3 tcDepth3
|
||||
|
||||
|
||||
uniform vec4 rtParams0;
|
||||
uniform vec2 oneOverTargetSize;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_position = IN_pos;
|
||||
|
||||
vec2 uv = viewportCoordToRenderTarget( IN_tc, rtParams0 );
|
||||
//OUT_position = tMul( IN_pos, modelView );
|
||||
OUT_tcColor1 = uv + vec2( +1.0, -0.0 ) * oneOverTargetSize;
|
||||
OUT_tcColor0 = uv + vec2( -1.0, -0.0 ) * oneOverTargetSize;
|
||||
OUT_tcDepth0 = uv + vec2( -0.5, -0.0 ) * oneOverTargetSize;
|
||||
OUT_tcDepth1 = uv + vec2( -1.5, -0.0 ) * oneOverTargetSize;
|
||||
OUT_tcDepth2 = uv + vec2( +1.5, -0.0 ) * oneOverTargetSize;
|
||||
OUT_tcDepth3 = uv + vec2( +2.5, -0.0 ) * oneOverTargetSize;
|
||||
|
||||
correctSSP(gl_Position);
|
||||
}
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../../gl/hlslCompat.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
#include "../../gl/postFX.glsl"
|
||||
|
||||
uniform sampler2D colorSampler; // Original source image
|
||||
uniform sampler2D smallBlurSampler; // Output of SmallBlurPS()
|
||||
uniform sampler2D largeBlurSampler; // Blurred output of DofDownsample()
|
||||
uniform sampler2D depthSampler; //
|
||||
uniform vec2 oneOverTargetSize;
|
||||
uniform vec4 dofLerpScale;
|
||||
uniform vec4 dofLerpBias;
|
||||
uniform vec3 dofEqFar;
|
||||
uniform float maxFarCoC;
|
||||
|
||||
//static float d0 = 0.1;
|
||||
//static float d1 = 0.1;
|
||||
//static float d2 = 0.8;
|
||||
//static vec4 dofLerpScale = vec4( -1.0 / d0, -1.0 / d1, -1.0 / d2, 1.0 / d2 );
|
||||
//static vec4 dofLerpBias = vec4( 1.0, (1.0 - d2) / d1, 1.0 / d2, (d2 - 1.0) / d2 );
|
||||
//static vec3 dofEqFar = vec3( 2.0, 0.0, 1.0 );
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
vec4 tex2Doffset( sampler2D s, vec2 tc, vec2 offset )
|
||||
{
|
||||
return texture( s, tc + offset * oneOverTargetSize );
|
||||
}
|
||||
|
||||
half3 GetSmallBlurSample( vec2 tc )
|
||||
{
|
||||
half3 sum;
|
||||
const half weight = 4.0 / 17;
|
||||
sum = half3(0); // Unblurred sample done by alpha blending
|
||||
//sum += weight * tex2Doffset( colorSampler, tc, vec2( 0, 0 ) ).rgb;
|
||||
sum += weight * tex2Doffset( colorSampler, tc, vec2( +0.5, -1.5 ) ).rgb;
|
||||
sum += weight * tex2Doffset( colorSampler, tc, vec2( -1.5, -0.5 ) ).rgb;
|
||||
sum += weight * tex2Doffset( colorSampler, tc, vec2( -0.5, +1.5 ) ).rgb;
|
||||
sum += weight * tex2Doffset( colorSampler, tc, vec2( +1.5, +0.5 ) ).rgb;
|
||||
return sum;
|
||||
}
|
||||
|
||||
half4 InterpolateDof( half3 small, half3 med, half3 large, half t )
|
||||
{
|
||||
//t = 2;
|
||||
half4 weights;
|
||||
half3 color;
|
||||
half alpha;
|
||||
|
||||
// Efficiently calculate the cross-blend weights for each sample.
|
||||
// Let the unblurred sample to small blur fade happen over distance
|
||||
// d0, the small to medium blur over distance d1, and the medium to
|
||||
// large blur over distance d2, where d0 + d1 + d2 = 1.
|
||||
//vec4 dofLerpScale = vec4( -1 / d0, -1 / d1, -1 / d2, 1 / d2 );
|
||||
//vec4 dofLerpBias = vec4( 1, (1 – d2) / d1, 1 / d2, (d2 – 1) / d2 );
|
||||
|
||||
weights = saturate( t * dofLerpScale + dofLerpBias );
|
||||
weights.yz = min( weights.yz, 1 - weights.xy );
|
||||
|
||||
// Unblurred sample with weight "weights.x" done by alpha blending
|
||||
color = weights.y * small + weights.z * med + weights.w * large;
|
||||
//color = med;
|
||||
alpha = dot( weights.yzw, half3( 16.0 / 17, 1.0, 1.0 ) );
|
||||
//alpha = 0.0;
|
||||
|
||||
return half4( color, alpha );
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
//return half4( 1,0,1,1 );
|
||||
//return half4( texture( colorSampler, IN_uv0 ).rgb, 1.0 );
|
||||
//return half4( texture( colorSampler, texCoords ).rgb, 0 );
|
||||
half3 small;
|
||||
half4 med;
|
||||
half3 large;
|
||||
half depth;
|
||||
half nearCoc;
|
||||
half farCoc;
|
||||
half coc;
|
||||
|
||||
small = GetSmallBlurSample( IN_uv0 );
|
||||
//small = half3( 1,0,0 );
|
||||
//return half4( small, 1.0 );
|
||||
med = texture( smallBlurSampler, IN_uv1 );
|
||||
//med.rgb = half3( 0,1,0 );
|
||||
//return half4(med.rgb, 0.0);
|
||||
large = texture( largeBlurSampler, IN_uv2 ).rgb;
|
||||
//large = half3( 0,0,1 );
|
||||
//return large;
|
||||
//return half4(large.rgb,1.0);
|
||||
nearCoc = med.a;
|
||||
|
||||
// Since the med blur texture is screwed up currently
|
||||
// replace it with the large, but this needs to be fixed.
|
||||
//med.rgb = large;
|
||||
|
||||
//nearCoc = 0;
|
||||
depth = prepassUncondition( depthSampler, IN_uv3 ).w;
|
||||
//return half4(depth.rrr,1);
|
||||
//return half4(nearCoc.rrr,1.0);
|
||||
|
||||
if (depth > 0.999 )
|
||||
{
|
||||
coc = nearCoc; // We don't want to blur the sky.
|
||||
//coc = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// dofEqFar.x and dofEqFar.y specify the linear ramp to convert
|
||||
// to depth for the distant out-of-focus region.
|
||||
// dofEqFar.z is the ratio of the far to the near blur radius.
|
||||
farCoc = clamp( dofEqFar.x * depth + dofEqFar.y, 0.0, maxFarCoC );
|
||||
coc = max( nearCoc, farCoc * dofEqFar.z );
|
||||
//coc = nearCoc;
|
||||
}
|
||||
|
||||
//coc = nearCoc;
|
||||
//coc = farCoc;
|
||||
//return half4(coc.rrr,0.5);
|
||||
//return half4(farCoc.rrr,1);
|
||||
//return half4(nearCoc.rrr,1);
|
||||
|
||||
//return half4( 1,0,1,0 );
|
||||
OUT_col = InterpolateDof( small, med.rgb, large, coc );
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../../gl/hlslCompat.glsl"
|
||||
#include "../../../gl/torque.glsl"
|
||||
#include "../../gl/postFX.glsl"
|
||||
|
||||
uniform vec4 rtParams0;
|
||||
uniform vec4 rtParams1;
|
||||
uniform vec4 rtParams2;
|
||||
uniform vec4 rtParams3;
|
||||
uniform vec2 oneOverTargetSize;
|
||||
|
||||
void main()
|
||||
{
|
||||
/*
|
||||
OUT.hpos = IN_pos;
|
||||
OUT_uv0 = IN_uv;
|
||||
OUT_uv1 = IN_uv;
|
||||
OUT_uv2 = IN_uv;
|
||||
OUT_uv3 = IN_uv;
|
||||
*/
|
||||
|
||||
/*
|
||||
OUT_hpos = IN_pos;
|
||||
OUT_uv0 = IN_uv + rtParams0.xy;
|
||||
OUT_uv1 = IN_uv + rtParams1.xy;
|
||||
OUT_uv2 = IN_uv + rtParams2.xy;
|
||||
OUT_uv3 = IN_uv + rtParams3.xy;
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
OUT_hpos = IN_pos;
|
||||
OUT_uv0 = IN_uv * rtParams0.zw;
|
||||
OUT_uv1 = IN_uv * rtParams1.zw;
|
||||
OUT_uv2 = IN_uv * rtParams2.zw;
|
||||
OUT_uv3 = IN_uv * rtParams3.zw;
|
||||
*/
|
||||
|
||||
|
||||
OUT_hpos = IN_pos;
|
||||
OUT_uv0 = viewportCoordToRenderTarget( IN_uv, rtParams0 );
|
||||
OUT_uv1 = viewportCoordToRenderTarget( IN_uv, rtParams1 ); // + vec2( -5, 1 ) * oneOverTargetSize;
|
||||
OUT_uv2 = viewportCoordToRenderTarget( IN_uv, rtParams2 );
|
||||
OUT_uv3 = viewportCoordToRenderTarget( IN_uv, rtParams3 );
|
||||
|
||||
|
||||
OUT_wsEyeRay = IN_wsEyeRay;
|
||||
|
||||
correctSSP(gl_Position);
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../../gl/hlslCompat.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
in vec3 wsEyeRay;
|
||||
#define IN_wsEyeRay wsEyeRay
|
||||
in vec2 uv0;
|
||||
#define IN_uv0 uv0
|
||||
in vec2 uv1;
|
||||
#define IN_uv1 uv1
|
||||
in vec2 uv2;
|
||||
#define IN_uv2 uv2
|
||||
in vec2 uv3;
|
||||
#define IN_uv3 uv3
|
||||
in vec2 uv4;
|
||||
#define IN_uv4 uv4
|
||||
in vec2 uv5;
|
||||
#define IN_uv5 uv5
|
||||
in vec2 uv6;
|
||||
#define IN_uv6 uv6
|
||||
in vec2 uv7;
|
||||
#define IN_uv7 uv7
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
uniform sampler2D diffuseMap;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 kernel = vec4( 0.175, 0.275, 0.375, 0.475 ) * 0.5 / 1.3; //25f;
|
||||
|
||||
OUT_col = vec4(0);
|
||||
OUT_col += texture( diffuseMap, IN_uv0 ) * kernel.x;
|
||||
OUT_col += texture( diffuseMap, IN_uv1 ) * kernel.y;
|
||||
OUT_col += texture( diffuseMap, IN_uv2 ) * kernel.z;
|
||||
OUT_col += texture( diffuseMap, IN_uv3 ) * kernel.w;
|
||||
|
||||
OUT_col += texture( diffuseMap, IN_uv4 ) * kernel.x;
|
||||
OUT_col += texture( diffuseMap, IN_uv5 ) * kernel.y;
|
||||
OUT_col += texture( diffuseMap, IN_uv6 ) * kernel.z;
|
||||
OUT_col += texture( diffuseMap, IN_uv7 ) * kernel.w;
|
||||
|
||||
// Calculate a lumenance value in the alpha so we
|
||||
// can use alpha test to save fillrate.
|
||||
//vec3 rgb2lum = vec3( 0.30, 0.59, 0.11 );
|
||||
//OUT_col.a = dot( OUT_col.rgb, rgb2lum );
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../../gl/hlslCompat.glsl"
|
||||
#include "../../../gl/torque.glsl"
|
||||
|
||||
in vec4 vPosition;
|
||||
in vec2 vTexCoord0;
|
||||
in vec3 vTexCoord1;
|
||||
|
||||
#define IN_pos vPosition
|
||||
#define _IN_uv vTexCoord0
|
||||
#define IN_wsEyeRay vTexCoord1
|
||||
|
||||
#define OUT_hpos gl_Position
|
||||
out vec3 wsEyeRay;
|
||||
#define OUT_wsEyeRay wsEyeRay
|
||||
out vec2 uv0;
|
||||
#define OUT_uv0 uv0
|
||||
out vec2 uv1;
|
||||
#define OUT_uv1 uv1
|
||||
out vec2 uv2;
|
||||
#define OUT_uv2 uv2
|
||||
out vec2 uv3;
|
||||
#define OUT_uv3 uv3
|
||||
out vec2 uv4;
|
||||
#define OUT_uv4 uv4
|
||||
out vec2 uv5;
|
||||
#define OUT_uv5 uv5
|
||||
out vec2 uv6;
|
||||
#define OUT_uv6 uv6
|
||||
out vec2 uv7;
|
||||
#define OUT_uv7 uv7
|
||||
|
||||
uniform vec2 texSize0;
|
||||
uniform vec4 rtParams0;
|
||||
uniform vec2 oneOverTargetSize;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_hpos = IN_pos;
|
||||
|
||||
vec2 IN_uv = viewportCoordToRenderTarget( _IN_uv, rtParams0 );
|
||||
|
||||
// I don't know why this offset is necessary, but it is.
|
||||
//IN_uv = IN_uv * oneOverTargetSize;
|
||||
|
||||
OUT_uv0 = IN_uv + ( ( BLUR_DIR * 3.5f ) / texSize0 );
|
||||
OUT_uv1 = IN_uv + ( ( BLUR_DIR * 2.5f ) / texSize0 );
|
||||
OUT_uv2 = IN_uv + ( ( BLUR_DIR * 1.5f ) / texSize0 );
|
||||
OUT_uv3 = IN_uv + ( ( BLUR_DIR * 0.5f ) / texSize0 );
|
||||
|
||||
OUT_uv4 = IN_uv - ( ( BLUR_DIR * 3.5f ) / texSize0 );
|
||||
OUT_uv5 = IN_uv - ( ( BLUR_DIR * 2.5f ) / texSize0 );
|
||||
OUT_uv6 = IN_uv - ( ( BLUR_DIR * 1.5f ) / texSize0 );
|
||||
OUT_uv7 = IN_uv - ( ( BLUR_DIR * 0.5f ) / texSize0 );
|
||||
|
||||
/*
|
||||
OUT_uv0 = viewportCoordToRenderTarget( OUT_uv0, rtParams0 );
|
||||
OUT_uv1 = viewportCoordToRenderTarget( OUT_uv1, rtParams0 );
|
||||
OUT_uv2 = viewportCoordToRenderTarget( OUT_uv2, rtParams0 );
|
||||
OUT_uv3 = viewportCoordToRenderTarget( OUT_uv3, rtParams0 );
|
||||
|
||||
OUT_uv4 = viewportCoordToRenderTarget( OUT_uv4, rtParams0 );
|
||||
OUT_uv5 = viewportCoordToRenderTarget( OUT_uv5, rtParams0 );
|
||||
OUT_uv6 = viewportCoordToRenderTarget( OUT_uv6, rtParams0 );
|
||||
OUT_uv7 = viewportCoordToRenderTarget( OUT_uv7, rtParams0 );
|
||||
*/
|
||||
|
||||
correctSSP(gl_Position);
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../../gl/hlslCompat.glsl"
|
||||
#include "../../../gl/torque.glsl"
|
||||
#include "../../gl/postFX.glsl"
|
||||
|
||||
uniform vec4 rtParams0;
|
||||
uniform vec4 rtParams1;
|
||||
uniform vec4 rtParams2;
|
||||
uniform vec4 rtParams3;
|
||||
|
||||
void main()
|
||||
{
|
||||
/*
|
||||
OUT.hpos = IN_pos;
|
||||
OUT_uv0 = IN_uv;
|
||||
OUT_uv1 = IN_uv;
|
||||
OUT_uv2 = IN_uv;
|
||||
OUT_uv3 = IN_uv;
|
||||
*/
|
||||
|
||||
/*
|
||||
OUT_hpos = IN_pos;
|
||||
OUT_uv0 = IN_uv + rtParams0.xy;
|
||||
OUT_uv1 = IN_uv + rtParams1.xy;
|
||||
OUT_uv2 = IN_uv + rtParams2.xy;
|
||||
OUT_uv3 = IN_uv + rtParams3.xy;
|
||||
*/
|
||||
|
||||
/*
|
||||
OUT_hpos = IN_pos;
|
||||
OUT_uv0 = IN_uv * rtParams0.zw;
|
||||
OUT_uv1 = IN_uv * rtParams1.zw;
|
||||
OUT_uv2 = IN_uv * rtParams2.zw;
|
||||
OUT_uv3 = IN_uv * rtParams3.zw;
|
||||
*/
|
||||
|
||||
|
||||
OUT_hpos = IN_pos;
|
||||
OUT_uv0 = viewportCoordToRenderTarget( IN_uv, rtParams0 );
|
||||
OUT_uv1 = viewportCoordToRenderTarget( IN_uv, rtParams1 );
|
||||
OUT_uv2 = viewportCoordToRenderTarget( IN_uv, rtParams2 );
|
||||
OUT_uv3 = viewportCoordToRenderTarget( IN_uv, rtParams3 );
|
||||
|
||||
|
||||
OUT_wsEyeRay = IN_wsEyeRay;
|
||||
|
||||
correctSSP(gl_Position);
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// This vertex and pixel shader applies a 3 x 3 blur to the image in
|
||||
// colorMapSampler, which is the same size as the render target.
|
||||
// The sample weights are 1/16 in the corners, 2/16 on the edges,
|
||||
// and 4/16 in the center.
|
||||
|
||||
#include "../../../gl/hlslCompat.glsl"
|
||||
|
||||
uniform sampler2D colorSampler; // Output of DofNearCoc()
|
||||
|
||||
in vec4 texCoords;
|
||||
#define IN_texCoords texCoords
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color;
|
||||
color = vec4(0.0);
|
||||
color += texture( colorSampler, IN_texCoords.xz );
|
||||
color += texture( colorSampler, IN_texCoords.yz );
|
||||
color += texture( colorSampler, IN_texCoords.xw );
|
||||
color += texture( colorSampler, IN_texCoords.yw );
|
||||
OUT_col = color / 4.0;
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// This vertex and pixel shader applies a 3 x 3 blur to the image in
|
||||
// colorMapSampler, which is the same size as the render target.
|
||||
// The sample weights are 1/16 in the corners, 2/16 on the edges,
|
||||
// and 4/16 in the center.
|
||||
|
||||
#include "../../../gl/hlslCompat.glsl"
|
||||
#include "../../../gl/torque.glsl"
|
||||
|
||||
in vec4 vPosition;
|
||||
in vec2 vTexCoord0;
|
||||
|
||||
#define IN_position vPosition
|
||||
#define IN_texCoords vTexCoord0
|
||||
|
||||
#define OUT_position gl_Position
|
||||
out vec4 texCoords;
|
||||
#define OUT_texCoords texCoords
|
||||
|
||||
uniform vec2 oneOverTargetSize;
|
||||
uniform vec4 rtParams0;
|
||||
|
||||
void main()
|
||||
{
|
||||
const vec4 halfPixel = vec4( -0.5, 0.5, -0.5, 0.5 );
|
||||
OUT_position = IN_position; //Transform_ObjectToClip( IN_position );
|
||||
|
||||
//vec2 uv = IN_texCoords + rtParams0.xy;
|
||||
vec2 uv = viewportCoordToRenderTarget( IN_texCoords, rtParams0 );
|
||||
OUT_texCoords = uv.xxyy + halfPixel * oneOverTargetSize.xxyy;
|
||||
|
||||
correctSSP(gl_Position);
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../../gl/hlslCompat.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
in vec2 uv0;
|
||||
#define IN_uv0 uv0
|
||||
|
||||
uniform sampler2D edgeBuffer;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_col = vec4( texture( edgeBuffer, IN_uv0 ).rrr, 1.0 );
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../../gl/hlslCompat.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
#include "../../gl/postFX.glsl"
|
||||
|
||||
uniform sampler2D edgeBuffer;
|
||||
uniform sampler2D backBuffer;
|
||||
uniform vec2 targetSize;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 pixelSize = 1.0 / targetSize;
|
||||
|
||||
// Sample edge buffer, bail if not on an edge
|
||||
float edgeSample = texture(edgeBuffer, IN_uv0).r;
|
||||
clip(edgeSample - 1e-6);
|
||||
|
||||
// Ok we're on an edge, so multi-tap sample, average, and return
|
||||
vec2 offsets[9] = vec2[](
|
||||
vec2( 0.0, 0.0),
|
||||
vec2(-1.0, -1.0),
|
||||
vec2( 0.0, -1.0),
|
||||
vec2( 1.0, -1.0),
|
||||
vec2( 1.0, 0.0),
|
||||
vec2( 1.0, 1.0),
|
||||
vec2( 0.0, 1.0),
|
||||
vec2(-1.0, 1.0),
|
||||
vec2(-1.0, 0.0)
|
||||
);
|
||||
|
||||
vec4 accumColor = vec4(0.0);
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
// Multiply the intensity of the edge, by the UV, so that things which maybe
|
||||
// aren't quite full edges get sub-pixel sampling to reduce artifacts
|
||||
|
||||
// Scaling offsets by 0.5 to reduce the range bluriness from extending to
|
||||
// far outward from the edge.
|
||||
|
||||
vec2 offsetUV = IN_uv1 + edgeSample * ( offsets[i] * 0.5 ) * pixelSize;//rtWidthHeightInvWidthNegHeight.zw;
|
||||
//offsetUV *= 0.999;
|
||||
accumColor+= texture(backBuffer, offsetUV);
|
||||
}
|
||||
accumColor /= 9.0;
|
||||
|
||||
OUT_col = accumColor;
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../../gl/hlslCompat.glsl"
|
||||
#include "../../../gl/torque.glsl"
|
||||
#include "../../gl/postFX.glsl"
|
||||
|
||||
uniform vec4 rtParams0;
|
||||
uniform vec4 rtParams1;
|
||||
uniform vec4 rtParams2;
|
||||
uniform vec4 rtParams3;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_hpos = IN_pos;
|
||||
OUT_uv0 = viewportCoordToRenderTarget( IN_uv, rtParams0 );
|
||||
OUT_uv1 = viewportCoordToRenderTarget( IN_uv, rtParams1 );
|
||||
OUT_uv2 = viewportCoordToRenderTarget( IN_uv, rtParams2 );
|
||||
OUT_uv3 = viewportCoordToRenderTarget( IN_uv, rtParams3 );
|
||||
|
||||
OUT_wsEyeRay = IN_wsEyeRay;
|
||||
|
||||
correctSSP(gl_Position);
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../../gl/hlslCompat.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
// GPU Gems 3, pg 443-444
|
||||
float GetEdgeWeight(vec2 uv0, in sampler2D prepassBuffer, in vec2 targetSize)
|
||||
{
|
||||
vec2 offsets[9] = vec2[](
|
||||
vec2( 0.0, 0.0),
|
||||
vec2(-1.0, -1.0),
|
||||
vec2( 0.0, -1.0),
|
||||
vec2( 1.0, -1.0),
|
||||
vec2( 1.0, 0.0),
|
||||
vec2( 1.0, 1.0),
|
||||
vec2( 0.0, 1.0),
|
||||
vec2(-1.0, 1.0),
|
||||
vec2(-1.0, 0.0)
|
||||
);
|
||||
|
||||
|
||||
vec2 PixelSize = 1.0 / targetSize;
|
||||
|
||||
float Depth[9];
|
||||
vec3 Normal[9];
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
vec2 uv = uv0 + offsets[i] * PixelSize;
|
||||
vec4 gbSample = prepassUncondition( prepassBuffer, uv );
|
||||
Depth[i] = gbSample.a;
|
||||
Normal[i] = gbSample.rgb;
|
||||
}
|
||||
|
||||
vec4 Deltas1 = vec4(Depth[1], Depth[2], Depth[3], Depth[4]);
|
||||
vec4 Deltas2 = vec4(Depth[5], Depth[6], Depth[7], Depth[8]);
|
||||
|
||||
Deltas1 = abs(Deltas1 - Depth[0]);
|
||||
Deltas2 = abs(Depth[0] - Deltas2);
|
||||
|
||||
vec4 maxDeltas = max(Deltas1, Deltas2);
|
||||
vec4 minDeltas = max(min(Deltas1, Deltas2), 0.00001);
|
||||
|
||||
vec4 depthResults = step(minDeltas * 25.0, maxDeltas);
|
||||
|
||||
Deltas1.x = dot(Normal[1], Normal[0]);
|
||||
Deltas1.y = dot(Normal[2], Normal[0]);
|
||||
Deltas1.z = dot(Normal[3], Normal[0]);
|
||||
Deltas1.w = dot(Normal[4], Normal[0]);
|
||||
|
||||
Deltas2.x = dot(Normal[5], Normal[0]);
|
||||
Deltas2.y = dot(Normal[6], Normal[0]);
|
||||
Deltas2.z = dot(Normal[7], Normal[0]);
|
||||
Deltas2.w = dot(Normal[8], Normal[0]);
|
||||
|
||||
Deltas1 = abs(Deltas1 - Deltas2);
|
||||
|
||||
vec4 normalResults = step(0.4, Deltas1);
|
||||
|
||||
normalResults = max(normalResults, depthResults);
|
||||
|
||||
return dot(normalResults, vec4(1.0, 1.0, 1.0, 1.0)) * 0.25;
|
||||
}
|
||||
|
||||
in vec2 uv0;
|
||||
#define IN_uv0 uv0
|
||||
|
||||
uniform sampler2D prepassBuffer;
|
||||
uniform vec2 targetSize;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_col = vec4( GetEdgeWeight(IN_uv0, prepassBuffer, targetSize ) );//rtWidthHeightInvWidthNegHeight.zw);
|
||||
}
|
||||
|
|
@ -44,7 +44,7 @@ Etc.
|
|||
(2.)
|
||||
Then include this file,
|
||||
|
||||
#include "Fxaa3_11.h"
|
||||
include "Fxaa3_11.h"
|
||||
|
||||
(3.)
|
||||
Then call the FXAA pixel shader from within your desired shader.
|
||||
|
|
|
|||
125
Templates/Empty/game/shaders/common/postFx/fxaa/gl/fxaaP.glsl
Normal file
125
Templates/Empty/game/shaders/common/postFx/fxaa/gl/fxaaP.glsl
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#define FXAA_PC 1
|
||||
#define FXAA_GLSL_130 1
|
||||
#define FXAA_QUALITY__PRESET 12
|
||||
#define FXAA_GREEN_AS_LUMA 1
|
||||
|
||||
#include "../Fxaa3_11.h"
|
||||
#include "../../../gl/hlslCompat.glsl"
|
||||
|
||||
uniform sampler2D colorTex ;
|
||||
uniform vec2 oneOverTargetSize;
|
||||
|
||||
in vec4 hpos;
|
||||
in vec2 uv0;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_col = FxaaPixelShader(
|
||||
|
||||
uv0, // vertex position
|
||||
|
||||
vec4(0), // Unused... console stuff
|
||||
|
||||
colorTex, // The color back buffer
|
||||
|
||||
colorTex, // Used for 360 optimization
|
||||
|
||||
colorTex, // Used for 360 optimization
|
||||
|
||||
oneOverTargetSize,
|
||||
|
||||
vec4(0), // Unused... console stuff
|
||||
|
||||
vec4(0), // Unused... console stuff
|
||||
|
||||
vec4(0), // Unused... console stuff
|
||||
|
||||
//
|
||||
// Only used on FXAA Quality.
|
||||
// This used to be the FXAA_QUALITY__SUBPIX define.
|
||||
// It is here now to allow easier tuning.
|
||||
// Choose the amount of sub-pixel aliasing removal.
|
||||
// This can effect sharpness.
|
||||
// 1.00 - upper limit (softer)
|
||||
// 0.75 - default amount of filtering
|
||||
// 0.50 - lower limit (sharper, less sub-pixel aliasing removal)
|
||||
// 0.25 - almost off
|
||||
// 0.00 - completely off
|
||||
0.75,
|
||||
|
||||
//
|
||||
// Only used on FXAA Quality.
|
||||
// This used to be the FXAA_QUALITY__EDGE_THRESHOLD define.
|
||||
// It is here now to allow easier tuning.
|
||||
// The minimum amount of local contrast required to apply algorithm.
|
||||
// 0.333 - too little (faster)
|
||||
// 0.250 - low quality
|
||||
// 0.166 - default
|
||||
// 0.125 - high quality
|
||||
// 0.063 - overkill (slower)
|
||||
0.166,
|
||||
|
||||
//
|
||||
// Only used on FXAA Quality.
|
||||
// This used to be the FXAA_QUALITY__EDGE_THRESHOLD_MIN define.
|
||||
// It is here now to allow easier tuning.
|
||||
// Trims the algorithm from processing darks.
|
||||
// 0.0833 - upper limit (default, the start of visible unfiltered edges)
|
||||
// 0.0625 - high quality (faster)
|
||||
// 0.0312 - visible limit (slower)
|
||||
// Special notes when using FXAA_GREEN_AS_LUMA,
|
||||
// Likely want to set this to zero.
|
||||
// As colors that are mostly not-green
|
||||
// will appear very dark in the green channel!
|
||||
// Tune by looking at mostly non-green content,
|
||||
// then start at zero and increase until aliasing is a problem.
|
||||
0,
|
||||
|
||||
//
|
||||
// Only used on FXAA Console.
|
||||
// This used to be the FXAA_CONSOLE__EDGE_SHARPNESS define.
|
||||
// It is here now to allow easier tuning.
|
||||
// This does not effect PS3, as this needs to be compiled in.
|
||||
// Use FXAA_CONSOLE__PS3_EDGE_SHARPNESS for PS3.
|
||||
// Due to the PS3 being ALU bound,
|
||||
// there are only three safe values here: 2 and 4 and 8.
|
||||
// These options use the shaders ability to a free *|/ by 2|4|8.
|
||||
// For all other platforms can be a non-power of two.
|
||||
// 8.0 is sharper (default!!!)
|
||||
// 4.0 is softer
|
||||
// 2.0 is really soft (good only for vector graphics inputs)
|
||||
8,
|
||||
|
||||
0, // Unused... console stuff
|
||||
|
||||
0, // Unused... console stuff
|
||||
|
||||
vec4(0) // Unused... console stuff
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "../../../gl/hlslCompat.glsl"
|
||||
#include "../../../gl/torque.glsl"
|
||||
|
||||
in vec4 vPosition;
|
||||
in vec2 vTexCoord0;
|
||||
|
||||
uniform vec4 rtParams0;
|
||||
|
||||
out vec4 hpos;
|
||||
out vec2 uv0;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vPosition;
|
||||
hpos = gl_Position;
|
||||
uv0 = viewportCoordToRenderTarget( vTexCoord0, rtParams0 );
|
||||
|
||||
correctSSP(gl_Position);
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Based on 'Cubic Lens Distortion HLSL Shader' by François Tarlier
|
||||
// www.francois-tarlier.com/blog/index.php/2009/11/cubic-lens-distortion-shader
|
||||
|
||||
#include "./postFx.glsl"
|
||||
#include "../../gl/torque.glsl"
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
|
||||
uniform sampler2D backBuffer;
|
||||
uniform float distCoeff;
|
||||
uniform float cubeDistort;
|
||||
uniform vec3 colorDistort;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 tex = IN_uv0;
|
||||
|
||||
float f = 0;
|
||||
float r2 = (tex.x - 0.5) * (tex.x - 0.5) + (tex.y - 0.5) * (tex.y - 0.5);
|
||||
|
||||
// Only compute the cubic distortion if necessary.
|
||||
if ( cubeDistort == 0.0 )
|
||||
f = 1 + r2 * distCoeff;
|
||||
else
|
||||
f = 1 + r2 * (distCoeff + cubeDistort * sqrt(r2));
|
||||
|
||||
// Distort each color channel seperately to get a chromatic distortion effect.
|
||||
vec3 outColor;
|
||||
vec3 distort = vec3(f) + colorDistort;
|
||||
|
||||
for ( int i=0; i < 3; i++ )
|
||||
{
|
||||
float x = distort[i] * ( tex.x - 0.5 ) + 0.5;
|
||||
float y = distort[i] * ( tex.y - 0.5 ) + 0.5;
|
||||
outColor[i] = tex2Dlod( backBuffer, vec4(x,y,0,0) )[i];
|
||||
}
|
||||
|
||||
OUT_col = vec4( outColor.rgb, 1 );
|
||||
}
|
||||
39
Templates/Empty/game/shaders/common/postFx/gl/flashP.glsl
Normal file
39
Templates/Empty/game/shaders/common/postFx/gl/flashP.glsl
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "./postFx.glsl"
|
||||
#include "../../gl/torque.glsl"
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
|
||||
uniform float damageFlash;
|
||||
uniform float whiteOut;
|
||||
uniform sampler2D backBuffer;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color1 = texture(backBuffer, IN_uv0);
|
||||
vec4 color2 = color1 * MUL_COLOR;
|
||||
vec4 damage = mix(color1,color2,damageFlash);
|
||||
OUT_col = mix(damage,WHITE_COLOR,whiteOut);
|
||||
}
|
||||
52
Templates/Empty/game/shaders/common/postFx/gl/fogP.glsl
Normal file
52
Templates/Empty/game/shaders/common/postFx/gl/fogP.glsl
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
#include "../../gl/torque.glsl"
|
||||
|
||||
uniform sampler2D prepassTex ;
|
||||
uniform vec3 eyePosWorld;
|
||||
uniform vec4 fogColor;
|
||||
uniform vec3 fogData;
|
||||
uniform vec4 rtParams0;
|
||||
|
||||
in vec2 uv0;
|
||||
in vec3 wsEyeRay;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
//vec2 prepassCoord = ( uv0.xy * rtParams0.zw ) + rtParams0.xy;
|
||||
float depth = prepassUncondition( prepassTex, uv0 ).w;
|
||||
//return vec4( depth, 0, 0, 0.7 );
|
||||
|
||||
float factor = computeSceneFog( eyePosWorld,
|
||||
eyePosWorld + ( wsEyeRay * depth ),
|
||||
fogData.x,
|
||||
fogData.y,
|
||||
fogData.z );
|
||||
|
||||
OUT_col = hdrEncode( vec4( fogColor.rgb, 1.0 - saturate( factor ) ) );
|
||||
}
|
||||
49
Templates/Empty/game/shaders/common/postFx/gl/gammaP.glsl
Normal file
49
Templates/Empty/game/shaders/common/postFx/gl/gammaP.glsl
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
#include "../../gl/torque.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
uniform sampler2D backBuffer;
|
||||
uniform sampler1D colorCorrectionTex;
|
||||
|
||||
uniform float OneOverGamma;
|
||||
|
||||
in vec2 uv0;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color = texture(backBuffer, uv0.xy);
|
||||
|
||||
// Apply the color correction.
|
||||
color.r = texture( colorCorrectionTex, color.r ).r;
|
||||
color.g = texture( colorCorrectionTex, color.g ).g;
|
||||
color.b = texture( colorCorrectionTex, color.b ).b;
|
||||
|
||||
// Apply gamma correction
|
||||
color.rgb = pow( abs(color.rgb), vec3(OneOverGamma) );
|
||||
|
||||
OUT_col = color;
|
||||
}
|
||||
59
Templates/Empty/game/shaders/common/postFx/gl/glowBlurP.glsl
Normal file
59
Templates/Empty/game/shaders/common/postFx/gl/glowBlurP.glsl
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
|
||||
uniform sampler2D diffuseMap ;
|
||||
|
||||
in vec4 hpos; //POSITION;
|
||||
in vec2 uv0; //TEXCOORD0;
|
||||
in vec2 uv1; //TEXCOORD1;
|
||||
in vec2 uv2; //TEXCOORD2;
|
||||
in vec2 uv3; //TEXCOORD3;
|
||||
in vec2 uv4; //TEXCOORD4;
|
||||
in vec2 uv5; //TEXCOORD5;
|
||||
in vec2 uv6; //TEXCOORD6;
|
||||
in vec2 uv7; //TEXCOORD7;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 kernel = vec4( 0.175, 0.275, 0.375, 0.475 ) * 0.5f;
|
||||
|
||||
OUT_col = vec4(0);
|
||||
OUT_col += texture( diffuseMap, uv0 ) * kernel.x;
|
||||
OUT_col += texture( diffuseMap, uv1 ) * kernel.y;
|
||||
OUT_col += texture( diffuseMap, uv2 ) * kernel.z;
|
||||
OUT_col += texture( diffuseMap, uv3 ) * kernel.w;
|
||||
|
||||
OUT_col += texture( diffuseMap, uv4 ) * kernel.x;
|
||||
OUT_col += texture( diffuseMap, uv5 ) * kernel.y;
|
||||
OUT_col += texture( diffuseMap, uv6 ) * kernel.z;
|
||||
OUT_col += texture( diffuseMap, uv7 ) * kernel.w;
|
||||
|
||||
// Calculate a lumenance value in the alpha so we
|
||||
// can use alpha test to save fillrate.
|
||||
vec3 rgb2lum = vec3( 0.30, 0.59, 0.11 );
|
||||
OUT_col.a = dot( OUT_col.rgb, rgb2lum );
|
||||
|
||||
}
|
||||
59
Templates/Empty/game/shaders/common/postFx/gl/glowBlurV.glsl
Normal file
59
Templates/Empty/game/shaders/common/postFx/gl/glowBlurV.glsl
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
#include "../../gl/torque.glsl"
|
||||
|
||||
in vec4 vPosition;
|
||||
in vec2 vTexCoord0;
|
||||
|
||||
uniform vec2 texSize0;
|
||||
|
||||
out vec4 hpos; //POSITION;
|
||||
out vec2 uv0; //TEXCOORD0;
|
||||
out vec2 uv1; //TEXCOORD1;
|
||||
out vec2 uv2; //TEXCOORD2;
|
||||
out vec2 uv3; //TEXCOORD3;
|
||||
out vec2 uv4; //TEXCOORD4;
|
||||
out vec2 uv5; //TEXCOORD5;
|
||||
out vec2 uv6; //TEXCOORD6;
|
||||
out vec2 uv7; //TEXCOORD7;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vPosition;
|
||||
hpos = gl_Position;
|
||||
|
||||
vec2 uv = vTexCoord0 + (0.5f / texSize0);
|
||||
|
||||
uv0 = uv + ( ( BLUR_DIR * 3.5f ) / texSize0 );
|
||||
uv1 = uv + ( ( BLUR_DIR * 2.5f ) / texSize0 );
|
||||
uv2 = uv + ( ( BLUR_DIR * 1.5f ) / texSize0 );
|
||||
uv3 = uv + ( ( BLUR_DIR * 0.5f ) / texSize0 );
|
||||
|
||||
uv4 = uv - ( ( BLUR_DIR * 3.5f ) / texSize0 );
|
||||
uv5 = uv - ( ( BLUR_DIR * 2.5f ) / texSize0 );
|
||||
uv6 = uv - ( ( BLUR_DIR * 1.5f ) / texSize0 );
|
||||
uv7 = uv - ( ( BLUR_DIR * 0.5f ) / texSize0 );
|
||||
|
||||
correctSSP(gl_Position);
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
#include "../../gl/torque.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
#include "postFX.glsl"
|
||||
|
||||
#undef IN_uv0
|
||||
#define _IN_uv0 uv0
|
||||
|
||||
uniform mat4 matPrevScreenToWorld;
|
||||
uniform mat4 matWorldToScreen;
|
||||
|
||||
// Passed in from setShaderConsts()
|
||||
uniform float velocityMultiplier;
|
||||
|
||||
uniform sampler2D backBuffer;
|
||||
uniform sampler2D prepassTex;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 IN_uv0 = _IN_uv0;
|
||||
float samples = 5;
|
||||
|
||||
// First get the prepass texture for uv channel 0
|
||||
vec4 prepass = prepassUncondition( prepassTex, IN_uv0 );
|
||||
|
||||
// Next extract the depth
|
||||
float depth = prepass.a;
|
||||
|
||||
// Create the screen position
|
||||
vec4 screenPos = vec4(IN_uv0.x*2-1, IN_uv0.y*2-1, depth*2-1, 1);
|
||||
|
||||
// Calculate the world position
|
||||
vec4 D = tMul(screenPos, matWorldToScreen);
|
||||
vec4 worldPos = D / D.w;
|
||||
|
||||
// Now calculate the previous screen position
|
||||
vec4 previousPos = tMul( worldPos, matPrevScreenToWorld );
|
||||
previousPos /= previousPos.w;
|
||||
|
||||
// Calculate the XY velocity
|
||||
vec2 velocity = ((screenPos - previousPos) / velocityMultiplier).xy;
|
||||
|
||||
// Generate the motion blur
|
||||
vec4 color = texture(backBuffer, IN_uv0);
|
||||
IN_uv0 += velocity;
|
||||
|
||||
for(int i = 1; i<samples; ++i, IN_uv0 += velocity)
|
||||
{
|
||||
vec4 currentColor = texture(backBuffer, IN_uv0);
|
||||
color += currentColor;
|
||||
}
|
||||
|
||||
OUT_col = color / samples;
|
||||
}
|
||||
33
Templates/Empty/game/shaders/common/postFx/gl/passthruP.glsl
Normal file
33
Templates/Empty/game/shaders/common/postFx/gl/passthruP.glsl
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
|
||||
in vec2 uv0;
|
||||
uniform sampler2D inputTex ;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_col = texture( inputTex, uv0 );
|
||||
}
|
||||
63
Templates/Empty/game/shaders/common/postFx/gl/postFX.glsl
Normal file
63
Templates/Empty/game/shaders/common/postFx/gl/postFX.glsl
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifdef TORQUE_VERTEX_SHADER
|
||||
|
||||
in vec4 vPosition;
|
||||
in vec2 vTexCoord0;
|
||||
in vec3 vTexCoord1;
|
||||
|
||||
#define IN_pos vPosition
|
||||
#define IN_uv vTexCoord0.st
|
||||
#define IN_wsEyeRay vTexCoord1.xyz
|
||||
|
||||
out vec2 uv0;
|
||||
out vec2 uv1;
|
||||
out vec2 uv2;
|
||||
out vec2 uv3;
|
||||
out vec3 wsEyeRay;
|
||||
|
||||
#define OUT_uv0 uv0
|
||||
#define OUT_uv1 uv1
|
||||
#define OUT_uv2 uv2
|
||||
#define OUT_uv3 uv3
|
||||
#define OUT_wsEyeRay wsEyeRay
|
||||
#define OUT_hpos gl_Position
|
||||
|
||||
#endif //TORQUE_VERTEX_SHADER
|
||||
|
||||
|
||||
#ifdef TORQUE_PIXEL_SHADER
|
||||
|
||||
in vec2 uv0;
|
||||
in vec2 uv1;
|
||||
in vec2 uv2;
|
||||
in vec2 uv3;
|
||||
in vec3 wsEyeRay;
|
||||
|
||||
#define IN_uv0 uv0
|
||||
#define IN_uv1 uv1
|
||||
#define IN_uv2 uv2
|
||||
#define IN_uv3 uv3
|
||||
#define IN_wsEyeRay wsEyeRay
|
||||
|
||||
#endif//TORQUE_PIXEL_SHADER
|
||||
52
Templates/Empty/game/shaders/common/postFx/gl/postFxV.glsl
Normal file
52
Templates/Empty/game/shaders/common/postFx/gl/postFxV.glsl
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
#include "../../gl/torque.glsl"
|
||||
|
||||
in vec4 vPosition;
|
||||
in vec2 vTexCoord0;
|
||||
in vec3 vTexCoord1;
|
||||
|
||||
uniform vec4 rtParams0;
|
||||
uniform vec4 rtParams1;
|
||||
uniform vec4 rtParams2;
|
||||
uniform vec4 rtParams3;
|
||||
|
||||
out vec2 uv0;
|
||||
out vec2 uv1;
|
||||
out vec2 uv2;
|
||||
out vec2 uv3;
|
||||
out vec3 wsEyeRay;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = vPosition;
|
||||
correctSSP(gl_Position);
|
||||
|
||||
uv0 = viewportCoordToRenderTarget( vTexCoord0, rtParams0 );
|
||||
uv1 = viewportCoordToRenderTarget( vTexCoord0, rtParams1 );
|
||||
uv2 = viewportCoordToRenderTarget( vTexCoord0, rtParams2 );
|
||||
uv3 = viewportCoordToRenderTarget( vTexCoord0, rtParams3 );
|
||||
|
||||
wsEyeRay = vTexCoord1;
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
#include "../../gl/torque.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
uniform float accumTime;
|
||||
uniform vec2 projectionOffset;
|
||||
uniform vec4 targetViewport;
|
||||
|
||||
uniform sampler2D inputTex;
|
||||
|
||||
in vec2 uv0;
|
||||
|
||||
#define IN_uv0 uv0
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
float speed = 2.0;
|
||||
float distortion = 6.0;
|
||||
|
||||
float y = IN_uv0.y + (cos((IN_uv0.y+projectionOffset.y) * distortion + accumTime * speed) * 0.01);
|
||||
float x = IN_uv0.x + (sin((IN_uv0.x+projectionOffset.x) * distortion + accumTime * speed) * 0.01);
|
||||
|
||||
// Clamp the calculated uv values to be within the target's viewport
|
||||
y = clamp(y, targetViewport.y, targetViewport.w);
|
||||
x = clamp(x, targetViewport.x, targetViewport.z);
|
||||
|
||||
OUT_col = texture (inputTex, vec2(x, y));
|
||||
}
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
#include "../../gl/torque.glsl"
|
||||
#include "postFX.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Defines
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// oceanFogData
|
||||
#define FOG_DENSITY waterFogData[0]
|
||||
#define FOG_DENSITY_OFFSET waterFogData[1]
|
||||
#define WET_DEPTH waterFogData[2]
|
||||
#define WET_DARKENING waterFogData[3]
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Uniforms
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
uniform sampler2D prepassTex ;
|
||||
uniform sampler2D backbuffer ;
|
||||
uniform sampler1D waterDepthGradMap;
|
||||
uniform vec3 eyePosWorld;
|
||||
uniform vec3 ambientColor;
|
||||
uniform vec4 waterColor;
|
||||
uniform vec4 waterFogData;
|
||||
uniform vec4 waterFogPlane;
|
||||
uniform vec2 nearFar;
|
||||
uniform vec4 rtParams0;
|
||||
uniform float waterDepthGradMax;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
//vec2 prepassCoord = IN_uv0;
|
||||
//IN_uv0 = ( IN_uv0.xy * rtParams0.zw ) + rtParams0.xy;
|
||||
float depth = prepassUncondition( prepassTex, IN_uv0 ).w;
|
||||
//return vec4( depth.rrr, 1 );
|
||||
|
||||
// Skip fogging the extreme far plane so that
|
||||
// the canvas clear color always appears.
|
||||
//clip( 0.9 - depth );
|
||||
|
||||
// We assume that the eye position is below water because
|
||||
// otherwise this shader/posteffect should not be active.
|
||||
|
||||
depth *= nearFar.y;
|
||||
|
||||
vec3 eyeRay = normalize( IN_wsEyeRay );
|
||||
|
||||
vec3 rayStart = eyePosWorld;
|
||||
vec3 rayEnd = eyePosWorld + ( eyeRay * depth );
|
||||
//return vec4( rayEnd, 1 );
|
||||
|
||||
vec4 plane = waterFogPlane; //vec4( 0, 0, 1, -waterHeight );
|
||||
//plane.w -= 0.15;
|
||||
|
||||
float startSide = dot( plane.xyz, rayStart ) + plane.w;
|
||||
if ( startSide > 0 )
|
||||
{
|
||||
rayStart.z -= ( startSide );
|
||||
//return vec4( 1, 0, 0, 1 );
|
||||
}
|
||||
|
||||
vec3 hitPos;
|
||||
vec3 ray = rayEnd - rayStart;
|
||||
float rayLen = length( ray );
|
||||
vec3 rayDir = normalize( ray );
|
||||
|
||||
float endSide = dot( plane.xyz, rayEnd ) + plane.w;
|
||||
float planeDist;
|
||||
|
||||
if ( endSide < -0.005 )
|
||||
{
|
||||
//return vec4( 0, 0, 1, 1 );
|
||||
hitPos = rayEnd;
|
||||
planeDist = endSide;
|
||||
}
|
||||
else
|
||||
{
|
||||
//return vec4( 0, 0, 0, 0 );
|
||||
float den = dot( ray, plane.xyz );
|
||||
|
||||
// Parallal to the plane, return the endPnt.
|
||||
//if ( den == 0.0f )
|
||||
// return endPnt;
|
||||
|
||||
float dist = -( dot( plane.xyz, rayStart ) + plane.w ) / den;
|
||||
if ( dist < 0.0 )
|
||||
dist = 0.0;
|
||||
//return vec4( 1, 0, 0, 1 );
|
||||
//return vec4( ( dist ).rrr, 1 );
|
||||
|
||||
|
||||
hitPos = mix( rayStart, rayEnd, dist );
|
||||
|
||||
planeDist = dist;
|
||||
}
|
||||
|
||||
float delta = length( hitPos - rayStart );
|
||||
|
||||
float fogAmt = 1.0 - saturate( exp( -FOG_DENSITY * ( delta - FOG_DENSITY_OFFSET ) ) );
|
||||
//return vec4( fogAmt.rrr, 1 );
|
||||
|
||||
// Calculate the water "base" color based on depth.
|
||||
vec4 fogColor = waterColor * texture( waterDepthGradMap, saturate( delta / waterDepthGradMax ) );
|
||||
// Modulate baseColor by the ambientColor.
|
||||
fogColor *= vec4( ambientColor.rgb, 1 );
|
||||
|
||||
vec3 inColor = hdrDecode( texture( backbuffer, IN_uv0 ).rgb );
|
||||
inColor.rgb *= 1.0 - saturate( abs( planeDist ) / WET_DEPTH ) * WET_DARKENING;
|
||||
//return vec4( inColor, 1 );
|
||||
|
||||
vec3 outColor = mix( inColor, fogColor.rgb, fogAmt );
|
||||
|
||||
OUT_col = vec4( hdrEncode( outColor ), 1 );
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue