mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Merge branch 'Preview4_0' of https://github.com/TorqueGameEngines/Torque3D into Preview4_0
This commit is contained in:
commit
6a357d8dfb
1537 changed files with 173488 additions and 37732 deletions
|
|
@ -38,3 +38,10 @@ function ServerPlay3D(%profile,%transform)
|
|||
ClientGroup.getObject(%idx).play3D(%profile,%transform);
|
||||
}
|
||||
|
||||
function ServerPlaySound(%profile,%pos)
|
||||
{
|
||||
// Play the given sound profile at the given position on every client
|
||||
// The sound will be transmitted as an event, not attached to any object.
|
||||
for(%idx = 0; %idx < ClientGroup.getCount(); %idx++)
|
||||
commandToClient(ClientGroup.getObject(%idx), 'PlaySound',%profile, %pos);
|
||||
}
|
||||
|
|
@ -66,7 +66,7 @@ $guiContent = new GuiControl(ConsoleDlg) {
|
|||
canSaveDynamicFields = "0";
|
||||
|
||||
new GuiBitmapCtrl() {
|
||||
bitmap = "data/ui/art/hudfill.png";
|
||||
bitmapAsset = "Core_GUI:hudFill";
|
||||
color = "255 255 255 255";
|
||||
wrap = "0";
|
||||
position = "0 0";
|
||||
|
|
|
|||
|
|
@ -50,11 +50,13 @@ new GuiControlProfile(GuiConsoleTextProfile)
|
|||
category = "Core";
|
||||
};
|
||||
|
||||
$ConsoleDefaultFillColor = "0 0 0 175";
|
||||
|
||||
if(!isObject(ConsoleScrollProfile))
|
||||
new GuiControlProfile(ConsoleScrollProfile : GuiScrollProfile)
|
||||
{
|
||||
opaque = true;
|
||||
fillColor = "0 0 0 175";
|
||||
fillColor = $ConsoleDefaultFillColor;
|
||||
border = 1;
|
||||
//borderThickness = 0;
|
||||
borderColor = "0 0 0";
|
||||
|
|
|
|||
|
|
@ -1,6 +1 @@
|
|||
<ShapeAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="Camera"
|
||||
fileName="@assetFile=camera.dts"
|
||||
constuctorFileName="@assetFile=camera.tscript" />
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
<MaterialAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="Green"
|
||||
scriptFile="@assetFile=green"
|
||||
materialDefinitionName="Green"
|
||||
originalFilePath="D:/Gamedev/Projects/Catographer/GameBuild/Templates/BaseGame/game/core/gameObjects/shapes/green" />
|
||||
|
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 142 B |
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
singleton TSShapeConstructor(cameradts)
|
||||
singleton TSShapeConstructor(cameradts2)
|
||||
{
|
||||
baseShapeAsset = "Core_GameObjects:Camera";
|
||||
singleDetailSize = "0";
|
||||
|
|
|
|||
196
Templates/BaseGame/game/core/gameObjects/shapes/green.tscript
Normal file
196
Templates/BaseGame/game/core/gameObjects/shapes/green.tscript
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
//--- OBJECT WRITE BEGIN ---
|
||||
new Material(OctahedronMat) {
|
||||
mapTo = "green";
|
||||
diffuseColor[0] = "0 1 0 1";
|
||||
diffuseColor[1] = "1 1 1 1";
|
||||
diffuseColor[2] = "1 1 1 1";
|
||||
diffuseColor[3] = "1 1 1 1";
|
||||
DiffuseMap[0] = "core/gameObjects/images/camera";
|
||||
diffuseMapSRGB[0] = "1";
|
||||
diffuseMapSRGB[1] = "1";
|
||||
diffuseMapSRGB[2] = "1";
|
||||
diffuseMapSRGB[3] = "1";
|
||||
detailScale[0] = "2 2";
|
||||
detailScale[1] = "2 2";
|
||||
detailScale[2] = "2 2";
|
||||
detailScale[3] = "2 2";
|
||||
detailNormalMapStrength[0] = "1";
|
||||
detailNormalMapStrength[1] = "1";
|
||||
detailNormalMapStrength[2] = "1";
|
||||
detailNormalMapStrength[3] = "1";
|
||||
roughness[0] = "1";
|
||||
roughness[1] = "1";
|
||||
roughness[2] = "1";
|
||||
roughness[3] = "1";
|
||||
metalness[0] = "0";
|
||||
metalness[1] = "0";
|
||||
metalness[2] = "0";
|
||||
metalness[3] = "0";
|
||||
glowMul[0] = "0";
|
||||
glowMul[1] = "0";
|
||||
glowMul[2] = "0";
|
||||
glowMul[3] = "0";
|
||||
accuEnabled[0] = "0";
|
||||
accuEnabled[1] = "0";
|
||||
accuEnabled[2] = "0";
|
||||
accuEnabled[3] = "0";
|
||||
accuScale[0] = "1";
|
||||
accuScale[1] = "1";
|
||||
accuScale[2] = "1";
|
||||
accuScale[3] = "1";
|
||||
accuDirection[0] = "1";
|
||||
accuDirection[1] = "1";
|
||||
accuDirection[2] = "1";
|
||||
accuDirection[3] = "1";
|
||||
accuStrength[0] = "0.6";
|
||||
accuStrength[1] = "0.6";
|
||||
accuStrength[2] = "0.6";
|
||||
accuStrength[3] = "0.6";
|
||||
accuCoverage[0] = "0.9";
|
||||
accuCoverage[1] = "0.9";
|
||||
accuCoverage[2] = "0.9";
|
||||
accuCoverage[3] = "0.9";
|
||||
accuSpecular[0] = "16";
|
||||
accuSpecular[1] = "16";
|
||||
accuSpecular[2] = "16";
|
||||
accuSpecular[3] = "16";
|
||||
isSRGB[0] = "0";
|
||||
isSRGB[1] = "0";
|
||||
isSRGB[2] = "0";
|
||||
isSRGB[3] = "0";
|
||||
invertRoughness[0] = "0";
|
||||
invertRoughness[1] = "0";
|
||||
invertRoughness[2] = "0";
|
||||
invertRoughness[3] = "0";
|
||||
roughnessChan[0] = "0";
|
||||
roughnessChan[1] = "0";
|
||||
roughnessChan[2] = "0";
|
||||
roughnessChan[3] = "0";
|
||||
AOChan[0] = "1";
|
||||
AOChan[1] = "1";
|
||||
AOChan[2] = "1";
|
||||
AOChan[3] = "1";
|
||||
metalChan[0] = "2";
|
||||
metalChan[1] = "2";
|
||||
metalChan[2] = "2";
|
||||
metalChan[3] = "2";
|
||||
glow[0] = "0";
|
||||
glow[1] = "0";
|
||||
glow[2] = "0";
|
||||
glow[3] = "0";
|
||||
parallaxScale[0] = "0";
|
||||
parallaxScale[1] = "0";
|
||||
parallaxScale[2] = "0";
|
||||
parallaxScale[3] = "0";
|
||||
useAnisotropic[0] = "1";
|
||||
useAnisotropic[1] = "1";
|
||||
useAnisotropic[2] = "1";
|
||||
useAnisotropic[3] = "1";
|
||||
vertLit[0] = "0";
|
||||
vertLit[1] = "0";
|
||||
vertLit[2] = "0";
|
||||
vertLit[3] = "0";
|
||||
vertColor[0] = "0";
|
||||
vertColor[1] = "0";
|
||||
vertColor[2] = "0";
|
||||
vertColor[3] = "0";
|
||||
minnaertConstant[0] = "-1";
|
||||
minnaertConstant[1] = "-1";
|
||||
minnaertConstant[2] = "-1";
|
||||
minnaertConstant[3] = "-1";
|
||||
subSurface[0] = "0";
|
||||
subSurface[1] = "0";
|
||||
subSurface[2] = "0";
|
||||
subSurface[3] = "0";
|
||||
subSurfaceColor[0] = "1 0.2 0.2 1";
|
||||
subSurfaceColor[1] = "1 0.2 0.2 1";
|
||||
subSurfaceColor[2] = "1 0.2 0.2 1";
|
||||
subSurfaceColor[3] = "1 0.2 0.2 1";
|
||||
subSurfaceRolloff[0] = "0.2";
|
||||
subSurfaceRolloff[1] = "0.2";
|
||||
subSurfaceRolloff[2] = "0.2";
|
||||
subSurfaceRolloff[3] = "0.2";
|
||||
emissive[0] = "0";
|
||||
emissive[1] = "0";
|
||||
emissive[2] = "0";
|
||||
emissive[3] = "0";
|
||||
foreground[0] = "0";
|
||||
foreground[1] = "0";
|
||||
foreground[2] = "0";
|
||||
foreground[3] = "0";
|
||||
doubleSided = "0";
|
||||
animFlags[0] = "0x00000000";
|
||||
animFlags[1] = "0x00000000";
|
||||
animFlags[2] = "0x00000000";
|
||||
animFlags[3] = "0x00000000";
|
||||
scrollDir[0] = "0 0";
|
||||
scrollDir[1] = "0 0";
|
||||
scrollDir[2] = "0 0";
|
||||
scrollDir[3] = "0 0";
|
||||
scrollSpeed[0] = "0";
|
||||
scrollSpeed[1] = "0";
|
||||
scrollSpeed[2] = "0";
|
||||
scrollSpeed[3] = "0";
|
||||
rotSpeed[0] = "0";
|
||||
rotSpeed[1] = "0";
|
||||
rotSpeed[2] = "0";
|
||||
rotSpeed[3] = "0";
|
||||
rotPivotOffset[0] = "0 0";
|
||||
rotPivotOffset[1] = "0 0";
|
||||
rotPivotOffset[2] = "0 0";
|
||||
rotPivotOffset[3] = "0 0";
|
||||
waveType[0] = "Sin";
|
||||
waveType[1] = "Sin";
|
||||
waveType[2] = "Sin";
|
||||
waveType[3] = "Sin";
|
||||
waveFreq[0] = "0";
|
||||
waveFreq[1] = "0";
|
||||
waveFreq[2] = "0";
|
||||
waveFreq[3] = "0";
|
||||
waveAmp[0] = "0";
|
||||
waveAmp[1] = "0";
|
||||
waveAmp[2] = "0";
|
||||
waveAmp[3] = "0";
|
||||
sequenceFramePerSec[0] = "0";
|
||||
sequenceFramePerSec[1] = "0";
|
||||
sequenceFramePerSec[2] = "0";
|
||||
sequenceFramePerSec[3] = "0";
|
||||
sequenceSegmentSize[0] = "0";
|
||||
sequenceSegmentSize[1] = "0";
|
||||
sequenceSegmentSize[2] = "0";
|
||||
sequenceSegmentSize[3] = "0";
|
||||
cellIndex[0] = "0 0";
|
||||
cellIndex[1] = "0 0";
|
||||
cellIndex[2] = "0 0";
|
||||
cellIndex[3] = "0 0";
|
||||
cellLayout[0] = "0 0";
|
||||
cellLayout[1] = "0 0";
|
||||
cellLayout[2] = "0 0";
|
||||
cellLayout[3] = "0 0";
|
||||
cellSize[0] = "0";
|
||||
cellSize[1] = "0";
|
||||
cellSize[2] = "0";
|
||||
cellSize[3] = "0";
|
||||
bumpAtlas[0] = "0";
|
||||
bumpAtlas[1] = "0";
|
||||
bumpAtlas[2] = "0";
|
||||
bumpAtlas[3] = "0";
|
||||
castShadows = "0";
|
||||
planarReflection = "0";
|
||||
translucent = "1";
|
||||
translucentBlendOp = "PreMul";
|
||||
translucentZWrite = "0";
|
||||
alphaTest = "0";
|
||||
alphaRef = "1";
|
||||
dynamicCubemap = "0";
|
||||
showFootprints = "1";
|
||||
showDust = "0";
|
||||
effectColor[0] = "0 0 0 0";
|
||||
effectColor[1] = "0 0 0 0";
|
||||
footstepSoundId = "-1";
|
||||
impactSoundId = "-1";
|
||||
ImpactFXIndex = "-1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "1";
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
|
@ -55,23 +55,6 @@ singleton Material(CameraMat)
|
|||
};
|
||||
|
||||
//--- camera.dts MATERIALS END ---
|
||||
//--- noshape.dts MATERIALS BEGIN ---
|
||||
singleton Material(noshape_NoShape)
|
||||
{
|
||||
mapTo = "NoShape";
|
||||
|
||||
diffuseMapAsset[0] = "";
|
||||
|
||||
diffuseColor[0] = "0.8 0.003067 0 .8";
|
||||
emissive[0] = 0;
|
||||
|
||||
doubleSided = false;
|
||||
translucent = 1;
|
||||
translucentBlendOp = "LerpAlpha";
|
||||
castShadows = false;
|
||||
};
|
||||
|
||||
//--- noshape.dts MATERIALS END ---
|
||||
|
||||
//--- noshapetext.dae MATERIALS BEGIN ---
|
||||
singleton Material(noshapetext_lambert1)
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
singleton Material( Empty )
|
||||
{
|
||||
};
|
||||
|
||||
singleton Material(WarningMaterial) {
|
||||
detailMapAsset[0] = "Core_PostFX:missingTexture_image";
|
||||
diffuseColor[0] = "25 16 0";
|
||||
emissive[0] = false;
|
||||
translucent = false;
|
||||
};
|
||||
|
|
@ -20,9 +20,9 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../../gl/hlslCompat.glsl"
|
||||
#include "../../../rendering/shaders/gl/hlslCompat.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
#include "../../gl/postFx.glsl"
|
||||
#include "../../../rendering/shaders/postFX/gl/postFx.glsl"
|
||||
|
||||
uniform sampler2D backBuffer; // The original backbuffer.
|
||||
uniform sampler2D deferredTex; // The pre-pass depth and normals.
|
||||
|
|
|
|||
|
|
@ -15,4 +15,6 @@ singleton PostEffect( reflectionProbeArrayPostFX )
|
|||
texture[0] = "#deferred";
|
||||
texture[1] = "#color";
|
||||
texture[2] = "#matinfo";
|
||||
|
||||
allowReflectPass = true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -20,21 +20,21 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
singleton ShaderData( PFX_PassthruShader )
|
||||
{
|
||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/passthruP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/passthruP.glsl";
|
||||
|
||||
samplerNames[0] = "$inputTex";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
function postFXInit()
|
||||
{
|
||||
singleton ShaderData( PFX_PassthruShader )
|
||||
{
|
||||
DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl";
|
||||
DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/passthruP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl";
|
||||
OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/passthruP.glsl";
|
||||
|
||||
samplerNames[0] = "$inputTex";
|
||||
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
|
||||
//Load the core postFX files themselves
|
||||
if (!$Server::Dedicated)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -59,11 +59,11 @@ function Core_Rendering::initClient(%this)
|
|||
|
||||
configureCanvas();
|
||||
|
||||
postFXInit();
|
||||
|
||||
//Autodetect settings if it's our first time
|
||||
if($pref::Video::autoDetect)
|
||||
AutodetectGraphics();
|
||||
|
||||
postFXInit();
|
||||
|
||||
closeSplashWindow();
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
//--- OBJECT WRITE BEGIN ---
|
||||
singleton Material(moon_noglow) {
|
||||
mapTo="moon_noglow";
|
||||
DiffuseMapAsset = "Core_Rendering:moon_noglow_image";
|
||||
emissive = true;
|
||||
translucent = true;
|
||||
vertColor[ 0 ] = true;
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
//--- OBJECT WRITE BEGIN ---
|
||||
singleton Material(moon_wglow) {
|
||||
mapTo="moon_wglow";
|
||||
DiffuseMapAsset = "Core_Rendering:moon_wglow_image";
|
||||
emissive = true;
|
||||
translucent = true;
|
||||
vertColor[ 0 ] = true;
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
|
@ -811,7 +811,7 @@ function AutodetectGraphics_Apply(%shaderVer, %intel, %videoMem )
|
|||
PostFXManager.settingsEffectSetEnabled(HDRPostFX, $pref::PostFX::EnableHDR);
|
||||
PostFXManager.settingsEffectSetEnabled(DepthOfFieldPostFX, $pref::PostFX::EnableDOF);
|
||||
PostFXManager.settingsEffectSetEnabled(LightRayPostFX, $pref::PostFX::EnableLightRays);
|
||||
PostFXManager.settingsEffectSetEnabled(VignettePostEffect, $pref::PostFX::EnableVignette);
|
||||
PostFXManager.settingsEffectSetEnabled(VignettePostFX, $pref::PostFX::EnableVignette);
|
||||
|
||||
echo("Graphics quality settings have been auto detected.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@
|
|||
#include "./torque.glsl"
|
||||
#include "./brdf.glsl"
|
||||
|
||||
uniform float maxProbeDrawDistance;
|
||||
|
||||
#ifndef TORQUE_SHADERGEN
|
||||
#line 27
|
||||
// These are the uniforms used by most lighting shaders.
|
||||
|
|
@ -106,7 +108,7 @@ struct Surface
|
|||
|
||||
void updateSurface(inout Surface surface)
|
||||
{
|
||||
surface.NdotV = abs(dot(surface.N, surface.V)) + 1e-5f; // avoid artifact
|
||||
surface.NdotV = clamp( dot(surface.N, surface.V), 0.0009765625f,0.9990234375f); //0.5f/512.0f (512 is size of dfg/brdf lookup tex)
|
||||
|
||||
surface.linearRoughness = surface.roughness * surface.roughness;
|
||||
surface.linearRoughnessSq = surface.linearRoughness * surface.linearRoughness;
|
||||
|
|
@ -330,7 +332,7 @@ float defineSphereSpaceInfluence(vec3 wsPosition, vec3 wsProbePosition, float ra
|
|||
{
|
||||
vec3 L = wsProbePosition.xyz - wsPosition;
|
||||
float contribution = 1.0 - length(L) / radius;
|
||||
return contribution;
|
||||
return saturate(contribution);
|
||||
}
|
||||
|
||||
float getDistBoxToPoint(vec3 pt, vec3 extents)
|
||||
|
|
@ -342,10 +344,9 @@ float getDistBoxToPoint(vec3 pt, vec3 extents)
|
|||
float defineBoxSpaceInfluence(vec3 wsPosition, mat4 worldToObj, float attenuation)
|
||||
{
|
||||
vec3 surfPosLS = tMul(worldToObj, vec4(wsPosition, 1.0)).xyz;
|
||||
float atten = 1.0 - attenuation;
|
||||
float baseVal = 0.25;
|
||||
float dist = getDistBoxToPoint(surfPosLS, vec3(baseVal, baseVal, baseVal));
|
||||
return saturate(smoothstep(baseVal + 0.0001, atten*baseVal, dist));
|
||||
return saturate(smoothstep(baseVal, (baseVal-attenuation/2), dist));
|
||||
}
|
||||
|
||||
// Box Projected IBL Lighting
|
||||
|
|
@ -367,9 +368,9 @@ vec3 boxProject(vec3 wsPosition, vec3 wsReflectVec, mat4 worldToObj, vec3 refSca
|
|||
}
|
||||
|
||||
vec4 computeForwardProbes(Surface surface,
|
||||
float cubeMips, int numProbes, mat4x4 worldToObjArray[MAX_FORWARD_PROBES], vec4 probeConfigData[MAX_FORWARD_PROBES],
|
||||
vec4 inProbePosArray[MAX_FORWARD_PROBES], vec4 refScaleArray[MAX_FORWARD_PROBES], vec4 inRefPosArray[MAX_FORWARD_PROBES],
|
||||
float skylightCubemapIdx, sampler2D BRDFTexture,
|
||||
float cubeMips, int numProbes, mat4x4 inWorldToObjArray[MAX_FORWARD_PROBES], vec4 inProbeConfigData[MAX_FORWARD_PROBES],
|
||||
vec4 inProbePosArray[MAX_FORWARD_PROBES], vec4 inRefScaleArray[MAX_FORWARD_PROBES], vec4 inRefPosArray[MAX_FORWARD_PROBES],
|
||||
vec3 wsEyePos, float skylightCubemapIdx, sampler2D BRDFTexture,
|
||||
samplerCubeArray irradianceCubemapAR, samplerCubeArray specularCubemapAR)
|
||||
{
|
||||
int i = 0;
|
||||
|
|
@ -384,47 +385,37 @@ vec4 computeForwardProbes(Surface surface,
|
|||
for (i = 0; i < numProbes; ++i)
|
||||
{
|
||||
contribution[i] = 0;
|
||||
|
||||
if (probeConfigData[i].r == 0) //box
|
||||
float atten = 1.0-(length(wsEyePos-inProbePosArray[i].xyz)/maxProbeDrawDistance);
|
||||
if (inProbeConfigData[i].r == 0) //box
|
||||
{
|
||||
contribution[i] = defineBoxSpaceInfluence(surface.P, worldToObjArray[i], probeConfigData[i].b);
|
||||
if (contribution[i] > 0.0)
|
||||
probehits++;
|
||||
contribution[i] = defineBoxSpaceInfluence(surface.P, inWorldToObjArray[i], inProbeConfigData[i].b)*atten;
|
||||
}
|
||||
else if (probeConfigData[i].r == 1) //sphere
|
||||
else if (inProbeConfigData[i].r == 1) //sphere
|
||||
{
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, probeConfigData[i].g);
|
||||
if (contribution[i] > 0.0)
|
||||
probehits++;
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, inProbeConfigData[i].g)*atten;
|
||||
}
|
||||
|
||||
contribution[i] = max(contribution[i], 0);
|
||||
if (contribution[i]>0.0)
|
||||
probehits++;
|
||||
else
|
||||
contribution[i] = 0.0;
|
||||
|
||||
blendSum += contribution[i];
|
||||
invBlendSum += (1.0f - contribution[i]);
|
||||
}
|
||||
|
||||
if (probehits > 1.0)
|
||||
if (probehits > 1.0)//if we overlap
|
||||
{
|
||||
invBlendSum = (probehits - blendSum)/(probehits-1); //grab the remainder
|
||||
for (i = 0; i < numProbes; i++)
|
||||
{
|
||||
blendFactor[i] = ((contribution[i] / blendSum)) / probehits;
|
||||
blendFactor[i] *= ((contribution[i]) / invBlendSum);
|
||||
blendFactor[i] = saturate(blendFactor[i]);
|
||||
blendFacSum += blendFactor[i];
|
||||
blendFactor[i] = contribution[i]/blendSum; //what % total is this instance
|
||||
blendFactor[i] *= blendFactor[i] / invBlendSum; //what should we add to sum to 1
|
||||
blendFacSum += blendFactor[i]; //running tally of results
|
||||
}
|
||||
|
||||
// Normalize blendVal
|
||||
if (blendFacSum == 0.0f) // Possible with custom weight
|
||||
{
|
||||
blendFacSum = 1.0f;
|
||||
}
|
||||
|
||||
float invBlendSumWeighted = 1.0f / blendFacSum;
|
||||
for (i = 0; i < numProbes; ++i)
|
||||
{
|
||||
blendFactor[i] *= invBlendSumWeighted;
|
||||
contribution[i] *= blendFactor[i];
|
||||
contribution[i] *= blendFactor[i]/blendFacSum; //normalize
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -471,8 +462,8 @@ vec4 computeForwardProbes(Surface surface,
|
|||
float contrib = contribution[i];
|
||||
if (contrib > 0.0f)
|
||||
{
|
||||
float cubemapIdx = int(probeConfigData[i].a);
|
||||
vec3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refScaleArray[i].xyz, inRefPosArray[i].xyz);
|
||||
int cubemapIdx = int(inProbeConfigData[i].a);
|
||||
vec3 dir = boxProject(surface.P, surface.R, inWorldToObjArray[i], inRefScaleArray[i].xyz, inRefPosArray[i].xyz);
|
||||
|
||||
irradiance += textureLod(irradianceCubemapAR, vec4(dir, cubemapIdx), 0).xyz * contrib;
|
||||
specular += textureLod(specularCubemapAR, vec4(dir, cubemapIdx), lod).xyz * contrib;
|
||||
|
|
@ -491,8 +482,8 @@ vec4 computeForwardProbes(Surface surface,
|
|||
vec3 kD = 1.0f - F;
|
||||
kD *= 1.0f - surface.metalness;
|
||||
|
||||
float dfgNdotV = max( surface.NdotV , 0.0009765625f ); //0.5f/512.0f (512 is size of dfg/brdf lookup tex)
|
||||
vec2 envBRDF = textureLod(BRDFTexture, vec2(dfgNdotV, surface.roughness),0).rg;
|
||||
//float dfgNdotV = max( surface.NdotV , 0.0009765625f ); //0.5f/512.0f (512 is size of dfg/brdf lookup tex)
|
||||
vec2 envBRDF = textureLod(BRDFTexture, vec2(surface.NdotV, surface.roughness),0).rg;
|
||||
specular *= F * envBRDF.x + surface.f90 * envBRDF.y;
|
||||
irradiance *= kD * surface.baseColor.rgb;
|
||||
|
||||
|
|
@ -504,13 +495,16 @@ vec4 computeForwardProbes(Surface surface,
|
|||
float horizonOcclusion = 1.3;
|
||||
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
|
||||
horizon *= horizon;
|
||||
|
||||
#if CAPTURING == 1
|
||||
return vec4(mix(surface.baseColor.rgb,(irradiance + specular) * horizon,surface.metalness/2),0);
|
||||
#else
|
||||
return vec4((irradiance + specular) * horizon, 0);//alpha writes disabled
|
||||
#endif
|
||||
}
|
||||
|
||||
vec4 debugVizForwardProbes(Surface surface,
|
||||
float cubeMips, int numProbes, mat4 worldToObjArray[MAX_FORWARD_PROBES], vec4 probeConfigData[MAX_FORWARD_PROBES],
|
||||
vec4 inProbePosArray[MAX_FORWARD_PROBES], vec4 refScaleArray[MAX_FORWARD_PROBES], vec4 inRefPosArray[MAX_FORWARD_PROBES],
|
||||
float cubeMips, int numProbes, mat4 inWorldToObjArray[MAX_FORWARD_PROBES], vec4 inProbeConfigData[MAX_FORWARD_PROBES],
|
||||
vec4 inProbePosArray[MAX_FORWARD_PROBES], vec4 inRefScaleArray[MAX_FORWARD_PROBES], vec4 inRefPosArray[MAX_FORWARD_PROBES],
|
||||
float skylightCubemapIdx, sampler2D BRDFTexture,
|
||||
samplerCubeArray irradianceCubemapAR, samplerCubeArray specularCubemapAR, int showAtten, int showContrib, int showSpec, int showDiff)
|
||||
{
|
||||
|
|
@ -527,15 +521,15 @@ vec4 debugVizForwardProbes(Surface surface,
|
|||
{
|
||||
contribution[i] = 0;
|
||||
|
||||
if (probeConfigData[i].r == 0) //box
|
||||
if (inProbeConfigData[i].r == 0) //box
|
||||
{
|
||||
contribution[i] = defineBoxSpaceInfluence(surface.P, worldToObjArray[i], probeConfigData[i].b);
|
||||
contribution[i] = defineBoxSpaceInfluence(surface.P, inWorldToObjArray[i], inProbeConfigData[i].b);
|
||||
if (contribution[i] > 0.0)
|
||||
probehits++;
|
||||
}
|
||||
else if (probeConfigData[i].r == 1) //sphere
|
||||
else if (inProbeConfigData[i].r == 1) //sphere
|
||||
{
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, probeConfigData[i].g);
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, inProbeConfigData[i].g);
|
||||
if (contribution[i] > 0.0)
|
||||
probehits++;
|
||||
}
|
||||
|
|
@ -620,8 +614,8 @@ vec4 debugVizForwardProbes(Surface surface,
|
|||
float contrib = contribution[i];
|
||||
if (contrib > 0.0f)
|
||||
{
|
||||
float cubemapIdx = probeConfigData[i].a;
|
||||
vec3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refScaleArray[i].xyz, inRefPosArray[i].xyz);
|
||||
float cubemapIdx = inProbeConfigData[i].a;
|
||||
vec3 dir = boxProject(surface.P, surface.R, inWorldToObjArray[i], inRefScaleArray[i].xyz, inRefPosArray[i].xyz);
|
||||
|
||||
irradiance += textureLod(irradianceCubemapAR, vec4(dir, cubemapIdx), 0).xyz * contrib;
|
||||
specular += textureLod(specularCubemapAR, vec4(dir, cubemapIdx), lod).xyz * contrib;
|
||||
|
|
@ -650,8 +644,7 @@ vec4 debugVizForwardProbes(Surface surface,
|
|||
vec3 kD = 1.0f - F;
|
||||
kD *= 1.0f - surface.metalness;
|
||||
|
||||
float dfgNdotV = max( surface.NdotV , 0.0009765625f ); //0.5f/512.0f (512 is size of dfg/brdf lookup tex)
|
||||
vec2 envBRDF = textureLod(BRDFTexture, vec2(dfgNdotV, surface.roughness),0).rg;
|
||||
vec2 envBRDF = textureLod(BRDFTexture, vec2(surface.NdotV, surface.roughness),0).rg;
|
||||
specular *= F * envBRDF.x + surface.f90 * envBRDF.y;
|
||||
irradiance *= kD * surface.baseColor.rgb;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@
|
|||
#include "./brdf.hlsl"
|
||||
#include "./shaderModelAutoGen.hlsl"
|
||||
|
||||
//globals
|
||||
uniform float3 eyePosWorld;
|
||||
uniform float maxProbeDrawDistance;
|
||||
#ifndef TORQUE_SHADERGEN
|
||||
|
||||
// These are the uniforms used by most lighting shaders.
|
||||
|
|
@ -105,10 +108,9 @@ struct Surface
|
|||
|
||||
inline void Update()
|
||||
{
|
||||
NdotV = abs(dot(N, V)) + 1e-5f; // avoid artifact
|
||||
|
||||
linearRoughness = roughness * roughness;
|
||||
linearRoughnessSq = linearRoughness * linearRoughness;
|
||||
NdotV = clamp( dot(N, V), 0.0009765625f,0.9990234375f); // avoid artifact
|
||||
linearRoughness = roughness * roughness;
|
||||
linearRoughnessSq = linearRoughness * linearRoughness;
|
||||
|
||||
albedo = baseColor.rgb * (1.0f - metalness);
|
||||
f0 = lerp(0.04f, baseColor.rgb, metalness);
|
||||
|
|
@ -334,7 +336,7 @@ float defineSphereSpaceInfluence(float3 wsPosition, float3 wsProbePosition, floa
|
|||
{
|
||||
float3 L = wsProbePosition.xyz - wsPosition;
|
||||
float contribution = 1.0 - length(L) / radius;
|
||||
return contribution;
|
||||
return saturate(contribution);
|
||||
}
|
||||
|
||||
float getDistBoxToPoint(float3 pt, float3 extents)
|
||||
|
|
@ -346,10 +348,9 @@ float getDistBoxToPoint(float3 pt, float3 extents)
|
|||
float defineBoxSpaceInfluence(float3 wsPosition, float4x4 worldToObj, float attenuation)
|
||||
{
|
||||
float3 surfPosLS = mul(worldToObj, float4(wsPosition, 1.0)).xyz;
|
||||
float atten = 1.0 - attenuation;
|
||||
float baseVal = 0.25;
|
||||
float dist = getDistBoxToPoint(surfPosLS, float3(baseVal, baseVal, baseVal));
|
||||
return saturate(smoothstep(baseVal + 0.0001, atten*baseVal, dist));
|
||||
return saturate(smoothstep(baseVal, (baseVal-attenuation/2), dist));
|
||||
}
|
||||
|
||||
// Box Projected IBL Lighting
|
||||
|
|
@ -371,9 +372,9 @@ float3 boxProject(float3 wsPosition, float3 wsReflectVec, float4x4 worldToObj, f
|
|||
}
|
||||
|
||||
float4 computeForwardProbes(Surface surface,
|
||||
float cubeMips, int numProbes, float4x4 worldToObjArray[MAX_FORWARD_PROBES], float4 probeConfigData[MAX_FORWARD_PROBES],
|
||||
float4 inProbePosArray[MAX_FORWARD_PROBES], float4 refScaleArray[MAX_FORWARD_PROBES], float4 inRefPosArray[MAX_FORWARD_PROBES],
|
||||
float skylightCubemapIdx, TORQUE_SAMPLER2D(BRDFTexture),
|
||||
float cubeMips, int numProbes, float4x4 inWorldToObjArray[MAX_FORWARD_PROBES], float4 inProbeConfigData[MAX_FORWARD_PROBES],
|
||||
float4 inProbePosArray[MAX_FORWARD_PROBES], float4 inRefScaleArray[MAX_FORWARD_PROBES], float4 inRefPosArray[MAX_FORWARD_PROBES],
|
||||
float3 wsEyePos, float skylightCubemapIdx, TORQUE_SAMPLER2D(BRDFTexture),
|
||||
TORQUE_SAMPLERCUBEARRAY(irradianceCubemapAR), TORQUE_SAMPLERCUBEARRAY(specularCubemapAR))
|
||||
{
|
||||
int i = 0;
|
||||
|
|
@ -385,50 +386,41 @@ float4 computeForwardProbes(Surface surface,
|
|||
float probehits = 0;
|
||||
//Set up our struct data
|
||||
float contribution[MAX_FORWARD_PROBES];
|
||||
//Process prooooobes
|
||||
for (i = 0; i < numProbes; ++i)
|
||||
{
|
||||
contribution[i] = 0;
|
||||
|
||||
if (probeConfigData[i].r == 0) //box
|
||||
contribution[i] = 0.0;
|
||||
float atten = 1.0-(length(wsEyePos-inProbePosArray[i].xyz)/maxProbeDrawDistance);
|
||||
if (inProbeConfigData[i].r == 0) //box
|
||||
{
|
||||
contribution[i] = defineBoxSpaceInfluence(surface.P, worldToObjArray[i], probeConfigData[i].b);
|
||||
if (contribution[i] > 0.0)
|
||||
probehits++;
|
||||
contribution[i] = defineBoxSpaceInfluence(surface.P, inWorldToObjArray[i], inProbeConfigData[i].b)*atten;
|
||||
}
|
||||
else if (probeConfigData[i].r == 1) //sphere
|
||||
else if (inProbeConfigData[i].r == 1) //sphere
|
||||
{
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, probeConfigData[i].g);
|
||||
if (contribution[i] > 0.0)
|
||||
probehits++;
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, inProbeConfigData[i].g)*atten;
|
||||
}
|
||||
|
||||
contribution[i] = max(contribution[i], 0);
|
||||
if (contribution[i]>0.0)
|
||||
probehits++;
|
||||
else
|
||||
contribution[i] = 0.0;
|
||||
|
||||
blendSum += contribution[i];
|
||||
invBlendSum += (1.0f - contribution[i]);
|
||||
}
|
||||
|
||||
if (probehits > 1.0)
|
||||
if (probehits > 1.0)//if we overlap
|
||||
{
|
||||
invBlendSum = (probehits - blendSum)/(probehits-1); //grab the remainder
|
||||
for (i = 0; i < numProbes; i++)
|
||||
{
|
||||
blendFactor[i] = ((contribution[i] / blendSum)) / probehits;
|
||||
blendFactor[i] *= ((contribution[i]) / invBlendSum);
|
||||
blendFactor[i] = saturate(blendFactor[i]);
|
||||
blendFacSum += blendFactor[i];
|
||||
blendFactor[i] = contribution[i]/blendSum; //what % total is this instance
|
||||
blendFactor[i] *= blendFactor[i] / invBlendSum; //what should we add to sum to 1
|
||||
blendFacSum += blendFactor[i]; //running tally of results
|
||||
}
|
||||
|
||||
// Normalize blendVal
|
||||
if (blendFacSum == 0.0f) // Possible with custom weight
|
||||
{
|
||||
blendFacSum = 1.0f;
|
||||
}
|
||||
|
||||
float invBlendSumWeighted = 1.0f / blendFacSum;
|
||||
for (i = 0; i < numProbes; ++i)
|
||||
{
|
||||
blendFactor[i] *= invBlendSumWeighted;
|
||||
contribution[i] *= blendFactor[i];
|
||||
contribution[i] *= blendFactor[i]/blendFacSum; //normalize
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -475,8 +467,8 @@ float4 computeForwardProbes(Surface surface,
|
|||
float contrib = contribution[i];
|
||||
if (contrib > 0.0f)
|
||||
{
|
||||
int cubemapIdx = probeConfigData[i].a;
|
||||
float3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refScaleArray[i].xyz, inRefPosArray[i].xyz);
|
||||
int cubemapIdx = inProbeConfigData[i].a;
|
||||
float3 dir = boxProject(surface.P, surface.R, inWorldToObjArray[i], inRefScaleArray[i].xyz, inRefPosArray[i].xyz);
|
||||
|
||||
irradiance += TORQUE_TEXCUBEARRAYLOD(irradianceCubemapAR, dir, cubemapIdx, 0).xyz * contrib;
|
||||
specular += TORQUE_TEXCUBEARRAYLOD(specularCubemapAR, dir, cubemapIdx, lod).xyz * contrib;
|
||||
|
|
@ -495,8 +487,8 @@ float4 computeForwardProbes(Surface surface,
|
|||
float3 kD = 1.0f - F;
|
||||
kD *= 1.0f - surface.metalness;
|
||||
|
||||
float dfgNdotV = max( surface.NdotV , 0.0009765625f ); //0.5f/512.0f (512 is size of dfg/brdf lookup tex)
|
||||
float2 envBRDF = TORQUE_TEX2DLOD(BRDFTexture, float4(dfgNdotV, surface.roughness,0,0)).rg;
|
||||
//float dfgNdotV = max( surface.NdotV , 0.0009765625f ); //0.5f/512.0f (512 is size of dfg/brdf lookup tex)
|
||||
float2 envBRDF = TORQUE_TEX2DLOD(BRDFTexture, float4(surface.NdotV, surface.roughness,0,0)).rg;
|
||||
specular *= F * envBRDF.x + surface.f90 * envBRDF.y;
|
||||
irradiance *= kD * surface.baseColor.rgb;
|
||||
|
||||
|
|
@ -508,13 +500,16 @@ float4 computeForwardProbes(Surface surface,
|
|||
float horizonOcclusion = 1.3;
|
||||
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
|
||||
horizon *= horizon;
|
||||
|
||||
#if CAPTURING == 1
|
||||
return float4(lerp(surface.baseColor.rgb,(irradiance + specular) * horizon,surface.metalness/2),0);
|
||||
#else
|
||||
return float4((irradiance + specular) * horizon, 0);//alpha writes disabled
|
||||
#endif
|
||||
}
|
||||
|
||||
float4 debugVizForwardProbes(Surface surface,
|
||||
float cubeMips, int numProbes, float4x4 worldToObjArray[MAX_FORWARD_PROBES], float4 probeConfigData[MAX_FORWARD_PROBES],
|
||||
float4 inProbePosArray[MAX_FORWARD_PROBES], float4 refScaleArray[MAX_FORWARD_PROBES], float4 inRefPosArray[MAX_FORWARD_PROBES],
|
||||
float cubeMips, int numProbes, float4x4 inWorldToObjArray[MAX_FORWARD_PROBES], float4 inProbeConfigData[MAX_FORWARD_PROBES],
|
||||
float4 inProbePosArray[MAX_FORWARD_PROBES], float4 inRefScaleArray[MAX_FORWARD_PROBES], float4 inRefPosArray[MAX_FORWARD_PROBES],
|
||||
float skylightCubemapIdx, TORQUE_SAMPLER2D(BRDFTexture),
|
||||
TORQUE_SAMPLERCUBEARRAY(irradianceCubemapAR), TORQUE_SAMPLERCUBEARRAY(specularCubemapAR), int showAtten, int showContrib, int showSpec, int showDiff)
|
||||
{
|
||||
|
|
@ -531,15 +526,15 @@ float4 debugVizForwardProbes(Surface surface,
|
|||
{
|
||||
contribution[i] = 0;
|
||||
|
||||
if (probeConfigData[i].r == 0) //box
|
||||
if (inProbeConfigData[i].r == 0) //box
|
||||
{
|
||||
contribution[i] = defineBoxSpaceInfluence(surface.P, worldToObjArray[i], probeConfigData[i].b);
|
||||
contribution[i] = defineBoxSpaceInfluence(surface.P, inWorldToObjArray[i], inProbeConfigData[i].b);
|
||||
if (contribution[i] > 0.0)
|
||||
probehits++;
|
||||
}
|
||||
else if (probeConfigData[i].r == 1) //sphere
|
||||
else if (inProbeConfigData[i].r == 1) //sphere
|
||||
{
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, probeConfigData[i].g);
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, inProbeConfigData[i].g);
|
||||
if (contribution[i] > 0.0)
|
||||
probehits++;
|
||||
}
|
||||
|
|
@ -624,8 +619,8 @@ float4 debugVizForwardProbes(Surface surface,
|
|||
float contrib = contribution[i];
|
||||
if (contrib > 0.0f)
|
||||
{
|
||||
int cubemapIdx = probeConfigData[i].a;
|
||||
float3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refScaleArray[i].xyz, inRefPosArray[i].xyz);
|
||||
int cubemapIdx = inProbeConfigData[i].a;
|
||||
float3 dir = boxProject(surface.P, surface.R, inWorldToObjArray[i], inRefScaleArray[i].xyz, inRefPosArray[i].xyz);
|
||||
|
||||
irradiance += TORQUE_TEXCUBEARRAYLOD(irradianceCubemapAR, dir, cubemapIdx, 0).xyz * contrib;
|
||||
specular += TORQUE_TEXCUBEARRAYLOD(specularCubemapAR, dir, cubemapIdx, lod).xyz * contrib;
|
||||
|
|
@ -654,8 +649,7 @@ float4 debugVizForwardProbes(Surface surface,
|
|||
float3 kD = 1.0f - F;
|
||||
kD *= 1.0f - surface.metalness;
|
||||
|
||||
float dfgNdotV = max( surface.NdotV , 0.0009765625f ); //0.5f/512.0f (512 is size of dfg/brdf lookup tex)
|
||||
float2 envBRDF = TORQUE_TEX2DLOD(BRDFTexture, float4(dfgNdotV, surface.roughness,0,0)).rg;
|
||||
float2 envBRDF = TORQUE_TEX2DLOD(BRDFTexture, float4(surface.NdotV, surface.roughness,0,0)).rg;
|
||||
specular *= F * envBRDF.x + surface.f90 * envBRDF.y;
|
||||
irradiance *= kD * surface.baseColor.rgb;
|
||||
|
||||
|
|
|
|||
|
|
@ -196,6 +196,38 @@ void main()
|
|||
lightCol *= max(cookie.r, max(cookie.g, cookie.b));
|
||||
#endif
|
||||
|
||||
#ifdef DIFFUSE_LIGHT_VIZ
|
||||
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
|
||||
vec3 factor = lightColor * max(surfaceToLight.NdotL, 0) * shadow * lightIntensity * attenuation;
|
||||
|
||||
vec3 diffuse = BRDF_GetDebugDiffuse(surface,surfaceToLight) * factor;
|
||||
vec3 final = max(0.0f, diffuse);
|
||||
OUT_col = vec4(final, 0);
|
||||
return
|
||||
#endif
|
||||
|
||||
#ifdef SPECULAR_LIGHT_VIZ
|
||||
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
|
||||
vec3 factor = lightColor * max(surfaceToLight.NdotL, 0) * shadow * lightIntensity * attenuation;
|
||||
|
||||
vec3 diffuse = BRDF_GetDebugSpecular(surface,surfaceToLight) * factor;
|
||||
vec3 final = max(0.0f, diffuse);
|
||||
OUT_col = vec4(final, 0);
|
||||
return
|
||||
#endif
|
||||
|
||||
#ifdef DETAIL_LIGHTING_VIZ
|
||||
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
|
||||
vec3 factor = lightColor * max(surfaceToLight.NdotL, 0) * shadow * lightIntensity * attenuation;
|
||||
|
||||
vec3 diffuse = BRDF_GetDiffuse(surface,surfaceToLight) * factor;
|
||||
vec3 spec = BRDF_GetSpecular(surface,surfaceToLight) * factor;
|
||||
|
||||
vec3 final = max(vec3(0.0f), diffuse + spec * surface.F);
|
||||
OUT_col = vec4(final, 0);
|
||||
return
|
||||
#endif
|
||||
|
||||
//get punctual light contribution
|
||||
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadowed);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ uniform sampler2D ssaoMask;
|
|||
uniform vec4 rtParams6;
|
||||
#endif
|
||||
|
||||
uniform vec4 inProbePosArray[MAX_PROBES];
|
||||
uniform vec4 inRefPosArray[MAX_PROBES];
|
||||
uniform vec4 probePosArray[MAX_PROBES];
|
||||
uniform vec4 refPosArray[MAX_PROBES];
|
||||
uniform mat4 worldToObjArray[MAX_PROBES];
|
||||
uniform vec4 refScaleArray[MAX_PROBES];
|
||||
uniform vec4 probeConfigData[MAX_PROBES]; //r,g,b/mode,radius,atten
|
||||
|
|
@ -84,78 +84,57 @@ void main()
|
|||
{
|
||||
contribution[i] = 0;
|
||||
|
||||
float atten =1.0-(length(eyePosWorld-probePosArray[i].xyz)/maxProbeDrawDistance);
|
||||
if (probeConfigData[i].r == 0) //box
|
||||
{
|
||||
contribution[i] = defineBoxSpaceInfluence(surface.P, worldToObjArray[i], probeConfigData[i].b);
|
||||
if (contribution[i]>0.0)
|
||||
probehits++;
|
||||
contribution[i] = defineBoxSpaceInfluence(surface.P, worldToObjArray[i], probeConfigData[i].b)*atten;
|
||||
}
|
||||
else if (probeConfigData[i].r == 1) //sphere
|
||||
{
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, probeConfigData[i].g);
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, probePosArray[i].xyz, probeConfigData[i].g)*atten;
|
||||
}
|
||||
|
||||
if (contribution[i]>0.0)
|
||||
probehits++;
|
||||
}
|
||||
|
||||
contribution[i] = max(contribution[i],0);
|
||||
else
|
||||
contribution[i] = 0;
|
||||
|
||||
blendSum += contribution[i];
|
||||
invBlendSum += (1.0f - contribution[i]);
|
||||
}
|
||||
// Weight0 = normalized NDF, inverted to have 1 at center, 0 at boundary.
|
||||
// And as we invert, we need to divide by Num-1 to stay normalized (else sum is > 1).
|
||||
// respect constraint B.
|
||||
// Weight1 = normalized inverted NDF, so we have 1 at center, 0 at boundary
|
||||
// and respect constraint A.
|
||||
|
||||
if (probehits > 1.0)
|
||||
if (probehits > 1.0)//if we overlap
|
||||
{
|
||||
invBlendSum = (probehits - blendSum)/(probehits-1); //grab the remainder
|
||||
for (i = 0; i < numProbes; i++)
|
||||
{
|
||||
blendFactor[i] = ((contribution[i] / blendSum)) / probehits;
|
||||
blendFactor[i] *= ((contribution[i]) / invBlendSum);
|
||||
blendFactor[i] = saturate(blendFactor[i]);
|
||||
blendFacSum += blendFactor[i];
|
||||
blendFactor[i] = contribution[i]/blendSum; //what % total is this instance
|
||||
blendFactor[i] *= blendFactor[i] / invBlendSum; //what should we add to sum to 1
|
||||
blendFacSum += blendFactor[i]; //running tally of results
|
||||
}
|
||||
|
||||
// Normalize blendVal
|
||||
if (blendFacSum == 0.0f) // Possible with custom weight
|
||||
{
|
||||
blendFacSum = 1.0f;
|
||||
}
|
||||
|
||||
float invBlendSumWeighted = 1.0f / blendFacSum;
|
||||
for (i = 0; i < numProbes; ++i)
|
||||
{
|
||||
blendFactor[i] *= invBlendSumWeighted;
|
||||
contribution[i] *= blendFactor[i];
|
||||
contribution[i] *= blendFactor[i]/blendFacSum; //normalize
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUGVIZ_ATTENUATION == 1
|
||||
float contribAlpha = 1;
|
||||
float contribAlpha = 0;
|
||||
for (i = 0; i < numProbes; ++i)
|
||||
{
|
||||
contribAlpha -= contribution[i];
|
||||
contribAlpha += contribution[i];
|
||||
}
|
||||
|
||||
OUT_col = vec4(1 - contribAlpha, 1 - contribAlpha, 1 - contribAlpha, 1);
|
||||
OUT_col = vec4(contribAlpha,contribAlpha,contribAlpha, 1);
|
||||
return;
|
||||
#endif
|
||||
|
||||
#if DEBUGVIZ_CONTRIB == 1
|
||||
vec3 finalContribColor = vec3(0, 0, 0);
|
||||
float contribAlpha = 1;
|
||||
for (i = 0; i < numProbes; ++i)
|
||||
{
|
||||
finalContribColor += contribution[i] *probeContribColors[i].rgb;
|
||||
contribAlpha -= contribution[i];
|
||||
finalContribColor += contribution[i] * vec3(fmod(i+1,2),fmod(i+1,3),fmod(i+1,4));
|
||||
}
|
||||
|
||||
//Skylight coloration for anything not covered by probes above
|
||||
if(skylightCubemapIdx != -1)
|
||||
finalContribColor += vec3(0, 1, 0) * contribAlpha;
|
||||
|
||||
OUT_col = vec4(finalContribColor, 1);
|
||||
return;
|
||||
#endif
|
||||
|
|
@ -178,8 +157,8 @@ void main()
|
|||
float contrib = contribution[i];
|
||||
if (contrib > 0.0f)
|
||||
{
|
||||
float cubemapIdx = probeConfigData[i].a;
|
||||
vec3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refScaleArray[i].xyz, inRefPosArray[i].xyz);
|
||||
int cubemapIdx = int(probeConfigData[i].a);
|
||||
vec3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refScaleArray[i].xyz, refPosArray[i].xyz);
|
||||
|
||||
irradiance += textureLod(irradianceCubemapAR, vec4(dir, cubemapIdx), 0).xyz * contrib;
|
||||
specular += textureLod(specularCubemapAR, vec4(dir, cubemapIdx), lod).xyz * contrib;
|
||||
|
|
@ -188,7 +167,7 @@ void main()
|
|||
}
|
||||
#endif
|
||||
|
||||
if (skylightCubemapIdx != -1 && alpha > 0.001)
|
||||
if (skylightCubemapIdx != -1 && alpha >= 0.001)
|
||||
{
|
||||
irradiance = lerp(irradiance,textureLod(irradianceCubemapAR, vec4(surface.R, skylightCubemapIdx), 0).xyz,alpha);
|
||||
specular = lerp(specular,textureLod(specularCubemapAR, vec4(surface.R, skylightCubemapIdx), lod).xyz,alpha);
|
||||
|
|
@ -202,14 +181,13 @@ void main()
|
|||
return;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//energy conservation
|
||||
vec3 F = FresnelSchlickRoughness(surface.NdotV, surface.f0, surface.roughness);
|
||||
vec3 kD = 1.0f - F;
|
||||
kD *= 1.0f - surface.metalness;
|
||||
|
||||
float dfgNdotV = max( surface.NdotV , 0.0009765625f ); //0.5f/512.0f (512 is size of dfg/brdf lookup tex)
|
||||
vec2 envBRDF = textureLod(BRDFTexture, vec2(dfgNdotV, surface.roughness),0).rg;
|
||||
vec2 envBRDF = textureLod(BRDFTexture, vec2(surface.NdotV, surface.roughness),0).rg;
|
||||
specular *= F * envBRDF.x + surface.f90 * envBRDF.y;
|
||||
irradiance *= kD * surface.baseColor.rgb;
|
||||
|
||||
|
|
@ -221,6 +199,9 @@ void main()
|
|||
float horizonOcclusion = 1.3;
|
||||
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
|
||||
horizon *= horizon;
|
||||
|
||||
OUT_col = vec4(irradiance + specular, 0);//alpha writes disabled
|
||||
#if CAPTURING == 1
|
||||
OUT_col = vec4(mix(surface.baseColor.rgb,(irradiance + specular) * horizon,surface.metalness/2),0);
|
||||
#else
|
||||
OUT_col = vec4((irradiance + specular) * horizon, 0);//alpha writes disabled
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,6 +122,41 @@ void main()
|
|||
lightCol *= max(cookie.r, max(cookie.g, cookie.b));
|
||||
#endif
|
||||
|
||||
#ifdef DIFFUSE_LIGHT_VIZ
|
||||
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
|
||||
vec3 factor = lightColor * max(surfaceToLight.NdotL, 0) * shadow * lightIntensity * attenuation;
|
||||
|
||||
vec3 diffuse = BRDF_GetDebugDiffuse(surface,surfaceToLight) * factor;
|
||||
vec3 final = max(0.0f, diffuse) * getSpotAngleAtt(-surfaceToLight.L, lightDirection, lightSpotParams );
|
||||
|
||||
OUT_col = vec4(final, 0);
|
||||
return;
|
||||
#endif
|
||||
|
||||
#ifdef SPECULAR_LIGHT_VIZ
|
||||
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
|
||||
float3 factor = lightColor * max(surfaceToLight.NdotL, 0) * shadow * lightIntensity * attenuation;
|
||||
|
||||
vec3 diffuse = BRDF_GetDebugSpecular(surface,surfaceToLight) * factor;
|
||||
vec3 final = max(0.0f, diffuse) * getSpotAngleAtt(-surfaceToLight.L, lightDirection, lightSpotParams );
|
||||
|
||||
OUT_col = vec4(final, 0);
|
||||
return;
|
||||
#endif
|
||||
|
||||
#ifdef DETAIL_LIGHTING_VIZ
|
||||
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
|
||||
vec3 factor = lightColor * max(surfaceToLight.NdotL, 0) * shadow * lightIntensity * attenuation;
|
||||
|
||||
vec3 diffuse = BRDF_GetDiffuse(surface,surfaceToLight) * factor;
|
||||
vec3 spec = BRDF_GetSpecular(surface,surfaceToLight) * factor;
|
||||
|
||||
vec3 final = max(vec3(0.0f), diffuse + spec * surface.F) * getSpotAngleAtt(-surfaceToLight.L, lightDirection, lightSpotParams );
|
||||
|
||||
OUT_col = vec4(final, 0);
|
||||
return;
|
||||
#endif
|
||||
|
||||
//get Punctual light contribution
|
||||
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadowed);
|
||||
//get spot angle attenuation
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ void main()
|
|||
lightingColor = shadowed_colors.rgb;
|
||||
#endif
|
||||
|
||||
shadow = lerp( shadow, 1.0, saturate( fadeOutAmt ) );
|
||||
shadow = mix( shadow, 1.0, saturate( fadeOutAmt ) );
|
||||
|
||||
#ifdef PSSM_DEBUG_RENDER
|
||||
if ( fadeOutAmt > 1.0 )
|
||||
|
|
@ -225,6 +225,37 @@ void main()
|
|||
|
||||
#endif //NO_SHADOW
|
||||
|
||||
#ifdef DIFFUSE_LIGHT_VIZ
|
||||
vec3 factor = lightingColor.rgb * max(surfaceToLight.NdotL, 0) * shadow * lightBrightness;
|
||||
vec3 diffuse = BRDF_GetDebugDiffuse(surface,surfaceToLight) * factor;
|
||||
|
||||
vec3 final = max(0.0f, diffuse);
|
||||
|
||||
OUT_col = vec4(final, 0);
|
||||
return;
|
||||
#endif
|
||||
|
||||
#ifdef SPECULAR_LIGHT_VIZ
|
||||
vec3 factor = lightingColor.rgb * max(surfaceToLight.NdotL, 0) * shadow * lightBrightness;
|
||||
vec3 spec = BRDF_GetDebugSpecular(surface, surfaceToLight) * factor;
|
||||
|
||||
vec3 final = max(0.0f, factor);
|
||||
|
||||
OUT_col = vec4(final, 0);
|
||||
return;
|
||||
#endif
|
||||
|
||||
#ifdef DETAIL_LIGHTING_VIZ
|
||||
vec3 factor = lightingColor.rgb * max(surfaceToLight.NdotL, 0) * shadow * lightBrightness;
|
||||
vec3 diffuse = BRDF_GetDebugDiffuse(surface,surfaceToLight) * factor;
|
||||
vec3 spec = BRDF_GetDebugSpecular(surface,surfaceToLight) * factor;
|
||||
|
||||
vec3 final = max(0.0f, diffuse + spec);
|
||||
|
||||
OUT_col = vec4(final, 0);
|
||||
return;
|
||||
#endif
|
||||
|
||||
//get directional light contribution
|
||||
vec3 lighting = getDirectionalLight(surface, surfaceToLight, lightingColor.rgb, lightBrightness, shadow);
|
||||
|
||||
|
|
|
|||
|
|
@ -134,7 +134,6 @@ uniform float shadowSoftness;
|
|||
uniform float4x4 worldToCamera;
|
||||
uniform float3x3 worldToLightProj;
|
||||
|
||||
uniform float3 eyePosWorld;
|
||||
uniform float4x4 cameraToWorld;
|
||||
|
||||
float4 main( ConvexConnectP IN ) : SV_TARGET
|
||||
|
|
@ -218,12 +217,12 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
|
|||
|
||||
#ifdef DETAIL_LIGHTING_VIZ
|
||||
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
|
||||
vec3 factor = lightColor * max(surfaceToLight.NdotL, 0) * shadow * lightIntensity * attenuation;
|
||||
float3 factor = lightColor * max(surfaceToLight.NdotL, 0) * shadow * lightIntensity * attenuation;
|
||||
|
||||
vec3 diffuse = BRDF_GetDiffuse(surface,surfaceToLight) * factor;
|
||||
vec3 spec = BRDF_GetSpecular(surface,surfaceToLight) * factor;
|
||||
float3 diffuse = BRDF_GetDiffuse(surface,surfaceToLight) * factor;
|
||||
float3 spec = BRDF_GetSpecular(surface,surfaceToLight) * factor;
|
||||
|
||||
vec3 final = max(vec3(0.0f), diffuse + spec * surface.F);
|
||||
float3 final = max(float3(0.0f), diffuse + spec * surface.F);
|
||||
return final;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ TORQUE_UNIFORM_SAMPLER2D(BRDFTexture, 3);
|
|||
uniform float4 rtParams0;
|
||||
uniform float4 vsFarPlane;
|
||||
uniform float4x4 cameraToWorld;
|
||||
uniform float3 eyePosWorld;
|
||||
|
||||
//cubemap arrays require all the same size. so shared mips# value
|
||||
uniform float cubeMips;
|
||||
|
|
@ -27,8 +26,8 @@ TORQUE_UNIFORM_SAMPLER2D(ssaoMask, 6);
|
|||
uniform float4 rtParams6;
|
||||
#endif
|
||||
|
||||
uniform float4 inProbePosArray[MAX_PROBES];
|
||||
uniform float4 inRefPosArray[MAX_PROBES];
|
||||
uniform float4 probePosArray[MAX_PROBES];
|
||||
uniform float4 refPosArray[MAX_PROBES];
|
||||
uniform float4x4 worldToObjArray[MAX_PROBES];
|
||||
uniform float4 refScaleArray[MAX_PROBES];
|
||||
uniform float4 probeConfigData[MAX_PROBES]; //r,g,b/mode,radius,atten
|
||||
|
|
@ -76,79 +75,58 @@ float4 main(PFXVertToPix IN) : SV_TARGET
|
|||
//Process prooooobes
|
||||
for (i = 0; i < numProbes; ++i)
|
||||
{
|
||||
contribution[i] = 0;
|
||||
contribution[i] = 0.0;
|
||||
|
||||
float atten =1.0-(length(eyePosWorld-probePosArray[i].xyz)/maxProbeDrawDistance);
|
||||
if (probeConfigData[i].r == 0) //box
|
||||
{
|
||||
contribution[i] = defineBoxSpaceInfluence(surface.P, worldToObjArray[i], probeConfigData[i].b);
|
||||
if (contribution[i]>0.0)
|
||||
probehits++;
|
||||
contribution[i] = defineBoxSpaceInfluence(surface.P, worldToObjArray[i], probeConfigData[i].b)*atten;
|
||||
}
|
||||
else if (probeConfigData[i].r == 1) //sphere
|
||||
{
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, inProbePosArray[i].xyz, probeConfigData[i].g);
|
||||
contribution[i] = defineSphereSpaceInfluence(surface.P, probePosArray[i].xyz, probeConfigData[i].g)*atten;
|
||||
}
|
||||
|
||||
if (contribution[i]>0.0)
|
||||
probehits++;
|
||||
}
|
||||
|
||||
contribution[i] = max(contribution[i],0);
|
||||
else
|
||||
contribution[i] = 0.0;
|
||||
|
||||
blendSum += contribution[i];
|
||||
invBlendSum += (1.0f - contribution[i]);
|
||||
}
|
||||
// Weight0 = normalized NDF, inverted to have 1 at center, 0 at boundary.
|
||||
// And as we invert, we need to divide by Num-1 to stay normalized (else sum is > 1).
|
||||
// respect constraint B.
|
||||
// Weight1 = normalized inverted NDF, so we have 1 at center, 0 at boundary
|
||||
// and respect constraint A.
|
||||
|
||||
if (probehits > 1.0)
|
||||
if (probehits > 1.0)//if we overlap
|
||||
{
|
||||
invBlendSum = (probehits - blendSum)/(probehits-1); //grab the remainder
|
||||
for (i = 0; i < numProbes; i++)
|
||||
{
|
||||
blendFactor[i] = ((contribution[i] / blendSum)) / probehits;
|
||||
blendFactor[i] *= ((contribution[i]) / invBlendSum);
|
||||
blendFactor[i] = saturate(blendFactor[i]);
|
||||
blendFacSum += blendFactor[i];
|
||||
blendFactor[i] = contribution[i]/blendSum; //what % total is this instance
|
||||
blendFactor[i] *= blendFactor[i] / invBlendSum; //what should we add to sum to 1
|
||||
blendFacSum += blendFactor[i]; //running tally of results
|
||||
}
|
||||
|
||||
// Normalize blendVal
|
||||
if (blendFacSum == 0.0f) // Possible with custom weight
|
||||
{
|
||||
blendFacSum = 1.0f;
|
||||
}
|
||||
|
||||
float invBlendSumWeighted = 1.0f / blendFacSum;
|
||||
for (i = 0; i < numProbes; ++i)
|
||||
{
|
||||
blendFactor[i] *= invBlendSumWeighted;
|
||||
contribution[i] *= blendFactor[i];
|
||||
contribution[i] *= blendFactor[i]/blendFacSum; //normalize
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUGVIZ_ATTENUATION == 1
|
||||
float contribAlpha = 1;
|
||||
float contribAlpha = 0;
|
||||
for (i = 0; i < numProbes; ++i)
|
||||
{
|
||||
contribAlpha -= contribution[i];
|
||||
contribAlpha += contribution[i];
|
||||
}
|
||||
|
||||
return float4(1 - contribAlpha, 1 - contribAlpha, 1 - contribAlpha, 1);
|
||||
return float4(contribAlpha,contribAlpha,contribAlpha, 1);
|
||||
#endif
|
||||
|
||||
#if DEBUGVIZ_CONTRIB == 1
|
||||
float3 finalContribColor = float3(0, 0, 0);
|
||||
float contribAlpha = 1;
|
||||
for (i = 0; i < numProbes; ++i)
|
||||
{
|
||||
finalContribColor += contribution[i] *probeContribColors[i].rgb;
|
||||
contribAlpha -= contribution[i];
|
||||
finalContribColor += contribution[i] * float3(fmod(i+1,2),fmod(i+1,3),fmod(i+1,4));
|
||||
}
|
||||
|
||||
//Skylight coloration for anything not covered by probes above
|
||||
if(skylightCubemapIdx != -1)
|
||||
finalContribColor += float3(0, 1, 0) * contribAlpha;
|
||||
|
||||
return float4(finalContribColor, 1);
|
||||
#endif
|
||||
}
|
||||
|
|
@ -171,7 +149,7 @@ float4 main(PFXVertToPix IN) : SV_TARGET
|
|||
if (contrib > 0.0f)
|
||||
{
|
||||
int cubemapIdx = probeConfigData[i].a;
|
||||
float3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refScaleArray[i].xyz, inRefPosArray[i].xyz);
|
||||
float3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refScaleArray[i].xyz, refPosArray[i].xyz);
|
||||
|
||||
irradiance += TORQUE_TEXCUBEARRAYLOD(irradianceCubemapAR, dir, cubemapIdx, 0).xyz * contrib;
|
||||
specular += TORQUE_TEXCUBEARRAYLOD(specularCubemapAR, dir, cubemapIdx, lod).xyz * contrib;
|
||||
|
|
@ -197,8 +175,7 @@ float4 main(PFXVertToPix IN) : SV_TARGET
|
|||
float3 kD = 1.0f - F;
|
||||
kD *= 1.0f - surface.metalness;
|
||||
|
||||
float dfgNdotV = max( surface.NdotV , 0.0009765625f ); //0.5f/512.0f (512 is size of dfg/brdf lookup tex)
|
||||
float2 envBRDF = TORQUE_TEX2DLOD(BRDFTexture, float4(dfgNdotV, surface.roughness,0,0)).rg;
|
||||
float2 envBRDF = TORQUE_TEX2DLOD(BRDFTexture, float4(surface.NdotV, surface.roughness,0,0)).rg;
|
||||
specular *= F * envBRDF.x + surface.f90 * envBRDF.y;
|
||||
irradiance *= kD * surface.baseColor.rgb;
|
||||
|
||||
|
|
@ -210,6 +187,9 @@ float4 main(PFXVertToPix IN) : SV_TARGET
|
|||
float horizonOcclusion = 1.3;
|
||||
float horizon = saturate( 1 + horizonOcclusion * dot(surface.R, surface.N));
|
||||
horizon *= horizon;
|
||||
|
||||
#if CAPTURING == 1
|
||||
return float4(lerp(surface.baseColor.rgb,(irradiance + specular) * horizon,surface.metalness/2),0);
|
||||
#else
|
||||
return float4((irradiance + specular) * horizon, 0);//alpha writes disabled
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ uniform float4x4 worldToLightProj;
|
|||
uniform float4 lightParams;
|
||||
|
||||
uniform float shadowSoftness;
|
||||
uniform float3 eyePosWorld;
|
||||
|
||||
uniform float4x4 cameraToWorld;
|
||||
uniform float4x4 worldToCamera;
|
||||
|
|
@ -147,12 +146,12 @@ float4 main( ConvexConnectP IN ) : SV_TARGET
|
|||
|
||||
#ifdef DETAIL_LIGHTING_VIZ
|
||||
float attenuation = getDistanceAtt(surfaceToLight.Lu, radius);
|
||||
vec3 factor = lightColor * max(surfaceToLight.NdotL, 0) * shadow * lightIntensity * attenuation;
|
||||
float3 factor = lightColor * max(surfaceToLight.NdotL, 0) * shadow * lightIntensity * attenuation;
|
||||
|
||||
vec3 diffuse = BRDF_GetDiffuse(surface,surfaceToLight) * factor;
|
||||
vec3 spec = BRDF_GetSpecular(surface,surfaceToLight) * factor;
|
||||
float3 diffuse = BRDF_GetDiffuse(surface,surfaceToLight) * factor;
|
||||
float3 spec = BRDF_GetSpecular(surface,surfaceToLight) * factor;
|
||||
|
||||
vec3 final = max(vec3(0.0f), diffuse + spec * surface.F) * getSpotAngleAtt(-surfaceToLight.L, lightDirection, lightSpotParams );
|
||||
vec3 final = max(float3(0.0f), diffuse + spec * surface.F) * getSpotAngleAtt(-surfaceToLight.L, lightDirection, lightSpotParams );
|
||||
return final;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ uniform float4 lightColor;
|
|||
uniform float4 lightAmbient;
|
||||
|
||||
uniform float shadowSoftness;
|
||||
uniform float3 eyePosWorld;
|
||||
|
||||
uniform float4 atlasXOffset;
|
||||
uniform float4 atlasYOffset;
|
||||
|
|
|
|||
|
|
@ -642,4 +642,24 @@ function populateAllFonts(%font)
|
|||
populateFontCacheRange(%font,24,0,65535);
|
||||
populateFontCacheRange(%font,32,0,65535);
|
||||
populateFontCacheRange(%font,36,0,65535);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
function clientCMDPlaySound(%soundAssetId,%pos)
|
||||
{
|
||||
playSoundAsset(%soundAssetId,%pos);
|
||||
}
|
||||
|
||||
function playSoundAsset(%soundAssetId,%pos)
|
||||
{
|
||||
%assetDef = AssetDatabase.acquireAsset(%soundAssetId);
|
||||
%handle = 0;
|
||||
if(isObject(%assetDef))
|
||||
{
|
||||
%handle = %assetDef.playSound(%pos);
|
||||
if( isObject( ClientMissionCleanup ) )
|
||||
ClientMissionCleanup.add(%handle);
|
||||
}
|
||||
AssetDatabase.releaseAsset(%soundAssetId);
|
||||
return %handle;
|
||||
}
|
||||
|
|
@ -44,6 +44,9 @@ function loadModuleMaterials(%moduleGroup)
|
|||
if(%module.group !$= %moduleGroup)
|
||||
continue;
|
||||
}
|
||||
|
||||
if(%module.ModuleId $= "CoreModule") //the core container module is a special case that has some path complications
|
||||
continue; //so we'll skip it so it doesn't complicate the other core modules' path tests
|
||||
|
||||
%modulePath = %module.ModulePath;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue