mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 23:24:41 +00:00
Implementation of reflection and skylight probes.
Moves lighting math to the diffuse/specular two-channel logic.
This commit is contained in:
parent
83dd55e851
commit
2be32ad737
102 changed files with 12346 additions and 1911 deletions
|
|
@ -28,8 +28,10 @@ singleton Material(Cheetah_Main)
|
|||
specularPower[0] = "10";
|
||||
translucentBlendOp = "None";
|
||||
normalMap[0] = "art/shapes/Cheetah/Cheetah_N";
|
||||
specularMap[0] = "art/shapes/Cheetah/Cheetah_S";
|
||||
castDynamicShadows = true;
|
||||
diffuseColor[3] = "1 1 1 1";
|
||||
specular0 = "0.9 0.9 0.9 1";
|
||||
specularPower0 = "10";
|
||||
};
|
||||
|
||||
singleton Material(Cheetah_TailLights)
|
||||
|
|
|
|||
|
|
@ -24,19 +24,18 @@ singleton Material(Mat_Soldier_Main)
|
|||
{
|
||||
mapTo = "base_Soldier_Main";
|
||||
|
||||
diffuseMap[0] = "Soldier_Dif.dds";
|
||||
normalMap[0] = "Soldier_N.dds";
|
||||
specularMap[0] = "Soldier_Spec.dds";
|
||||
|
||||
diffuseColor[0] = "1 1 1 1";
|
||||
specular[0] = "0.9 0.9 0.9 1";
|
||||
specularPower[0] = 10;
|
||||
|
||||
doubleSided = false;
|
||||
translucent = false;
|
||||
showFootprints = "0";
|
||||
diffuseMap[0] = "art/shapes/actors/Soldier/Soldier_Dif.dds";
|
||||
normalMap[0] = "art/shapes/actors/Soldier/Soldier_N.dds";
|
||||
specularMap[0] = "art/shapes/actors/Soldier/Soldier_c";
|
||||
FlipRB[0] = "1";
|
||||
castDynamicShadows = true;
|
||||
materialTag0 = "Player";
|
||||
isSRGb[0] = "1";
|
||||
roughness0 = "1";
|
||||
FlipRB0 = "1";
|
||||
specularPower0 = "10";
|
||||
pixelSpecular0 = "0";
|
||||
specular0 = "0.9 0.9 0.9 1";
|
||||
};
|
||||
|
||||
singleton Material(Mat_Soldier_Dazzle)
|
||||
|
|
@ -110,7 +109,8 @@ singleton Material(Mat_Orange_Soldier_Main : Mat_Soldier_Main)
|
|||
singleton Material(Mat_Red_Soldier_Main : Mat_Soldier_Main)
|
||||
{
|
||||
mapTo = "Red_Soldier_Main";
|
||||
diffuseMap[0] = "Soldier_Red_Dif.dds";
|
||||
diffuseMap[0] = "art/shapes/actors/Soldier/Soldier_Red_Dif.dds";
|
||||
normalMap[0] = "art/shapes/actors/Soldier/Soldier_N.dds";
|
||||
};
|
||||
|
||||
singleton Material(Mat_Teal_Soldier_Main : Mat_Soldier_Main)
|
||||
|
|
|
|||
|
|
@ -25,9 +25,6 @@ singleton Material(cube_GridMaterial)
|
|||
{
|
||||
mapTo = "GridMaterial";
|
||||
|
||||
diffuseMap[0] = "grid";
|
||||
normalMap[0] = "";
|
||||
specularMap[0] = "";
|
||||
|
||||
diffuseColor[0] = "1 1 1 1";
|
||||
specular[0] = "0.9 0.9 0.9 1";
|
||||
|
|
@ -38,6 +35,12 @@ singleton Material(cube_GridMaterial)
|
|||
doubleSided = false;
|
||||
translucent = false;
|
||||
translucentBlendOp = "None";
|
||||
materialTag0 = "Miscellaneous";
|
||||
smoothness[0] = "1";
|
||||
metalness[0] = "1";
|
||||
specularPower0 = "0.415939";
|
||||
pixelSpecular0 = "0";
|
||||
specular0 = "0.9 0.9 0.9 1";
|
||||
};
|
||||
|
||||
//--- cube.dae MATERIALS END ---
|
||||
|
|
|
|||
|
|
@ -24,14 +24,11 @@ new Material(Structure_wall)
|
|||
{
|
||||
mapTo = "building01walls";
|
||||
diffuseMap[0] = "art/shapes/station/building01walls";
|
||||
//emissive[0] = true;
|
||||
};
|
||||
|
||||
|
||||
new Material(Structure_grid)
|
||||
{
|
||||
mapTo = "grid";
|
||||
diffuseMap[0] = "art/shapes/station/grid";
|
||||
normalMap[0] = "art/shapes/station/building01walls_n.dds";
|
||||
specularMap[0] = "art/shapes/station/building01walls_c.dds";
|
||||
effectColor[0] = "InvisibleBlack";
|
||||
materialTag0 = "Miscellaneous";
|
||||
pixelSpecular0 = "0";
|
||||
//emissive[0] = true;
|
||||
};
|
||||
|
||||
|
|
@ -40,6 +37,20 @@ new Material(Structure_plate)
|
|||
{
|
||||
mapTo = "plate";
|
||||
diffuseMap[0] = "art/shapes/station/plate";
|
||||
normalMap[0] = "art/shapes/station/plate_n.dds";
|
||||
specularMap[0] = "art/shapes/station/plate_c.dds";
|
||||
pixelSpecular0 = "0";
|
||||
materialTag0 = "Miscellaneous";
|
||||
//emissive[0] = true;
|
||||
};
|
||||
|
||||
|
||||
new Material(Structure_grid)
|
||||
{
|
||||
mapTo = "grid";
|
||||
diffuseMap[0] = "art/shapes/station/grid";
|
||||
normalMap[0] = "art/shapes/station/grid_n.dds";
|
||||
specularMap[0] = "art/shapes/station/grid_c.dds";
|
||||
//emissive[0] = true;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@ new TerrainMaterial()
|
|||
detailBrightness = "1";
|
||||
Enabled = "1";
|
||||
diffuseSize = "400";
|
||||
compositeMap = "art/terrains/Example/snowtop";
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -51,8 +51,12 @@ singleton Material( Grid512_ForestGreenLines_Mat )
|
|||
singleton Material( Grid512_Green_Mat )
|
||||
{
|
||||
mapTo = "Grid512_Green_Mat";
|
||||
diffuseMap[0] = "512_green";
|
||||
diffuseMap[0] = "core/art/grids/512_green";
|
||||
materialTag0 = "TestMaterial";
|
||||
smoothness[0] = "1";
|
||||
metalness[0] = "1";
|
||||
translucent = "0";
|
||||
translucentBlendOp = "Add";
|
||||
};
|
||||
|
||||
singleton Material( Grid512_Grey_Mat )
|
||||
|
|
@ -65,8 +69,10 @@ singleton Material( Grid512_Grey_Mat )
|
|||
singleton Material( Grid512_GreyBase_Mat )
|
||||
{
|
||||
mapTo = "Grid512_GreyBase_Mat";
|
||||
diffuseMap[0] = "512_grey_base";
|
||||
diffuseMap[0] = "core/art/grids/512_grey_base";
|
||||
materialTag0 = "TestMaterial";
|
||||
smoothness[0] = "1";
|
||||
metalness[0] = "1";
|
||||
};
|
||||
|
||||
singleton Material( Grid512_Orange_Mat )
|
||||
|
|
|
|||
|
|
@ -47,23 +47,56 @@ new ShaderData( AL_DeferredShader )
|
|||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/deferredShadingP.glsl";
|
||||
|
||||
samplerNames[0] = "colorBufferTex";
|
||||
samplerNames[1] = "directLightingBuffer";
|
||||
samplerNames[1] = "diffuseLightingBuffer";
|
||||
samplerNames[2] = "matInfoTex";
|
||||
samplerNames[3] = "indirectLightingBuffer";
|
||||
samplerNames[3] = "specularLightingBuffer";
|
||||
samplerNames[4] = "deferredTex";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
new ShaderData( AL_ProbeShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/postFxV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/lighting/advanced/probeShadingP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/probeShadingP.glsl";
|
||||
|
||||
samplerNames[0] = "colorBufferTex";
|
||||
samplerNames[1] = "diffuseLightingBuffer";
|
||||
samplerNames[2] = "matInfoTex";
|
||||
samplerNames[3] = "specularLightingBuffer";
|
||||
samplerNames[4] = "deferredTex";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
|
||||
singleton PostEffect( AL_PreCapture )
|
||||
{
|
||||
renderTime = "PFXBeforeBin";
|
||||
renderBin = "ProbeBin";
|
||||
shader = AL_ProbeShader;
|
||||
stateBlock = AL_DeferredShadingState;
|
||||
texture[0] = "#color";
|
||||
texture[1] = "#diffuseLighting";
|
||||
texture[2] = "#matinfo";
|
||||
texture[3] = "#specularLighting";
|
||||
texture[4] = "#deferred";
|
||||
target = "$backBuffer";
|
||||
renderPriority = 10000;
|
||||
allowReflectPass = true;
|
||||
};
|
||||
|
||||
singleton PostEffect( AL_DeferredShading )
|
||||
{
|
||||
renderTime = "PFXAfterBin";
|
||||
renderBin = "SkyBin";
|
||||
renderBin = "ProbeBin";
|
||||
shader = AL_DeferredShader;
|
||||
stateBlock = AL_DeferredShadingState;
|
||||
texture[0] = "#color";
|
||||
texture[1] = "#directLighting";
|
||||
texture[1] = "#diffuseLighting";
|
||||
texture[2] = "#matinfo";
|
||||
texture[3] = "#indirectLighting";
|
||||
texture[3] = "#specularLighting";
|
||||
texture[4] = "#deferred";
|
||||
|
||||
target = "$backBuffer";
|
||||
|
|
@ -192,7 +225,7 @@ new ShaderData( AL_LightMapShader )
|
|||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgLightMapVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "indirectLightingBuffer";
|
||||
samplerNames[0] = "specularLightingBuffer";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
|
|
@ -200,7 +233,7 @@ singleton PostEffect( AL_LightMapVisualize )
|
|||
{
|
||||
shader = AL_LightMapShader;
|
||||
stateBlock = AL_DefaultVisualizeState;
|
||||
texture[0] = "#indirectLighting";
|
||||
texture[0] = "#specularLighting";
|
||||
target = "$backBuffer";
|
||||
renderPriority = 9999;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ new ShaderData( AL_LightColorVisualizeShader )
|
|||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgLightColorVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "directLightingBuffer";
|
||||
samplerNames[0] = "diffuseLightingBuffer";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
|
@ -158,7 +158,7 @@ singleton PostEffect( AL_LightColorVisualize )
|
|||
{
|
||||
shader = AL_LightColorVisualizeShader;
|
||||
stateBlock = AL_DefaultVisualizeState;
|
||||
texture[0] = "#directLighting";
|
||||
texture[0] = "#diffuseLighting";
|
||||
target = "$backBuffer";
|
||||
renderPriority = 9999;
|
||||
};
|
||||
|
|
@ -184,16 +184,16 @@ new ShaderData( AL_LightSpecularVisualizeShader )
|
|||
OGLVertexShaderFile = "shaders/common/postFx/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/dbgLightSpecularVisualizeP.glsl";
|
||||
|
||||
samplerNames[0] = "directLightingBuffer";
|
||||
samplerNames[0] = "diffuseLightingBuffer";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
singleton PostEffect( AL_LightSpecularVisualize )
|
||||
{
|
||||
shader = AL_LightSpecularVisualizeShader;
|
||||
shader = AL_LightColorVisualizeShader;
|
||||
stateBlock = AL_DefaultVisualizeState;
|
||||
texture[0] = "#directLighting";
|
||||
texture[0] = "#specularLighting";
|
||||
target = "$backBuffer";
|
||||
renderPriority = 9999;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -86,11 +86,11 @@ new CustomMaterial( AL_VectorLightMaterial )
|
|||
sampler["shadowMap"] = "$dynamiclight";
|
||||
sampler["dynamicShadowMap"] = "$dynamicShadowMap";
|
||||
sampler["ssaoMask"] = "#ssaoMask";
|
||||
sampler["lightBuffer"] = "#indirectLighting";
|
||||
sampler["lightBuffer"] = "#specularLighting";
|
||||
sampler["colorBuffer"] = "#color";
|
||||
sampler["matInfoBuffer"] = "#matinfo";
|
||||
|
||||
target = "directLighting";
|
||||
target = "diffuseLighting";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
|
@ -163,11 +163,11 @@ new CustomMaterial( AL_PointLightMaterial )
|
|||
sampler["shadowMap"] = "$dynamiclight";
|
||||
sampler["dynamicShadowMap"] = "$dynamicShadowMap";
|
||||
sampler["cookieMap"] = "$dynamiclightmask";
|
||||
sampler["lightBuffer"] = "#indirectLighting";
|
||||
sampler["lightBuffer"] = "#specularLighting";
|
||||
sampler["colorBuffer"] = "#color";
|
||||
sampler["matInfoBuffer"] = "#matinfo";
|
||||
|
||||
target = "directLighting";
|
||||
target = "diffuseLighting";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
|
@ -202,11 +202,11 @@ new CustomMaterial( AL_SpotLightMaterial )
|
|||
sampler["shadowMap"] = "$dynamiclight";
|
||||
sampler["dynamicShadowMap"] = "$dynamicShadowMap";
|
||||
sampler["cookieMap"] = "$dynamiclightmask";
|
||||
sampler["lightBuffer"] = "#indirectLighting";
|
||||
sampler["lightBuffer"] = "#specularLighting";
|
||||
sampler["colorBuffer"] = "#color";
|
||||
sampler["matInfoBuffer"] = "#matinfo";
|
||||
|
||||
target = "directLighting";
|
||||
target = "diffuseLighting";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
|
@ -269,7 +269,124 @@ new CustomMaterial( AL_ParticlePointLightMaterial )
|
|||
stateBlock = AL_ConvexLightState;
|
||||
|
||||
sampler["deferredBuffer"] = "#deferred";
|
||||
target = "directLighting";
|
||||
target = "diffuseLighting";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
//Reflection probe Specular
|
||||
new ShaderData( ReflectionProbeShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/lighting/advanced/convexGeometryV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/lighting/advanced/reflectionProbeP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/lighting/advanced/gl/convexGeometryV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/reflectionProbeP.glsl";
|
||||
|
||||
samplerNames[0] = "$deferredBuffer";
|
||||
samplerNames[1] = "$matInfoBuffer";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
// Convex-geometry light states
|
||||
new GFXStateBlockData( AL_ProbeState )
|
||||
{
|
||||
blendDefined = true;
|
||||
blendEnable = true;
|
||||
blendSrc = GFXBlendOne;
|
||||
blendDest = GFXBlendOne;
|
||||
blendOp = GFXBlendOpAdd;
|
||||
|
||||
zDefined = true;
|
||||
zEnable = true;
|
||||
zWriteEnable = false;
|
||||
zFunc = GFXCmpGreaterEqual;
|
||||
|
||||
samplersDefined = true;
|
||||
samplerStates[0] = SamplerClampPoint; // G-buffer
|
||||
mSamplerNames[0] = "deferredBuffer";
|
||||
samplerStates[1] = SamplerClampLinear; // Shadow Map (Do not use linear, these are perspective projections)
|
||||
mSamplerNames[1] = "matInfoBuffer";
|
||||
|
||||
cullDefined = true;
|
||||
cullMode = GFXCullCW;
|
||||
|
||||
stencilDefined = true;
|
||||
stencilEnable = true;
|
||||
stencilFailOp = GFXStencilOpKeep;
|
||||
stencilZFailOp = GFXStencilOpKeep;
|
||||
stencilPassOp = GFXStencilOpKeep;
|
||||
stencilFunc = GFXCmpLess;
|
||||
stencilRef = 0;
|
||||
};
|
||||
|
||||
new CustomMaterial( ReflectionProbeMaterial )
|
||||
{
|
||||
shader = ReflectionProbeShader;
|
||||
stateBlock = AL_ProbeState;
|
||||
|
||||
sampler["deferredBuffer"] = "#deferred";
|
||||
sampler["matInfoBuffer"] = "#matinfo";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
//Skylight
|
||||
new ShaderData( IrradianceShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/lighting/advanced/cubemapV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/lighting/advanced/irradianceP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/lighting/advanced/gl/cubemapV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/irradianceP.glsl";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
new ShaderData( PrefiterCubemapShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/lighting/advanced/cubemapV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/lighting/advanced/prefilterP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/lighting/advanced/gl/cubemapV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/prefilterP.glsl";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
new ShaderData( BRDFLookupShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/lighting/advanced/cubemapV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/lighting/advanced/brdfLookupP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/lighting/advanced/gl/cubemapV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/brdfLookupP.glsl";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
new ShaderData( SklyightShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/lighting/advanced/convexGeometryV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/lighting/advanced/skylightP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/lighting/advanced/gl/convexGeometryV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/lighting/advanced/gl/skylightP.glsl";
|
||||
|
||||
samplerNames[0] = "$deferredBuffer";
|
||||
samplerNames[1] = "$matInfoBuffer";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
||||
new CustomMaterial( SklyightMaterial )
|
||||
{
|
||||
shader = SklyightShader;
|
||||
stateBlock = AL_ProbeState;
|
||||
|
||||
sampler["deferredBuffer"] = "#deferred";
|
||||
sampler["matInfoBuffer"] = "#matinfo";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
|
|
@ -64,7 +64,7 @@ singleton CustomMaterial( BL_ProjectedShadowMaterial )
|
|||
function onActivateBasicLM()
|
||||
{
|
||||
// If HDR is enabled... enable the special format token.
|
||||
if ( $platform !$= "macos" && HDRPostFx.isEnabled )
|
||||
if ( HDRPostFx.isEnabled )
|
||||
AL_FormatToken.enable();
|
||||
|
||||
// Create render pass for projected shadow.
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@ function initRenderManager()
|
|||
// meshes... but that causes issues in reflections.
|
||||
DiffuseRenderPassManager.addManager( new RenderObjectMgr(SkyBin) { bintype = "Sky"; renderOrder = 0.1; processAddOrder = 0.1; } );
|
||||
|
||||
//DiffuseRenderPassManager.addManager( new RenderVistaMgr() { bintype = "Vista"; renderOrder = 0.15; processAddOrder = 0.15; } );
|
||||
DiffuseRenderPassManager.addManager( new RenderProbeMgr(ProbeBin) { bintype = "Probes"; renderOrder = 0.15; processAddOrder = 0.15; } );
|
||||
//DiffuseRenderPassManager.addManager( new RenderVistaMgr() { bintype = "Vista"; renderOrder = 0.15; processAddOrder = 0.15; } );
|
||||
|
||||
DiffuseRenderPassManager.addManager( new RenderObjectMgr(BeginBin) { bintype = "Begin"; renderOrder = 0.2; processAddOrder = 0.2; } );
|
||||
// Normal mesh rendering.
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ new SimGroup(MissionGroup) {
|
|||
levelName = "A Probe Test";
|
||||
};
|
||||
new SkyBox(theSky) {
|
||||
Material = "DesertSkyMat";
|
||||
Material = "sky_day_hdr";
|
||||
drawBottom = "0";
|
||||
fogBandHeight = "0";
|
||||
position = "0 0 0";
|
||||
|
|
@ -37,48 +37,16 @@ new SimGroup(MissionGroup) {
|
|||
canSave = "1";
|
||||
canSaveDynamicFields = "1";
|
||||
};
|
||||
new Sun(theSun) {
|
||||
azimuth = "290";
|
||||
elevation = "50";
|
||||
color = "1 1 1 1";
|
||||
ambient = "0.473532 0.473532 0.473532 1";
|
||||
brightness = "1";
|
||||
castShadows = "1";
|
||||
staticRefreshFreq = "250";
|
||||
dynamicRefreshFreq = "8";
|
||||
coronaEnabled = "1";
|
||||
coronaScale = "0.5";
|
||||
coronaTint = "1 1 1 1";
|
||||
coronaUseLightColor = "1";
|
||||
flareScale = "1";
|
||||
attenuationRatio = "0 1 1";
|
||||
shadowType = "PSSM";
|
||||
texSize = "1024";
|
||||
overDarkFactor = "3000 1500 750 250";
|
||||
shadowDistance = "100";
|
||||
shadowSoftness = "0.25";
|
||||
numSplits = "4";
|
||||
logWeight = "0.9";
|
||||
fadeStartDistance = "0";
|
||||
lastSplitTerrainOnly = "0";
|
||||
representedInLightmap = "0";
|
||||
shadowDarkenColor = "0 0 0 -1";
|
||||
includeLightmappedGeometryInShadow = "0";
|
||||
new Skylight() {
|
||||
enabled = "1";
|
||||
StaticCubemap = "sky_day_hdr_cubemap";
|
||||
position = "0 0 0";
|
||||
rotation = "1 0 0 0";
|
||||
scale = "1 1 1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "1";
|
||||
bias = "0.1";
|
||||
Blur = "1";
|
||||
enabled = "1";
|
||||
height = "1024";
|
||||
lightBleedFactor = "0.8";
|
||||
minVariance = "0";
|
||||
pointShadowType = "PointShadowType_Paraboloid";
|
||||
shadowBox = "-100 -100 -100 100 100 100";
|
||||
splitFadeDistances = "1 1 1 1";
|
||||
width = "3072";
|
||||
persistentId = "e4c73467-4089-11e8-b478-cd227cd60b8b";
|
||||
reflectionPath = "levels/AProbeTest/probes/";
|
||||
};
|
||||
new SimGroup(PlayerDropPoints) {
|
||||
canSave = "1";
|
||||
|
|
@ -117,13 +85,46 @@ new SimGroup(MissionGroup) {
|
|||
rotation = "1 0 0 0";
|
||||
scale = "1 1 1";
|
||||
};
|
||||
new Sun() {
|
||||
azimuth = "200";
|
||||
elevation = "20";
|
||||
color = "0.8 0.8 0.8 1";
|
||||
ambient = "0.2 0.2 0.2 1";
|
||||
brightness = "1";
|
||||
castShadows = "1";
|
||||
staticRefreshFreq = "250";
|
||||
dynamicRefreshFreq = "8";
|
||||
coronaEnabled = "1";
|
||||
coronaMaterial = "Corona_Mat";
|
||||
coronaScale = "0.5";
|
||||
coronaTint = "1 1 1 1";
|
||||
coronaUseLightColor = "1";
|
||||
flareType = "SunFlareExample";
|
||||
flareScale = "1";
|
||||
attenuationRatio = "0 1 1";
|
||||
shadowType = "PSSM";
|
||||
texSize = "512";
|
||||
overDarkFactor = "2000 1000 500 100";
|
||||
shadowDistance = "400";
|
||||
shadowSoftness = "0.15";
|
||||
numSplits = "4";
|
||||
logWeight = "0.91";
|
||||
fadeStartDistance = "0";
|
||||
lastSplitTerrainOnly = "0";
|
||||
representedInLightmap = "0";
|
||||
shadowDarkenColor = "0 0 0 -1";
|
||||
includeLightmappedGeometryInShadow = "0";
|
||||
position = "35.7492 65.5507 -15.5377";
|
||||
rotation = "1 0 0 0";
|
||||
scale = "1 1 1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "1";
|
||||
direction = "1 1 -1";
|
||||
};
|
||||
new ReflectionProbe() {
|
||||
enabled = "1";
|
||||
enabled = "0";
|
||||
ProbeShape = "Sphere";
|
||||
radius = "10";
|
||||
Intensity = "1";
|
||||
IndirectLightMode = "Ambient Color";
|
||||
IndirectLight = "1 1 1 1";
|
||||
ReflectionMode = "Baked Cubemap";
|
||||
reflectionPath = "levels/probeTest/probes/";
|
||||
Bake = "0";
|
||||
|
|
@ -134,6 +135,9 @@ new SimGroup(MissionGroup) {
|
|||
canSaveDynamicFields = "1";
|
||||
persistentId = "8072e1be-2846-11e7-9f56-abd46b190c60";
|
||||
GroundColor = "0.8 0.7 0.5 1";
|
||||
IndirectLight = "1 1 1 1";
|
||||
IndirectLightMode = "Spherical Harmonics";
|
||||
Intensity = "1";
|
||||
SkyColor = "0.5 0.5 1 1";
|
||||
};
|
||||
new ConvexShape() {
|
||||
|
|
@ -243,7 +247,7 @@ new SimGroup(MissionGroup) {
|
|||
};
|
||||
new PointLight() {
|
||||
radius = "10";
|
||||
isEnabled = "1";
|
||||
isEnabled = "0";
|
||||
color = "0.887923 1 0.008023 1";
|
||||
brightness = "1";
|
||||
castShadows = "0";
|
||||
|
|
@ -272,5 +276,24 @@ new SimGroup(MissionGroup) {
|
|||
canSave = "1";
|
||||
canSaveDynamicFields = "1";
|
||||
};
|
||||
new ReflectionProbe() {
|
||||
enabled = "0";
|
||||
ProbeShape = "Box";
|
||||
radius = "10";
|
||||
ReflectionMode = "Baked Cubemap";
|
||||
reflectionPath = "levels/probeTest/probes/";
|
||||
Bake = "0";
|
||||
position = "15.4549 0.559989 4.53387";
|
||||
rotation = "1 0 0 0";
|
||||
scale = "5 5 5";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "1";
|
||||
persistentId = "4ec88e62-4e8f-11e8-ae68-993c6bb8eb5b";
|
||||
GroundColor = "0.8 0.7 0.5 1";
|
||||
IndirectLight = "1 1 1 1";
|
||||
IndirectLightMode = "Spherical Harmonics";
|
||||
Intensity = "1";
|
||||
SkyColor = "0.5 0.5 1 1";
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -16,7 +16,6 @@ new SimGroup(MissionGroup) {
|
|||
canvasClearColor = "0 0 0 255";
|
||||
ambientLightBlendPhase = "1";
|
||||
ambientLightBlendCurve = "0 0 -1 -1";
|
||||
LevelEnvMap = "DesertSkyCubemap";
|
||||
soundAmbience = "AudioAmbienceDefault";
|
||||
soundDistanceModel = "Linear";
|
||||
canSave = "1";
|
||||
|
|
@ -33,6 +32,7 @@ new SimGroup(MissionGroup) {
|
|||
baseTexFormat = "DDS";
|
||||
lightMapSize = "256";
|
||||
screenError = "16";
|
||||
ignoreZodiacs = "0";
|
||||
position = "-1024 -1024 179.978";
|
||||
rotation = "1 0 0 0";
|
||||
canSave = "1";
|
||||
|
|
@ -67,8 +67,8 @@ new SimGroup(MissionGroup) {
|
|||
playAmbient = "1";
|
||||
meshCulling = "0";
|
||||
originSort = "0";
|
||||
collisionType = "Collision Mesh";
|
||||
decalType = "Collision Mesh";
|
||||
CollisionType = "Collision Mesh";
|
||||
DecalType = "Collision Mesh";
|
||||
allowPlayerStep = "1";
|
||||
alphaFadeEnable = "0";
|
||||
alphaFadeStart = "100";
|
||||
|
|
@ -76,6 +76,10 @@ new SimGroup(MissionGroup) {
|
|||
alphaFadeInverse = "0";
|
||||
renderNormals = "0";
|
||||
forceDetail = "-1";
|
||||
ignoreZodiacs = "0";
|
||||
useGradientRange = "0";
|
||||
gradientRange = "0 180";
|
||||
invertGradientRange = "0";
|
||||
position = "9.42739 27.7428 241.767";
|
||||
rotation = "1 0 0 0";
|
||||
scale = "1 1 1";
|
||||
|
|
@ -133,8 +137,8 @@ new SimGroup(MissionGroup) {
|
|||
playAmbient = "1";
|
||||
meshCulling = "0";
|
||||
originSort = "0";
|
||||
collisionType = "Collision Mesh";
|
||||
decalType = "Collision Mesh";
|
||||
CollisionType = "Collision Mesh";
|
||||
DecalType = "Collision Mesh";
|
||||
allowPlayerStep = "1";
|
||||
alphaFadeEnable = "0";
|
||||
alphaFadeStart = "100";
|
||||
|
|
@ -142,6 +146,10 @@ new SimGroup(MissionGroup) {
|
|||
alphaFadeInverse = "0";
|
||||
renderNormals = "0";
|
||||
forceDetail = "-1";
|
||||
ignoreZodiacs = "0";
|
||||
useGradientRange = "0";
|
||||
gradientRange = "0 180";
|
||||
invertGradientRange = "0";
|
||||
position = "17.8995 16.1596 241.136";
|
||||
rotation = "1 0 0 0";
|
||||
scale = "1 1 1";
|
||||
|
|
@ -158,27 +166,18 @@ new SimGroup(MissionGroup) {
|
|||
|
||||
surface = "0 0 0 1 1.29457 -0.42643 0.5";
|
||||
surface = "0 1 0 0 1.29457 -0.42643 -0.5";
|
||||
surface = "0.707107 0 0 0.707107 1.29457 5.75621 0";
|
||||
surface = "0 0.707107 -0.707107 0 1.29457 -6.60907 -4.54747e-013";
|
||||
surface = "0.5 0.5 -0.5 0.5 -3.35148 -0.42643 -1.28542e-008";
|
||||
surface = "0.5 -0.5 0.5 0.5 5.94063 -0.42643 -1.28542e-008";
|
||||
};
|
||||
new EnvVolume() {
|
||||
AreaEnvMap = "MipCubemap";
|
||||
cubeReflectorDesc = "DefaultCubeDesc";
|
||||
position = "8.21068 19.3464 241.855";
|
||||
rotation = "1 0 0 0";
|
||||
scale = "10 10 10";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "1";
|
||||
surface = "0.707107 0 0 0.707106 1.29457 5.75621 0";
|
||||
surface = "0 0.707107 -0.707107 0 1.29457 -6.60907 -4.54747e-13";
|
||||
surface = "0.5 0.5 -0.5 0.5 -3.35148 -0.42643 -1.28542e-08";
|
||||
surface = "0.5 -0.5 0.5 0.5 5.94063 -0.42643 -1.28542e-08";
|
||||
};
|
||||
new TSStatic() {
|
||||
shapeName = "art/shapes/textures/PBRTEST2.dae";
|
||||
playAmbient = "1";
|
||||
meshCulling = "0";
|
||||
originSort = "0";
|
||||
collisionType = "Collision Mesh";
|
||||
decalType = "Collision Mesh";
|
||||
CollisionType = "Collision Mesh";
|
||||
DecalType = "Collision Mesh";
|
||||
allowPlayerStep = "1";
|
||||
alphaFadeEnable = "0";
|
||||
alphaFadeStart = "100";
|
||||
|
|
@ -186,6 +185,10 @@ new SimGroup(MissionGroup) {
|
|||
alphaFadeInverse = "0";
|
||||
renderNormals = "0";
|
||||
forceDetail = "-1";
|
||||
ignoreZodiacs = "0";
|
||||
useGradientRange = "0";
|
||||
gradientRange = "0 180";
|
||||
invertGradientRange = "0";
|
||||
position = "5.60579 18.8689 241.462";
|
||||
rotation = "1 0 0 0";
|
||||
scale = "1 1 1";
|
||||
|
|
@ -198,8 +201,8 @@ new SimGroup(MissionGroup) {
|
|||
meshCulling = "0";
|
||||
originSort = "0";
|
||||
cubeReflectorDesc = "DefaultCubeDesc";
|
||||
collisionType = "Collision Mesh";
|
||||
decalType = "Collision Mesh";
|
||||
CollisionType = "Collision Mesh";
|
||||
DecalType = "Collision Mesh";
|
||||
allowPlayerStep = "1";
|
||||
alphaFadeEnable = "0";
|
||||
alphaFadeStart = "100";
|
||||
|
|
@ -207,6 +210,10 @@ new SimGroup(MissionGroup) {
|
|||
alphaFadeInverse = "0";
|
||||
renderNormals = "0";
|
||||
forceDetail = "-1";
|
||||
ignoreZodiacs = "0";
|
||||
useGradientRange = "0";
|
||||
gradientRange = "0 180";
|
||||
invertGradientRange = "0";
|
||||
position = "22.1653 4.41543 241.364";
|
||||
rotation = "1 0 0 0";
|
||||
scale = "1 1 1";
|
||||
|
|
@ -218,8 +225,8 @@ new SimGroup(MissionGroup) {
|
|||
playAmbient = "1";
|
||||
meshCulling = "0";
|
||||
originSort = "0";
|
||||
collisionType = "Collision Mesh";
|
||||
decalType = "Collision Mesh";
|
||||
CollisionType = "Collision Mesh";
|
||||
DecalType = "Collision Mesh";
|
||||
allowPlayerStep = "1";
|
||||
alphaFadeEnable = "0";
|
||||
alphaFadeStart = "100";
|
||||
|
|
@ -227,6 +234,10 @@ new SimGroup(MissionGroup) {
|
|||
alphaFadeInverse = "0";
|
||||
renderNormals = "0";
|
||||
forceDetail = "-1";
|
||||
ignoreZodiacs = "0";
|
||||
useGradientRange = "0";
|
||||
gradientRange = "0 180";
|
||||
invertGradientRange = "0";
|
||||
position = "15.72 5.9186 241.191";
|
||||
rotation = "1 0 0 0";
|
||||
scale = "1 1 1";
|
||||
|
|
@ -246,8 +257,8 @@ new SimGroup(MissionGroup) {
|
|||
playAmbient = "1";
|
||||
meshCulling = "0";
|
||||
originSort = "0";
|
||||
collisionType = "Collision Mesh";
|
||||
decalType = "Collision Mesh";
|
||||
CollisionType = "Collision Mesh";
|
||||
DecalType = "Collision Mesh";
|
||||
allowPlayerStep = "0";
|
||||
alphaFadeEnable = "0";
|
||||
alphaFadeStart = "100";
|
||||
|
|
@ -255,6 +266,10 @@ new SimGroup(MissionGroup) {
|
|||
alphaFadeInverse = "0";
|
||||
renderNormals = "0";
|
||||
forceDetail = "-1";
|
||||
ignoreZodiacs = "0";
|
||||
useGradientRange = "0";
|
||||
gradientRange = "0 180";
|
||||
invertGradientRange = "0";
|
||||
position = "12.8895 -2.18239 238.765";
|
||||
rotation = "1 0 0 0";
|
||||
scale = "1 1 1";
|
||||
|
|
@ -266,8 +281,8 @@ new SimGroup(MissionGroup) {
|
|||
playAmbient = "1";
|
||||
meshCulling = "0";
|
||||
originSort = "0";
|
||||
collisionType = "Collision Mesh";
|
||||
decalType = "Collision Mesh";
|
||||
CollisionType = "Collision Mesh";
|
||||
DecalType = "Collision Mesh";
|
||||
allowPlayerStep = "0";
|
||||
alphaFadeEnable = "0";
|
||||
alphaFadeStart = "100";
|
||||
|
|
@ -275,6 +290,10 @@ new SimGroup(MissionGroup) {
|
|||
alphaFadeInverse = "0";
|
||||
renderNormals = "0";
|
||||
forceDetail = "-1";
|
||||
ignoreZodiacs = "0";
|
||||
useGradientRange = "0";
|
||||
gradientRange = "0 180";
|
||||
invertGradientRange = "0";
|
||||
position = "10.406 10.0939 240.551";
|
||||
rotation = "1 0 0 0";
|
||||
scale = "1 1 1";
|
||||
|
|
@ -300,9 +319,6 @@ new SimGroup(MissionGroup) {
|
|||
enabled = "1";
|
||||
ProbeShape = "Sphere";
|
||||
radius = "10";
|
||||
Intensity = "1";
|
||||
IndirectLightMode = "Ambient Color";
|
||||
IndirectLight = "1 1 1 1";
|
||||
ReflectionMode = "Baked Cubemap";
|
||||
reflectionPath = "levels/empty terrain/";
|
||||
Bake = "0";
|
||||
|
|
@ -312,14 +328,14 @@ new SimGroup(MissionGroup) {
|
|||
canSave = "1";
|
||||
canSaveDynamicFields = "1";
|
||||
persistentId = "fc28816f-65a6-11e7-b9a1-b6f5317ad553";
|
||||
IndirectLight = "1 1 1 1";
|
||||
IndirectLightMode = "Ambient Color";
|
||||
Intensity = "1";
|
||||
};
|
||||
new ReflectionProbe() {
|
||||
enabled = "1";
|
||||
ProbeShape = "Sphere";
|
||||
radius = "10";
|
||||
Intensity = "1";
|
||||
IndirectLightMode = "Ambient Color";
|
||||
IndirectLight = "1 1 1 1";
|
||||
ReflectionMode = "Baked Cubemap";
|
||||
reflectionPath = "levels/empty terrain/";
|
||||
Bake = "0";
|
||||
|
|
@ -329,6 +345,20 @@ new SimGroup(MissionGroup) {
|
|||
canSave = "1";
|
||||
canSaveDynamicFields = "1";
|
||||
persistentId = "10bb5f41-65a7-11e7-b9a1-b6f5317ad553";
|
||||
IndirectLight = "1 1 1 1";
|
||||
IndirectLightMode = "Ambient Color";
|
||||
Intensity = "1";
|
||||
};
|
||||
new Skylight() {
|
||||
enabled = "1";
|
||||
StaticCubemap = "HdrSkyCubemap";
|
||||
position = "16.4688 10.5898 241.399";
|
||||
rotation = "1 0 0 0";
|
||||
scale = "1 1 1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "1";
|
||||
persistentId = "de646cc8-4f49-11e8-8a25-ec48d38e6b49";
|
||||
reflectionPath = "levels/Empty Terrain/probes/";
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Portions Copyright Zefiros
|
||||
// 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
|
||||
|
|
@ -38,12 +38,140 @@ uniform vec4 inLightColor[4];
|
|||
|
||||
uniform vec4 ambient;
|
||||
#define ambientCameraFactor 0.3
|
||||
uniform float specularPower;
|
||||
uniform vec4 specularColor;
|
||||
uniform float smoothness;
|
||||
uniform float metalness;
|
||||
uniform vec4 albedo;
|
||||
|
||||
#endif // !TORQUE_SHADERGEN
|
||||
|
||||
|
||||
vec3 F_schlick( in vec3 f0, in vec3 f90, in float u )
|
||||
{
|
||||
//
|
||||
// F( v, h ) = F0 + ( 1.0 - F0 ) * pow( 1.0f - HdotV, 5.0f )
|
||||
//
|
||||
//
|
||||
// where
|
||||
//
|
||||
// F0 = BaseColor * nDotL
|
||||
//
|
||||
// Dielectric materials always have a range of 0.02 < F0 < 0.05 , use a stock value of 0.04 ( roughly plastics )
|
||||
//
|
||||
|
||||
return f0 + ( f90 - f0 ) * pow( 1.0f - u , 5.0f );
|
||||
}
|
||||
|
||||
float Fr_DisneyDiffuse ( float NdotV , float NdotL , float LdotH , float linearRoughness )
|
||||
{
|
||||
float energyBias = mix (0 , 0.5 , linearRoughness );
|
||||
float energyFactor = mix (1.0 , 1.0 / 1.51 , linearRoughness );
|
||||
float fd90 = energyBias + 2.0 * LdotH * LdotH * linearRoughness ;
|
||||
vec3 f0 = vec3 ( 1.0f , 1.0f , 1.0f );
|
||||
float lightScatter = F_schlick( f0 , vec3(fd90), NdotL ).r;
|
||||
float viewScatter = F_schlick(f0 , vec3(fd90), NdotV ).r;
|
||||
|
||||
return lightScatter * viewScatter * energyFactor ;
|
||||
}
|
||||
|
||||
float SmithGGX( float NdotL, float NdotV, float alpha )
|
||||
{
|
||||
//
|
||||
// G( L, V, h ) = G( L ) G( V )
|
||||
//
|
||||
// nDotL
|
||||
// G( L ) = _________________________
|
||||
// nDotL ( 1 - k ) + k
|
||||
//
|
||||
//
|
||||
// NdotV
|
||||
// G( V ) = _________________________
|
||||
// NdotV ( 1 - k ) + k
|
||||
//
|
||||
//
|
||||
// pow( ( Roughness + 1 ), 2)
|
||||
// , Where k = __________________________ ( unreal 4 )
|
||||
// 8
|
||||
//
|
||||
|
||||
float alphaSqr = alpha * alpha;
|
||||
|
||||
//float GGX_V = NdotL * sqrt ( ( - NdotV * alphaSqr + NdotV ) * NdotV + alphaSqr );
|
||||
//float GGX_L = NdotV * sqrt ( ( - NdotL * alphaSqr + NdotL ) * NdotL + alphaSqr );
|
||||
|
||||
float GGX_V = NdotL + sqrt ( ( - NdotV * alphaSqr + NdotV ) * NdotV + alphaSqr );
|
||||
float GGX_L = NdotV + sqrt ( ( - NdotL * alphaSqr + NdotL ) * NdotL + alphaSqr );
|
||||
|
||||
return 1.0/( GGX_V + GGX_L );
|
||||
//return 0.5f / ( GGX_V + GGX_L );
|
||||
}
|
||||
|
||||
float D_GGX( float NdotH , float alpha )
|
||||
{
|
||||
//
|
||||
// or GGX ( disney / unreal 4 )
|
||||
//
|
||||
// alpha = pow( roughness, 2 );
|
||||
//
|
||||
// pow( alpha, 2 )
|
||||
// D( h ) = ________________________________________________________________
|
||||
// PI pow( pow( NdotH , 2 ) ( pow( alpha, 2 ) - 1 ) + 1 ), 2 )
|
||||
//
|
||||
|
||||
float alphaSqr = alpha*alpha;
|
||||
float f = ( NdotH * alphaSqr - NdotH ) * NdotH + 1;
|
||||
return alphaSqr / ( M_PI_F * (f * f) );
|
||||
}
|
||||
|
||||
vec4 EvalBDRF( vec3 baseColor, vec3 lightColor, vec3 toLight, vec3 position, vec3 normal, float roughness, float metallic )
|
||||
{
|
||||
//
|
||||
// Microfacet Specular Cook-Torrance
|
||||
//
|
||||
// D( h ) F( v, h ) G( l, v, h )
|
||||
// f( l, v ) = ____________________________
|
||||
// 4 ( dot( n, l ) dot( n, v )
|
||||
//
|
||||
//
|
||||
|
||||
vec3 L = normalize( toLight );
|
||||
vec3 V = normalize( -position );
|
||||
vec3 H = normalize( L + V );
|
||||
vec3 N = normal;
|
||||
|
||||
float NdotV = abs( dot( N, V ) ) + 1e-5f;
|
||||
float NdotH = saturate( dot( N, H ) );
|
||||
float NdotL = saturate( dot( N, L ) );
|
||||
float LdotH = saturate( dot( L, H ) );
|
||||
|
||||
float VdotH = saturate( dot( V, H ) );
|
||||
|
||||
if ( NdotL == 0 )
|
||||
return vec4( 0.0f, 0.0f, 0.0f, 0.0f );
|
||||
|
||||
float alpha = roughness;
|
||||
float visLinAlpha = alpha * alpha;
|
||||
|
||||
vec3 f0 = baseColor;
|
||||
float metal = metallic;
|
||||
|
||||
vec3 F_conductor= F_schlick( f0, vec3( 1.0, 1.0, 1.0 ), VdotH );
|
||||
vec3 F_dielec = F_schlick( vec3( 0.04, 0.04, 0.04 ), vec3( 1.0, 1.0, 1.0 ), VdotH );
|
||||
float Vis = SmithGGX( NdotL, NdotV, visLinAlpha );
|
||||
float D = D_GGX( NdotH, visLinAlpha );
|
||||
|
||||
vec3 Fr_dielec = D * F_dielec * Vis;
|
||||
vec3 Fr_conductor = D * F_conductor * Vis;
|
||||
|
||||
vec3 Fd = vec3(Fr_DisneyDiffuse( NdotV , NdotL , LdotH , visLinAlpha ) / M_PI_F);
|
||||
vec3 specular = ( 1.0f - metal ) * Fr_dielec + metal * Fr_conductor;
|
||||
vec3 diffuse = ( 1.0f - metal ) * Fd * f0;
|
||||
|
||||
vec3 ret = ( diffuse + specular + lightColor) * vec3(NdotL);
|
||||
|
||||
float FR = saturate(length(specular));
|
||||
return vec4(ret,FR);
|
||||
}
|
||||
|
||||
void compute4Lights( vec3 wsView,
|
||||
vec3 wsPosition,
|
||||
vec3 wsNormal,
|
||||
|
|
@ -57,8 +185,9 @@ void compute4Lights( vec3 wsView,
|
|||
vec4 inLightSpotDir[3],
|
||||
vec4 inLightSpotAngle,
|
||||
vec4 inLightSpotFalloff,
|
||||
float specularPower,
|
||||
vec4 specularColor,
|
||||
float smoothness,
|
||||
float metalness,
|
||||
vec4 albedo,
|
||||
|
||||
#endif // TORQUE_SHADERGEN
|
||||
|
||||
|
|
@ -81,9 +210,6 @@ void compute4Lights( vec3 wsView,
|
|||
for ( i = 0; i < 3; i++ )
|
||||
lightVectors[i] = wsPosition[i] - inLightPos[i];
|
||||
|
||||
vec4 squareDists = vec4(0);
|
||||
for ( i = 0; i < 3; i++ )
|
||||
squareDists += lightVectors[i] * lightVectors[i];
|
||||
|
||||
// Accumulate the dot product between the light
|
||||
// vector and the normal.
|
||||
|
|
@ -99,40 +225,12 @@ void compute4Lights( vec3 wsView,
|
|||
vec4 nDotL = vec4(0);
|
||||
for ( i = 0; i < 3; i++ )
|
||||
nDotL += lightVectors[i] * -wsNormal[i];
|
||||
|
||||
vec4 rDotL = vec4(0);
|
||||
#ifndef TORQUE_BL_NOSPECULAR
|
||||
|
||||
// We're using the Phong specular reflection model
|
||||
// here where traditionally Torque has used Blinn-Phong
|
||||
// which has proven to be more accurate to real materials.
|
||||
//
|
||||
// We do so because its cheaper as do not need to
|
||||
// calculate the half angle for all 4 lights.
|
||||
//
|
||||
// Advanced Lighting still uses Blinn-Phong, but the
|
||||
// specular reconstruction it does looks fairly similar
|
||||
// to this.
|
||||
//
|
||||
vec3 R = reflect( wsView, -wsNormal );
|
||||
|
||||
for ( i = 0; i < 3; i++ )
|
||||
rDotL += lightVectors[i] * R[i];
|
||||
|
||||
#endif
|
||||
|
||||
// Normalize the dots.
|
||||
//
|
||||
// Notice we're using the half type here to get a
|
||||
// much faster sqrt via the rsq_pp instruction at
|
||||
// the loss of some precision.
|
||||
//
|
||||
// Unless we have some extremely large point lights
|
||||
// i don't believe the precision loss will matter.
|
||||
//
|
||||
vec4 squareDists = vec4(0);
|
||||
for ( i = 0; i < 3; i++ )
|
||||
squareDists += lightVectors[i] * lightVectors[i];
|
||||
half4 correction = half4(inversesqrt( squareDists ));
|
||||
nDotL = saturate( nDotL * correction );
|
||||
rDotL = clamp( rDotL * correction, 0.00001, 1.0 );
|
||||
|
||||
// First calculate a simple point light linear
|
||||
// attenuation factor.
|
||||
|
|
@ -157,93 +255,18 @@ void compute4Lights( vec3 wsView,
|
|||
|
||||
#endif
|
||||
|
||||
// Finally apply the shadow masking on the attenuation.
|
||||
atten *= shadowMask;
|
||||
|
||||
// Get the final light intensity.
|
||||
vec4 intensity = nDotL * atten;
|
||||
|
||||
// Combine the light colors for output.
|
||||
outDiffuse = vec4(0);
|
||||
for ( i = 0; i < 4; i++ )
|
||||
outDiffuse += intensity[i] * inLightColor[i];
|
||||
|
||||
// Output the specular power.
|
||||
vec4 specularIntensity = pow( rDotL, vec4(specularPower) ) * atten;
|
||||
|
||||
// Apply the per-light specular attenuation.
|
||||
vec4 specular = vec4(0,0,0,1);
|
||||
// Combine the light colors for output.
|
||||
vec4 lightColor = vec4(0);
|
||||
for ( i = 0; i < 4; i++ )
|
||||
specular += vec4( inLightColor[i].rgb * inLightColor[i].a * specularIntensity[i], 1 );
|
||||
|
||||
// Add the final specular intensity values together
|
||||
// using a single dot product operation then get the
|
||||
// final specular lighting color.
|
||||
outSpecular = specularColor * specular;
|
||||
}
|
||||
|
||||
|
||||
// This value is used in AL as a constant power to raise specular values
|
||||
// to, before storing them into the light info buffer. The per-material
|
||||
// specular value is then computer by using the integer identity of
|
||||
// exponentiation:
|
||||
//
|
||||
// (a^m)^n = a^(m*n)
|
||||
//
|
||||
// or
|
||||
//
|
||||
// (specular^constSpecular)^(matSpecular/constSpecular) = specular^(matSpecular*constSpecular)
|
||||
//
|
||||
#define AL_ConstantSpecularPower 12.0f
|
||||
|
||||
/// The specular calculation used in Advanced Lighting.
|
||||
///
|
||||
/// @param toLight Normalized vector representing direction from the pixel
|
||||
/// being lit, to the light source, in world space.
|
||||
///
|
||||
/// @param normal Normalized surface normal.
|
||||
///
|
||||
/// @param toEye The normalized vector representing direction from the pixel
|
||||
/// being lit to the camera.
|
||||
///
|
||||
float AL_CalcSpecular( vec3 toLight, vec3 normal, vec3 toEye )
|
||||
{
|
||||
// (R.V)^c
|
||||
float specVal = dot( normalize( -reflect( toLight, normal ) ), toEye );
|
||||
|
||||
// Return the specular factor.
|
||||
return pow( max( specVal, 0.00001f ), AL_ConstantSpecularPower );
|
||||
}
|
||||
|
||||
/// The output for Deferred Lighting
|
||||
///
|
||||
/// @param toLight Normalized vector representing direction from the pixel
|
||||
/// being lit, to the light source, in world space.
|
||||
///
|
||||
/// @param normal Normalized surface normal.
|
||||
///
|
||||
/// @param toEye The normalized vector representing direction from the pixel
|
||||
/// being lit to the camera.
|
||||
///
|
||||
vec4 AL_DeferredOutput(
|
||||
vec3 lightColor,
|
||||
vec3 diffuseColor,
|
||||
vec4 matInfo,
|
||||
vec4 ambient,
|
||||
float specular,
|
||||
float shadowAttenuation)
|
||||
{
|
||||
vec3 specularColor = vec3(specular);
|
||||
bool metalness = getFlag(matInfo.r, 3);
|
||||
if ( metalness )
|
||||
{
|
||||
specularColor = 0.04 * (1 - specular) + diffuseColor * specular;
|
||||
}
|
||||
|
||||
//specular = color * map * spec^gloss
|
||||
float specularOut = (specularColor * matInfo.b * min(pow(max(specular,1.0f), max((matInfo.a / AL_ConstantSpecularPower),1.0f)),matInfo.a)).r;
|
||||
lightColor += intensity[i] * inLightColor[i];
|
||||
|
||||
lightColor *= vec3(shadowAttenuation);
|
||||
lightColor += ambient.rgb;
|
||||
return vec4(lightColor.rgb, specularOut);
|
||||
}
|
||||
vec3 toLight = vec3(0);
|
||||
for ( i = 0; i < 3; i++ )
|
||||
toLight += lightVectors[i].rgb;
|
||||
|
||||
outDiffuse = vec4(albedo.rgb*(1.0-metalness),albedo.a);
|
||||
outSpecular = EvalBDRF( vec3( 1.0, 1.0, 1.0 ), lightColor.rgb, toLight, wsPosition, wsNormal, smoothness, metalness );
|
||||
}
|
||||
|
|
@ -336,4 +336,20 @@ vec3 toGamma(vec3 tex)
|
|||
}
|
||||
#endif //
|
||||
|
||||
vec3 PBRFresnel(vec3 albedo, vec3 indirect, float metalness, float fresnel)
|
||||
{
|
||||
vec3 diffuseColor = albedo - (albedo * metalness);
|
||||
vec3 reflectColor = mix(indirect*albedo, indirect, fresnel);
|
||||
|
||||
return diffuseColor + reflectColor;
|
||||
}
|
||||
|
||||
vec3 simpleFresnel(vec3 diffuseColor, vec3 reflectColor, float metalness, float angle, float bias, float power)
|
||||
{
|
||||
float fresnelTerm = bias + (1.0 - bias) * pow(abs(1.0 - max(angle, 0)), power);
|
||||
|
||||
fresnelTerm *= metalness;
|
||||
|
||||
return mix(diffuseColor, reflectColor, fresnelTerm);
|
||||
}
|
||||
#endif // _TORQUE_GLSL_
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ float Fr_DisneyDiffuse ( float NdotV , float NdotL , float LdotH , float linearR
|
|||
float lightScatter = F_schlick( f0 , fd90 , NdotL ).r;
|
||||
float viewScatter = F_schlick(f0 , fd90 , NdotV ).r;
|
||||
|
||||
return lightScatter * viewScatter * energyFactor ;
|
||||
return lightScatter * viewScatter * energyFactor;
|
||||
}
|
||||
|
||||
float SmithGGX( float NdotL, float NdotV, float alpha )
|
||||
|
|
@ -268,4 +268,41 @@ void compute4Lights( float3 wsView,
|
|||
|
||||
outDiffuse = float4(albedo.rgb*(1.0-metalness),albedo.a);
|
||||
outSpecular = EvalBDRF( float3( 1.0, 1.0, 1.0 ), lightColor.rgb, toLight, wsPosition, wsNormal, smoothness, metalness );
|
||||
}
|
||||
|
||||
float G1V(float dotNV, float k)
|
||||
{
|
||||
return 1.0f/(dotNV*(1.0f-k)+k);
|
||||
}
|
||||
|
||||
float3 directSpecular(float3 N, float3 V, float3 L, float roughness, float F0)
|
||||
{
|
||||
float alpha = roughness*roughness;
|
||||
|
||||
//TODO don't need to calculate all this again timmy!!!!!!
|
||||
float3 H = normalize(V + L);
|
||||
float dotNL = clamp(dot(N,L), 0.0, 1.0);
|
||||
float dotNV = clamp(dot(N,V), 0.0, 1.0);
|
||||
float dotNH = clamp(dot(N,H), 0.0, 1.0);
|
||||
float dotHV = clamp(dot(H,V), 0.0, 1.0);
|
||||
float dotLH = clamp(dot(L,H), 0.0, 1.0);
|
||||
|
||||
float F, D, vis;
|
||||
|
||||
// D
|
||||
float alphaSqr = alpha*alpha;
|
||||
float pi = 3.14159f;
|
||||
float denom = dotNH * dotNH *(alphaSqr-1.0) + 1.0f;
|
||||
D = alphaSqr/(pi * denom * denom);
|
||||
|
||||
// F
|
||||
float dotLH5 = pow(1.0f-dotLH,5);
|
||||
F = F0 + (1.0-F0)*(dotLH5);
|
||||
|
||||
// V
|
||||
float k = alpha/2.0f;
|
||||
vis = G1V(dotNL,k)*G1V(dotNV,k);
|
||||
|
||||
float specular = dotNL * D * F * vis;
|
||||
return float3(specular,specular,specular);
|
||||
}
|
||||
|
|
@ -0,0 +1,138 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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.hlsl"
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : TORQUE_POSITION;
|
||||
float2 uv : TEXCOORD;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html
|
||||
// efficient VanDerCorpus calculation.
|
||||
float RadicalInverse_VdC(uint bits)
|
||||
{
|
||||
bits = (bits << 16u) | (bits >> 16u);
|
||||
bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
|
||||
bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
|
||||
bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
|
||||
bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
|
||||
return float(bits) * 2.3283064365386963e-10; // / 0x100000000
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
float2 Hammersley(uint i, uint N)
|
||||
{
|
||||
return float2(float(i)/float(N), RadicalInverse_VdC(i));
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
float3 ImportanceSampleGGX(float2 Xi, float3 N, float roughness)
|
||||
{
|
||||
float a = roughness*roughness;
|
||||
|
||||
float phi = 2.0 * M_PI_F * Xi.x;
|
||||
float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (a*a - 1.0) * Xi.y));
|
||||
float sinTheta = sqrt(1.0 - cosTheta*cosTheta);
|
||||
|
||||
// from spherical coordinates to cartesian coordinates - halfway vector
|
||||
float3 H;
|
||||
H.x = cos(phi) * sinTheta;
|
||||
H.y = sin(phi) * sinTheta;
|
||||
H.z = cosTheta;
|
||||
|
||||
// from tangent-space H vector to world-space sample vector
|
||||
float3 up = abs(N.z) < 0.999 ? float3(0.0, 0.0, 1.0) : float3(1.0, 0.0, 0.0);
|
||||
float3 tangent = normalize(cross(up, N));
|
||||
float3 bitangent = cross(N, tangent);
|
||||
|
||||
float3 sampleVec = tangent * H.x + bitangent * H.y + N * H.z;
|
||||
return normalize(sampleVec);
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
float GeometrySchlickGGX(float NdotV, float roughness)
|
||||
{
|
||||
// note that we use a different k for IBL
|
||||
float a = roughness;
|
||||
float k = (a * a) / 2.0;
|
||||
|
||||
float nom = NdotV;
|
||||
float denom = NdotV * (1.0 - k) + k;
|
||||
|
||||
return nom / denom;
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
float GeometrySmith(float3 N, float3 V, float3 L, float roughness)
|
||||
{
|
||||
float NdotV = max(dot(N, V), 0.0);
|
||||
float NdotL = max(dot(N, L), 0.0);
|
||||
float ggx2 = GeometrySchlickGGX(NdotV, roughness);
|
||||
float ggx1 = GeometrySchlickGGX(NdotL, roughness);
|
||||
|
||||
return ggx1 * ggx2;
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
float2 IntegrateBRDF(float NdotV, float roughness)
|
||||
{
|
||||
float3 V;
|
||||
V.x = sqrt(1.0 - NdotV*NdotV);
|
||||
V.y = 0.0;
|
||||
V.z = NdotV;
|
||||
|
||||
float A = 0.0;
|
||||
float B = 0.0;
|
||||
|
||||
float3 N = float3(0.0, 0.0, 1.0);
|
||||
|
||||
const uint SAMPLE_COUNT = 1024u;
|
||||
for(uint i = 0u; i < SAMPLE_COUNT; ++i)
|
||||
{
|
||||
// generates a sample vector that's biased towards the
|
||||
// preferred alignment direction (importance sampling).
|
||||
float2 Xi = Hammersley(i, SAMPLE_COUNT);
|
||||
float3 H = ImportanceSampleGGX(Xi, N, roughness);
|
||||
float3 L = normalize(2.0 * dot(V, H) * H - V);
|
||||
|
||||
float NdotL = max(L.z, 0.0);
|
||||
float NdotH = max(H.z, 0.0);
|
||||
float VdotH = max(dot(V, H), 0.0);
|
||||
|
||||
if(NdotL > 0.0)
|
||||
{
|
||||
float G = GeometrySmith(N, V, L, roughness);
|
||||
float G_Vis = (G * VdotH) / (NdotH * NdotV);
|
||||
float Fc = pow(1.0 - VdotH, 5.0);
|
||||
|
||||
A += (1.0 - Fc) * G_Vis;
|
||||
B += Fc * G_Vis;
|
||||
}
|
||||
}
|
||||
A /= float(SAMPLE_COUNT);
|
||||
B /= float(SAMPLE_COUNT);
|
||||
return float2(A, B);
|
||||
}
|
||||
|
||||
float4 main(ConnectData IN) : TORQUE_TARGET0
|
||||
{
|
||||
return float4(IntegrateBRDF(IN.uv.x, IN.uv.y).rg,0,1);
|
||||
//return float2(1,1);
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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 "../../shaderModel.hlsl"
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : TORQUE_POSITION;
|
||||
float2 uv : TEXCOORD;
|
||||
};
|
||||
|
||||
ConnectData main( uint vertexID : SV_VertexID )
|
||||
{
|
||||
ConnectData result;
|
||||
result.uv = float2((vertexID << 1) & 2, vertexID & 2);
|
||||
result.hpos = float4(result.uv * float2(2.0f, -2.0f) + float2(-1.0f, 1.0f), 0.0f, 1.0f);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -23,11 +23,11 @@
|
|||
#include "shadergen:/autogenConditioners.h"
|
||||
#include "../../postfx/postFx.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(indirectLightingBuffer,0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(specularLightingBuffer,0);
|
||||
|
||||
|
||||
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
||||
{
|
||||
float4 directlighting = float4(TORQUE_TEX2D( indirectLightingBuffer, IN.uv0 ).rgb,1.0);
|
||||
return directlighting;
|
||||
float4 diffuseLighting = float4(TORQUE_TEX2D( specularLightingBuffer, IN.uv0 ).rgb,1.0);
|
||||
return diffuseLighting;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@
|
|||
#include "shaders/common/torque.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(colorBufferTex,0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(directLightingBuffer,1);
|
||||
TORQUE_UNIFORM_SAMPLER2D(diffuseLightingBuffer,1);
|
||||
TORQUE_UNIFORM_SAMPLER2D(matInfoTex,2);
|
||||
TORQUE_UNIFORM_SAMPLER2D(indirectLightingBuffer,3);
|
||||
TORQUE_UNIFORM_SAMPLER2D(specularLightingBuffer,3);
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredTex,4);
|
||||
|
||||
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
||||
|
|
@ -37,25 +37,27 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
|||
if (depth>0.9999)
|
||||
return float4(0,0,0,0);
|
||||
|
||||
float3 colorBuffer = TORQUE_TEX2D( colorBufferTex, IN.uv0 ).rgb; //albedo
|
||||
float3 albedo = TORQUE_TEX2D( colorBufferTex, IN.uv0 ).rgb; //albedo
|
||||
float4 matInfo = TORQUE_TEX2D(matInfoTex, IN.uv0); //flags|smoothness|ao|metallic
|
||||
|
||||
bool emissive = getFlag(matInfo.r, 0);
|
||||
if (emissive)
|
||||
{
|
||||
return float4(colorBuffer, 1.0);
|
||||
return float4(albedo, 1.0);
|
||||
}
|
||||
|
||||
float4 directLighting = TORQUE_TEX2D( directLightingBuffer, IN.uv0 ); //shadowmap*specular
|
||||
float3 indirectLighting = TORQUE_TEX2D( indirectLightingBuffer, IN.uv0 ).rgb; //environment mapping*lightmaps
|
||||
float4 diffuse = TORQUE_TEX2D( diffuseLightingBuffer, IN.uv0 ); //shadowmap*specular
|
||||
float4 specular = TORQUE_TEX2D( specularLightingBuffer, IN.uv0 ); //environment mapping*lightmaps
|
||||
|
||||
float metalness = matInfo.a;
|
||||
|
||||
float frez = directLighting.a;
|
||||
|
||||
float3 diffuseColor = colorBuffer - (colorBuffer * metalness);
|
||||
float3 reflectColor = indirectLighting*colorBuffer;
|
||||
colorBuffer = diffuseColor+lerp(reflectColor,indirectLighting,frez);
|
||||
colorBuffer *= max(directLighting.rgb,float3(0,0,0));
|
||||
float3 diffuseColor = albedo - (albedo * metalness);
|
||||
float3 specularColor = lerp(float3(0.04,0.04,0.04), albedo, metalness);
|
||||
|
||||
float3 light = (diffuseColor * diffuse.rgb) + (specularColor * specular.rgb);
|
||||
|
||||
//albedo = diffuseColor+lerp(reflectColor,indiffuseLighting,frez);
|
||||
//albedo *= max(diffuseLighting.rgb,float3(0,0,0));
|
||||
|
||||
return hdrEncode( float4(colorBuffer.rgb, 1.0) );
|
||||
return float4(light.rgb, 1.0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../../gl/hlslCompat.glsl"
|
||||
out vec2 uv;
|
||||
|
||||
void main()
|
||||
{
|
||||
uv = vec2((gl_VertexID << 1) & 2, gl_VertexID & 2);
|
||||
gl_Position = vec4(uv * vec2(2.0f, -2.0f) + vec2(-1.0f, 1.0f), 0.0f, 1.0f);
|
||||
correctSSP(gl_Position);
|
||||
}
|
||||
|
|
@ -24,12 +24,12 @@
|
|||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
in vec2 uv0;
|
||||
uniform sampler2D directLightingBuffer;
|
||||
uniform sampler2D diffuseLightingBuffer;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 directLighting = vec4(texture( directLightingBuffer, uv0 ).rgb,1.0);
|
||||
OUT_col = directLighting;
|
||||
vec4 diffuseLighting = vec4(texture( diffuseLightingBuffer, uv0 ).rgb,1.0);
|
||||
OUT_col = diffuseLighting;
|
||||
}
|
||||
|
|
@ -23,6 +23,7 @@
|
|||
out vec4 OUT_col;
|
||||
out vec4 OUT_col1;
|
||||
out vec4 OUT_col2;
|
||||
out vec4 OUT_col3;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Main
|
||||
|
|
@ -33,8 +34,11 @@ void main()
|
|||
OUT_col = vec4(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
// Clear Color Buffer.
|
||||
OUT_col1 = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
OUT_col1 = vec4(0.0, 0.0, 0.0, 0.0001);
|
||||
|
||||
// Clear Material Info Buffer.
|
||||
OUT_col2 = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
OUT_col2 = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
// Clear Light Info Buffer.
|
||||
OUT_col3 = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,8 +26,9 @@
|
|||
#include "../../../gl/torque.glsl"
|
||||
|
||||
uniform sampler2D colorBufferTex;
|
||||
uniform sampler2D lightDeferredTex;
|
||||
uniform sampler2D diffuseLightingBuffer;
|
||||
uniform sampler2D matInfoTex;
|
||||
uniform sampler2D specularLightingBuffer;
|
||||
uniform sampler2D deferredTex;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
|
@ -40,20 +41,27 @@ void main()
|
|||
OUT_col = vec4(0.0);
|
||||
return;
|
||||
}
|
||||
vec4 lightBuffer = texture( lightDeferredTex, uv0 );
|
||||
vec4 colorBuffer = texture( colorBufferTex, uv0 );
|
||||
vec4 matInfo = texture( matInfoTex, uv0 );
|
||||
float specular = clamp(lightBuffer.a,0.0,1.0);
|
||||
|
||||
// Diffuse Color Altered by Metalness
|
||||
bool metalness = getFlag(matInfo.r, 3);
|
||||
if ( metalness )
|
||||
|
||||
vec3 colorBuffer = texture( colorBufferTex, uv0 ).rgb; //albedo
|
||||
vec4 matInfo = texture( matInfoTex, uv0 ); //flags|smoothness|ao|metallic
|
||||
bool emissive = getFlag(matInfo.r, 0);
|
||||
if (emissive)
|
||||
{
|
||||
colorBuffer *= (1.0 - colorBuffer.a);
|
||||
OUT_col = float4(colorBuffer, 1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
colorBuffer += vec4(specular, specular, specular, 1.0);
|
||||
colorBuffer *= vec4(lightBuffer.rgb, 1.0);
|
||||
|
||||
OUT_col = hdrEncode( vec4(colorBuffer.rgb, 1.0) );
|
||||
|
||||
vec4 diffuseLighting = texture( diffuseLightingBuffer, uv0 ); //shadowmap*specular
|
||||
|
||||
vec3 specularLighting = texture( specularLightingBuffer, uv0 ).rgb; //environment mapping*lightmaps
|
||||
float metalness = matInfo.a;
|
||||
|
||||
float frez = diffuseLighting.a;
|
||||
|
||||
vec3 diffuseColor = colorBuffer - (colorBuffer * metalness);
|
||||
vec3 reflectColor = specularLighting*colorBuffer;
|
||||
colorBuffer = diffuseColor+lerp(reflectColor,specularLighting,frez);
|
||||
colorBuffer *= max(diffuseLighting.rgb,vec3(0,0,0));
|
||||
|
||||
OUT_col = hdrEncode(vec4(colorBuffer,1.0));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,60 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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/torque.glsl"
|
||||
|
||||
in vec2 uv;
|
||||
uniform int face;
|
||||
|
||||
uniform samplerCube environmentMap;
|
||||
|
||||
out vec4 outColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 N = getCubeDir(face, uv);
|
||||
vec3 irradiance = vec3(0.0);
|
||||
|
||||
// tangent space calculation from origin point
|
||||
vec3 up = vec3(0.0, 0.0, 1.0);
|
||||
vec3 right = cross(up, N);
|
||||
up = cross(N, right);
|
||||
|
||||
float sampleDelta = 0.025;
|
||||
int nrSamples = 0;
|
||||
for(float phi = 0.0; phi < M_2PI_F; phi += sampleDelta)
|
||||
{
|
||||
for(float theta = 0.0; theta < M_HALFPI_F; theta += sampleDelta)
|
||||
{
|
||||
// spherical to cartesian (in tangent space)
|
||||
vec3 tangentSample = vec3(sin(theta) * cos(phi), sin(theta) * sin(phi), cos(theta));
|
||||
// tangent space to world
|
||||
vec3 sampleVec = tangentSample.x * right + tangentSample.y * up + tangentSample.z * N;
|
||||
|
||||
irradiance += texture(environmentMap, sampleVec).rgb * cos(theta) * sin(theta);
|
||||
nrSamples++;
|
||||
}
|
||||
}
|
||||
irradiance = M_PI_F * irradiance * (1.0 / float(nrSamples));
|
||||
|
||||
outColor = vec4(irradiance, 1.0);
|
||||
}
|
||||
|
|
@ -138,8 +138,9 @@ void main()
|
|||
vec3 ssPos = ssPos.xyz / ssPos.w;
|
||||
vec2 uvScene = getUVFromSSPos( ssPos, rtParams0 );
|
||||
|
||||
// Emissive.
|
||||
// Matinfo flags
|
||||
vec4 matInfo = texture( matInfoBuffer, uvScene );
|
||||
//early out if emissive
|
||||
bool emissive = getFlag( matInfo.r, 0 );
|
||||
if ( emissive )
|
||||
{
|
||||
|
|
@ -245,12 +246,17 @@ void main()
|
|||
// cause the hardware occlusion query to disable the shadow.
|
||||
|
||||
// Specular term
|
||||
float specular = AL_CalcSpecular( lightVec,
|
||||
normal,
|
||||
normalize( -eyeRay ) ) * lightBrightness * atten * shadowed;
|
||||
float specular = 0;
|
||||
vec4 real_specular = EvalBDRF( colorSample.rgb,
|
||||
lightcol,
|
||||
lightVec,
|
||||
viewSpacePos,
|
||||
normal,
|
||||
1.05-matInfo.b*0.9, //slightly compress roughness to allow for non-baked lighting
|
||||
matInfo.a );
|
||||
vec3 lightColorOut = real_specular.rgb * lightBrightness * shadowed* atten;
|
||||
|
||||
float Sat_NL_Att = saturate( nDotL * atten * shadowed ) * lightBrightness;
|
||||
vec3 lightColorOut = lightMapParams.rgb * lightcol;
|
||||
vec4 addToResult = vec4(0.0);
|
||||
|
||||
// TODO: This needs to be removed when lightmapping is disabled
|
||||
|
|
@ -269,5 +275,5 @@ void main()
|
|||
addToResult = ( 1.0 - shadowed ) * abs(lightMapParams);
|
||||
}
|
||||
|
||||
OUT_col = AL_DeferredOutput(lightColorOut+subsurface*(1.0-Sat_NL_Att), colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att);
|
||||
OUT_col = vec4((lightColorOut*Sat_NL_Att+subsurface*(1.0-Sat_NL_Att)+addToResult.rgb),real_specular.a);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 "shadergen:/autogenConditioners.h"
|
||||
#include "../../../postFx/gl/postFX.glsl"
|
||||
#include "../../../gl/torque.glsl"
|
||||
|
||||
uniform sampler2D colorBufferTex;
|
||||
uniform sampler2D diffuseLightingBuffer;
|
||||
uniform sampler2D matInfoTex;
|
||||
uniform sampler2D specularLightingBuffer;
|
||||
uniform sampler2D deferredTex;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
float depth = deferredUncondition( deferredTex, uv0 ).w;
|
||||
if (depth>0.9999)
|
||||
{
|
||||
OUT_col = vec4(0.0);
|
||||
return;
|
||||
}
|
||||
|
||||
vec3 colorBuffer = texture( colorBufferTex, uv0 ).rgb; //albedo
|
||||
vec4 matInfo = texture( matInfoTex, uv0 ); //flags|smoothness|ao|metallic
|
||||
bool emissive = getFlag(matInfo.r, 0);
|
||||
if (emissive)
|
||||
{
|
||||
OUT_col = float4(colorBuffer, 1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
vec4 diffuseLighting = texture( diffuseLightingBuffer, uv0 ); //shadowmap*specular
|
||||
|
||||
colorBuffer *= max(diffuseLighting.rgb,vec3(0,0,0));
|
||||
|
||||
OUT_col = hdrEncode(vec4(colorBuffer,1.0));
|
||||
}
|
||||
|
|
@ -0,0 +1,229 @@
|
|||
#include "../../../gl/hlslCompat.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
|
||||
#include "farFrustumQuad.glsl"
|
||||
#include "lightingUtils.glsl"
|
||||
#include "../../../gl/lighting.glsl"
|
||||
#include "../../../gl/torque.glsl"
|
||||
#line 8
|
||||
|
||||
in vec4 pos;
|
||||
in vec4 wsEyeDir;
|
||||
in vec4 ssPos;
|
||||
in vec4 vsEyeDir;
|
||||
|
||||
uniform sampler2D deferredBuffer;
|
||||
uniform sampler2D matInfoBuffer;
|
||||
uniform samplerCube cubeMap;
|
||||
|
||||
uniform vec4 rtParams0;
|
||||
|
||||
uniform vec3 probeWSPos;
|
||||
uniform vec3 probeLSPos;
|
||||
uniform vec4 vsFarPlane;
|
||||
|
||||
uniform float lightRange;
|
||||
uniform vec2 lightAttenuation;
|
||||
|
||||
uniform mat4 invViewMat;
|
||||
|
||||
uniform vec3 eyePosWorld;
|
||||
uniform vec3 bbMin;
|
||||
uniform vec3 bbMax;
|
||||
|
||||
uniform float Intensity;
|
||||
|
||||
//SHTerms
|
||||
uniform vec4 SHTerms0;
|
||||
uniform vec4 SHTerms1;
|
||||
uniform vec4 SHTerms2;
|
||||
uniform vec4 SHTerms3;
|
||||
uniform vec4 SHTerms4;
|
||||
uniform vec4 SHTerms5;
|
||||
uniform vec4 SHTerms6;
|
||||
uniform vec4 SHTerms7;
|
||||
uniform vec4 SHTerms8;
|
||||
|
||||
uniform float SHConsts0;
|
||||
uniform float SHConsts1;
|
||||
uniform float SHConsts2;
|
||||
uniform float SHConsts3;
|
||||
uniform float SHConsts4;
|
||||
|
||||
uniform float useSphereMode;
|
||||
|
||||
vec4 decodeSH(vec3 normal)
|
||||
{
|
||||
float x = normal.x;
|
||||
float y = normal.y;
|
||||
float z = normal.z;
|
||||
|
||||
vec3 l00 = SHTerms0.rgb;
|
||||
|
||||
vec3 l10 = SHTerms1.rgb;
|
||||
vec3 l11 = SHTerms2.rgb;
|
||||
vec3 l12 = SHTerms3.rgb;
|
||||
|
||||
vec3 l20 = SHTerms4.rgb;
|
||||
vec3 l21 = SHTerms5.rgb;
|
||||
vec3 l22 = SHTerms6.rgb;
|
||||
vec3 l23 = SHTerms7.rgb;
|
||||
vec3 l24 = SHTerms8.rgb;
|
||||
|
||||
vec3 result = (
|
||||
l00 * SHConsts0 +
|
||||
|
||||
l12 * SHConsts1 * x +
|
||||
l10 * SHConsts1 * y +
|
||||
l11 * SHConsts1 * z +
|
||||
|
||||
l20 * SHConsts2 * x*y +
|
||||
l21 * SHConsts2 * y*z +
|
||||
l22 * SHConsts3 * (3.0*z*z - 1.0) +
|
||||
l23 * SHConsts2 * x*z +
|
||||
l24 * SHConsts4 * (x*x - y*y)
|
||||
);
|
||||
|
||||
return vec4(result,1);
|
||||
}
|
||||
|
||||
out vec4 OUT_col;
|
||||
void main()
|
||||
{
|
||||
// Compute scene UV
|
||||
vec3 ssPos = ssPos.xyz / ssPos.w;
|
||||
|
||||
//vec4 hardCodedRTParams0 = vec4(0,0.0277777780,1,0.972222209);
|
||||
vec2 uvScene = getUVFromSSPos( ssPos, rtParams0 );
|
||||
|
||||
// Matinfo flags
|
||||
vec4 matInfo = texture( matInfoBuffer, uvScene );
|
||||
|
||||
// Sample/unpack the normal/z data
|
||||
vec4 deferredSample = deferredUncondition( deferredBuffer, uvScene );
|
||||
vec3 normal = deferredSample.rgb;
|
||||
float depth = deferredSample.a;
|
||||
if (depth>0.9999)
|
||||
OUT_col = vec4(0,0,0,0);
|
||||
|
||||
// Need world-space normal.
|
||||
vec3 wsNormal = tMul(vec4(normal, 1), invViewMat).rgb;
|
||||
|
||||
vec4 color = vec4(1, 1, 1, 1);
|
||||
vec4 ref = vec4(0,0,0,0);
|
||||
float alpha = 0;
|
||||
|
||||
vec3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, vsEyeDir.xyz, vsFarPlane );
|
||||
vec3 viewSpacePos = eyeRay * depth;
|
||||
|
||||
vec3 wsEyeRay = tMul(vec4(eyeRay, 1), invViewMat).rgb;
|
||||
|
||||
// Use eye ray to get ws pos
|
||||
vec3 worldPos = vec3(eyePosWorld + wsEyeRay * depth);
|
||||
float smoothness = min((1.0 - matInfo.b)*11.0 + 1.0, 8.0);//bump up to 8 for finalization
|
||||
|
||||
if(useSphereMode>0.0)
|
||||
{
|
||||
// Eye ray - Eye -> Pixel
|
||||
|
||||
|
||||
// Build light vec, get length, clip pixel if needed
|
||||
vec3 lightVec = probeLSPos - viewSpacePos;
|
||||
float lenLightV = length( lightVec );
|
||||
clip( lightRange - lenLightV );
|
||||
|
||||
// Get the attenuated falloff.
|
||||
float atten = attenuate( vec4(1,1,1,1), lightAttenuation, lenLightV );
|
||||
clip( atten - 1e-6 );
|
||||
|
||||
// Normalize lightVec
|
||||
lightVec /= lenLightV;
|
||||
|
||||
// If we can do dynamic branching then avoid wasting
|
||||
// fillrate on pixels that are backfacing to the light.
|
||||
float nDotL = abs(dot( lightVec, normal ));
|
||||
|
||||
float Sat_NL_Att = saturate( nDotL * atten );
|
||||
|
||||
vec3 reflectionVec = reflect(wsEyeDir, vec4(wsNormal,nDotL)).xyz;
|
||||
|
||||
vec3 nrdir = normalize(reflectionVec);
|
||||
vec3 rbmax = (bbMax - worldPos.xyz) / nrdir;
|
||||
vec3 rbmin = (bbMin - worldPos.xyz) / nrdir;
|
||||
|
||||
vec3 rbminmax = rbmin;
|
||||
if (nrdir.x > 0.0)
|
||||
rbminmax.x = rbmax.x;
|
||||
if (nrdir.y > 0.0)
|
||||
rbminmax.y = rbmax.y;
|
||||
if (nrdir.z > 0.0)
|
||||
rbminmax.z = rbmax.z;
|
||||
|
||||
float fa = min(min(rbminmax.x,rbminmax.y),rbminmax.z);
|
||||
if (dot( lightVec, normal )<0.0f)
|
||||
clip(fa);
|
||||
|
||||
vec3 posOnBox = worldPos.xyz + nrdir * fa;
|
||||
reflectionVec = posOnBox - probeWSPos;
|
||||
|
||||
//reflectionVec = tMul(probeWSPos,reflectionVec);
|
||||
|
||||
ref = vec4(reflectionVec, smoothness);
|
||||
|
||||
alpha = Sat_NL_Att;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Build light vec, get length, clip pixel if needed
|
||||
vec3 lightVec = probeLSPos - viewSpacePos;
|
||||
float lenLightV = length(lightVec);
|
||||
//clip(lightRange - lenLightV);
|
||||
|
||||
// Normalize lightVec
|
||||
lightVec /= lenLightV;
|
||||
|
||||
// If we can do dynamic branching then avoid wasting
|
||||
// fillrate on pixels that are backfacing to the light.
|
||||
float nDotL = abs(dot(lightVec, normal));
|
||||
|
||||
vec3 reflectionVec = reflect(wsEyeDir, vec4(wsNormal, nDotL)).xyz;
|
||||
|
||||
vec3 nrdir = normalize(reflectionVec);
|
||||
vec3 rbmax = (bbMax - worldPos.xyz) / nrdir;
|
||||
vec3 rbmin = (bbMin - worldPos.xyz) / nrdir;
|
||||
|
||||
vec3 rbminmax = rbmin;
|
||||
if (nrdir.x > 0.0)
|
||||
rbminmax.x = rbmax.x;
|
||||
if (nrdir.y > 0.0)
|
||||
rbminmax.y = rbmax.y;
|
||||
if (nrdir.z > 0.0)
|
||||
rbminmax.z = rbmax.z;
|
||||
|
||||
float fa = min(min(rbminmax.x, rbminmax.y), rbminmax.z);
|
||||
if (dot(lightVec, normal)<0.0f)
|
||||
clip(fa);
|
||||
|
||||
//Try to clip anything that falls outside our box as well
|
||||
//TODO: Make it support rotated boxes as well
|
||||
if(worldPos.x > bbMax.x || worldPos.y > bbMax.y || worldPos.z > bbMax.z ||
|
||||
worldPos.x < bbMin.x || worldPos.y < bbMin.y || worldPos.z < bbMin.z)
|
||||
clip(-1);
|
||||
|
||||
vec3 posOnBox = worldPos.xyz + nrdir * fa;
|
||||
reflectionVec = posOnBox - probeWSPos;
|
||||
|
||||
ref = vec4(reflectionVec, smoothness);
|
||||
|
||||
alpha = 1;
|
||||
}
|
||||
|
||||
color = textureLod(cubeMap, vec3(ref.xyz), float(ref.w));
|
||||
|
||||
vec4 specularColor = (color);
|
||||
vec4 indirectColor = (decodeSH(wsNormal));
|
||||
|
||||
color.rgb = lerp(indirectColor.rgb * 1.5, specularColor.rgb * 1.5, matInfo.b);
|
||||
|
||||
OUT_col = vec4(color.rgb, alpha);
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
#include "shadergen:/autogenConditioners.h"
|
||||
#include "../../torque.hlsl"
|
||||
|
||||
// This is the shader input
|
||||
struct Vert
|
||||
{
|
||||
float4 position : POSITION;
|
||||
float2 uv0 : TEXCOORD0;
|
||||
float3 wsEyeRay : TEXCOORD1;
|
||||
};
|
||||
|
||||
// This is the shader output data.
|
||||
struct Conn
|
||||
{
|
||||
float4 position : POSITION;
|
||||
float2 uv0 : TEXCOORD0;
|
||||
float3 wsEyeRay : TEXCOORD1;
|
||||
};
|
||||
|
||||
// Render Target Paramaters
|
||||
float4 rtParams0;
|
||||
|
||||
Conn main(Vert IN,
|
||||
uniform float4x4 modelView : register(C0))
|
||||
{
|
||||
Conn OUT;
|
||||
OUT.position = IN.position;
|
||||
OUT.uv0 = viewportCoordToRenderTarget( IN.uv0, rtParams0 );
|
||||
OUT.wsEyeRay = IN.wsEyeRay;
|
||||
return OUT;
|
||||
}
|
||||
|
||||
|
|
@ -80,12 +80,13 @@ void main()
|
|||
vec3 ssPos = IN_ssPos.xyz / IN_ssPos.w;
|
||||
vec2 uvScene = getUVFromSSPos( ssPos, rtParams0 );
|
||||
|
||||
// Emissive.
|
||||
// Matinfo flags
|
||||
vec4 matInfo = texture( matInfoBuffer, uvScene );
|
||||
//early out if emissive
|
||||
bool emissive = getFlag( matInfo.r, 0 );
|
||||
if ( emissive )
|
||||
{
|
||||
OUT_col = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
OUT_col = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -182,12 +183,19 @@ void main()
|
|||
// cause the hardware occlusion query to disable the shadow.
|
||||
|
||||
// Specular term
|
||||
float specular = AL_CalcSpecular( -lightToPxlVec,
|
||||
normal,
|
||||
normalize( -eyeRay ) ) * lightBrightness * atten * shadowed;
|
||||
float specular = 0;
|
||||
|
||||
vec3 lightVec = lightPosition - viewSpacePos;
|
||||
vec4 real_specular = EvalBDRF( colorSample.rgb,
|
||||
lightcol,
|
||||
lightVec,
|
||||
viewSpacePos,
|
||||
normal,
|
||||
1.05-matInfo.b*0.9, //slightly compress roughness to allow for non-baked lighting
|
||||
matInfo.a );
|
||||
vec3 lightColorOut = real_specular.rgb * lightBrightness * shadowed* atten;
|
||||
|
||||
float Sat_NL_Att = saturate( nDotL * atten * shadowed ) * lightBrightness;
|
||||
vec3 lightColorOut = lightMapParams.rgb * lightcol;
|
||||
vec4 addToResult = vec4(0.0);
|
||||
|
||||
// TODO: This needs to be removed when lightmapping is disabled
|
||||
|
|
@ -206,5 +214,5 @@ void main()
|
|||
addToResult = ( 1.0 - shadowed ) * abs(lightMapParams);
|
||||
}
|
||||
|
||||
OUT_col = AL_DeferredOutput(lightColorOut+subsurface*(1.0-Sat_NL_Att), colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att);
|
||||
OUT_col = vec4((lightColorOut*Sat_NL_Att+subsurface*(1.0-Sat_NL_Att)+addToResult.rgb),real_specular.a);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,12 +193,13 @@ vec4 AL_VectorLightShadowCast( sampler2D _sourceshadowMap,
|
|||
out vec4 OUT_col;
|
||||
void main()
|
||||
{
|
||||
// Emissive.
|
||||
// Matinfo flags
|
||||
float4 matInfo = texture( matInfoBuffer, uv0 );
|
||||
//early out if emissive
|
||||
bool emissive = getFlag( matInfo.r, 0 );
|
||||
if ( emissive )
|
||||
{
|
||||
OUT_col = vec4(1.0, 1.0, 1.0, 0.0);
|
||||
OUT_col = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -289,29 +290,20 @@ void main()
|
|||
|
||||
#endif // !NO_SHADOW
|
||||
|
||||
// Specular term
|
||||
float specular = AL_CalcSpecular( -lightDirection,
|
||||
normal,
|
||||
normalize(-vsEyeRay) ) * lightBrightness * shadowed;
|
||||
// Specular term
|
||||
vec3 viewSpacePos = vsEyeRay * depth;
|
||||
vec4 real_specular = EvalBDRF( colorSample.rgb,
|
||||
lightColor.rgb,
|
||||
normalize( -lightDirection ),
|
||||
viewSpacePos,
|
||||
normal,
|
||||
1.0-matInfo.b,
|
||||
matInfo.a );
|
||||
vec3 lightColorOut = real_specular.rgb * lightBrightness * shadowed;
|
||||
|
||||
float Sat_NL_Att = saturate( dotNL * shadowed ) * lightBrightness;
|
||||
vec3 lightColorOut = lightMapParams.rgb * lightColor.rgb;
|
||||
vec4 addToResult = (lightAmbient * (1 - ambientCameraFactor)) + ( lightAmbient * ambientCameraFactor * saturate(dot(normalize(-vsEyeRay), normal)) );
|
||||
|
||||
// TODO: This needs to be removed when lightmapping is disabled
|
||||
// as its extra work per-pixel on dynamic lit scenes.
|
||||
//
|
||||
// Special lightmapping pass.
|
||||
if ( lightMapParams.a < 0.0 )
|
||||
{
|
||||
// This disables shadows on the backsides of objects.
|
||||
shadowed = dotNL < 0.0f ? 1.0f : shadowed;
|
||||
|
||||
Sat_NL_Att = 1.0f;
|
||||
lightColorOut = vec3(shadowed);
|
||||
specular *= lightBrightness;
|
||||
addToResult = ( 1.0 - shadowed ) * abs(lightMapParams);
|
||||
}
|
||||
float Sat_NdotV = saturate(dot(normalize(-vsEyeRay), normal));
|
||||
vec4 addToResult = ( lightAmbient * (1 - ambientCameraFactor)) + ( lightAmbient * ambientCameraFactor * Sat_NdotV );
|
||||
|
||||
// Sample the AO texture.
|
||||
#ifdef USE_SSAO_MASK
|
||||
|
|
@ -323,5 +315,5 @@ void main()
|
|||
lightColorOut = debugColor;
|
||||
#endif
|
||||
|
||||
OUT_col = AL_DeferredOutput(lightColorOut+subsurface*(1.0-Sat_NL_Att), colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att);
|
||||
OUT_col = vec4(matInfo.g*(lightColorOut*Sat_NL_Att+subsurface*(1.0-Sat_NL_Att)+addToResult.rgb),real_specular.a);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../torque.hlsl"
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : TORQUE_POSITION;
|
||||
float2 uv : TEXCOORD;
|
||||
};
|
||||
|
||||
uniform int face;
|
||||
|
||||
TORQUE_UNIFORM_SAMPLERCUBE(environmentMap, 0);
|
||||
|
||||
float4 main(ConnectData IN) : TORQUE_TARGET0
|
||||
{
|
||||
float3 N = getCubeDir(face,IN.uv);
|
||||
float3 irradiance = 0;
|
||||
|
||||
// tangent space calculation from origin point
|
||||
float3 up = float3(0.0, 0.0, 1.0);
|
||||
float3 right = cross(up, N);
|
||||
up = cross(N, right);
|
||||
|
||||
float sampleDelta = 0.025;
|
||||
int nrSamples = 0;
|
||||
for(float phi = 0.0; phi < M_2PI_F; phi += sampleDelta)
|
||||
{
|
||||
for(float theta = 0.0; theta < M_HALFPI_F; theta += sampleDelta)
|
||||
{
|
||||
// spherical to cartesian (in tangent space)
|
||||
float3 tangentSample = float3(sin(theta) * cos(phi), sin(theta) * sin(phi), cos(theta));
|
||||
// tangent space to world
|
||||
float3 sampleVec = tangentSample.x * right + tangentSample.y * up + tangentSample.z * N;
|
||||
|
||||
irradiance += TORQUE_TEXCUBE(environmentMap, sampleVec).rgb * cos(theta) * sin(theta);
|
||||
nrSamples++;
|
||||
}
|
||||
}
|
||||
irradiance = M_PI_F * irradiance * (1.0 / float(nrSamples));
|
||||
|
||||
return float4(irradiance, 1.0);
|
||||
}
|
||||
|
|
@ -136,48 +136,58 @@ uniform float2 lightAttenuation;
|
|||
uniform float3x3 viewToLightProj;
|
||||
uniform float3x3 dynamicViewToLightProj;
|
||||
|
||||
float4 main( ConvexConnectP IN ) : TORQUE_TARGET0
|
||||
{
|
||||
struct PS_OUTPUT
|
||||
{
|
||||
float4 diffuse: TORQUE_TARGET0;
|
||||
float4 spec: TORQUE_TARGET1;
|
||||
};
|
||||
|
||||
PS_OUTPUT main(ConvexConnectP IN)
|
||||
{
|
||||
PS_OUTPUT Output = (PS_OUTPUT)0;
|
||||
|
||||
// Compute scene UV
|
||||
float3 ssPos = IN.ssPos.xyz / IN.ssPos.w;
|
||||
float2 uvScene = getUVFromSSPos( ssPos, rtParams0 );
|
||||
|
||||
float2 uvScene = getUVFromSSPos(ssPos, rtParams0);
|
||||
|
||||
// Matinfo flags
|
||||
float4 matInfo = TORQUE_TEX2D( matInfoBuffer, uvScene );
|
||||
float4 matInfo = TORQUE_TEX2D(matInfoBuffer, uvScene);
|
||||
//early out if emissive
|
||||
bool emissive = getFlag(matInfo.r, 0);
|
||||
if (emissive)
|
||||
{
|
||||
return float4(0.0, 0.0, 0.0, 0.0);
|
||||
//return float4(0.0, 0.0, 0.0, 0.0);
|
||||
return Output;
|
||||
}
|
||||
float4 colorSample = TORQUE_TEX2D( colorBuffer, uvScene );
|
||||
float3 subsurface = float3(0.0,0.0,0.0);
|
||||
if (getFlag( matInfo.r, 1 ))
|
||||
|
||||
float4 colorSample = TORQUE_TEX2D(colorBuffer, uvScene);
|
||||
float3 subsurface = float3(0.0, 0.0, 0.0);
|
||||
if (getFlag(matInfo.r, 1))
|
||||
{
|
||||
subsurface = colorSample.rgb;
|
||||
if (colorSample.r>colorSample.g)
|
||||
if (colorSample.r > colorSample.g)
|
||||
subsurface = float3(0.772549, 0.337255, 0.262745);
|
||||
else
|
||||
subsurface = float3(0.337255, 0.772549, 0.262745);
|
||||
}
|
||||
|
||||
// Sample/unpack the normal/z data
|
||||
float4 deferredSample = TORQUE_DEFERRED_UNCONDITION( deferredBuffer, uvScene );
|
||||
float4 deferredSample = TORQUE_DEFERRED_UNCONDITION(deferredBuffer, uvScene);
|
||||
float3 normal = deferredSample.rgb;
|
||||
float depth = deferredSample.a;
|
||||
|
||||
// Eye ray - Eye -> Pixel
|
||||
float3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN.vsEyeDir.xyz, vsFarPlane );
|
||||
float3 eyeRay = getDistanceVectorToPlane(-vsFarPlane.w, IN.vsEyeDir.xyz, vsFarPlane);
|
||||
float3 viewSpacePos = eyeRay * depth;
|
||||
|
||||
// Build light vec, get length, clip pixel if needed
|
||||
float3 lightVec = lightPosition - viewSpacePos;
|
||||
float lenLightV = length( lightVec );
|
||||
clip( lightRange - lenLightV );
|
||||
float lenLightV = length(lightVec);
|
||||
clip(lightRange - lenLightV);
|
||||
|
||||
// Get the attenuated falloff.
|
||||
float atten = attenuate( lightColor, lightAttenuation, lenLightV );
|
||||
clip( atten - 1e-6 );
|
||||
float atten = attenuate(lightColor, lightAttenuation, lenLightV);
|
||||
clip(atten - 1e-6);
|
||||
|
||||
// Normalize lightVec
|
||||
lightVec /= lenLightV;
|
||||
|
|
@ -187,97 +197,93 @@ float4 main( ConvexConnectP IN ) : TORQUE_TARGET0
|
|||
float nDotL = dot( lightVec, normal );
|
||||
//DB_CLIP( nDotL < 0 );
|
||||
|
||||
#ifdef NO_SHADOW
|
||||
|
||||
float shadowed = 1.0;
|
||||
|
||||
#else
|
||||
#ifdef NO_SHADOW
|
||||
|
||||
// Get a linear depth from the light source.
|
||||
float distToLight = lenLightV / lightRange;
|
||||
float shadowed = 1.0;
|
||||
|
||||
#ifdef SHADOW_CUBE
|
||||
|
||||
// TODO: We need to fix shadow cube to handle soft shadows!
|
||||
float occ = TORQUE_TEXCUBE( shadowMap, mul( viewToLightProj, -lightVec ) ).r;
|
||||
float shadowed = saturate( exp( lightParams.y * ( occ - distToLight ) ) );
|
||||
|
||||
#else
|
||||
#else
|
||||
|
||||
// Static
|
||||
float2 shadowCoord = decodeShadowCoord( mul( viewToLightProj, -lightVec ) ).xy;
|
||||
float static_shadowed = softShadow_filter( TORQUE_SAMPLER2D_MAKEARG(shadowMap),
|
||||
ssPos.xy,
|
||||
shadowCoord,
|
||||
shadowSoftness,
|
||||
distToLight,
|
||||
nDotL,
|
||||
lightParams.y );
|
||||
// Get a linear depth from the light source.
|
||||
float distToLight = lenLightV / lightRange;
|
||||
|
||||
// Dynamic
|
||||
float2 dynamicShadowCoord = decodeShadowCoord( mul( dynamicViewToLightProj, -lightVec ) ).xy;
|
||||
float dynamic_shadowed = softShadow_filter( TORQUE_SAMPLER2D_MAKEARG(dynamicShadowMap),
|
||||
ssPos.xy,
|
||||
dynamicShadowCoord,
|
||||
shadowSoftness,
|
||||
distToLight,
|
||||
nDotL,
|
||||
lightParams.y );
|
||||
#ifdef SHADOW_CUBE
|
||||
|
||||
float shadowed = min(static_shadowed, dynamic_shadowed);
|
||||
// TODO: We need to fix shadow cube to handle soft shadows!
|
||||
float occ = TORQUE_TEXCUBE(shadowMap, mul(viewToLightProj, -lightVec)).r;
|
||||
float shadowed = saturate(exp(lightParams.y * (occ - distToLight)));
|
||||
|
||||
#endif
|
||||
#else
|
||||
|
||||
// Static
|
||||
float2 shadowCoord = decodeShadowCoord(mul(viewToLightProj, -lightVec)).xy;
|
||||
float static_shadowed = softShadow_filter(TORQUE_SAMPLER2D_MAKEARG(shadowMap),
|
||||
ssPos.xy,
|
||||
shadowCoord,
|
||||
shadowSoftness,
|
||||
distToLight,
|
||||
nDotL,
|
||||
lightParams.y);
|
||||
|
||||
// Dynamic
|
||||
float2 dynamicShadowCoord = decodeShadowCoord(mul(dynamicViewToLightProj, -lightVec)).xy;
|
||||
float dynamic_shadowed = softShadow_filter(TORQUE_SAMPLER2D_MAKEARG(dynamicShadowMap),
|
||||
ssPos.xy,
|
||||
dynamicShadowCoord,
|
||||
shadowSoftness,
|
||||
distToLight,
|
||||
nDotL,
|
||||
lightParams.y);
|
||||
|
||||
float shadowed = min(static_shadowed, dynamic_shadowed);
|
||||
|
||||
#endif
|
||||
|
||||
#endif // !NO_SHADOW
|
||||
|
||||
#endif // !NO_SHADOW
|
||||
|
||||
float3 lightcol = lightColor.rgb;
|
||||
#ifdef USE_COOKIE_TEX
|
||||
#ifdef USE_COOKIE_TEX
|
||||
|
||||
// Lookup the cookie sample.
|
||||
float4 cookie = TORQUE_TEXCUBE( cookieMap, mul( viewToLightProj, -lightVec ) );
|
||||
// Lookup the cookie sample.
|
||||
float4 cookie = TORQUE_TEXCUBE(cookieMap, mul(viewToLightProj, -lightVec));
|
||||
|
||||
// Multiply the light with the cookie tex.
|
||||
lightcol *= cookie.rgb;
|
||||
// Multiply the light with the cookie tex.
|
||||
lightcol *= cookie.rgb;
|
||||
|
||||
// Use a maximum channel luminance to attenuate
|
||||
// the lighting else we get specular in the dark
|
||||
// regions of the cookie texture.
|
||||
atten *= max( cookie.r, max( cookie.g, cookie.b ) );
|
||||
// Use a maximum channel luminance to attenuate
|
||||
// the lighting else we get specular in the dark
|
||||
// regions of the cookie texture.
|
||||
atten *= max(cookie.r, max(cookie.g, cookie.b));
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// NOTE: Do not clip on fully shadowed pixels as it would
|
||||
// cause the hardware occlusion query to disable the shadow.
|
||||
|
||||
// Specular term
|
||||
float specular = 0;
|
||||
|
||||
float4 real_specular = EvalBDRF( float3( 1.0, 1.0, 1.0 ),
|
||||
lightcol,
|
||||
lightVec,
|
||||
viewSpacePos,
|
||||
normal,
|
||||
1.0-matInfo.b,
|
||||
matInfo.a );
|
||||
float3 lightColorOut = real_specular.rgb * lightBrightness * shadowed* atten;
|
||||
//lightColorOut /= colorSample.rgb;
|
||||
float Sat_NL_Att = saturate( nDotL * atten * shadowed ) * lightBrightness;
|
||||
float4 addToResult = 0.0;
|
||||
|
||||
// TODO: This needs to be removed when lightmapping is disabled
|
||||
// as its extra work per-pixel on dynamic lit scenes.
|
||||
//
|
||||
// Special lightmapping pass.
|
||||
if ( lightMapParams.a < 0.0 )
|
||||
{
|
||||
// This disables shadows on the backsides of objects.
|
||||
shadowed = nDotL < 0.0f ? 1.0f : shadowed;
|
||||
float3 l = lightVec;// normalize(-lightDirection);
|
||||
float3 v = eyeRay;// normalize(eyePosWorld - worldPos.xyz);
|
||||
|
||||
Sat_NL_Att = 1.0f;
|
||||
shadowed = lerp( 1.0f, shadowed, atten );
|
||||
lightColorOut = shadowed;
|
||||
specular *= lightBrightness;
|
||||
addToResult = ( 1.0 - shadowed ) * abs(lightMapParams);
|
||||
}
|
||||
return float4((lightColorOut*Sat_NL_Att+subsurface*(1.0-Sat_NL_Att)+addToResult.rgb),real_specular.a);
|
||||
float3 h = normalize(v + l);
|
||||
float dotNLa = clamp(dot(normal, l), 0.0, 1.0);
|
||||
float dotNVa = clamp(dot(normal, v), 0.0, 1.0);
|
||||
float dotNHa = clamp(dot(normal, h), 0.0, 1.0);
|
||||
float dotHVa = clamp(dot(normal, v), 0.0, 1.0);
|
||||
float dotLHa = clamp(dot(l, h), 0.0, 1.0);
|
||||
|
||||
float roughness = matInfo.g;
|
||||
float metalness = matInfo.b;
|
||||
|
||||
//diffuse
|
||||
float disDiff = Fr_DisneyDiffuse(dotNVa, dotNLa, dotLHa, roughness);
|
||||
float3 diffuse = float3(disDiff, disDiff, disDiff) / M_PI_F;// alternative: (lightColor * dotNL) / Pi;
|
||||
//specular
|
||||
float3 specular = directSpecular(normal, v, l, roughness, 1.0) * lightColor.rgb;
|
||||
|
||||
|
||||
if (nDotL<0) shadowed = 0;
|
||||
float Sat_NL_Att = saturate( nDotL * shadowed ) * lightBrightness;
|
||||
//output
|
||||
Output.diffuse = float4(diffuse * lightBrightness*shadowed, Sat_NL_Att);
|
||||
Output.spec = float4(specular * lightBrightness*shadowed, Sat_NL_Att);
|
||||
|
||||
return Output;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,130 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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.hlsl"
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : SV_Position;
|
||||
float2 uv : TEXCOORD;
|
||||
};
|
||||
|
||||
TORQUE_UNIFORM_SAMPLERCUBE(environmentMap, 0);
|
||||
|
||||
uniform float roughness;
|
||||
uniform int face;
|
||||
uniform int mipSize;
|
||||
uniform int resolution;
|
||||
float RadicalInverse_VdC(uint bits)
|
||||
{
|
||||
bits = (bits << 16u) | (bits >> 16u);
|
||||
bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
|
||||
bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
|
||||
bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
|
||||
bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
|
||||
return float(bits) * 2.3283064365386963e-10; // / 0x100000000
|
||||
}
|
||||
|
||||
float2 Hammersley(uint i, uint N)
|
||||
{
|
||||
return float2(float(i) / float(N), RadicalInverse_VdC(i));
|
||||
}
|
||||
|
||||
float DistributionGGX(float3 N, float3 H, float roughness)
|
||||
{
|
||||
float a = roughness * roughness;
|
||||
float a2 = a * a;
|
||||
float NdotH = max(dot(N, H), 0.0);
|
||||
float NdotH2 = NdotH * NdotH;
|
||||
|
||||
float nom = a2;
|
||||
float denom = (NdotH2 * (a2 - 1.0) + 1.0);
|
||||
denom = M_PI_F * denom * denom;
|
||||
|
||||
return nom / denom;
|
||||
}
|
||||
|
||||
float3 ImportanceSampleGGX(float2 Xi, float3 N)
|
||||
{
|
||||
float a = roughness * roughness;
|
||||
|
||||
float phi = 2.0 * M_PI_F * Xi.x;
|
||||
float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (a*a - 1.0) * Xi.y));
|
||||
float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
|
||||
|
||||
// from spherical coordinates to cartesian coordinates
|
||||
float3 H;
|
||||
H.x = cos(phi) * sinTheta;
|
||||
H.y = sin(phi) * sinTheta;
|
||||
H.z = cosTheta;
|
||||
|
||||
// from tangent-space vector to world-space sample vector
|
||||
float3 up = abs(N.z) < 0.999 ? float3(0.0, 0.0, 1.0) : float3(1.0, 0.0, 0.0);
|
||||
float3 tangent = normalize(cross(up, N));
|
||||
float3 bitangent = cross(N, tangent);
|
||||
|
||||
float3 sampleVec = tangent * H.x + bitangent * H.y + N * H.z;
|
||||
return normalize(sampleVec);
|
||||
}
|
||||
|
||||
float3 prefilterEnvMap(float3 R)
|
||||
{
|
||||
int sampleCount = resolution*2;
|
||||
float3 N = R;
|
||||
float3 V = R;
|
||||
float totalWeight = 0.0;
|
||||
float3 prefilteredColor = float3(0.0, 0.0, 0.0);
|
||||
|
||||
for (int i = 0; i < sampleCount; ++i)
|
||||
{
|
||||
float2 Xi = Hammersley(i, sampleCount);
|
||||
float3 H = ImportanceSampleGGX(Xi, N);
|
||||
float3 L = normalize(2.0 * dot(V, H) * H - V);
|
||||
|
||||
float NdotL = max(dot(N, L), 0.0);
|
||||
if (NdotL > 0.0)
|
||||
{
|
||||
// sample from the environment's mip level based on roughness/pdf
|
||||
float D = DistributionGGX(N, H, roughness);
|
||||
float NdotH = max(dot(N, H), 0.0);
|
||||
float HdotV = max(dot(H, V), 0.0);
|
||||
float pdf = D * NdotH / (4.0 * HdotV) + 0.0001;
|
||||
|
||||
float saTexel = 4.0 * M_PI_F / (6.0 * sampleCount * sampleCount);
|
||||
float saSample = 1.0 / (float(sampleCount) * pdf + 0.0001);
|
||||
|
||||
float mipLevel = roughness == 0.0 ? 0.0 : 0.5 * log2(saSample / saTexel);
|
||||
|
||||
prefilteredColor += TORQUE_TEXCUBELOD(environmentMap, float4(L, mipLevel)).rgb * NdotL;
|
||||
|
||||
totalWeight += NdotL;
|
||||
}
|
||||
}
|
||||
|
||||
return (prefilteredColor / totalWeight);
|
||||
}
|
||||
|
||||
float4 main(ConnectData IN) : TORQUE_TARGET0
|
||||
{
|
||||
float3 N = getCubeDir(face, IN.uv);
|
||||
return float4(prefilterEnvMap(N), 1.0);
|
||||
}
|
||||
|
|
@ -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 "../../shaderModelAutoGen.hlsl"
|
||||
#include "../../postfx/postFx.hlsl"
|
||||
#include "shaders/common/torque.hlsl"
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(colorBufferTex,0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(diffuseLightingBuffer,1);
|
||||
TORQUE_UNIFORM_SAMPLER2D(matInfoTex,2);
|
||||
TORQUE_UNIFORM_SAMPLER2D(specularLightingBuffer,3);
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredTex,4);
|
||||
|
||||
float4 main( PFXVertToPix IN) : TORQUE_TARGET0
|
||||
{
|
||||
float depth = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 ).w;
|
||||
if (depth>0.9999)
|
||||
return float4(0,0,0,0);
|
||||
|
||||
float3 colorBuffer = TORQUE_TEX2D( colorBufferTex, IN.uv0 ).rgb; //albedo
|
||||
float4 matInfo = TORQUE_TEX2D(matInfoTex, IN.uv0); //flags|smoothness|ao|metallic
|
||||
|
||||
bool emissive = getFlag(matInfo.r, 0);
|
||||
if (emissive)
|
||||
{
|
||||
return float4(colorBuffer, 1.0);
|
||||
}
|
||||
|
||||
float4 diffuseLighting = TORQUE_TEX2D( diffuseLightingBuffer, IN.uv0 ); //shadowmap*specular
|
||||
colorBuffer *= diffuseLighting.rgb;
|
||||
|
||||
return hdrEncode( float4(colorBuffer.rgb, 1.0) );
|
||||
}
|
||||
|
|
@ -0,0 +1,217 @@
|
|||
#include "../../shaderModelAutoGen.hlsl"
|
||||
|
||||
#include "farFrustumQuad.hlsl"
|
||||
#include "lightingUtils.hlsl"
|
||||
#include "../../lighting.hlsl"
|
||||
#include "../../torque.hlsl"
|
||||
|
||||
struct ConvexConnectP
|
||||
{
|
||||
float4 pos : TORQUE_POSITION;
|
||||
float4 wsEyeDir : TEXCOORD0;
|
||||
float4 ssPos : TEXCOORD1;
|
||||
float4 vsEyeDir : TEXCOORD2;
|
||||
};
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(matInfoBuffer, 1);
|
||||
TORQUE_UNIFORM_SAMPLERCUBE(cubeMap, 2);
|
||||
TORQUE_UNIFORM_SAMPLERCUBE(irradianceCubemap, 3);
|
||||
TORQUE_UNIFORM_SAMPLER2D(BRDFTexture, 4);
|
||||
|
||||
uniform float4 rtParams0;
|
||||
|
||||
uniform float3 probeWSPos;
|
||||
uniform float3 probeLSPos;
|
||||
uniform float4 vsFarPlane;
|
||||
|
||||
uniform float radius;
|
||||
uniform float2 attenuation;
|
||||
|
||||
uniform float4x4 invViewMat;
|
||||
|
||||
uniform float3 eyePosWorld;
|
||||
uniform float3 bbMin;
|
||||
uniform float3 bbMax;
|
||||
|
||||
uniform float useSphereMode;
|
||||
|
||||
float3 iblSpecular(float3 v, float3 n, float roughness)
|
||||
{
|
||||
float3 R = reflect(v, n);
|
||||
const float MAX_REFLECTION_LOD = 6.0;
|
||||
float3 prefilteredColor = TORQUE_TEXCUBELOD(cubeMap, float4(R, roughness * MAX_REFLECTION_LOD)).rgb;
|
||||
float2 envBRDF = TORQUE_TEX2D(BRDFTexture, float2(max(dot(n, v), 0.0), roughness)).rg;
|
||||
//return prefilteredColor * (envBRDF.x + envBRDF.y);
|
||||
return prefilteredColor;
|
||||
}
|
||||
|
||||
// Box Projected IBL Lighting
|
||||
// Based on: http://www.gamedev.net/topic/568829-box-projected-cubemap-environment-mapping/
|
||||
|
||||
float3 boxProject(float3 wsPosition, float3 reflectDir, float3 boxWSPos, float3 boxMin, float3 boxMax)
|
||||
{
|
||||
float3 nrdir = normalize(reflectDir);
|
||||
float3 rbmax = (boxMax - wsPosition) / nrdir;
|
||||
float3 rbmin = (boxMin - wsPosition) / nrdir;
|
||||
|
||||
float3 rbminmax;
|
||||
rbminmax.x = (nrdir.x > 0.0) ? rbmax.x : rbmin.x;
|
||||
rbminmax.y = (nrdir.y > 0.0) ? rbmax.y : rbmin.y;
|
||||
rbminmax.z = (nrdir.z > 0.0) ? rbmax.z : rbmin.z;
|
||||
|
||||
float fa = min(min(rbminmax.x, rbminmax.y), rbminmax.z);
|
||||
float3 posonbox = wsPosition + nrdir * fa;
|
||||
|
||||
return posonbox - boxWSPos;
|
||||
}
|
||||
|
||||
float3 iblBoxDiffuse(float3 normal,
|
||||
float3 wsPos,
|
||||
TORQUE_SAMPLERCUBE(irradianceCube),
|
||||
float3 boxPos,
|
||||
float3 boxMin,
|
||||
float3 boxMax)
|
||||
{
|
||||
// Irradiance (Diffuse)
|
||||
float3 cubeN = normalize(normal);
|
||||
float3 irradiance = TORQUE_TEXCUBE(irradianceCube, cubeN).xyz;
|
||||
|
||||
return irradiance;
|
||||
}
|
||||
|
||||
float3 iblBoxSpecular(float3 normal,
|
||||
float3 wsPos,
|
||||
float roughness,
|
||||
float3 viewDir,
|
||||
TORQUE_SAMPLER2D(brdfTexture),
|
||||
TORQUE_SAMPLERCUBE(radianceCube),
|
||||
float3 boxPos,
|
||||
float3 boxMin,
|
||||
float3 boxMax)
|
||||
{
|
||||
float3 v = viewDir;
|
||||
float3 n = normalize(normal);
|
||||
float ndotv = clamp(dot(n, v), 0.0, 1.0);
|
||||
|
||||
// BRDF
|
||||
float2 brdf = TORQUE_TEX2D(brdfTexture, float2(roughness, ndotv)).xy;
|
||||
|
||||
// Radiance (Specular)
|
||||
float lod = roughness * 6.0;
|
||||
float3 r = 2.0 * ndotv * n - v; // reflect(v, n);
|
||||
float3 cubeR = normalize(r);
|
||||
cubeR = boxProject(wsPos, cubeR, boxPos, boxMin, boxMax);
|
||||
|
||||
float3 radiance = TORQUE_TEXCUBELOD(radianceCube, float4(cubeR, lod)).xyz * (brdf.x + brdf.y);
|
||||
|
||||
return radiance;
|
||||
}
|
||||
|
||||
struct PS_OUTPUT
|
||||
{
|
||||
float4 diffuse: TORQUE_TARGET0;
|
||||
float4 spec: TORQUE_TARGET1;
|
||||
};
|
||||
|
||||
PS_OUTPUT main( ConvexConnectP IN )
|
||||
{
|
||||
PS_OUTPUT Output = (PS_OUTPUT)0;
|
||||
|
||||
// Compute scene UV
|
||||
float3 ssPos = IN.ssPos.xyz / IN.ssPos.w;
|
||||
|
||||
//float4 hardCodedRTParams0 = float4(0,0.0277777780,1,0.972222209);
|
||||
float2 uvScene = getUVFromSSPos( ssPos, rtParams0 );
|
||||
|
||||
// Matinfo flags
|
||||
float4 matInfo = TORQUE_TEX2D( matInfoBuffer, uvScene );
|
||||
|
||||
// Sample/unpack the normal/z data
|
||||
float4 deferredSample = TORQUE_DEFERRED_UNCONDITION( deferredBuffer, uvScene );
|
||||
float3 normal = deferredSample.rgb;
|
||||
float depth = deferredSample.a;
|
||||
if (depth>0.9999)
|
||||
clip(-1);
|
||||
|
||||
// Need world-space normal.
|
||||
float3 wsNormal = mul(float4(normal, 1), invViewMat).rgb;
|
||||
|
||||
float4 color = float4(1, 1, 1, 1);
|
||||
float4 ref = float4(0,0,0,0);
|
||||
float alpha = 1;
|
||||
|
||||
float3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN.vsEyeDir.xyz, vsFarPlane );
|
||||
float3 viewSpacePos = eyeRay * depth;
|
||||
|
||||
float3 wsEyeRay = mul(float4(eyeRay, 1), invViewMat).rgb;
|
||||
|
||||
// Use eye ray to get ws pos
|
||||
float3 worldPos = float3(eyePosWorld + wsEyeRay * depth);
|
||||
float smoothness = min((1.0 - matInfo.b)*11.0 + 1.0, 8.0);//bump up to 8 for finalization
|
||||
|
||||
if(useSphereMode)
|
||||
{
|
||||
// Build light vec, get length, clip pixel if needed
|
||||
float3 lightVec = probeLSPos - viewSpacePos;
|
||||
float lenLightV = length( lightVec );
|
||||
clip( radius - lenLightV );
|
||||
|
||||
// Get the attenuated falloff.
|
||||
float atten = attenuate( float4(1,1,1,1), attenuation, lenLightV );
|
||||
clip( atten - 1e-6 );
|
||||
|
||||
// Normalize lightVec
|
||||
lightVec = normalize(lightVec);
|
||||
|
||||
// If we can do dynamic branching then avoid wasting
|
||||
// fillrate on pixels that are backfacing to the light.
|
||||
float nDotL = abs(dot( lightVec, normal ));
|
||||
|
||||
float Sat_NL_Att = saturate( nDotL * atten );
|
||||
|
||||
float3 reflectionVec = reflect(IN.wsEyeDir, float4(wsNormal,nDotL)).xyz;
|
||||
|
||||
float3 nrdir = normalize(reflectionVec);
|
||||
float3 rbmax = (bbMax - worldPos.xyz) / nrdir;
|
||||
float3 rbmin = (bbMin - worldPos.xyz) / nrdir;
|
||||
|
||||
float3 rbminmax = (nrdir > 0.0) ? rbmax : rbmin;
|
||||
float fa = min(min(rbminmax.x,rbminmax.y),rbminmax.z);
|
||||
if (dot( lightVec, normal )<0.0f)
|
||||
clip(fa);
|
||||
|
||||
float3 posOnBox = worldPos.xyz + nrdir * fa;
|
||||
reflectionVec = posOnBox - probeWSPos;
|
||||
|
||||
reflectionVec = mul(probeWSPos,reflectionVec);
|
||||
|
||||
ref = float4(reflectionVec, smoothness);
|
||||
|
||||
alpha = Sat_NL_Att;
|
||||
float roughness = 1 - matInfo.b;
|
||||
|
||||
float3 irradiance = TORQUE_TEXCUBELOD(irradianceCubemap, ref).rgb;
|
||||
|
||||
float3 specular = TORQUE_TEXCUBELOD(cubeMap, ref).rgb;// iblSpecular(wsEyeRay, wsNormal, roughness);
|
||||
|
||||
Output.diffuse = float4(irradiance.rgb, alpha);
|
||||
Output.spec = float4(specular.rgb, alpha);
|
||||
|
||||
return Output;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Try to clip anything that falls outside our box as well
|
||||
//TODO: Make it support rotated boxes as well
|
||||
if(worldPos.x > bbMax.x || worldPos.y > bbMax.y || worldPos.z > bbMax.z ||
|
||||
worldPos.x < bbMin.x || worldPos.y < bbMin.y || worldPos.z < bbMin.z)
|
||||
clip(-1);
|
||||
|
||||
float blendVal = 1.0;
|
||||
float3 pixDir = normalize(eyePosWorld.xyz - worldPos.xyz);
|
||||
Output.diffuse = float4(iblBoxDiffuse(wsNormal, worldPos, TORQUE_SAMPLERCUBE_MAKEARG(irradianceCubemap), probeWSPos, bbMin, bbMax), blendVal);
|
||||
Output.spec = float4(iblBoxSpecular(wsNormal, worldPos, 1.0 - matInfo.b, pixDir, TORQUE_SAMPLER2D_MAKEARG(BRDFTexture), TORQUE_SAMPLERCUBE_MAKEARG(cubeMap), probeWSPos, bbMin, bbMax), blendVal);
|
||||
return Output;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
#include "../../shaderModelAutoGen.hlsl"
|
||||
|
||||
#include "farFrustumQuad.hlsl"
|
||||
#include "lightingUtils.hlsl"
|
||||
#include "../../lighting.hlsl"
|
||||
#include "../../torque.hlsl"
|
||||
|
||||
struct ConvexConnectP
|
||||
{
|
||||
float4 pos : TORQUE_POSITION;
|
||||
float4 wsEyeDir : TEXCOORD0;
|
||||
float4 ssPos : TEXCOORD1;
|
||||
float4 vsEyeDir : TEXCOORD2;
|
||||
};
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
|
||||
TORQUE_UNIFORM_SAMPLER2D(matInfoBuffer, 1);
|
||||
TORQUE_UNIFORM_SAMPLERCUBE(cubeMap, 2);
|
||||
TORQUE_UNIFORM_SAMPLERCUBE(irradianceCubemap, 3);
|
||||
TORQUE_UNIFORM_SAMPLER2D(BRDFTexture, 4);
|
||||
|
||||
|
||||
uniform float4 rtParams0;
|
||||
|
||||
uniform float4 vsFarPlane;
|
||||
|
||||
uniform float4x4 invViewMat;
|
||||
|
||||
uniform float3 eyePosWorld;
|
||||
|
||||
//SHTerms
|
||||
/*uniform float4 SHTerms0;
|
||||
uniform float4 SHTerms1;
|
||||
uniform float4 SHTerms2;
|
||||
uniform float4 SHTerms3;
|
||||
uniform float4 SHTerms4;
|
||||
uniform float4 SHTerms5;
|
||||
uniform float4 SHTerms6;
|
||||
uniform float4 SHTerms7;
|
||||
uniform float4 SHTerms8;
|
||||
|
||||
uniform float SHConsts0;
|
||||
uniform float SHConsts1;
|
||||
uniform float SHConsts2;
|
||||
uniform float SHConsts3;
|
||||
uniform float SHConsts4;
|
||||
|
||||
float4 decodeSH(float3 normal)
|
||||
{
|
||||
float x = normal.x;
|
||||
float y = normal.y;
|
||||
float z = normal.z;
|
||||
|
||||
float3 l00 = SHTerms0.rgb;
|
||||
|
||||
float3 l10 = SHTerms1.rgb;
|
||||
float3 l11 = SHTerms2.rgb;
|
||||
float3 l12 = SHTerms3.rgb;
|
||||
|
||||
float3 l20 = SHTerms4.rgb;
|
||||
float3 l21 = SHTerms5.rgb;
|
||||
float3 l22 = SHTerms6.rgb;
|
||||
float3 l23 = SHTerms7.rgb;
|
||||
float3 l24 = SHTerms8.rgb;
|
||||
|
||||
float3 result = (
|
||||
l00 * SHConsts0 +
|
||||
|
||||
l12 * SHConsts1 * x +
|
||||
l10 * SHConsts1 * y +
|
||||
l11 * SHConsts1 * z +
|
||||
|
||||
l20 * SHConsts2 * x*y +
|
||||
l21 * SHConsts2 * y*z +
|
||||
l22 * SHConsts3 * (3.0*z*z - 1.0) +
|
||||
l23 * SHConsts2 * x*z +
|
||||
l24 * SHConsts4 * (x*x - y*y)
|
||||
);
|
||||
|
||||
return float4(result,1);
|
||||
}*/
|
||||
|
||||
float3 iblSpecular(float3 v, float3 n, float roughness)
|
||||
{
|
||||
float3 R = reflect(v, n);
|
||||
const float MAX_REFLECTION_LOD = 4.0;
|
||||
float3 prefilteredColor = TORQUE_TEXCUBELOD(cubeMap, float4(R, roughness * MAX_REFLECTION_LOD)).rgb;
|
||||
float2 envBRDF = TORQUE_TEX2D(BRDFTexture, float2(max(dot(n, v), 0.0), roughness)).rg;
|
||||
return prefilteredColor * (envBRDF.x + envBRDF.y);
|
||||
//return prefilteredColor;
|
||||
}
|
||||
|
||||
struct PS_OUTPUT
|
||||
{
|
||||
float4 diffuse: TORQUE_TARGET0;
|
||||
float4 spec: TORQUE_TARGET1;
|
||||
};
|
||||
|
||||
PS_OUTPUT main( ConvexConnectP IN )
|
||||
{
|
||||
PS_OUTPUT Output = (PS_OUTPUT)0;
|
||||
|
||||
// Compute scene UV
|
||||
float3 ssPos = IN.ssPos.xyz / IN.ssPos.w;
|
||||
|
||||
//float4 hardCodedRTParams0 = float4(0,0.0277777780,1,0.972222209);
|
||||
float2 uvScene = getUVFromSSPos( ssPos, rtParams0 );
|
||||
|
||||
// Matinfo flags
|
||||
float4 matInfo = TORQUE_TEX2D( matInfoBuffer, uvScene );
|
||||
|
||||
// Sample/unpack the normal/z data
|
||||
float4 deferredSample = TORQUE_DEFERRED_UNCONDITION( deferredBuffer, uvScene );
|
||||
float3 normal = deferredSample.rgb;
|
||||
float depth = deferredSample.a;
|
||||
if (depth>0.9999)
|
||||
return Output;
|
||||
|
||||
// Need world-space normal.
|
||||
float3 wsNormal = mul(float4(normal, 1), invViewMat).rgb;
|
||||
|
||||
float3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN.vsEyeDir.xyz, vsFarPlane );
|
||||
|
||||
float3 wsEyeRay = mul(float4(eyeRay, 1), invViewMat).rgb;
|
||||
|
||||
// Use eye ray to get ws pos
|
||||
float3 worldPos = float3(eyePosWorld + wsEyeRay * depth);
|
||||
|
||||
float3 reflectionVec = reflect(IN.wsEyeDir, float4(wsNormal,1)).xyz;
|
||||
|
||||
float roughness = 1 - matInfo.b;
|
||||
|
||||
float3 v = normalize(eyePosWorld - worldPos);
|
||||
|
||||
float3 irradiance = TORQUE_TEXCUBE(irradianceCubemap, wsNormal).rgb;
|
||||
|
||||
float3 specular = iblSpecular(wsEyeRay, wsNormal, roughness);
|
||||
|
||||
|
||||
Output.diffuse = float4(irradiance.rgb, 1);
|
||||
Output.spec = float4(specular.rgb, 1);
|
||||
|
||||
return Output;
|
||||
|
||||
}
|
||||
|
|
@ -192,23 +192,24 @@ float4 AL_VectorLightShadowCast( TORQUE_SAMPLER2D(sourceShadowMap),
|
|||
dot( finalMask, overDarkPSSM ) ) );
|
||||
};
|
||||
|
||||
float4 main( FarFrustumQuadConnectP IN ) : TORQUE_TARGET0
|
||||
struct PS_OUTPUT
|
||||
{
|
||||
float4 spec: TORQUE_TARGET0;
|
||||
float4 diffuse: TORQUE_TARGET1;
|
||||
};
|
||||
|
||||
PS_OUTPUT main(FarFrustumQuadConnectP IN)
|
||||
{
|
||||
PS_OUTPUT Output = (PS_OUTPUT)0;
|
||||
// Matinfo flags
|
||||
float4 matInfo = TORQUE_TEX2D( matInfoBuffer, IN.uv0 );
|
||||
//early out if emissive
|
||||
bool emissive = getFlag(matInfo.r, 0);
|
||||
if (emissive)
|
||||
{
|
||||
return float4(0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
float4 colorSample = TORQUE_TEX2D( colorBuffer, IN.uv0 );
|
||||
float3 subsurface = float3(0.0,0.0,0.0);
|
||||
if (getFlag( matInfo.r, 1 ))
|
||||
float4 matInfo = TORQUE_TEX2D(matInfoBuffer, IN.uv0);
|
||||
|
||||
float4 colorSample = TORQUE_TEX2D(colorBuffer, IN.uv0);
|
||||
float3 subsurface = float3(0.0, 0.0, 0.0);
|
||||
if (getFlag(matInfo.r, 1))
|
||||
{
|
||||
subsurface = colorSample.rgb;
|
||||
if (colorSample.r>colorSample.g)
|
||||
if (colorSample.r > colorSample.g)
|
||||
subsurface = float3(0.772549, 0.337255, 0.262745);
|
||||
else
|
||||
subsurface = float3(0.337255, 0.772549, 0.262745);
|
||||
|
|
@ -224,96 +225,97 @@ float4 main( FarFrustumQuadConnectP IN ) : TORQUE_TARGET0
|
|||
// Get the light attenuation.
|
||||
float dotNL = dot(-lightDirection, normal);
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
float3 debugColor = float3(0,0,0);
|
||||
#endif
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
float3 debugColor = float3(0, 0, 0);
|
||||
#endif
|
||||
|
||||
#ifdef NO_SHADOW
|
||||
|
||||
// Fully unshadowed.
|
||||
float shadowed = 1.0;
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
debugColor = float3(1.0, 1.0, 1.0);
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
float4 static_shadowed_colors = AL_VectorLightShadowCast(TORQUE_SAMPLER2D_MAKEARG(shadowMap),
|
||||
IN.uv0.xy,
|
||||
worldToLightProj,
|
||||
worldPos,
|
||||
scaleX, scaleY,
|
||||
offsetX, offsetY,
|
||||
farPlaneScalePSSM,
|
||||
atlasXOffset, atlasYOffset,
|
||||
atlasScale,
|
||||
shadowSoftness,
|
||||
dotNL,
|
||||
overDarkPSSM);
|
||||
float4 dynamic_shadowed_colors = AL_VectorLightShadowCast(TORQUE_SAMPLER2D_MAKEARG(dynamicShadowMap),
|
||||
IN.uv0.xy,
|
||||
dynamicWorldToLightProj,
|
||||
worldPos,
|
||||
dynamicScaleX, dynamicScaleY,
|
||||
dynamicOffsetX, dynamicOffsetY,
|
||||
dynamicFarPlaneScalePSSM,
|
||||
atlasXOffset, atlasYOffset,
|
||||
atlasScale,
|
||||
shadowSoftness,
|
||||
dotNL,
|
||||
overDarkPSSM);
|
||||
|
||||
float static_shadowed = static_shadowed_colors.a;
|
||||
float dynamic_shadowed = dynamic_shadowed_colors.a;
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
debugColor = static_shadowed_colors.rgb*0.5 + dynamic_shadowed_colors.rgb*0.5;
|
||||
#endif
|
||||
|
||||
// Fade out the shadow at the end of the range.
|
||||
float4 zDist = (zNearFarInvNearFar.x + zNearFarInvNearFar.y * depth);
|
||||
float fadeOutAmt = (zDist.x - fadeStartLength.x) * fadeStartLength.y;
|
||||
|
||||
static_shadowed = lerp(static_shadowed, 1.0, saturate(fadeOutAmt));
|
||||
dynamic_shadowed = lerp(dynamic_shadowed, 1.0, saturate(fadeOutAmt));
|
||||
|
||||
// temp for debugging. uncomment one or the other.
|
||||
//float shadowed = static_shadowed;
|
||||
//float shadowed = dynamic_shadowed;
|
||||
float shadowed = min(static_shadowed, dynamic_shadowed);
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
if (fadeOutAmt > 1.0)
|
||||
debugColor = 1.0;
|
||||
#endif
|
||||
|
||||
#endif // !NO_SHADOW
|
||||
|
||||
float3 l = normalize(-lightDirection);
|
||||
float3 v = normalize(eyePosWorld - worldPos.xyz);
|
||||
|
||||
float3 h = normalize(v + l);
|
||||
float dotNLa = clamp(dot(normal, l), 0.0, 1.0);
|
||||
float dotNVa = clamp(dot(normal, v), 0.0, 1.0);
|
||||
float dotNHa = clamp(dot(normal, h), 0.0, 1.0);
|
||||
float dotHVa = clamp(dot(normal, v), 0.0, 1.0);
|
||||
float dotLHa = clamp(dot(l, h), 0.0, 1.0);
|
||||
|
||||
float roughness = matInfo.g;
|
||||
float metalness = matInfo.b;
|
||||
|
||||
//diffuse
|
||||
//float dotNL = clamp(dot(normal,l), 0.0, 1.0);
|
||||
float disDiff = Fr_DisneyDiffuse(dotNVa, dotNLa, dotLHa, roughness);
|
||||
float3 diffuse = float3(disDiff, disDiff, disDiff) / M_PI_F;// alternative: (lightColor * dotNL) / Pi;
|
||||
//specular
|
||||
float3 specular = directSpecular(normal, v, l, roughness, 1.0) * lightColor.rgb;
|
||||
|
||||
#ifdef NO_SHADOW
|
||||
float finalShadowed = shadowed;
|
||||
|
||||
// Fully unshadowed.
|
||||
float shadowed = 1.0;
|
||||
//output
|
||||
Output.diffuse = float4(diffuse * (lightBrightness*shadowed), dotNLa);
|
||||
Output.spec = float4(specular * (lightBrightness*shadowed), dotNLa);
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
debugColor = float3(1.0,1.0,1.0);
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
float4 static_shadowed_colors = AL_VectorLightShadowCast( TORQUE_SAMPLER2D_MAKEARG(shadowMap),
|
||||
IN.uv0.xy,
|
||||
worldToLightProj,
|
||||
worldPos,
|
||||
scaleX, scaleY,
|
||||
offsetX, offsetY,
|
||||
farPlaneScalePSSM,
|
||||
atlasXOffset, atlasYOffset,
|
||||
atlasScale,
|
||||
shadowSoftness,
|
||||
dotNL,
|
||||
overDarkPSSM);
|
||||
float4 dynamic_shadowed_colors = AL_VectorLightShadowCast( TORQUE_SAMPLER2D_MAKEARG(dynamicShadowMap),
|
||||
IN.uv0.xy,
|
||||
dynamicWorldToLightProj,
|
||||
worldPos,
|
||||
dynamicScaleX, dynamicScaleY,
|
||||
dynamicOffsetX, dynamicOffsetY,
|
||||
dynamicFarPlaneScalePSSM,
|
||||
atlasXOffset, atlasYOffset,
|
||||
atlasScale,
|
||||
shadowSoftness,
|
||||
dotNL,
|
||||
overDarkPSSM);
|
||||
|
||||
float static_shadowed = static_shadowed_colors.a;
|
||||
float dynamic_shadowed = dynamic_shadowed_colors.a;
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
debugColor = static_shadowed_colors.rgb*0.5+dynamic_shadowed_colors.rgb*0.5;
|
||||
#endif
|
||||
|
||||
// Fade out the shadow at the end of the range.
|
||||
float4 zDist = (zNearFarInvNearFar.x + zNearFarInvNearFar.y * depth);
|
||||
float fadeOutAmt = ( zDist.x - fadeStartLength.x ) * fadeStartLength.y;
|
||||
|
||||
static_shadowed = lerp( static_shadowed, 1.0, saturate( fadeOutAmt ) );
|
||||
dynamic_shadowed = lerp( dynamic_shadowed, 1.0, saturate( fadeOutAmt ) );
|
||||
|
||||
// temp for debugging. uncomment one or the other.
|
||||
//float shadowed = static_shadowed;
|
||||
//float shadowed = dynamic_shadowed;
|
||||
float shadowed = min(static_shadowed, dynamic_shadowed);
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
if ( fadeOutAmt > 1.0 )
|
||||
debugColor = 1.0;
|
||||
#endif
|
||||
|
||||
#endif // !NO_SHADOW
|
||||
|
||||
// Specular term
|
||||
float3 viewSpacePos = IN.vsEyeRay * depth;
|
||||
float4 real_specular = EvalBDRF( float3( 1.0, 1.0, 1.0 ),
|
||||
lightColor.rgb,
|
||||
normalize( -lightDirection ),
|
||||
viewSpacePos,
|
||||
normal,
|
||||
1.0-matInfo.b,
|
||||
matInfo.a );
|
||||
float3 lightColorOut = real_specular.rgb * lightBrightness * shadowed;
|
||||
|
||||
float Sat_NL_Att = saturate( dotNL * shadowed ) * lightBrightness;
|
||||
float Sat_NdotV = saturate(dot(normalize(-IN.vsEyeRay), normal));
|
||||
float4 addToResult = ( lightAmbient * (1 - ambientCameraFactor)) + ( lightAmbient * ambientCameraFactor * Sat_NdotV );
|
||||
|
||||
// Sample the AO texture.
|
||||
#ifdef USE_SSAO_MASK
|
||||
float ao = 1.0 - TORQUE_TEX2D( ssaoMask, viewportCoordToRenderTarget( IN.uv0.xy, rtParams3 ) ).r;
|
||||
addToResult *= ao;
|
||||
#endif
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
lightColorOut = debugColor;
|
||||
#endif
|
||||
|
||||
return float4(matInfo.g*(lightColorOut*Sat_NL_Att+subsurface*(1.0-Sat_NL_Att)+addToResult.rgb),real_specular.a);
|
||||
return Output;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,15 +55,16 @@ float3 Uncharted2Tonemap(const float3 x)
|
|||
return ((x*(A*x + C*B) + D*E) / (x*(A*x + B) + D*F)) - E / F;
|
||||
}
|
||||
|
||||
float3 tonemap(float3 c)
|
||||
float3 tonemap(float3 color)
|
||||
{
|
||||
const float W = 11.2;
|
||||
float ExposureBias = 2.0f;
|
||||
float ExposureAdjust = 1.5f;
|
||||
c *= ExposureAdjust;
|
||||
float3 curr = Uncharted2Tonemap(ExposureBias*c);
|
||||
float3 whiteScale = 1.0f / Uncharted2Tonemap(W);
|
||||
return curr*whiteScale;
|
||||
//float ExposureAdjust = 1.5f;
|
||||
//c *= ExposureAdjust;
|
||||
color = Uncharted2Tonemap(ExposureBias*color);
|
||||
color = color * (1.0f / Uncharted2Tonemap(W));
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
||||
|
|
@ -100,5 +101,7 @@ float4 main( PFXVertToPix IN ) : TORQUE_TARGET0
|
|||
sample.g = TORQUE_TEX1D( colorCorrectionTex, sample.g ).g;
|
||||
sample.b = TORQUE_TEX1D( colorCorrectionTex, sample.b ).b;
|
||||
|
||||
sample = float4(tonemap(sample.rgb),1);
|
||||
|
||||
return sample;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,29 @@ uniform float Contrast;
|
|||
|
||||
out vec4 OUT_col;
|
||||
|
||||
// uncharted 2 tonemapper see: http://filmicgames.com/archives/75
|
||||
vec3 Uncharted2Tonemap(vec3 x)
|
||||
{
|
||||
const float A = 0.15;
|
||||
const float B = 0.50;
|
||||
const float C = 0.10;
|
||||
const float D = 0.20;
|
||||
const float E = 0.02;
|
||||
const float F = 0.30;
|
||||
return ((x*(A*x + C*B) + D*E) / (x*(A*x + B) + D*F)) - E / F;
|
||||
}
|
||||
|
||||
vec3 tonemap(vec3 c)
|
||||
{
|
||||
const float W = 11.2;
|
||||
float ExposureBias = 2.0f;
|
||||
float ExposureAdjust = 1.5f;
|
||||
c *= ExposureAdjust;
|
||||
vec3 curr = Uncharted2Tonemap(ExposureBias*c);
|
||||
vec3 whiteScale = 1.0f / Uncharted2Tonemap(vec3(W,W,W));
|
||||
return curr*whiteScale;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 _sample = hdrDecode( texture( sceneTex, IN_uv0 ) );
|
||||
|
|
@ -76,17 +99,6 @@ void main()
|
|||
|
||||
// Add the bloom effect.
|
||||
_sample += g_fBloomScale * bloom;
|
||||
|
||||
// Map the high range of color values into a range appropriate for
|
||||
// display, taking into account the user's adaptation level,
|
||||
// white point, and selected value for for middle gray.
|
||||
if ( g_fEnableToneMapping > 0.0f )
|
||||
{
|
||||
float Lp = (g_fMiddleGray / (adaptedLum + 0.0001)) * hdrLuminance( _sample.rgb );
|
||||
//float toneScalar = ( Lp * ( 1.0 + ( Lp / ( g_fWhiteCutoff ) ) ) ) / ( 1.0 + Lp );
|
||||
float toneScalar = Lp;
|
||||
_sample.rgb = mix( _sample.rgb, _sample.rgb * toneScalar, g_fEnableToneMapping );
|
||||
}
|
||||
|
||||
// Apply the color correction.
|
||||
_sample.r = texture( colorCorrectionTex, _sample.r ).r;
|
||||
|
|
|
|||
|
|
@ -310,4 +310,38 @@ float3 simpleFresnel(float3 diffuseColor, float3 reflectColor, float metalness,
|
|||
|
||||
return lerp(diffuseColor, reflectColor, fresnelTerm);
|
||||
}
|
||||
|
||||
//hlsl version of the glsl funcion mod - note hlsl fmod is different
|
||||
#define mod(x,y) (x-y*floor(x/y))
|
||||
|
||||
//get direction for a cube face
|
||||
float3 getCubeDir(int face, float2 uv)
|
||||
{
|
||||
float2 debiased = uv * 2.0f - 1.0f;
|
||||
|
||||
float3 dir = 0;
|
||||
|
||||
switch (face)
|
||||
{
|
||||
case 0: dir = float3(1, -debiased.y, -debiased.x);
|
||||
break;
|
||||
|
||||
case 1: dir = float3(-1, -debiased.y, debiased.x);
|
||||
break;
|
||||
|
||||
case 2: dir = float3(debiased.x, 1, debiased.y);
|
||||
break;
|
||||
|
||||
case 3: dir = float3(debiased.x, -1, -debiased.y);
|
||||
break;
|
||||
|
||||
case 4: dir = float3(debiased.x, -debiased.y, 1);
|
||||
break;
|
||||
|
||||
case 5: dir = float3(-debiased.x, -debiased.y, -1);
|
||||
break;
|
||||
};
|
||||
|
||||
return normalize(dir);
|
||||
}
|
||||
#endif // _TORQUE_HLSL_
|
||||
|
|
|
|||
|
|
@ -120,7 +120,6 @@ void main()
|
|||
{
|
||||
// Modulate baseColor by the ambientColor.
|
||||
vec4 waterBaseColor = baseColor * vec4( ambientColor.rgb, 1 );
|
||||
waterBaseColor = waterBaseColor;
|
||||
|
||||
// Get the bumpNorm...
|
||||
vec3 bumpNorm = ( texture( bumpMap, IN_rippleTexCoord01.xy ).rgb * 2.0 - 1.0 ) * rippleMagnitude.x;
|
||||
|
|
|
|||
|
|
@ -324,7 +324,6 @@ void main()
|
|||
|
||||
// Calculate the water "base" color based on depth.
|
||||
vec4 waterBaseColor = baseColor * texture( depthGradMap, saturate( delta / depthGradMax ) );
|
||||
waterBaseColor = waterBaseColor;
|
||||
|
||||
// Modulate baseColor by the ambientColor.
|
||||
waterBaseColor *= vec4( ambientColor.rgb, 1 );
|
||||
|
|
|
|||
1
Templates/Full/game/shaders/procedural/.gitignore
vendored
Normal file
1
Templates/Full/game/shaders/procedural/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/procedural/
|
||||
115
Templates/Full/game/tools/resources/ReflectProbeSphere.dae
Normal file
115
Templates/Full/game/tools/resources/ReflectProbeSphere.dae
Normal file
File diff suppressed because one or more lines are too long
8
Templates/Full/game/tools/resources/materials.cs
Normal file
8
Templates/Full/game/tools/resources/materials.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
singleton Material(ReflectProbePreviewMat)
|
||||
{
|
||||
mapTo = "ReflectProbePreviewMat";
|
||||
diffuseColor[0] = "1 1 1 1";
|
||||
smoothness[0] = "1";
|
||||
metalness[0] = "1";
|
||||
translucentBlendOp = "None";
|
||||
};
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
#include "shaders/common/shaderModelAutoGen.hlsl"
|
||||
|
||||
#include "shaders/common/lighting/advanced/farFrustumQuad.hlsl"
|
||||
#include "shaders/common/lighting/advanced/lightingUtils.hlsl"
|
||||
#include "shaders/common/lighting.hlsl"
|
||||
#include "shaders/common/torque.hlsl"
|
||||
|
||||
struct ConvexConnectP
|
||||
{
|
||||
float4 pos : TORQUE_POSITION;
|
||||
float4 wsEyeDir : TEXCOORD0;
|
||||
float4 ssPos : TEXCOORD1;
|
||||
float4 vsEyeDir : TEXCOORD2;
|
||||
};
|
||||
|
||||
TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0);
|
||||
TORQUE_UNIFORM_SAMPLERCUBE(cubeMap, 1);
|
||||
|
||||
uniform float4 rtParams0;
|
||||
|
||||
uniform float4x4 invViewMat;
|
||||
|
||||
float4 main( ConvexConnectP IN ) : TORQUE_TARGET0
|
||||
{
|
||||
// Compute scene UV
|
||||
float3 ssPos = IN.ssPos.xyz / IN.ssPos.w;
|
||||
float2 uvScene = getUVFromSSPos( ssPos, rtParams0 );
|
||||
|
||||
//float3 eyeRay = IN.vsEyeDir.xyz;
|
||||
|
||||
// Sample/unpack the normal/z data
|
||||
float4 deferredSample = TORQUE_DEFERRED_UNCONDITION( deferredBuffer, uvScene );
|
||||
float3 normal = deferredSample.rgb;
|
||||
float depth = deferredSample.a;
|
||||
if (depth>0.9999)
|
||||
return float4(0,0,0,0);
|
||||
|
||||
// Need world-space normal.
|
||||
float3 wsNormal = mul(float4(normal, 1), invViewMat).rgb;
|
||||
|
||||
float3 reflectionVec = reflect(IN.wsEyeDir, float4(normalize(wsNormal),1)).rgb;
|
||||
|
||||
float4 color = TORQUE_TEXCUBE(cubeMap, reflectionVec);
|
||||
|
||||
//simple visibility testing
|
||||
//float4 color = float4(1,0,0,1);
|
||||
|
||||
return float4(color.rgb, 1);
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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 "shaders/common/hlslStructs.hlsl"
|
||||
#include "shaders/common/shaderModel.hlsl"
|
||||
|
||||
struct VertData
|
||||
{
|
||||
float3 pos : POSITION;
|
||||
float tangentW : TEXCOORD3;
|
||||
float3 normal : NORMAL;
|
||||
float3 T : TANGENT;
|
||||
float2 texCoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct ConvexConnectV
|
||||
{
|
||||
float4 hpos : TORQUE_POSITION;
|
||||
float4 wsEyeDir : TEXCOORD0;
|
||||
float4 ssPos : TEXCOORD1;
|
||||
float4 vsEyeDir : TEXCOORD2;
|
||||
};
|
||||
|
||||
uniform float4x4 modelview;
|
||||
uniform float4x4 objTrans;
|
||||
uniform float4x4 worldViewOnly;
|
||||
uniform float3 eyePosWorld;
|
||||
|
||||
ConvexConnectV main( VertData IN )
|
||||
{
|
||||
ConvexConnectV OUT;
|
||||
|
||||
OUT.hpos = mul( modelview, float4(IN.pos,1.0) );
|
||||
OUT.wsEyeDir = mul(objTrans, float4(IN.pos, 1.0)) - float4(eyePosWorld, 0.0);
|
||||
OUT.vsEyeDir = mul(worldViewOnly, float4(IN.pos, 1.0));
|
||||
OUT.ssPos = OUT.hpos;
|
||||
|
||||
return OUT;
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -877,6 +877,24 @@ function ObjectBuilderGui::buildParticleSimulation(%this)
|
|||
%this.process();
|
||||
}
|
||||
|
||||
function ObjectBuilderGui::buildReflectionProbe(%this)
|
||||
{
|
||||
%this.objectClassName = "ReflectionProbe";
|
||||
%this.process();
|
||||
|
||||
%defaultPath = filePath($Server::MissionFile) @ "/" @ fileBase($Server::MissionFile) @ "/probes/";
|
||||
%this.addField("reflectionPath", "TypeFilepath", "reflectionPath", %defaultPath);
|
||||
}
|
||||
|
||||
function ObjectBuilderGui::buildSkylight(%this)
|
||||
{
|
||||
%this.objectClassName = "Skylight";
|
||||
%this.process();
|
||||
|
||||
%defaultPath = filePath($Server::MissionFile) @ "/" @ fileBase($Server::MissionFile) @ "/probes/";
|
||||
%this.addField("reflectionPath", "TypeFilepath", "reflectionPath", %defaultPath);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Mission
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
|
|||
192
Templates/Full/game/tools/worldEditor/gui/probeBakeDlg.gui
Normal file
192
Templates/Full/game/tools/worldEditor/gui/probeBakeDlg.gui
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
//--- OBJECT WRITE BEGIN ---
|
||||
%guiContent = new GuiControl(ProbeBakeDlg) {
|
||||
position = "0 0";
|
||||
extent = "1024 768";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiDefaultProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "1";
|
||||
|
||||
new GuiWindowCtrl() {
|
||||
text = "Update Environment Probes";
|
||||
resizeWidth = "0";
|
||||
resizeHeight = "0";
|
||||
canMove = "1";
|
||||
canClose = "1";
|
||||
canMinimize = "0";
|
||||
canMaximize = "0";
|
||||
canCollapse = "0";
|
||||
closeCommand = "Canvas.popDialog(ProbeBakeDlg);";
|
||||
edgeSnap = "0";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "392 314";
|
||||
extent = "270 164";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiWindowProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiTextCtrl() {
|
||||
text = "Probe Resolution";
|
||||
maxLength = "1024";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "11 32";
|
||||
extent = "91 13";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiTextProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiPopUpMenuCtrl(ProbeBakeDlg_ProbeResList) {
|
||||
maxPopupHeight = "200";
|
||||
sbUsesNAColor = "0";
|
||||
reverseTextList = "0";
|
||||
bitmapBounds = "16 16";
|
||||
text = "64";
|
||||
maxLength = "1024";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "103 29";
|
||||
extent = "157 19";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiPopUpMenuProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextCtrl() {
|
||||
text = "Number of bake iterations";
|
||||
maxLength = "1024";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "11 56";
|
||||
extent = "129 13";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiTextProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiTextEditCtrl(ProbeBakeDlg_NumIterTxt) {
|
||||
historySize = "0";
|
||||
tabComplete = "0";
|
||||
sinkAllKeyEvents = "0";
|
||||
password = "0";
|
||||
passwordMask = "*";
|
||||
text = "1";
|
||||
maxLength = "1024";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "150 53";
|
||||
extent = "108 18";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiTextEditProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiButtonCtrl(ProbeBakeDlg_RunBake) {
|
||||
text = "Update Probes";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
position = "68 120";
|
||||
extent = "140 30";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiButtonProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiProgressCtrl(ProbeBakeDlg_Progress) {
|
||||
maxLength = "1024";
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
anchorBottom = "0";
|
||||
anchorLeft = "1";
|
||||
anchorRight = "0";
|
||||
position = "8 80";
|
||||
extent = "251 25";
|
||||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "GuiProgressProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "GuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
|
@ -43,6 +43,7 @@ function initializeWorldEditor()
|
|||
exec("./gui/AddFMODProjectDlg.ed.gui");
|
||||
exec("./gui/SelectObjectsWindow.ed.gui");
|
||||
exec("./gui/ProceduralTerrainPainterGui.gui" );
|
||||
exec("./gui/probeBakeDlg.gui" );
|
||||
|
||||
// Load Scripts.
|
||||
exec("./scripts/menus.ed.cs");
|
||||
|
|
@ -61,6 +62,7 @@ function initializeWorldEditor()
|
|||
exec("./scripts/ManageSFXParametersWindow.ed.cs");
|
||||
exec("./scripts/AddFMODProjectDlg.ed.cs");
|
||||
exec("./scripts/SelectObjectsWindow.ed.cs");
|
||||
exec("./scripts/probeBake.ed.cs");
|
||||
|
||||
// Load Custom Editors
|
||||
loadDirectory(expandFilename("./scripts/editors"));
|
||||
|
|
@ -115,10 +117,11 @@ function initializeWorldEditor()
|
|||
EVisibility.addOption( "Debug Render: Light Frustums", "$Light::renderLightFrustums", "" );
|
||||
EVisibility.addOption( "Debug Render: Bounding Boxes", "$Scene::renderBoundingBoxes", "" );
|
||||
EVisibility.addOption( "Debug Render: Physics World", "$PhysicsWorld::render", "togglePhysicsDebugViz" );
|
||||
EVisibility.addOption( "Debug Render: Reflection Probes", "$Light::renderReflectionProbes", "" );
|
||||
EVisibility.addOption( "Debug Render: Probe Previews", "$Light::renderPreviewProbes", "" );
|
||||
EVisibility.addOption( "AL: Disable Shadows", "$Shadows::disable", "" );
|
||||
EVisibility.addOption( "AL: Light Color Viz", "$AL_LightColorVisualizeVar", "toggleLightColorViz" );
|
||||
EVisibility.addOption( "AL: Environment Light", "$AL_LightMapShaderVar", "toggleLightMapViz" );
|
||||
EVisibility.addOption( "AL: Light Specular Viz", "$AL_LightSpecularVisualizeVar", "toggleLightSpecularViz" );
|
||||
EVisibility.addOption( "AL: Diffuse Lighting Viz", "$AL_LightColorVisualizeVar", "toggleLightColorViz" );
|
||||
EVisibility.addOption( "AL: Specular Lighting Viz", "$AL_LightSpecularVisualizeVar", "toggleLightSpecularViz" );
|
||||
EVisibility.addOption( "AL: Normals Viz", "$AL_NormalsVisualizeVar", "toggleNormalsViz" );
|
||||
EVisibility.addOption( "AL: Depth Viz", "$AL_DepthVisualizeVar", "toggleDepthViz" );
|
||||
EVisibility.addOption( "AL: Color Buffer", "$AL_ColorBufferShaderVar", "toggleColorBufferViz" );
|
||||
|
|
|
|||
|
|
@ -55,6 +55,10 @@ function EWCreatorWindow::init( %this )
|
|||
|
||||
%this.registerMissionObject( "PointLight", "Point Light" );
|
||||
%this.registerMissionObject( "SpotLight", "Spot Light" );
|
||||
|
||||
%this.registerMissionObject( "ReflectionProbe", "Reflection Probe" );
|
||||
%this.registerMissionObject( "Skylight", "Skylight" );
|
||||
|
||||
%this.registerMissionObject( "GroundCover", "Ground Cover" );
|
||||
%this.registerMissionObject( "TerrainBlock", "Terrain Block" );
|
||||
%this.registerMissionObject( "GroundPlane", "Ground Plane" );
|
||||
|
|
|
|||
|
|
@ -294,6 +294,28 @@ function TerrainMaterialDlg::changeNormal( %this )
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function TerrainMaterialDlg::changecomposite( %this )
|
||||
{
|
||||
%ctrl = %this-->compositeTexCtrl;
|
||||
%file = %ctrl.bitmap;
|
||||
if( getSubStr( %file, 0 , 6 ) $= "tools/" )
|
||||
%file = "";
|
||||
|
||||
%file = TerrainMaterialDlg._selectTextureFileDialog( %file );
|
||||
if( %file $= "" )
|
||||
{
|
||||
if( %ctrl.bitmap !$= "" )
|
||||
%file = %ctrl.bitmap;
|
||||
else
|
||||
%file = "tools/materialEditor/gui/unknownImage";
|
||||
}
|
||||
|
||||
%file = makeRelativePath( %file, getMainDotCsDir() );
|
||||
%ctrl.setBitmap( %file );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function TerrainMaterialDlg::newMat( %this )
|
||||
{
|
||||
// Create a unique material name.
|
||||
|
|
@ -394,7 +416,12 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat )
|
|||
%this-->normTexCtrl.setBitmap( "tools/materialEditor/gui/unknownImage" );
|
||||
}else{
|
||||
%this-->normTexCtrl.setBitmap( %mat.normalMap );
|
||||
}
|
||||
}
|
||||
if (%mat.compositeMap $= ""){
|
||||
%this-->compositeTexCtrl.setBitmap( "tools/materialEditor/gui/unknownImage" );
|
||||
}else{
|
||||
%this-->compositeTexCtrl.setBitmap( %mat.compositeMap );
|
||||
}
|
||||
%this-->detSizeCtrl.setText( %mat.detailSize );
|
||||
%this-->baseSizeCtrl.setText( %mat.diffuseSize );
|
||||
%this-->detStrengthCtrl.setText( %mat.detailStrength );
|
||||
|
|
@ -448,6 +475,11 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
|
|||
}else{
|
||||
%newMacro = %this-->macroTexCtrl.bitmap;
|
||||
}
|
||||
if (%this-->compositeTexCtrl.bitmap $= "tools/materialEditor/gui/unknownImage"){
|
||||
%newComposite = "";
|
||||
}else{
|
||||
%newComposite = %this-->compositeTexCtrl.bitmap;
|
||||
}
|
||||
%detailSize = %this-->detSizeCtrl.getText();
|
||||
%diffuseSize = %this-->baseSizeCtrl.getText();
|
||||
%detailStrength = %this-->detStrengthCtrl.getText();
|
||||
|
|
@ -466,6 +498,7 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
|
|||
%mat.diffuseMap $= %newDiffuse &&
|
||||
%mat.normalMap $= %newNormal &&
|
||||
%mat.detailMap $= %newDetail &&
|
||||
%mat.compositeMap $= %newComposite &&
|
||||
%mat.macroMap $= %newMacro &&
|
||||
%mat.detailSize == %detailSize &&
|
||||
%mat.diffuseSize == %diffuseSize &&
|
||||
|
|
@ -497,7 +530,8 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
|
|||
}
|
||||
|
||||
%mat.diffuseMap = %newDiffuse;
|
||||
%mat.normalMap = %newNormal;
|
||||
%mat.normalMap = %newNormal;
|
||||
%mat.compositeMap = %newComposite;
|
||||
%mat.detailMap = %newDetail;
|
||||
%mat.macroMap = %newMacro;
|
||||
%mat.detailSize = %detailSize;
|
||||
|
|
@ -544,6 +578,7 @@ function TerrainMaterialDlg::snapshotMaterials( %this )
|
|||
diffuseMap = %mat.diffuseMap;
|
||||
normalMap = %mat.normalMap;
|
||||
detailMap = %mat.detailMap;
|
||||
compositeMap = %mat.compositeMap;
|
||||
macroMap = %mat.macroMap;
|
||||
detailSize = %mat.detailSize;
|
||||
diffuseSize = %mat.diffuseSize;
|
||||
|
|
@ -578,6 +613,7 @@ function TerrainMaterialDlg::restoreMaterials( %this )
|
|||
%mat.diffuseMap = %obj.diffuseMap;
|
||||
%mat.normalMap = %obj.normalMap;
|
||||
%mat.detailMap = %obj.detailMap;
|
||||
%mat.compositeMap = %obj.compositeMap;
|
||||
%mat.macroMap = %obj.macroMap;
|
||||
%mat.detailSize = %obj.detailSize;
|
||||
%mat.diffuseSize = %obj.diffuseSize;
|
||||
|
|
|
|||
|
|
@ -61,3 +61,21 @@ function EditorLightingMenu::onMenuSelect( %this )
|
|||
//%selSize = EWorldEditor.getSelectionSize();
|
||||
%this.enableItem( 1, true /*%selSize == 1*/ );
|
||||
}
|
||||
|
||||
function updateReflectionProbes()
|
||||
{
|
||||
/*%probeIds = parseMissionGroupForIds("ReflectionProbe", "");
|
||||
%probeCount = getWordCount(%probeIds);
|
||||
|
||||
for(%i=0; %i < %probeCount; %i++)
|
||||
{
|
||||
%probe = getWord(%probeIds, %i);
|
||||
|
||||
%path = filePath($Server::MissionFile) @ "/" @ fileBase($Server::MissionFile) @ "/probes/";
|
||||
%probe.bake(%path, 64);
|
||||
}
|
||||
|
||||
EWorldEditor.isDirty = true;*/
|
||||
|
||||
Canvas.pushDialog(ProbeBakeDlg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -263,6 +263,8 @@ function EditorGui::buildMenus(%this)
|
|||
item[0] = "Full Relight" TAB "Alt L" TAB "Editor.lightScene(\"\", forceAlways);";
|
||||
item[1] = "Toggle ShadowViz" TAB "" TAB "toggleShadowViz();";
|
||||
item[2] = "-";
|
||||
item[3] = "Update Reflection Probes" TAB "" TAB "updateReflectionProbes();";
|
||||
item[4] = "-";
|
||||
|
||||
// NOTE: The light managers will be inserted as the
|
||||
// last menu items in EditorLightingMenu::onAdd().
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
function ProbeBakeDlg::onWake(%this)
|
||||
{
|
||||
//set up
|
||||
ProbeBakeDlg_ProbeResList.add( "32" );
|
||||
ProbeBakeDlg_ProbeResList.add( "64" );
|
||||
ProbeBakeDlg_ProbeResList.add( "128" );
|
||||
ProbeBakeDlg_ProbeResList.add( "256" );
|
||||
ProbeBakeDlg_ProbeResList.add( "512" );
|
||||
ProbeBakeDlg_ProbeResList.add( "1024" );
|
||||
ProbeBakeDlg_ProbeResList.add( "2048" );
|
||||
|
||||
ProbeBakeDlg_ProbeResList.setSelected( 1, false );
|
||||
|
||||
ProbeBakeDlg_NumIterTxt.setText("1");
|
||||
}
|
||||
|
||||
function ProbeBakeDlg_RunBake::onClick(%this)
|
||||
{
|
||||
%probeIds = parseMissionGroupForIds("ReflectionProbe", "");
|
||||
%skylightIds = parseMissionGroupForIds("Skylight", "");
|
||||
|
||||
%probeIds = rtrim(ltrim(%probeIds SPC %skylightIds));
|
||||
%probeCount = getWordCount(%probeIds);
|
||||
|
||||
%numIter = ProbeBakeDlg_NumIterTxt.getText();
|
||||
%resolution = ProbeBakeDlg_ProbeResList.getText();
|
||||
%progressStep = 100 / (%numIter * %probeCount);
|
||||
%currentProgressValue = 0;
|
||||
|
||||
ProbeBakeDlg_Progress.setValue(%currentProgressValue);
|
||||
|
||||
for(%iter=0; %iter < %numIter; %iter++)
|
||||
{
|
||||
for(%i=0; %i < %probeCount; %i++)
|
||||
{
|
||||
%probe = getWord(%probeIds, %i);
|
||||
|
||||
%path = filePath($Server::MissionFile) @ "/" @ fileBase($Server::MissionFile) @ "/probes/";
|
||||
%probe.bake(%path, %resolution);
|
||||
|
||||
%currentProgressValue += %progressStep;
|
||||
ProbeBakeDlg_Progress.setValue(%currentProgressValue);
|
||||
Canvas.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
EWorldEditor.isDirty = true;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue