Moved unneeded modules to Templates/Modules

Added templated getObjectsByClass to Scene for easier engine-side polling of objects, including nested checks for subscenes
Proper init'ing of mGamemodeName in LevelAsset, as well as proper fieldType for mIsSubLevel
D3D11 added logic to handle scaling down of textures in cubemap arrays for lower texture resolution preferences
Added ability to collapse groups programmatically to GuiVariableInspector
Upped PSSM shadowmap max size to 4096
Caught GL deferred lighting/probes up to D3D11
Temporarily disabled forward lighting/probes on GL materials until conversion finished
Upped smMaxInstancingVerts to 2000 from 200 to support slightly more detailed meshes being instanced
Reordered project settings so they load ahead of core modules, so that core modules can actually use project settings
Established current preset file for PostFXManager to use for reverting
WIP logic for forcing probes to update as part of level lighting load step in loading process
Streamlined PostFXManager code, removing unnecessary/redundant files
Coverted HDR, Lightrays and SSAO and ExamplePostEffect to use new PostFX Manager/Editor paradigm
PostFX manager now enacts callbacks so that postFXs' can process their own settings as well as provide editor fields
Changed PostFX editor to work with new callbacks via using VariableInspector
Updated PostEffectAsset's template file so new PostFX's will now automatically register with the PostFXManager and have the needed new callbacks for integration
Made HDR on by default, removed enable field from editing
Made probe bake resolution a project setting
Updated many GL postFX shaders to have proper case for PostFx.glsl
Example module now loads ExampleGUI and ExamplePostEffect during init'ing
Removed unneeded autoload definitions from ExampleModule's module file
Fixed Graphics Adapter settings field to properly display as well as apply setting
Updated many referenced profiles in tools folder to use the Tools specific gui profiles to make theming more consistent
Fixed coloration of tools button bitmap to make theming more consistent
Updated a few theme settings for improved visibility with theme, particularly selected/highlighted text
Moved AssetBrowser field types to separated folder/files
Updated new module creation to properly utilize template file instead of overriding it with a programmatic script generation.
Removed unneded default autoload definitions from new modules
Added WIP for editing Module/Asset dependencies
Updated the PostEffectAsset to properly generate glsl and hlsl files from templates
Updated module editor window to display only necessary fields
Added WIP of TerrainAsset
Added shaderCache gitignore file so folder isn't lost
This commit is contained in:
Areloch 2019-09-29 06:44:43 -05:00
parent ff4c2d59fc
commit e7bf49e801
165 changed files with 2328 additions and 5095 deletions

View file

@ -81,6 +81,12 @@ void Scene::onRemove()
}*/
}
void Scene::onPostAdd()
{
if (isMethod("onPostAdd"))
Con::executef(this, "onPostAdd");
}
void Scene::addObject(SimObject* object)
{
//Child scene
@ -175,7 +181,7 @@ void Scene::unpackUpdate(NetConnection *conn, BitStream *stream)
}
//
Vector<SceneObject*> Scene::getObjectsByClass(String className)
Vector<SceneObject*> Scene::getObjectsByClass(String className, bool checkSubscenes)
{
return Vector<SceneObject*>();
}

View file

@ -50,6 +50,7 @@ public:
virtual bool onAdd();
virtual void onRemove();
virtual void onPostAdd();
virtual void interpolateTick(F32 delta);
virtual void processTick();
@ -67,7 +68,10 @@ public:
void unpackUpdate(NetConnection *conn, BitStream *stream);
//
Vector<SceneObject*> getObjectsByClass(String className);
Vector<SceneObject*> getObjectsByClass(String className, bool checkSubscenes);
template <class T>
Vector<T*> getObjectsByClass(bool checkSubscenes);
static Scene *getRootScene()
{
@ -79,3 +83,42 @@ public:
static Vector<Scene*> smSceneList;
};
template <class T>
Vector<T*> Scene::getObjectsByClass(bool checkSubscenes)
{
Vector<T*> foundObjects;
T* curObject;
//first, check ourself
for (U32 i = 0; i < mPermanentObjects.size(); i++)
{
curObject = dynamic_cast<T*>(mPermanentObjects[i]);
if (curObject)
foundObjects.push_back(curObject);
}
for (U32 i = 0; i < mDynamicObjects.size(); i++)
{
curObject = dynamic_cast<T*>(mDynamicObjects[i]);
if (curObject)
foundObjects.push_back(curObject);
}
if (checkSubscenes)
{
for (U32 i = 0; i < mSubScenes.size(); i++)
{
Vector<T*> appendList = mSubScenes[i]->getObjectsByClass<T>(true);
for (U32 a = 0; a < appendList.size(); a++)
{
foundObjects.push_back(appendList[a]);
}
}
}
return foundObjects;
}

View file

@ -88,6 +88,7 @@ LevelAsset::LevelAsset() : AssetBase(), mIsSubLevel(false)
mLevelFile = StringTable->EmptyString();
mPreviewImage = StringTable->EmptyString();
mGamemodeName = StringTable->EmptyString();
mMainLevelAsset = StringTable->EmptyString();
}
@ -114,7 +115,7 @@ void LevelAsset::initPersistFields()
addProtectedField("PreviewImage", TypeAssetLooseFilePath, Offset(mPreviewImage, LevelAsset),
&setPreviewImageFile, &getPreviewImageFile, "Path to the image used for selection preview.");
addField("isSubScene", TypeString, Offset(mIsSubLevel, LevelAsset), "Is this a sublevel to another Scene");
addField("isSubScene", TypeBool, Offset(mIsSubLevel, LevelAsset), "Is this a sublevel to another Scene");
addField("gameModeName", TypeString, Offset(mGamemodeName, LevelAsset), "Name of the Game Mode to be used with this level");
}

View file

@ -0,0 +1,290 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2013 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.
//-----------------------------------------------------------------------------
#ifndef TERRAINASSET_H
#include "TerrainAsset.h"
#endif
#ifndef _ASSET_MANAGER_H_
#include "assets/assetManager.h"
#endif
#ifndef _CONSOLETYPES_H_
#include "console/consoleTypes.h"
#endif
#ifndef _TAML_
#include "persistence/taml/taml.h"
#endif
#ifndef _ASSET_PTR_H_
#include "assets/assetPtr.h"
#endif
//-----------------------------------------------------------------------------
IMPLEMENT_CONOBJECT(TerrainAsset);
ConsoleType(TerrainAssetPtr, TypeTerrainAssetPtr, TerrainAsset, ASSET_ID_FIELD_PREFIX)
//-----------------------------------------------------------------------------
ConsoleGetType(TypeTerrainAssetPtr)
{
// Fetch asset Id.
return (*((AssetPtr<TerrainAsset>*)dptr)).getAssetId();
}
//-----------------------------------------------------------------------------
ConsoleSetType(TypeTerrainAssetPtr)
{
// Was a single argument specified?
if (argc == 1)
{
// Yes, so fetch field value.
const char* pFieldValue = argv[0];
// Fetch asset pointer.
AssetPtr<TerrainAsset>* pAssetPtr = dynamic_cast<AssetPtr<TerrainAsset>*>((AssetPtrBase*)(dptr));
// Is the asset pointer the correct type?
if (pAssetPtr == NULL)
{
// No, so fail.
//Con::warnf("(TypeMaterialAssetPtr) - Failed to set asset Id '%d'.", pFieldValue);
return;
}
// Set asset.
pAssetPtr->setAssetId(pFieldValue);
return;
}
// Warn.
Con::warnf("(TypeTerrainAssetPtr) - Cannot set multiple args to a single asset.");
}
//-----------------------------------------------------------------------------
TerrainAsset::TerrainAsset()
{
mTerrainFile = StringTable->EmptyString();
}
//-----------------------------------------------------------------------------
TerrainAsset::~TerrainAsset()
{
}
//-----------------------------------------------------------------------------
void TerrainAsset::initPersistFields()
{
// Call parent.
Parent::initPersistFields();
//addField("shaderGraph", TypeRealString, Offset(mShaderGraphFile, TerrainAsset), "");
addProtectedField("terrainFile", TypeAssetLooseFilePath, Offset(mTerrainFile, TerrainAsset),
&setTerrainFile, &getTerrainFile, "Path to the file containing the terrain data.");
}
void TerrainAsset::initializeAsset()
{
// Call parent.
Parent::initializeAsset();
if (!Platform::isFullPath(mTerrainFile))
mTerrainFile = getOwned() ? expandAssetFilePath(mTerrainFile) : mTerrainFile;
//if (Platform::isFile(mTerrainFile))
// Con::executeFile(mScriptFile, false, false);
}
void TerrainAsset::onAssetRefresh()
{
mTerrainFile = expandAssetFilePath(mTerrainFile);
//if (Platform::isFile(mScriptFile))
// Con::executeFile(mScriptFile, false, false);
}
void TerrainAsset::setTerrainFile(const char* pScriptFile)
{
// Sanity!
AssertFatal(pScriptFile != NULL, "Cannot use a NULL script file.");
// Fetch image file.
pScriptFile = StringTable->insert(pScriptFile);
// Update.
mTerrainFile = getOwned() ? expandAssetFilePath(pScriptFile) : pScriptFile;
// Refresh the asset.
refreshAsset();
}
//------------------------------------------------------------------------------
void TerrainAsset::copyTo(SimObject* object)
{
// Call to parent.
Parent::copyTo(object);
}
//-----------------------------------------------------------------------------
// GuiInspectorTypeAssetId
//-----------------------------------------------------------------------------
IMPLEMENT_CONOBJECT(GuiInspectorTypeTerrainAssetPtr);
ConsoleDocClass(GuiInspectorTypeTerrainAssetPtr,
"@brief Inspector field type for Material Asset Objects\n\n"
"Editor use only.\n\n"
"@internal"
);
void GuiInspectorTypeTerrainAssetPtr::consoleInit()
{
Parent::consoleInit();
ConsoleBaseType::getType(TypeTerrainAssetPtr)->setInspectorFieldType("GuiInspectorTypeTerrainAssetPtr");
}
GuiControl* GuiInspectorTypeTerrainAssetPtr::constructEditControl()
{
// Create base filename edit controls
mUseHeightOverride = true;
mHeightOverride = 100;
mMatEdContainer = new GuiControl();
mMatEdContainer->registerObject();
addObject(mMatEdContainer);
// Create "Open in ShapeEditor" button
mMatPreviewButton = new GuiBitmapButtonCtrl();
const char* matAssetId = getData();
TerrainAsset* matAsset = AssetDatabase.acquireAsset< TerrainAsset>(matAssetId);
TerrainMaterial* materialDef = nullptr;
char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor";
/*if (!Sim::findObject(matAsset->getMaterialDefinitionName(), materialDef))
{
Con::errorf("GuiInspectorTypeTerrainAssetPtr::constructEditControl() - unable to find material in asset");
}
else
{
mMatPreviewButton->setBitmap(materialDef->mDiffuseMapFilename[0]);
}*/
mMatPreviewButton->setPosition(0, 0);
mMatPreviewButton->setExtent(100,100);
// Change filespec
char szBuffer[512];
dSprintf(szBuffer, sizeof(szBuffer), "AssetBrowser.showDialog(\"TerrainAsset\", \"AssetBrowser.changeAsset\", %d, %s);",
mInspector->getComponentGroupTargetId(), mCaption);
mMatPreviewButton->setField("Command", szBuffer);
mMatPreviewButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile");
mMatPreviewButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile");
mMatPreviewButton->setDataField(StringTable->insert("hovertime"), NULL, "1000");
StringBuilder strbld;
/*strbld.append(matAsset->getMaterialDefinitionName());
strbld.append("\n");
strbld.append("Open this file in the Material Editor");*/
mMatPreviewButton->setDataField(StringTable->insert("tooltip"), NULL, strbld.data());
_registerEditControl(mMatPreviewButton);
//mMatPreviewButton->registerObject();
mMatEdContainer->addObject(mMatPreviewButton);
mMatAssetIdTxt = new GuiTextEditCtrl();
mMatAssetIdTxt->registerObject();
mMatAssetIdTxt->setActive(false);
mMatAssetIdTxt->setText(matAssetId);
mMatAssetIdTxt->setBounds(100, 0, 150, 18);
mMatEdContainer->addObject(mMatAssetIdTxt);
return mMatEdContainer;
}
bool GuiInspectorTypeTerrainAssetPtr::updateRects()
{
S32 dividerPos, dividerMargin;
mInspector->getDivider(dividerPos, dividerMargin);
Point2I fieldExtent = getExtent();
Point2I fieldPos = getPosition();
mCaptionRect.set(0, 0, fieldExtent.x - dividerPos - dividerMargin, fieldExtent.y);
mEditCtrlRect.set(fieldExtent.x - dividerPos + dividerMargin, 1, dividerPos - dividerMargin - 34, fieldExtent.y);
bool resized = mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent);
if (mMatEdContainer != nullptr)
{
mMatPreviewButton->resize(mEditCtrlRect.point, mEditCtrlRect.extent);
}
if (mMatPreviewButton != nullptr)
{
mMatPreviewButton->resize(Point2I::Zero, Point2I(100, 100));
}
if (mMatAssetIdTxt != nullptr)
{
mMatAssetIdTxt->resize(Point2I(100, 0), Point2I(mEditCtrlRect.extent.x - 100, 18));
}
return resized;
}
void GuiInspectorTypeTerrainAssetPtr::setMaterialAsset(String assetId)
{
mTargetObject->setDataField(mCaption, "", assetId);
//force a refresh
SimObject* obj = mInspector->getInspectObject();
mInspector->inspectObject(obj);
}
DefineEngineMethod(GuiInspectorTypeTerrainAssetPtr, setMaterialAsset, void, (String assetId), (""),
"Gets a particular shape animation asset for this shape.\n"
"@param animation asset index.\n"
"@return Shape Animation Asset.\n")
{
if (assetId == String::EmptyString)
return;
return object->setMaterialAsset(assetId);
}

View file

@ -0,0 +1,103 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2013 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.
//-----------------------------------------------------------------------------
#ifndef TERRAINASSET_H
#define TERRAINASSET_H
#ifndef _ASSET_BASE_H_
#include "assets/assetBase.h"
#endif
#ifndef _ASSET_DEFINITION_H_
#include "assets/assetDefinition.h"
#endif
#ifndef _STRINGUNIT_H_
#include "string/stringUnit.h"
#endif
#ifndef _ASSET_FIELD_TYPES_H_
#include "assets/assetFieldTypes.h"
#endif
#ifndef _GFXDEVICE_H_
#include "gfx/gfxDevice.h"
#endif
#ifndef _GUI_INSPECTOR_TYPES_H_
#include "gui/editor/guiInspectorTypes.h"
#endif
#include "terrain/terrData.h"
//-----------------------------------------------------------------------------
class TerrainAsset : public AssetBase
{
typedef AssetBase Parent;
StringTableEntry mTerrainFile;
public:
TerrainAsset();
virtual ~TerrainAsset();
/// Engine.
static void initPersistFields();
virtual void copyTo(SimObject* object);
void setTerrainFile(const char* pTerrainFile);
inline StringTableEntry getTerrainFile(void) const { return mTerrainFile; };
/// Declare Console Object.
DECLARE_CONOBJECT(TerrainAsset);
protected:
virtual void initializeAsset();
virtual void onAssetRefresh(void);
static bool setTerrainFile(void *obj, const char *index, const char *data) { static_cast<TerrainAsset*>(obj)->setTerrainFile(data); return false; }
static const char* getTerrainFile(void* obj, const char* data) { return static_cast<TerrainAsset*>(obj)->getTerrainFile(); }
};
DefineConsoleType(TypeTerrainAssetPtr, TerrainAsset)
//-----------------------------------------------------------------------------
// TypeAssetId GuiInspectorField Class
//-----------------------------------------------------------------------------
class GuiInspectorTypeTerrainAssetPtr : public GuiInspectorField
{
typedef GuiInspectorField Parent;
public:
GuiControl* mMatEdContainer;
GuiBitmapButtonCtrl *mMatPreviewButton;
GuiTextEditCtrl *mMatAssetIdTxt;
DECLARE_CONOBJECT(GuiInspectorTypeTerrainAssetPtr);
static void consoleInit();
virtual GuiControl* constructEditControl();
virtual bool updateRects();
void setMaterialAsset(String assetId);
};
#endif // _ASSET_BASE_H_

View file

@ -760,6 +760,12 @@ GFXTextureObject *GFXTextureManager::createTexture( U32 width, U32 height, GFXFo
GFXFormat checkFmt = format;
_validateTexParams( localWidth, localHeight, profile, numMips, checkFmt );
//check to see if we've handled the mips just now, and if not, then handle them here
if (numMips == numMipLevels && (localWidth != width || localHeight != height))
{
numMips = mFloor(mLog2(mMax(localWidth, localHeight))) + 1;
}
// AssertFatal( checkFmt == format, "Anonymous texture didn't get the format it wanted." );
GFXTextureObject *outTex = NULL;

View file

@ -116,6 +116,32 @@ void GuiVariableInspector::endGroup()
mCurrentGroup = "";
}
void GuiVariableInspector::setGroupExpanded(const char* groupName, bool isExpanded)
{
String name = groupName;
for (U32 g = 0; g < mGroups.size(); g++)
{
if (mGroups[g]->getGroupName() == name)
{
if (isExpanded)
mGroups[g]->expand();
else
mGroups[g]->collapse();
}
}
}
void GuiVariableInspector::setGroupsExpanded(bool isExpanded)
{
for (U32 g = 0; g < mGroups.size(); g++)
{
if (isExpanded)
mGroups[g]->expand();
else
mGroups[g]->collapse();
}
}
void GuiVariableInspector::addField(const char* name, const char* label, const char* typeName, const char* description,
const char* defaultValue, const char* dataValues, const char* callbackName, SimObject* ownerObj)
{
@ -227,6 +253,17 @@ DefineEngineMethod(GuiVariableInspector, endGroup, void, (),, "endGroup()")
object->endGroup();
}
DefineEngineMethod(GuiVariableInspector, setGroupExpanded, void, (const char* groupName, bool isExpanded), ("", false), "setGroupExpanded()")
{
object->setGroupExpanded(groupName, isExpanded);
}
DefineEngineMethod(GuiVariableInspector, setGroupsExpanded, void, (bool isExpanded), (false), "setGroupsExpanded()")
{
object->setGroupsExpanded(isExpanded);
}
DefineEngineMethod(GuiVariableInspector, addField, void, (const char* name, const char* label, const char* typeName,
const char* description, const char* defaultValue, const char* dataValues, SimObject* ownerObj),
("","","","","", "", nullAsType<SimObject*>()), "addField( fieldName/varName, fieldLabel, fieldTypeName, description, defaultValue, defaultValues, ownerObject )")

View file

@ -51,6 +51,8 @@ public:
void startGroup(const char* name);
void endGroup();
void setGroupExpanded(const char* groupName, bool isExpanded);
void setGroupsExpanded(bool isExpanded);
void addField(const char* name, const char* label, const char* typeName, const char* description,
const char* defaultValue, const char* dataValues, const char* callbackName, SimObject* ownerObj);
@ -71,4 +73,4 @@ protected:
};
#endif // _GUI_VARIABLEINSPECTOR_H_
#endif // _GUI_VARIABLEINSPECTOR_H_

View file

@ -595,7 +595,7 @@ ShadowMapParams::ShadowMapParams( LightInfo *light )
overDarkFactor.set(2000.0f, 1000.0f, 500.0f, 100.0f);
numSplits = 4;
logWeight = 0.91f;
texSize = 512;
texSize = 1024;
shadowDistance = 400.0f;
shadowSoftness = 0.15f;
fadeStartDist = 0.0f;
@ -655,9 +655,9 @@ void ShadowMapParams::_validate()
// based on the split count to keep the total
// shadow texture size within 4096.
if ( numSplits == 2 || numSplits == 4 )
maxTexSize = 2048;
maxTexSize = 4096;
if ( numSplits == 3 )
maxTexSize = 1024;
maxTexSize = 2048;
}
else
numSplits = 1;

View file

@ -827,6 +827,73 @@ Var* ShaderFeatureGLSL::addOutDetailTexCoord( Vector<ShaderComponent*> &compon
return outTex;
}
Var* ShaderFeatureGLSL::getSurface(Vector<ShaderComponent*>& componentList, MultiLine* meta, const MaterialFeatureData& fd)
{
ShaderConnector* connectComp = dynamic_cast<ShaderConnector*>(componentList[C_CONNECTOR]);
/*Var* diffuseColor = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
Var* matinfo = (Var*)LangElement::find("PBRConfig");
if (!matinfo)
{
Var* metalness = (Var*)LangElement::find("metalness");
if (!metalness)
{
metalness = new Var("metalness", "float");
metalness->uniform = true;
metalness->constSortPos = cspPotentialPrimitive;
}
Var* smoothness = (Var*)LangElement::find("smoothness");
if (!smoothness)
{
smoothness = new Var("smoothness", "float");
smoothness->uniform = true;
smoothness->constSortPos = cspPotentialPrimitive;
}
matinfo = new Var("PBRConfig", "vec4");
LangElement* colorDecl = new DecOp(matinfo);
meta->addStatement(new GenOp(" @ = vec4(0.0,1.0,@,@);\r\n", colorDecl, smoothness, metalness)); //reconstruct matinfo, no ao darkening
}
Var* wsNormal = (Var*)LangElement::find("wsNormal");
Var* normal = (Var*)LangElement::find("normal");
if (!normal)
{
normal = new Var("normal", "vec3");
meta->addStatement(new GenOp(" @;\r\n\n", new DecOp(normal)));
if (!fd.features[MFT_NormalMap])
{
Var* worldToTangent = getInWorldToTangent(componentList);
meta->addStatement(new GenOp(" @ = normalize(tMul(@,vec3(0,0,1.0f)));\r\n\n", normal, worldToTangent));
}
else
{
meta->addStatement(new GenOp(" @ = normalize( half3( @ ) );\r\n", normal, wsNormal));
}
}
Var* wsEyePos = (Var*)LangElement::find("eyePosWorld");
Var* wsPosition = getInWsPosition(componentList);
Var* wsView = getWsView(wsPosition, meta);
Var* surface = (Var*)LangElement::find("surface");
if (!surface)
{
surface = new Var("surface", "Surface");
meta->addStatement(new GenOp(" @ = createForwardSurface(@,@,@,@,@,@);\r\n\n", new DecOp(surface), diffuseColor, normal, matinfo,
wsPosition, wsEyePos, wsView));
}*/
Var* surface = (Var*)LangElement::find("surface");
if (!surface)
{
surface = new Var("surface", "float");
}
return surface;
}
//****************************************************************************
// Base Texture
//****************************************************************************
@ -2060,33 +2127,13 @@ void RTLightingFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
// TODO: We can totally detect for this in the material
// feature setup... we should move it out of here!
//
if ( fd.features[MFT_LightMap] || fd.features[MFT_ToneMap] || fd.features[MFT_VertLit] )
//if ( fd.features[MFT_LightMap] || fd.features[MFT_ToneMap] || fd.features[MFT_VertLit] )
return;
ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>( componentList[C_CONNECTOR] );
MultiLine *meta = new MultiLine;
// Look for a wsNormal or grab it from the connector.
Var *wsNormal = (Var*)LangElement::find( "wsNormal" );
if ( !wsNormal )
{
wsNormal = connectComp->getElement( RT_TEXCOORD );
wsNormal->setName( "wsNormal" );
wsNormal->setStructName( "IN" );
wsNormal->setType( "vec3" );
// If we loaded the normal its our responsibility
// to normalize it... the interpolators won't.
//
// Note we cast to half here to get partial precision
// optimized code which is an acceptable loss of
// precision for normals and performs much better
// on older Geforce cards.
//
meta->addStatement( new GenOp( " @ = normalize( half3( @ ) );\r\n", wsNormal, wsNormal ) );
}
// Now the wsPosition and wsView.
Var *wsPosition = getInWsPosition( componentList );
Var *wsView = getWsView( wsPosition, meta );
@ -2106,12 +2153,13 @@ void RTLightingFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
// Get all the light constants.
Var *inLightPos = new Var( "inLightPos", "vec4" );
inLightPos->uniform = true;
inLightPos->arraySize = 3;
inLightPos->arraySize = 4;
inLightPos->constSortPos = cspPotentialPrimitive;
Var *inLightInvRadiusSq = new Var( "inLightInvRadiusSq", "vec4" );
inLightInvRadiusSq->uniform = true;
inLightInvRadiusSq->constSortPos = cspPotentialPrimitive;
Var * inLightConfigData = new Var( "inLightConfigData", "vec4" );
inLightConfigData->uniform = true;
inLightConfigData->arraySize = 4;
inLightConfigData->constSortPos = cspPotentialPrimitive;
Var *inLightColor = new Var( "inLightColor", "vec4" );
inLightColor->uniform = true;
@ -2120,56 +2168,54 @@ void RTLightingFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
Var *inLightSpotDir = new Var( "inLightSpotDir", "vec4" );
inLightSpotDir->uniform = true;
inLightSpotDir->arraySize = 3;
inLightSpotDir->arraySize = 4;
inLightSpotDir->constSortPos = cspPotentialPrimitive;
Var *inLightSpotAngle = new Var( "inLightSpotAngle", "vec4" );
inLightSpotAngle->uniform = true;
inLightSpotAngle->constSortPos = cspPotentialPrimitive;
Var * lightSpotParams = new Var( "lightSpotParams", "vec4" );
lightSpotParams->uniform = true;
lightSpotParams->arraySize = 4;
lightSpotParams->constSortPos = cspPotentialPrimitive;
Var *lightSpotFalloff = new Var( "inLightSpotFalloff", "vec4" );
lightSpotFalloff->uniform = true;
lightSpotFalloff->constSortPos = cspPotentialPrimitive;
Var* hasVectorLight = new Var("hasVectorLight", "int");
hasVectorLight->uniform = true;
hasVectorLight->constSortPos = cspPotentialPrimitive;
Var *smoothness = (Var*)LangElement::find("smoothness");
if (!fd.features[MFT_SpecularMap])
Var* vectorLightDirection = new Var("vectorLightDirection", "vec4");
vectorLightDirection->uniform = true;
vectorLightDirection->constSortPos = cspPotentialPrimitive;
Var* vectorLightColor = new Var("vectorLightColor", "vec4");
vectorLightColor->uniform = true;
vectorLightColor->constSortPos = cspPotentialPrimitive;
Var* vectorLightBrightness = new Var("vectorLightBrightness", "float");
vectorLightBrightness->uniform = true;
vectorLightBrightness->constSortPos = cspPotentialPrimitive;
Var* surface = getSurface(componentList, meta, fd);
if (!surface)
{
if (!smoothness)
{
smoothness = new Var("smoothness", "float");
smoothness->uniform = true;
smoothness->constSortPos = cspPotentialPrimitive;
}
}
Con::errorf("ShaderGen::RTLightingFeatGLSL() - failed to generate surface!");
return;
}
Var *smoothness = (Var*)LangElement::find("smoothness");
Var *metalness = (Var*)LangElement::find("metalness");
if (!fd.features[MFT_SpecularMap])
{
if (!metalness)
{
metalness = new Var("metalness", "float");
metalness->uniform = true;
metalness->constSortPos = cspPotentialPrimitive;
}
}
Var *albedo = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
Var *curColor = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
Var *ambient = new Var( "ambient", "vec4" );
ambient->uniform = true;
ambient->constSortPos = cspPass;
Var* lighting = new Var("lighting", "vec4");
meta->addStatement(new GenOp(" @ = compute4Lights( @, @, @, @,\r\n"
" @, @, @, @, @, @, @);\r\n",
new DecOp(lighting), surface, lightMask, inLightPos, inLightConfigData, inLightColor, inLightSpotDir, lightSpotParams,
hasVectorLight, vectorLightDirection, vectorLightColor, vectorLightBrightness));
// Calculate the diffuse shading and specular powers.
meta->addStatement( new GenOp( " compute4Lights( @, @, @, @,\r\n"
" @, @, @, @, @, @, @, @, @,\r\n"
" @, @ );\r\n",
wsView, wsPosition, wsNormal, lightMask,
inLightPos, inLightInvRadiusSq, inLightColor, inLightSpotDir, inLightSpotAngle, lightSpotFalloff, smoothness, metalness, albedo,
rtShading, specular ) );
meta->addStatement(new GenOp(" @.rgb += @.rgb;\r\n", curColor, lighting));
// Apply the lighting to the diffuse color.
LangElement *lighting = new GenOp( "vec4( @.rgb + @.rgb, 1 )", rtShading, ambient );
meta->addStatement( new GenOp( " @;\r\n", assignColor( lighting, Material::Mul ) ) );
output = meta;
}
@ -2872,7 +2918,7 @@ void HardwareSkinningFeatureGLSL::processVert(Vector<ShaderComponent*> &componen
}
//****************************************************************************
// ReflectionProbeFeatHLSL
// ReflectionProbeFeatGLSL
//****************************************************************************
ReflectionProbeFeatGLSL::ReflectionProbeFeatGLSL()
@ -2880,6 +2926,17 @@ ReflectionProbeFeatGLSL::ReflectionProbeFeatGLSL()
{
addDependency(&mDep);
}
void ReflectionProbeFeatGLSL::processVert(Vector<ShaderComponent*>& componentList,
const MaterialFeatureData& fd)
{
//MultiLine* meta = new MultiLine;
//output = meta;
// Also output the worldToTanget transform which
// we use to create the world space normal.
//getOutWorldToTangent(componentList, meta, fd);
}
void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList,
const MaterialFeatureData& fd)
{
@ -2889,7 +2946,7 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
// TODO: We can totally detect for this in the material
// feature setup... we should move it out of here!
//
if (fd.features[MFT_LightMap] || fd.features[MFT_ToneMap] || fd.features[MFT_VertLit])
//if (fd.features[MFT_LightMap] || fd.features[MFT_ToneMap] || fd.features[MFT_VertLit])
return;
ShaderConnector * connectComp = dynamic_cast<ShaderConnector*>(componentList[C_CONNECTOR]);
@ -2897,15 +2954,13 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
MultiLine * meta = new MultiLine;
// Now the wsPosition and wsView.
Var * wsPosition = getInWsPosition(componentList);
Var * wsView = getWsView(wsPosition, meta);
Var * albedo = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
Var *wsPosition = getInWsPosition(componentList);
Var *wsView = getWsView(wsPosition, meta);
//Reflection Probe WIP
U32 MAX_FORWARD_PROBES = 4;
Var * numProbes = new Var("numProbes", "float");
Var * numProbes = new Var("numProbes", "int");
numProbes->uniform = true;
numProbes->constSortPos = cspPotentialPrimitive;
@ -2913,9 +2968,9 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
cubeMips->uniform = true;
cubeMips->constSortPos = cspPotentialPrimitive;
Var * hasSkylight = new Var("hasSkylight", "float");
hasSkylight->uniform = true;
hasSkylight->constSortPos = cspPotentialPrimitive;
Var * skylightCubemapIdx = new Var("skylightCubemapIdx", "float");
skylightCubemapIdx->uniform = true;
skylightCubemapIdx->constSortPos = cspPotentialPrimitive;
Var * inProbePosArray = new Var("inProbePosArray", "vec4");
inProbePosArray->arraySize = MAX_FORWARD_PROBES;
@ -2942,7 +2997,7 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
probeConfigData->uniform = true;
probeConfigData->constSortPos = cspPotentialPrimitive;
Var * worldToObjArray = new Var("worldToObjArray", "mat4x4");
Var * worldToObjArray = new Var("worldToObjArray", "mat4");
worldToObjArray->arraySize = MAX_FORWARD_PROBES;
worldToObjArray->uniform = true;
worldToObjArray->constSortPos = cspPotentialPrimitive;
@ -2965,87 +3020,29 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
irradianceCubemapAR->sampler = true;
irradianceCubemapAR->constNum = Var::getTexUnitNum();
Var * skylightSpecularMap = new Var("skylightSpecularMap", "samplerCube");
skylightSpecularMap->uniform = true;
skylightSpecularMap->sampler = true;
skylightSpecularMap->constNum = Var::getTexUnitNum();
Var* surface = getSurface(componentList, meta, fd);
Var * skylightIrradMap = new Var("skylightIrradMap", "samplerCube");
skylightIrradMap->uniform = true;
skylightIrradMap->sampler = true;
skylightIrradMap->constNum = Var::getTexUnitNum();
Var * inTex = getInTexCoord("texCoord", "vec2", componentList);
if (!inTex)
if (!surface)
{
Con::errorf("ShaderGen::ReflectionProbeFeatGLSL() - failed to generate surface!");
return;
Var * diffuseColor = (Var*)LangElement::find("diffuseColor");
if (!diffuseColor)
{
diffuseColor = new Var;
diffuseColor->setType("vec4");
diffuseColor->setName("diffuseColor");
LangElement* colorDecl = new DecOp(diffuseColor);
meta->addStatement(new GenOp(" @ = vec4(1.0,1.0,1.0,1.0);\r\n", colorDecl)); //default to flat white
}
Var* matinfo = (Var*)LangElement::find("PBRConfig");
if (!matinfo)
{
Var* metalness = (Var*)LangElement::find("metalness");
if (!metalness)
{
metalness = new Var("metalness", "float");
metalness->uniform = true;
metalness->constSortPos = cspPotentialPrimitive;
}
Var* smoothness = (Var*)LangElement::find("smoothness");
if (!smoothness)
{
smoothness = new Var("smoothness", "float");
smoothness->uniform = true;
smoothness->constSortPos = cspPotentialPrimitive;
}
matinfo = new Var("PBRConfig", "vec4");
LangElement* colorDecl = new DecOp(matinfo);
meta->addStatement(new GenOp(" @ = vec4(0.0,1.0,@,@);\r\n", colorDecl, smoothness, metalness)); //reconstruct matinfo, no ao darkening
}
Var* bumpNormal = (Var*)LangElement::find("bumpNormal");
if (!bumpNormal)
{
bumpNormal = new Var("bumpNormal", "vec4");
LangElement* colorDecl = new DecOp(bumpNormal);
meta->addStatement(new GenOp(" @ = vec4(1.0,0.0,0.0,0.0);\r\n", colorDecl)); //default to identity normal
}
Var *curColor = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
Var *matinfo = (Var*)LangElement::find("PBRConfig");
Var* metalness = (Var*)LangElement::find("metalness");
Var* smoothness = (Var*)LangElement::find("smoothness");
Var* wsEyePos = (Var*)LangElement::find("eyePosWorld");
Var* worldToCamera = (Var*)LangElement::find("worldToCamera");
if (!worldToCamera)
{
worldToCamera = new Var;
worldToCamera->setType("mat4x4");
worldToCamera->setName("worldToCamera");
worldToCamera->uniform = true;
worldToCamera->constSortPos = cspPass;
}
//Reflection vec
Var* surface = new Var("surface", "Surface");
meta->addStatement(new GenOp(" @ = createForwardSurface(@,@,@,@,@,@,@,@);\r\n\n", new DecOp(surface), diffuseColor, bumpNormal, matinfo,
inTex, wsPosition, wsEyePos, wsView, worldToCamera));
String computeForwardProbes = String(" @.rgb += computeForwardProbes(@,@,@,@,@,@,@,@,@,\r\n\t\t");
String computeForwardProbes = String(" @.rgb = computeForwardProbes(@,@,@,@,@,@,@,@,@,\r\n\t\t");
computeForwardProbes += String("@,@,\r\n\t\t");
computeForwardProbes += String("@, @, \r\n\t\t");
computeForwardProbes += String("@,@).rgb; \r\n");
meta->addStatement(new GenOp(computeForwardProbes.c_str(), albedo, surface, cubeMips, numProbes, worldToObjArray, probeConfigData, inProbePosArray, refBoxMinArray, refBoxMaxArray, inRefPosArray,
hasSkylight, BRDFTexture,
skylightIrradMap, skylightSpecularMap,
meta->addStatement(new GenOp(computeForwardProbes.c_str(), curColor, surface, cubeMips, numProbes, worldToObjArray, probeConfigData, inProbePosArray, refBoxMinArray, refBoxMaxArray, inRefPosArray,
skylightCubemapIdx, BRDFTexture,
irradianceCubemapAR, specularCubemapAR));
output = meta;
@ -3055,8 +3052,8 @@ ShaderFeature::Resources ReflectionProbeFeatGLSL::getResources(const MaterialFea
{
Resources res;
res.numTex = 5;
res.numTexReg = 5;
res.numTex = 3;
res.numTexReg = 3;
return res;
}
@ -3075,9 +3072,5 @@ void ReflectionProbeFeatGLSL::setTexData(Material::StageData& stageDat,
passData.mTexType[texIndex++] = Material::SGCube;
passData.mSamplerNames[texIndex] = "irradianceCubemapAR";
passData.mTexType[texIndex++] = Material::SGCube;
passData.mSamplerNames[texIndex] = "skylightSpecularMap";
passData.mTexType[texIndex++] = Material::SGCube;
passData.mSamplerNames[texIndex] = "skylightIrradMap";
passData.mTexType[texIndex++] = Material::SGCube;
}
}

View file

@ -134,6 +134,8 @@ public:
Var* getInvWorldView( Vector<ShaderComponent*> &componentList,
bool useInstancing,
MultiLine *meta );
Var* getSurface(Vector<ShaderComponent*>& componentList, MultiLine* meta, const MaterialFeatureData& fd);
// ShaderFeature
Var* getVertTexCoord( const String &name );
@ -678,6 +680,9 @@ protected:
public:
ReflectionProbeFeatGLSL();
virtual void processVert(Vector<ShaderComponent*>& componentList,
const MaterialFeatureData& fd);
virtual void processPix(Vector<ShaderComponent*>& componentList,
const MaterialFeatureData& fd);

View file

@ -86,7 +86,7 @@ bool TSMesh::smUseEncodedNormals = false;
const F32 TSMesh::VISIBILITY_EPSILON = 0.0001f;
S32 TSMesh::smMaxInstancingVerts = 200;
S32 TSMesh::smMaxInstancingVerts = 2000;
MatrixF TSMesh::smDummyNodeTransform(1);
// quick function to force object to face camera -- currently throws out roll :(
@ -3473,4 +3473,4 @@ void TSSkinMesh::printVerts()
bw._indexes.x, bw._indexes.y, bw._indexes.z, bw._indexes.w,
bw._weights.x, bw._weights.y, bw._weights.z, bw._weights.w);
}
}
}

View file

@ -73,7 +73,7 @@ MODULE_BEGIN( TSShapeInstance )
Con::addVariable("$pref::TS::maxInstancingVerts", TypeS32, &TSMesh::smMaxInstancingVerts,
"@brief Enables mesh instancing on non-skin meshes that have less that this count of verts.\n"
"The default value is 200. Higher values can degrade performance.\n"
"The default value is 2000. Higher values can degrade performance.\n"
"@ingroup Rendering\n" );
}

View file

@ -16,6 +16,9 @@ function CoreModule::onCreate(%this)
// to find exactly which subsystems should be readied before kicking things off.
// ----------------------------------------------------------------------------
new Settings(ProjectSettings) { file = "core/settings.xml"; };
ProjectSettings.read();
ModuleDatabase.LoadExplicit( "Core_Rendering" );
ModuleDatabase.LoadExplicit( "Core_Utility" );
ModuleDatabase.LoadExplicit( "Core_GUI" );
@ -25,9 +28,6 @@ function CoreModule::onCreate(%this)
ModuleDatabase.LoadExplicit( "Core_Components" );
ModuleDatabase.LoadExplicit( "Core_GameObjects" );
new Settings(ProjectSettings) { file = "core/settings.xml"; };
ProjectSettings.read();
%prefPath = getPrefpath();
if ( isFile( %prefPath @ "/clientPrefs.cs" ) )
exec( %prefPath @ "/clientPrefs.cs" );

View file

@ -54,6 +54,7 @@ function clientCmdMissionStartPhase1(%seq, %missionName)
if ( isScriptFile( %path ) )
{
postFXManager::loadPresetHandler( %path );
$PostFXManager::currentPreset = %path;
}
else
{
@ -138,6 +139,18 @@ function sceneLightingComplete()
echo("Mission lighting done");
$lightingMission = false;
//Bake probes
%boxProbeIds = parseMissionGroupForIds("BoxEnvironmentProbe", "");
%sphereProbeIds = parseMissionGroupForIds("SphereEnvironmentProbe", "");
%skylightIds = parseMissionGroupForIds("Skylight", "");
%probeIds = rtrim(ltrim(%boxProbeIds SPC %sphereProbeIds));
%probeIds = rtrim(ltrim(%probeIds SPC %skylightIds));
%probeCount = getWordCount(%probeIds);
$pref::ReflectionProbes::CurrentLevelPath = filePath($Client::MissionFile) @ "/" @ fileBase($Client::MissionFile) @ "/probes/";
ProbeBin.processProbes();
onPhaseComplete("STARTING MISSION");
// The is also the end of the mission load cycle.

View file

@ -147,7 +147,7 @@ function configureCanvas()
"--Refresh Rate : " @ %rate NL
"--AA TypeXLevel : " @ %aa NL
"--------------");
// Actually set the new video mode
Canvas.setVideoMode(%resX, %resY, %fs, %bpp, %rate, %aa);

View file

@ -2,9 +2,10 @@
function Core_PostFX::onCreate(%this)
{
//
exec("./scripts/postFxManager.cs");
exec("./scripts/postFx.cs");
/*exec("./scripts/postFxManager.gui.cs");
exec("./scripts/postFxManager.gui.settings.cs");
/*exec("./scripts/postFxManager.gui.settings.cs");
exec("./scripts/postFxManager.persistance.cs");
exec("./scripts/default.postfxpreset.cs");

File diff suppressed because it is too large Load diff

View file

@ -323,6 +323,80 @@ function HDRPostFX::onDisabled( %this )
resetLightManager();
}
function HDRPostFX::onAdd( %this )
{
PostFXManager.registerPostEffect(%this);
//HDR should really be on at all times
%this.enable();
$HDRPostFX::enableToneMapping = 1;
}
//This is used to populate the PostFXEditor's settings so the post FX can be edited
//This is automatically polled for any postFX that has been registered(in our onAdd) and the settings
//are thus exposed for editing
function HDRPostFX::populatePostFXSettings(%this)
{
PostEffectEditorInspector.startGroup("HDR - General");
PostEffectEditorInspector.addField("$PostFXManager::Settings::HDR::keyValue", "Key Value", "float", "", $HDRPostFX::keyValue, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::HDR::minLuminace", "Minimum Luminance", "float", "", $HDRPostFX::minLuminace, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::HDR::whiteCutoff", "White Cutoff", "float", "", $HDRPostFX::whiteCutoff, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::HDR::adaptRate", "Brightness Adapt Rate", "float", "", $HDRPostFX::adaptRate, "");
PostEffectEditorInspector.endGroup();
PostEffectEditorInspector.startGroup("HDR - Bloom");
PostEffectEditorInspector.addField("$PostFXManager::Settings::HDR::enableBloom", "Enable Bloom", "bool", "", $HDRPostFX::enableBloom, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::HDR::brightPassThreshold", "Bright Pass Threshold", "float", "", $HDRPostFX::brightPassThreshold, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::HDR::gaussMultiplier", "Blur Multiplier", "float", "", $HDRPostFX::gaussMultiplier, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::HDR::gaussMean", "Blur \"Mean\" Value", "float", "", $HDRPostFX::gaussMean, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::HDR::gaussStdDev", "Blur \"Std. Dev\" Value", "float", "", $HDRPostFX::gaussStdDev, "");
PostEffectEditorInspector.endGroup();
PostEffectEditorInspector.startGroup("HDR - Effects");
PostEffectEditorInspector.addField("$PostFXManager::Settings::HDR::enableBlueShift", "Enable Blue Shift", "bool", "", $HDRPostFX::enableBlueShift, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::HDR::blueShiftColor", "Blue Shift Color", "colorF", "", $HDRPostFX::blueShiftColor, "");
PostEffectEditorInspector.endGroup();
}
//This function pair(applyFromPreset and settingsApply) are done the way they are, with the separated variables
//so that we can effectively store the 'settings' away from the live variables that the postFX's actually utilize
//when rendering. This allows us to modify things but still leave room for reverting or temporarily applying them
function HDRPostFX::applyFromPreset(%this)
{
//HDRPostFX Settings
$HDRPostFX::adaptRate = $PostFXManager::Settings::HDR::adaptRate;
$HDRPostFX::blueShiftColor = $PostFXManager::Settings::HDR::blueShiftColor;
$HDRPostFX::brightPassThreshold = $PostFXManager::Settings::HDR::brightPassThreshold;
$HDRPostFX::enableBloom = $PostFXManager::Settings::HDR::enableBloom;
$HDRPostFX::enableBlueShift = $PostFXManager::Settings::HDR::enableBlueShift;
$HDRPostFX::enableToneMapping = $PostFXManager::Settings::HDR::enableToneMapping;
$HDRPostFX::gaussMean = $PostFXManager::Settings::HDR::gaussMean;
$HDRPostFX::gaussMultiplier = $PostFXManager::Settings::HDR::gaussMultiplier;
$HDRPostFX::gaussStdDev = $PostFXManager::Settings::HDR::gaussStdDev;
$HDRPostFX::keyValue = $PostFXManager::Settings::HDR::keyValue;
$HDRPostFX::minLuminace = $PostFXManager::Settings::HDR::minLuminace;
$HDRPostFX::whiteCutoff = $PostFXManager::Settings::HDR::whiteCutoff;
$HDRPostFX::colorCorrectionRamp = $PostFXManager::Settings::ColorCorrectionRamp;
}
function HDRPostFX::settingsApply(%this)
{
$PostFXManager::Settings::HDR::adaptRate = $HDRPostFX::adaptRate;
$PostFXManager::Settings::HDR::blueShiftColor = $HDRPostFX::blueShiftColor;
$PostFXManager::Settings::HDR::brightPassThreshold = $HDRPostFX::brightPassThreshold;
$PostFXManager::Settings::HDR::enableBloom = $HDRPostFX::enableBloom;
$PostFXManager::Settings::HDR::enableBlueShift = $HDRPostFX::enableBlueShift;
$PostFXManager::Settings::HDR::enableToneMapping = $HDRPostFX::enableToneMapping;
$PostFXManager::Settings::HDR::gaussMean = $HDRPostFX::gaussMean;
$PostFXManager::Settings::HDR::gaussMultiplier = $HDRPostFX::gaussMultiplier;
$PostFXManager::Settings::HDR::gaussStdDev = $HDRPostFX::gaussStdDev;
$PostFXManager::Settings::HDR::keyValue = $HDRPostFX::keyValue;
$PostFXManager::Settings::HDR::minLuminace = $HDRPostFX::minLuminace;
$PostFXManager::Settings::HDR::whiteCutoff = $HDRPostFX::whiteCutoff;
$PostFXManager::Settings::ColorCorrectionRamp = $HDRPostFX::colorCorrectionRamp;
}
singleton PostEffect( HDRPostFX )
{
isEnabled = false;

View file

@ -29,6 +29,10 @@ $LightRayPostFX::decay = 1.0;
$LightRayPostFX::exposure = 0.0005;
$LightRayPostFX::resolutionScale = 1.0;
function LightRayPostFX::onAdd( %this )
{
PostFXManager.registerPostEffect(%this);
}
singleton ShaderData( LightRayOccludeShader )
{
@ -67,7 +71,7 @@ singleton GFXStateBlockData( LightRayStateBlock : PFX_DefaultStateBlock )
singleton PostEffect( LightRayPostFX )
{
isEnabled = false;
//isEnabled = false;
allowReflectPass = false;
renderTime = "PFXBeforeBin";
@ -108,3 +112,43 @@ function LightRayPostFX::setShaderConsts( %this )
%pfx.setShaderConst( "$decay", $LightRayPostFX::decay );
%pfx.setShaderConst( "$exposure", $LightRayPostFX::exposure );
}
function LightRayPostFX::populatePostFXSettings(%this)
{
PostEffectEditorInspector.startGroup("Light Ray");
PostEffectEditorInspector.addField("$PostFXManager::Settings::EnableLightRays", "Enabled", "bool", "", $PostFXManager::PostFX::EnableLightRays, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::LightRays::brightScalar", "Brightness", "float", "", $LightRayPostFX::brightScalar, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::LightRays::numSamples", "Samples", "float", "", $LightRayPostFX::numSamples, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::LightRays::density", "Density", "float", "", $LightRayPostFX::density, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::LightRays::weight", "Weight", "float", "", $LightRayPostFX::weight, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::LightRays::decay", "Decay", "float", "", $LightRayPostFX::decay, "");
PostEffectEditorInspector.endGroup();
}
function LightRayPostFX::applyFromPreset(%this)
{
//Light rays settings
$PostFXManager::PostFX::EnableLightRays = $PostFXManager::Settings::EnableLightRays;
$LightRayPostFX::brightScalar = $PostFXManager::Settings::LightRays::brightScalar;
$LightRayPostFX::numSamples = $PostFXManager::Settings::LightRays::numSamples;
$LightRayPostFX::density = $PostFXManager::Settings::LightRays::density;
$LightRayPostFX::weight = $PostFXManager::Settings::LightRays::weight;
$LightRayPostFX::decay = $PostFXManager::Settings::LightRays::decay;
if($PostFXManager::PostFX::EnableLightRays)
%this.enable();
else
%this.disable();
}
function LightRayPostFX::settingsApply(%this)
{
$PostFXManager::Settings::EnableLightRays = $PostFXManager::PostFX::EnableLightRays;
$PostFXManager::Settings::LightRays::brightScalar = $LightRayPostFX::brightScalar;
$PostFXManager::Settings::LightRays::numSamples = $LightRayPostFX::numSamples;
$PostFXManager::Settings::LightRays::density = $LightRayPostFX::density;
$PostFXManager::Settings::LightRays::weight = $LightRayPostFX::weight;
$PostFXManager::Settings::LightRays::decay = $LightRayPostFX::decay;
}

View file

@ -20,6 +20,24 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
$PostFXManager::vebose = true;
function postVerbose(%string)
{
if($PostFXManager::vebose == true)
{
echo(%string);
}
}
if(!isObject(PostFXManager))
{
new ArrayObject(PostFXManager){};
}
function PostFXManager::registerPostEffect(%this, %postEffect)
{
PostFXManager.add(%postEffect);
}
// Used to name the saved files.
$PostFXManager::fileExtension = ".postfxpreset.cs";
@ -30,6 +48,10 @@ $PostFXManager::fileFilter = "Post Effect Presets|*.postfxpreset.cs";
// Enable / disable PostFX when loading presets or just apply the settings?
$PostFXManager::forceEnableFromPresets = true;
$PostFXManager::defaultPreset = "./default.postfxpreset.cs";
$PostFXManager::currentPreset = "";
//Load a preset file from the disk, and apply the settings to the
//controls. If bApplySettings is true - the actual values in the engine
//will be changed to reflect the settings from the file.
@ -37,6 +59,7 @@ function PostFXManager::loadPresetFile()
{
//Show the dialog and set the flag
getLoadFilename($PostFXManager::fileFilter, "PostFXManager::loadPresetHandler");
$PostFXManager::currentPreset = $Tools::FileDialogs::LastFilePath();
}
function PostFXManager::loadPresetHandler( %filename )
@ -48,7 +71,16 @@ function PostFXManager::loadPresetHandler( %filename )
postVerbose("% - PostFX Manager - Executing " @ %filename);
exec(%filename);
PostFXManager.settingsApplyFromPreset();
%count = PostFXManager.Count();
for(%i=0; %i < %count; %i++)
{
%postEffect = PostFXManager.getKey(%i);
if(isObject(%postEffect) && %postEffect.isMethod("applyFromPreset"))
{
%postEffect.applyFromPreset();
}
}
}
}
@ -69,11 +101,39 @@ function PostFXManager::savePresetHandler( %filename )
if(strStr(%filename, ".") == -1)
%filename = %filename @ $PostFXManager::fileExtension;
//Apply the current settings to the preset
PostFXManager.settingsApplyAll();
%count = PostFXManager.Count();
for(%i=0; %i < %count; %i++)
{
%postEffect = PostFXManager.getKey(%i);
if(isObject(%postEffect) && %postEffect.isMethod("settingsApply"))
{
%postEffect.settingsApply();
}
}
export("$PostFXManager::Settings::*", %filename, false);
postVerbose("% - PostFX Manager - Save complete. Preset saved at : " @ %filename);
}
function PostFXManager::settingsApplyDefaultPreset(%this)
{
PostFXManager::loadPresetHandler($PostFXManager::defaultPreset);
$PostFXManager::currentPreset = $PostFXManager::defaultPreset;
}
function PostFXManager::settingsEffectSetEnabled(%this, %postEffect, %bEnable)
{
// Apply the change
if ( %bEnable == true )
{
%postEffect.enable();
postVerbose("% - PostFX Manager - " @ %postEffect.getName() @ " enabled");
}
else
{
%postEffect.disable();
postVerbose("% - PostFX Manager - " @ %postEffect.getName() @ " disabled");
}
}

View file

@ -1,446 +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.
//-----------------------------------------------------------------------------
$PostFXManager::vebose = true;
function postVerbose(%string)
{
if($PostFXManager::vebose == true)
{
echo(%string);
}
}
function PostFXManager::onDialogPush( %this )
{
//Apply the settings to the controls
postVerbose("% - PostFX Manager - Loading GUI.");
%this.settingsRefreshAll();
}
// :: Controls for the overall postFX manager dialog
function ppOptionsEnable::onAction(%this)
{
//Disable / Enable all PostFX
if(ppOptionsEnable.getValue())
{
%toEnable = true;
}
else
{
%toEnable = false;
}
PostFXManager.settingsSetEnabled(%toEnable);
}
function PostFXManager::getEnableResultFromControl(%this, %control)
{
%toEnable = -1;
%bTest = %control.getValue();
if(%bTest == 1)
{
%toEnable = true;
}
else
{
%toEnable = false;
}
return %toEnable;
}
function ppOptionsEnableSSAO::onAction(%this)
{
%toEnable = PostFXManager.getEnableResultFromControl(%this);
PostFXManager.settingsEffectSetEnabled("SSAO", %toEnable);
}
function ppOptionsEnableHDR::onAction(%this)
{
%toEnable = PostFXManager.getEnableResultFromControl(%this);
PostFXManager.settingsEffectSetEnabled("HDR", %toEnable);
}
function ppOptionsEnableLightRays::onAction(%this)
{
%toEnable = PostFXManager.getEnableResultFromControl(%this);
PostFXManager.settingsEffectSetEnabled("LightRays", %toEnable);
}
function ppOptionsEnableDOF::onAction(%this)
{
%toEnable = PostFXManager.getEnableResultFromControl(%this);
PostFXManager.settingsEffectSetEnabled("DOF", %toEnable);
}
function ppOptionsEnableVignette::onAction(%this)
{
%toEnable = PostFXManager.getEnableResultFromControl(%this);
PostFXManager.settingsEffectSetEnabled("Vignette", %toEnable);
}
function ppOptionsSavePreset::onClick(%this)
{
//Stores the current settings into a preset file for loading and use later on
}
function ppOptionsLoadPreset::onClick(%this)
{
//Loads and applies the settings from a postfxpreset file
}
//Other controls, Quality dropdown
function ppOptionsSSAOQuality::onSelect( %this, %id, %text )
{
if(%id > -1 && %id < 3)
{
$SSAOPostFx::quality = %id;
}
}
//SSAO Slider controls
//General Tab
function ppOptionsSSAOOverallStrength::onMouseDragged(%this)
{
$SSAOPostFx::overallStrength = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
function ppOptionsSSAOBlurDepth::onMouseDragged(%this)
{
$SSAOPostFx::blurDepthTol = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
function ppOptionsSSAOBlurNormal::onMouseDragged(%this)
{
$SSAOPostFx::blurNormalTol = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
//Near Tab
function ppOptionsSSAONearRadius::onMouseDragged(%this)
{
$SSAOPostFx::sRadius = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
function ppOptionsSSAONearStrength::onMouseDragged(%this)
{
$SSAOPostFx::sStrength = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
function ppOptionsSSAONearDepthMin::onMouseDragged(%this)
{
$SSAOPostFx::sDepthMin = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
function ppOptionsSSAONearDepthMax::onMouseDragged(%this)
{
$SSAOPostFx::sDepthMax = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
function ppOptionsSSAONearToleranceNormal::onMouseDragged(%this)
{
$SSAOPostFx::sNormalTol = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
function ppOptionsSSAONearTolerancePower::onMouseDragged(%this)
{
$SSAOPostFx::sNormalPow = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
//Far Tab
function ppOptionsSSAOFarRadius::onMouseDragged(%this)
{
$SSAOPostFx::lRadius = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
function ppOptionsSSAOFarStrength::onMouseDragged(%this)
{
$SSAOPostFx::lStrength = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
function ppOptionsSSAOFarDepthMin::onMouseDragged(%this)
{
$SSAOPostFx::lDepthMin = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
function ppOptionsSSAOFarDepthMax::onMouseDragged(%this)
{
$SSAOPostFx::lDepthMax = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
function ppOptionsSSAOFarToleranceNormal::onMouseDragged(%this)
{
$SSAOPostFx::lNormalTol = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
function ppOptionsSSAOFarTolerancePower::onMouseDragged(%this)
{
$SSAOPostFx::lNormalPow = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
//HDR Slider Controls
//Brighness tab
function ppOptionsHDRToneMappingAmount::onMouseDragged(%this)
{
$HDRPostFX::enableToneMapping = %this.value;
%this.ToolTip = "value : " @ %this.value;
}
function ppOptionsHDRKeyValue::onMouseDragged(%this)
{
$HDRPostFX::keyValue = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
function ppOptionsHDRMinLuminance::onMouseDragged(%this)
{
$HDRPostFX::minLuminace = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
function ppOptionsHDRWhiteCutoff::onMouseDragged(%this)
{
$HDRPostFX::whiteCutoff = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
function ppOptionsHDRBrightnessAdaptRate::onMouseDragged(%this)
{
$HDRPostFX::adaptRate = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
//Blur tab
function ppOptionsHDRBloomBlurBrightPassThreshold::onMouseDragged(%this)
{
$HDRPostFX::brightPassThreshold = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
function ppOptionsHDRBloomBlurMultiplier::onMouseDragged(%this)
{
$HDRPostFX::gaussMultiplier = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
function ppOptionsHDRBloomBlurMean::onMouseDragged(%this)
{
$HDRPostFX::gaussMean = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
function ppOptionsHDRBloomBlurStdDev::onMouseDragged(%this)
{
$HDRPostFX::gaussStdDev = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
function ppOptionsHDRBloom::onAction(%this)
{
$HDRPostFX::enableBloom = %this.getValue();
}
function ppOptionsHDRToneMapping::onAction(%this)
{
//$HDRPostFX::enableToneMapping = %this.getValue();
}
function ppOptionsHDREffectsBlueShift::onAction(%this)
{
$HDRPostFX::enableBlueShift = %this.getValue();
}
//Controls for color range in blue Shift dialog
function ppOptionsHDREffectsBlueShiftColorBlend::onAction(%this)
{
$HDRPostFX::blueShiftColor = %this.PickColor;
%this.ToolTip = "Color Values : " @ %this.PickColor;
}
function ppOptionsHDREffectsBlueShiftColorBaseColor::onAction(%this)
{
//This one feeds the one above
ppOptionsHDREffectsBlueShiftColorBlend.baseColor = %this.PickColor;
%this.ToolTip = "Color Values : " @ %this.PickColor;
}
//Light rays Brightness Slider Controls
function ppOptionsLightRaysBrightScalar::onMouseDragged(%this)
{
$LightRayPostFX::brightScalar = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
//Light rays Number of Samples Slider Control
function ppOptionsLightRaysSampleScalar::onMouseDragged(%this)
{
$LightRayPostFX::numSamples = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
//Light rays Density Slider Control
function ppOptionsLightRaysDensityScalar::onMouseDragged(%this)
{
$LightRayPostFX::density = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
//Light rays Weight Slider Control
function ppOptionsLightRaysWeightScalar::onMouseDragged(%this)
{
$LightRayPostFX::weight = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
//Light rays Decay Slider Control
function ppOptionsLightRaysDecayScalar::onMouseDragged(%this)
{
$LightRayPostFX::decay = %this.value;
%this.ToolTip = "Value : " @ %this.value;
}
function ppOptionsUpdateDOFSettings()
{
DOFPostEffect.setFocusParams( $DOFPostFx::BlurMin, $DOFPostFx::BlurMax, $DOFPostFx::FocusRangeMin, $DOFPostFx::FocusRangeMax, -($DOFPostFx::BlurCurveNear), $DOFPostFx::BlurCurveFar );
DOFPostEffect.setAutoFocus( $DOFPostFx::EnableAutoFocus );
DOFPostEffect.setFocalDist(0);
if($PostFXManager::PostFX::EnableDOF)
{
DOFPostEffect.enable();
}
else
{
DOFPostEffect.disable();
}
}
//DOF General Tab
//DOF Toggles
function ppOptionsDOFEnableDOF::onAction(%this)
{
$PostFXManager::PostFX::EnableDOF = %this.getValue();
ppOptionsUpdateDOFSettings();
}
function ppOptionsDOFEnableAutoFocus::onAction(%this)
{
$DOFPostFx::EnableAutoFocus = %this.getValue();
DOFPostEffect.setAutoFocus( %this.getValue() );
}
//DOF AutoFocus Slider controls
function ppOptionsDOFFarBlurMinSlider::onMouseDragged(%this)
{
$DOFPostFx::BlurMin = %this.value;
ppOptionsUpdateDOFSettings();
}
function ppOptionsDOFFarBlurMaxSlider::onMouseDragged(%this)
{
$DOFPostFx::BlurMax = %this.value;
ppOptionsUpdateDOFSettings();
}
function ppOptionsDOFFocusRangeMinSlider::onMouseDragged(%this)
{
$DOFPostFx::FocusRangeMin = %this.value;
ppOptionsUpdateDOFSettings();
}
function ppOptionsDOFFocusRangeMaxSlider::onMouseDragged(%this)
{
$DOFPostFx::FocusRangeMax = %this.value;
ppOptionsUpdateDOFSettings();
}
function ppOptionsDOFBlurCurveNearSlider::onMouseDragged(%this)
{
$DOFPostFx::BlurCurveNear = %this.value;
ppOptionsUpdateDOFSettings();
}
function ppOptionsDOFBlurCurveFarSlider::onMouseDragged(%this)
{
$DOFPostFx::BlurCurveFar = %this.value;
ppOptionsUpdateDOFSettings();
}
function ppOptionsEnableHDRDebug::onAction(%this)
{
if ( %this.getValue() )
LuminanceVisPostFX.enable();
else
LuminanceVisPostFX.disable();
}
function ppOptionsUpdateVignetteSettings()
{
if($PostFXManager::PostFX::EnableVignette)
{
VignettePostEffect.enable();
}
else
{
VignettePostEffect.disable();
}
}
function ppOptionsVignetteEnableVignette::onAction(%this)
{
$PostFXManager::PostFX::EnableVignette = %this.getValue();
ppOptionsUpdateVignetteSettings();
}
function ppColorCorrection_selectFile()
{
%filter = "Image Files (*.png, *.jpg, *.dds, *.bmp, *.gif, *.jng. *.tga)|*.png;*.jpg;*.dds;*.bmp;*.gif;*.jng;*.tga|All Files (*.*)|*.*|";
getLoadFilename( %filter, "ppColorCorrection_selectFileHandler");
}
function ppColorCorrection_selectFileHandler( %filename )
{
if ( %filename $= "" || !isFile( %filename ) )
%filename = "core/postFX/images/null_color_ramp.png";
else
%filename = makeRelativePath( %filename, getMainDotCsDir() );
$HDRPostFX::colorCorrectionRamp = %filename;
PostFXManager-->ColorCorrectionFileName.Text = %filename;
}

View file

@ -1,439 +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.
//-----------------------------------------------------------------------------
$PostFXManager::defaultPreset = "./default.postfxpreset.cs";
function PostFXManager::settingsSetEnabled(%this, %bEnablePostFX)
{
$PostFXManager::PostFX::Enabled = %bEnablePostFX;
//if to enable the postFX, apply the ones that are enabled
if ( %bEnablePostFX )
{
//SSAO, HDR, LightRays, DOF
if ( $PostFXManager::PostFX::EnableSSAO )
SSAOPostFx.enable();
else
SSAOPostFx.disable();
if ( $PostFXManager::PostFX::EnableHDR )
HDRPostFX.enable();
else
HDRPostFX.disable();
if ( $PostFXManager::PostFX::EnableLightRays )
LightRayPostFX.enable();
else
LightRayPostFX.disable();
if ( $PostFXManager::PostFX::EnableDOF )
DOFPostEffect.enable();
else
DOFPostEffect.disable();
if ( $PostFXManager::PostFX::EnableVignette )
VignettePostEffect.enable();
else
VignettePostEffect.disable();
postVerbose("% - PostFX Manager - PostFX enabled");
}
else
{
//Disable all postFX
SSAOPostFx.disable();
HDRPostFX.disable();
LightRayPostFX.disable();
DOFPostEffect.disable();
VignettePostEffect.disable();
postVerbose("% - PostFX Manager - PostFX disabled");
}
VolFogGlowPostFx.disable();
}
function PostFXManager::settingsEffectSetEnabled(%this, %sName, %bEnable)
{
%postEffect = 0;
//Determine the postFX to enable, and apply the boolean
if(%sName $= "SSAO")
{
%postEffect = SSAOPostFx;
$PostFXManager::PostFX::EnableSSAO = %bEnable;
//$pref::PostFX::SSAO::Enabled = %bEnable;
}
else if(%sName $= "HDR")
{
%postEffect = HDRPostFX;
$PostFXManager::PostFX::EnableHDR = %bEnable;
//$pref::PostFX::HDR::Enabled = %bEnable;
}
else if(%sName $= "LightRays")
{
%postEffect = LightRayPostFX;
$PostFXManager::PostFX::EnableLightRays = %bEnable;
//$pref::PostFX::LightRays::Enabled = %bEnable;
}
else if(%sName $= "DOF")
{
%postEffect = DOFPostEffect;
$PostFXManager::PostFX::EnableDOF = %bEnable;
//$pref::PostFX::DOF::Enabled = %bEnable;
}
else if(%sName $= "Vignette")
{
%postEffect = VignettePostEffect;
$PostFXManager::PostFX::EnableVignette = %bEnable;
//$pref::PostFX::Vignette::Enabled = %bEnable;
}
// Apply the change
if ( %bEnable == true )
{
%postEffect.enable();
postVerbose("% - PostFX Manager - " @ %sName @ " enabled");
}
else
{
%postEffect.disable();
postVerbose("% - PostFX Manager - " @ %sName @ " disabled");
}
}
function PostFXManager::settingsRefreshSSAO(%this)
{
//Apply the enabled flag
ppOptionsEnableSSAO.setValue($PostFXManager::PostFX::EnableSSAO);
//Add the items we need to display
ppOptionsSSAOQuality.clear();
ppOptionsSSAOQuality.add("Low", 0);
ppOptionsSSAOQuality.add("Medium", 1);
ppOptionsSSAOQuality.add("High", 2);
//Set the selected, after adding the items!
ppOptionsSSAOQuality.setSelected($SSAOPostFx::quality);
//SSAO - Set the values of the sliders, General Tab
ppOptionsSSAOOverallStrength.setValue($SSAOPostFx::overallStrength);
ppOptionsSSAOBlurDepth.setValue($SSAOPostFx::blurDepthTol);
ppOptionsSSAOBlurNormal.setValue($SSAOPostFx::blurNormalTol);
//SSAO - Set the values for the near tab
ppOptionsSSAONearDepthMax.setValue($SSAOPostFx::sDepthMax);
ppOptionsSSAONearDepthMin.setValue($SSAOPostFx::sDepthMin);
ppOptionsSSAONearRadius.setValue($SSAOPostFx::sRadius);
ppOptionsSSAONearStrength.setValue($SSAOPostFx::sStrength);
ppOptionsSSAONearToleranceNormal.setValue($SSAOPostFx::sNormalTol);
ppOptionsSSAONearTolerancePower.setValue($SSAOPostFx::sNormalPow);
//SSAO - Set the values for the far tab
ppOptionsSSAOFarDepthMax.setValue($SSAOPostFx::lDepthMax);
ppOptionsSSAOFarDepthMin.setValue($SSAOPostFx::lDepthMin);
ppOptionsSSAOFarRadius.setValue($SSAOPostFx::lRadius);
ppOptionsSSAOFarStrength.setValue($SSAOPostFx::lStrength);
ppOptionsSSAOFarToleranceNormal.setValue($SSAOPostFx::lNormalTol);
ppOptionsSSAOFarTolerancePower.setValue($SSAOPostFx::lNormalPow);
}
function PostFXManager::settingsRefreshHDR(%this)
{
//Apply the enabled flag
ppOptionsEnableHDR.setValue($PostFXManager::PostFX::EnableHDR);
ppOptionsHDRBloom.setValue($HDRPostFX::enableBloom);
ppOptionsHDRBloomBlurBrightPassThreshold.setValue($HDRPostFX::brightPassThreshold);
ppOptionsHDRBloomBlurMean.setValue($HDRPostFX::gaussMean);
ppOptionsHDRBloomBlurMultiplier.setValue($HDRPostFX::gaussMultiplier);
ppOptionsHDRBloomBlurStdDev.setValue($HDRPostFX::gaussStdDev);
ppOptionsHDRBrightnessAdaptRate.setValue($HDRPostFX::adaptRate);
ppOptionsHDREffectsBlueShift.setValue($HDRPostFX::enableBlueShift);
ppOptionsHDREffectsBlueShiftColor.BaseColor = $HDRPostFX::blueShiftColor;
ppOptionsHDREffectsBlueShiftColor.PickColor = $HDRPostFX::blueShiftColor;
ppOptionsHDRKeyValue.setValue($HDRPostFX::keyValue);
ppOptionsHDRMinLuminance.setValue($HDRPostFX::minLuminace);
ppOptionsHDRToneMapping.setValue($HDRPostFX::enableToneMapping);
ppOptionsHDRToneMappingAmount.setValue($HDRPostFX::enableToneMapping);
ppOptionsHDRWhiteCutoff.setValue($HDRPostFX::whiteCutoff);
%this-->ColorCorrectionFileName.Text = $HDRPostFX::colorCorrectionRamp;
}
function PostFXManager::settingsRefreshLightrays(%this)
{
//Apply the enabled flag
ppOptionsEnableLightRays.setValue($PostFXManager::PostFX::EnableLightRays);
ppOptionsLightRaysBrightScalar.setValue($LightRayPostFX::brightScalar);
ppOptionsLightRaysSampleScalar.setValue($LightRayPostFX::numSamples);
ppOptionsLightRaysDensityScalar.setValue($LightRayPostFX::density);
ppOptionsLightRaysWeightScalar.setValue($LightRayPostFX::weight);
ppOptionsLightRaysDecayScalar.setValue($LightRayPostFX::decay);
}
function PostFXManager::settingsRefreshDOF(%this)
{
//Apply the enabled flag
ppOptionsEnableDOF.setValue($PostFXManager::PostFX::EnableDOF);
//ppOptionsDOFEnableDOF.setValue($PostFXManager::PostFX::EnableDOF);
ppOptionsDOFEnableAutoFocus.setValue($DOFPostFx::EnableAutoFocus);
ppOptionsDOFFarBlurMinSlider.setValue($DOFPostFx::BlurMin);
ppOptionsDOFFarBlurMaxSlider.setValue($DOFPostFx::BlurMax);
ppOptionsDOFFocusRangeMinSlider.setValue($DOFPostFx::FocusRangeMin);
ppOptionsDOFFocusRangeMaxSlider.setValue($DOFPostFx::FocusRangeMax);
ppOptionsDOFBlurCurveNearSlider.setValue($DOFPostFx::BlurCurveNear);
ppOptionsDOFBlurCurveFarSlider.setValue($DOFPostFx::BlurCurveFar);
}
function PostFXManager::settingsRefreshVignette(%this)
{
//Apply the enabled flag
ppOptionsEnableVignette.setValue($PostFXManager::PostFX::EnableVignette);
}
function PostFXManager::settingsRefreshAll(%this)
{
$PostFXManager::PostFX::Enabled = $pref::enablePostEffects;
$PostFXManager::PostFX::EnableSSAO = SSAOPostFx.isEnabled();
$PostFXManager::PostFX::EnableHDR = HDRPostFX.isEnabled();
$PostFXManager::PostFX::EnableLightRays = LightRayPostFX.isEnabled();
$PostFXManager::PostFX::EnableDOF = DOFPostEffect.isEnabled();
$PostFXManager::PostFX::EnableVignette = VignettePostEffect.isEnabled();
//For all the postFX here, apply the active settings in the system
//to the gui controls.
%this.settingsRefreshSSAO();
%this.settingsRefreshHDR();
%this.settingsRefreshLightrays();
%this.settingsRefreshDOF();
%this.settingsRefreshVignette();
ppOptionsEnable.setValue($PostFXManager::PostFX::Enabled);
postVerbose("% - PostFX Manager - GUI values updated.");
}
function PostFXManager::settingsApplyFromPreset(%this)
{
postVerbose("% - PostFX Manager - Applying from preset");
//SSAO Settings
$SSAOPostFx::blurDepthTol = $PostFXManager::Settings::SSAO::blurDepthTol;
$SSAOPostFx::blurNormalTol = $PostFXManager::Settings::SSAO::blurNormalTol;
$SSAOPostFx::lDepthMax = $PostFXManager::Settings::SSAO::lDepthMax;
$SSAOPostFx::lDepthMin = $PostFXManager::Settings::SSAO::lDepthMin;
$SSAOPostFx::lDepthPow = $PostFXManager::Settings::SSAO::lDepthPow;
$SSAOPostFx::lNormalPow = $PostFXManager::Settings::SSAO::lNormalPow;
$SSAOPostFx::lNormalTol = $PostFXManager::Settings::SSAO::lNormalTol;
$SSAOPostFx::lRadius = $PostFXManager::Settings::SSAO::lRadius;
$SSAOPostFx::lStrength = $PostFXManager::Settings::SSAO::lStrength;
$SSAOPostFx::overallStrength = $PostFXManager::Settings::SSAO::overallStrength;
$SSAOPostFx::quality = $PostFXManager::Settings::SSAO::quality;
$SSAOPostFx::sDepthMax = $PostFXManager::Settings::SSAO::sDepthMax;
$SSAOPostFx::sDepthMin = $PostFXManager::Settings::SSAO::sDepthMin;
$SSAOPostFx::sDepthPow = $PostFXManager::Settings::SSAO::sDepthPow;
$SSAOPostFx::sNormalPow = $PostFXManager::Settings::SSAO::sNormalPow;
$SSAOPostFx::sNormalTol = $PostFXManager::Settings::SSAO::sNormalTol;
$SSAOPostFx::sRadius = $PostFXManager::Settings::SSAO::sRadius;
$SSAOPostFx::sStrength = $PostFXManager::Settings::SSAO::sStrength;
//HDR settings
$HDRPostFX::adaptRate = $PostFXManager::Settings::HDR::adaptRate;
$HDRPostFX::blueShiftColor = $PostFXManager::Settings::HDR::blueShiftColor;
$HDRPostFX::brightPassThreshold = $PostFXManager::Settings::HDR::brightPassThreshold;
$HDRPostFX::enableBloom = $PostFXManager::Settings::HDR::enableBloom;
$HDRPostFX::enableBlueShift = $PostFXManager::Settings::HDR::enableBlueShift;
$HDRPostFX::enableToneMapping = $PostFXManager::Settings::HDR::enableToneMapping;
$HDRPostFX::gaussMean = $PostFXManager::Settings::HDR::gaussMean;
$HDRPostFX::gaussMultiplier = $PostFXManager::Settings::HDR::gaussMultiplier;
$HDRPostFX::gaussStdDev = $PostFXManager::Settings::HDR::gaussStdDev;
$HDRPostFX::keyValue = $PostFXManager::Settings::HDR::keyValue;
$HDRPostFX::minLuminace = $PostFXManager::Settings::HDR::minLuminace;
$HDRPostFX::whiteCutoff = $PostFXManager::Settings::HDR::whiteCutoff;
$HDRPostFX::colorCorrectionRamp = $PostFXManager::Settings::ColorCorrectionRamp;
//Light rays settings
$LightRayPostFX::brightScalar = $PostFXManager::Settings::LightRays::brightScalar;
$LightRayPostFX::numSamples = $PostFXManager::Settings::LightRays::numSamples;
$LightRayPostFX::density = $PostFXManager::Settings::LightRays::density;
$LightRayPostFX::weight = $PostFXManager::Settings::LightRays::weight;
$LightRayPostFX::decay = $PostFXManager::Settings::LightRays::decay;
//DOF settings
$DOFPostFx::EnableAutoFocus = $PostFXManager::Settings::DOF::EnableAutoFocus;
$DOFPostFx::BlurMin = $PostFXManager::Settings::DOF::BlurMin;
$DOFPostFx::BlurMax = $PostFXManager::Settings::DOF::BlurMax;
$DOFPostFx::FocusRangeMin = $PostFXManager::Settings::DOF::FocusRangeMin;
$DOFPostFx::FocusRangeMax = $PostFXManager::Settings::DOF::FocusRangeMax;
$DOFPostFx::BlurCurveNear = $PostFXManager::Settings::DOF::BlurCurveNear;
$DOFPostFx::BlurCurveFar = $PostFXManager::Settings::DOF::BlurCurveFar;
//Vignette settings
$VignettePostEffect::VMax = $PostFXManager::Settings::Vignette::VMax;
$VignettePostEffect::VMin = $PostFXManager::Settings::Vignette::VMin;
if ( $PostFXManager::forceEnableFromPresets )
{
$PostFXManager::PostFX::Enabled = $PostFXManager::Settings::EnablePostFX;
$PostFXManager::PostFX::EnableDOF = $pref::PostFX::EnableDOF ? $PostFXManager::Settings::EnableDOF : false;
$PostFXManager::PostFX::EnableVignette = $pref::PostFX::EnableVignette ? $PostFXManager::Settings::EnableVignette : false;
$PostFXManager::PostFX::EnableLightRays = $pref::PostFX::EnableLightRays ? $PostFXManager::Settings::EnableLightRays : false;
$PostFXManager::PostFX::EnableHDR = $pref::PostFX::EnableHDR ? $PostFXManager::Settings::EnableHDR : false;
$PostFXManager::PostFX::EnableSSAO = $pref::PostFX::EnabledSSAO ? $PostFXManager::Settings::EnableSSAO : false;
%this.settingsSetEnabled( true );
}
//make sure we apply the correct settings to the DOF
ppOptionsUpdateDOFSettings();
// Update the actual GUI controls if its awake ( otherwise it will when opened ).
if ( PostFXManager.isAwake() )
%this.settingsRefreshAll();
}
function PostFXManager::settingsApplySSAO(%this)
{
$PostFXManager::Settings::SSAO::blurDepthTol = $SSAOPostFx::blurDepthTol;
$PostFXManager::Settings::SSAO::blurNormalTol = $SSAOPostFx::blurNormalTol;
$PostFXManager::Settings::SSAO::lDepthMax = $SSAOPostFx::lDepthMax;
$PostFXManager::Settings::SSAO::lDepthMin = $SSAOPostFx::lDepthMin;
$PostFXManager::Settings::SSAO::lDepthPow = $SSAOPostFx::lDepthPow;
$PostFXManager::Settings::SSAO::lNormalPow = $SSAOPostFx::lNormalPow;
$PostFXManager::Settings::SSAO::lNormalTol = $SSAOPostFx::lNormalTol;
$PostFXManager::Settings::SSAO::lRadius = $SSAOPostFx::lRadius;
$PostFXManager::Settings::SSAO::lStrength = $SSAOPostFx::lStrength;
$PostFXManager::Settings::SSAO::overallStrength = $SSAOPostFx::overallStrength;
$PostFXManager::Settings::SSAO::quality = $SSAOPostFx::quality;
$PostFXManager::Settings::SSAO::sDepthMax = $SSAOPostFx::sDepthMax;
$PostFXManager::Settings::SSAO::sDepthMin = $SSAOPostFx::sDepthMin;
$PostFXManager::Settings::SSAO::sDepthPow = $SSAOPostFx::sDepthPow;
$PostFXManager::Settings::SSAO::sNormalPow = $SSAOPostFx::sNormalPow;
$PostFXManager::Settings::SSAO::sNormalTol = $SSAOPostFx::sNormalTol;
$PostFXManager::Settings::SSAO::sRadius = $SSAOPostFx::sRadius;
$PostFXManager::Settings::SSAO::sStrength = $SSAOPostFx::sStrength;
postVerbose("% - PostFX Manager - Settings Saved - SSAO");
}
function PostFXManager::settingsApplyHDR(%this)
{
$PostFXManager::Settings::HDR::adaptRate = $HDRPostFX::adaptRate;
$PostFXManager::Settings::HDR::blueShiftColor = $HDRPostFX::blueShiftColor;
$PostFXManager::Settings::HDR::brightPassThreshold = $HDRPostFX::brightPassThreshold;
$PostFXManager::Settings::HDR::enableBloom = $HDRPostFX::enableBloom;
$PostFXManager::Settings::HDR::enableBlueShift = $HDRPostFX::enableBlueShift;
$PostFXManager::Settings::HDR::enableToneMapping = $HDRPostFX::enableToneMapping;
$PostFXManager::Settings::HDR::gaussMean = $HDRPostFX::gaussMean;
$PostFXManager::Settings::HDR::gaussMultiplier = $HDRPostFX::gaussMultiplier;
$PostFXManager::Settings::HDR::gaussStdDev = $HDRPostFX::gaussStdDev;
$PostFXManager::Settings::HDR::keyValue = $HDRPostFX::keyValue;
$PostFXManager::Settings::HDR::minLuminace = $HDRPostFX::minLuminace;
$PostFXManager::Settings::HDR::whiteCutoff = $HDRPostFX::whiteCutoff;
$PostFXManager::Settings::ColorCorrectionRamp = $HDRPostFX::colorCorrectionRamp;
postVerbose("% - PostFX Manager - Settings Saved - HDR");
}
function PostFXManager::settingsApplyLightRays(%this)
{
$PostFXManager::Settings::LightRays::brightScalar = $LightRayPostFX::brightScalar;
$PostFXManager::Settings::LightRays::numSamples = $LightRayPostFX::numSamples;
$PostFXManager::Settings::LightRays::density = $LightRayPostFX::density;
$PostFXManager::Settings::LightRays::weight = $LightRayPostFX::weight;
$PostFXManager::Settings::LightRays::decay = $LightRayPostFX::decay;
postVerbose("% - PostFX Manager - Settings Saved - Light Rays");
}
function PostFXManager::settingsApplyDOF(%this)
{
$PostFXManager::Settings::DOF::EnableAutoFocus = $DOFPostFx::EnableAutoFocus;
$PostFXManager::Settings::DOF::BlurMin = $DOFPostFx::BlurMin;
$PostFXManager::Settings::DOF::BlurMax = $DOFPostFx::BlurMax;
$PostFXManager::Settings::DOF::FocusRangeMin = $DOFPostFx::FocusRangeMin;
$PostFXManager::Settings::DOF::FocusRangeMax = $DOFPostFx::FocusRangeMax;
$PostFXManager::Settings::DOF::BlurCurveNear = $DOFPostFx::BlurCurveNear;
$PostFXManager::Settings::DOF::BlurCurveFar = $DOFPostFx::BlurCurveFar;
postVerbose("% - PostFX Manager - Settings Saved - DOF");
}
function PostFXManager::settingsApplyVignette(%this)
{
$PostFXManager::Settings::Vignette::VMax = $VignettePostEffect::VMax;
$PostFXManager::Settings::Vignette::VMin = $VignettePostEffect::VMin;
postVerbose("% - PostFX Manager - Settings Saved - Vignette");
}
function PostFXManager::settingsApplyAll(%this, %sFrom)
{
// Apply settings which control if effects are on/off altogether.
$PostFXManager::Settings::EnablePostFX = $PostFXManager::PostFX::Enabled;
$PostFXManager::Settings::EnableDOF = $PostFXManager::PostFX::EnableDOF;
$PostFXManager::Settings::EnableVignette = $PostFXManager::PostFX::EnableVignette;
$PostFXManager::Settings::EnableLightRays = $PostFXManager::PostFX::EnableLightRays;
$PostFXManager::Settings::EnableHDR = $PostFXManager::PostFX::EnableHDR;
$PostFXManager::Settings::EnableSSAO = $PostFXManager::PostFX::EnableSSAO;
// Apply settings should save the values in the system to the
// the preset structure ($PostFXManager::Settings::*)
// SSAO Settings
%this.settingsApplySSAO();
// HDR settings
%this.settingsApplyHDR();
// Light rays settings
%this.settingsApplyLightRays();
// DOF
%this.settingsApplyDOF();
// Vignette
%this.settingsApplyVignette();
postVerbose("% - PostFX Manager - All Settings applied to $PostFXManager::Settings");
}
function PostFXManager::settingsApplyDefaultPreset(%this)
{
PostFXManager::loadPresetHandler($PostFXManager::defaultPreset);
}

View file

@ -61,6 +61,8 @@ function SSAOPostFx::onAdd( %this )
{
%this.wasVis = "Uninitialized";
%this.quality = "Uninitialized";
PostFXManager.registerPostEffect(%this);
}
function SSAOPostFx::preProcess( %this )
@ -128,7 +130,87 @@ function SSAOPostFx::onDisabled( %this )
$AL::UseSSAOMask = false;
}
function SSAOPostFx::populatePostFXSettings(%this)
{
PostEffectEditorInspector.startGroup("SSAO - General");
PostEffectEditorInspector.addField("$PostFXManager::Settings::EnabledSSAO", "Enabled", "bool", "Low,Medium,High", $PostFXManager::PostFX::EnableSSAO, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::SSAO::quality", "Quality", "list", "Low,Medium,High", $SSAOPostFx::quality, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::SSAO::overallStrength", "Overall Strength", "float", "", $SSAOPostFx::overallStrength, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::SSAO::blurDepthTol", "Blur (Softness)", "float", "", $SSAOPostFx::blurDepthTol, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::SSAO::blurNormalTol", "Blur (Normal Maps)", "float", "", $SSAOPostFx::blurNormalTol, "");
PostEffectEditorInspector.endGroup();
PostEffectEditorInspector.startGroup("SSAO - Near");
PostEffectEditorInspector.addField("$PostFXManager::Settings::SSAO::sRadius", "Radius", "list", "Low,Medium,High", $SSAOPostFx::sRadius, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::SSAO::sStrength", "Strength", "float", "", $SSAOPostFx::sStrength, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::SSAO::sDepthMin", "Depth Min", "float", "", $SSAOPostFx::sDepthMin, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::SSAO::sDepthMax", "Depth Max", "float", "", $SSAOPostFx::sDepthMax, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::SSAO::sNormalTol", "Normal Map Tolerance", "float", "", $SSAOPostFx::sNormalTol, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::SSAO::sNormalPow", "Normal Map Power", "float", "", $SSAOPostFx::sNormalPow, "");
PostEffectEditorInspector.endGroup();
PostEffectEditorInspector.startGroup("SSAO - Far");
PostEffectEditorInspector.addField("$PostFXManager::Settings::SSAO::lRadius", "Radius", "list", "Low,Medium,High", $SSAOPostFx::lRadius, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::SSAO::lStrength", "Strength", "float", "", $SSAOPostFx::lStrength, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::SSAO::lDepthMin", "Depth Min", "float", "", $SSAOPostFx::lDepthMin, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::SSAO::lDepthMax", "Depth Max", "float", "", $SSAOPostFx::lDepthMax, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::SSAO::lNormalTol", "Normal Map Tolerance", "float", "", $SSAOPostFx::lNormalTol, "");
PostEffectEditorInspector.addField("$PostFXManager::Settings::SSAO::lNormalPow", "Normal Map Power", "float", "", $SSAOPostFx::lNormalPow, "");
PostEffectEditorInspector.endGroup();
}
function SSAOPostFx::applyFromPreset(%this)
{
//SSAO Settings
$PostFXManager::PostFX::EnableSSAO = $PostFXManager::Settings::EnabledSSAO;
$SSAOPostFx::blurDepthTol = $PostFXManager::Settings::SSAO::blurDepthTol;
$SSAOPostFx::blurNormalTol = $PostFXManager::Settings::SSAO::blurNormalTol;
$SSAOPostFx::lDepthMax = $PostFXManager::Settings::SSAO::lDepthMax;
$SSAOPostFx::lDepthMin = $PostFXManager::Settings::SSAO::lDepthMin;
$SSAOPostFx::lDepthPow = $PostFXManager::Settings::SSAO::lDepthPow;
$SSAOPostFx::lNormalPow = $PostFXManager::Settings::SSAO::lNormalPow;
$SSAOPostFx::lNormalTol = $PostFXManager::Settings::SSAO::lNormalTol;
$SSAOPostFx::lRadius = $PostFXManager::Settings::SSAO::lRadius;
$SSAOPostFx::lStrength = $PostFXManager::Settings::SSAO::lStrength;
$SSAOPostFx::overallStrength = $PostFXManager::Settings::SSAO::overallStrength;
$SSAOPostFx::quality = $PostFXManager::Settings::SSAO::quality;
$SSAOPostFx::sDepthMax = $PostFXManager::Settings::SSAO::sDepthMax;
$SSAOPostFx::sDepthMin = $PostFXManager::Settings::SSAO::sDepthMin;
$SSAOPostFx::sDepthPow = $PostFXManager::Settings::SSAO::sDepthPow;
$SSAOPostFx::sNormalPow = $PostFXManager::Settings::SSAO::sNormalPow;
$SSAOPostFx::sNormalTol = $PostFXManager::Settings::SSAO::sNormalTol;
$SSAOPostFx::sRadius = $PostFXManager::Settings::SSAO::sRadius;
$SSAOPostFx::sStrength = $PostFXManager::Settings::SSAO::sStrength;
if($PostFXManager::PostFX::EnableSSAO)
%this.enable();
else
%this.disable();
}
function SSAOPostFx::settingsApply(%this)
{
$PostFXManager::Settings::EnabledSSAO = $PostFXManager::PostFX::EnableSSAO ;
$PostFXManager::Settings::SSAO::blurDepthTol = $SSAOPostFx::blurDepthTol;
$PostFXManager::Settings::SSAO::blurNormalTol = $SSAOPostFx::blurNormalTol;
$PostFXManager::Settings::SSAO::lDepthMax = $SSAOPostFx::lDepthMax;
$PostFXManager::Settings::SSAO::lDepthMin = $SSAOPostFx::lDepthMin;
$PostFXManager::Settings::SSAO::lDepthPow = $SSAOPostFx::lDepthPow;
$PostFXManager::Settings::SSAO::lNormalPow = $SSAOPostFx::lNormalPow;
$PostFXManager::Settings::SSAO::lNormalTol = $SSAOPostFx::lNormalTol;
$PostFXManager::Settings::SSAO::lRadius = $SSAOPostFx::lRadius;
$PostFXManager::Settings::SSAO::lStrength = $SSAOPostFx::lStrength;
$PostFXManager::Settings::SSAO::overallStrength = $SSAOPostFx::overallStrength;
$PostFXManager::Settings::SSAO::quality = $SSAOPostFx::quality;
$PostFXManager::Settings::SSAO::sDepthMax = $SSAOPostFx::sDepthMax;
$PostFXManager::Settings::SSAO::sDepthMin = $SSAOPostFx::sDepthMin;
$PostFXManager::Settings::SSAO::sDepthPow = $SSAOPostFx::sDepthPow;
$PostFXManager::Settings::SSAO::sNormalPow = $SSAOPostFx::sNormalPow;
$PostFXManager::Settings::SSAO::sNormalTol = $SSAOPostFx::sNormalTol;
$PostFXManager::Settings::SSAO::sRadius = $SSAOPostFx::sRadius;
$PostFXManager::Settings::SSAO::sStrength = $SSAOPostFx::sStrength;
}
//-----------------------------------------------------------------------------
// GFXStateBlockData / ShaderData
//-----------------------------------------------------------------------------

View file

@ -9,6 +9,8 @@ function Core_Rendering::onCreate(%this)
$Core::DefaultPrefilterCubemap = "core/rendering/images/default_prefilter.dds";
$Core::BRDFTexture = "core/rendering/images/brdfTexture.dds";
$pref::ReflectionProbes::BakeResolution = ProjectSettings.value("Rendering/ProbeCaptureResolution", "64");
exec("./scripts/renderManager.cs");
exec("./scripts/gfxData/clouds.cs");
exec("./scripts/gfxData/commonMaterialData.cs");

View file

@ -47,6 +47,8 @@ uniform vec4 albedo;
#define MAX_PROBES 50
#define MAX_FORWARD_PROBES 4
#define MAX_FORWARD_LIGHT 4
vec3 getDistanceVectorToPlane( vec3 origin, vec3 direction, vec4 plane )
{
float denum = dot( plane.xyz, direction.xyz );
@ -64,32 +66,6 @@ vec3 getDistanceVectorToPlane( float negFarPlaneDotEye, vec3 direction, vec4 pla
return direction.xyz * t;
}
void compute4Lights( vec3 wsView,
vec3 wsPosition,
vec3 wsNormal,
vec4 shadowMask,
#ifdef TORQUE_SHADERGEN
vec4 inLightPos[3],
vec4 inLightInvRadiusSq,
vec4 inLightColor[4],
vec4 inLightSpotDir[3],
vec4 inLightSpotAngle,
vec4 inLightSpotFalloff,
float smoothness,
float metalness,
vec4 albedo,
#endif // TORQUE_SHADERGEN
out vec4 outDiffuse,
out vec4 outSpecular )
{
outDiffuse = vec4(0,0,0,0);
outSpecular = vec4(0,0,0,0);
}
struct Surface
{
vec3 P; // world space position
@ -123,43 +99,43 @@ void updateSurface(inout Surface surface)
Surface createSurface(vec4 normDepth, sampler2D colorBuffer, sampler2D matInfoBuffer, in vec2 uv, in vec3 wsEyePos, in vec3 wsEyeRay, in mat4 invView)
{
Surface surface;// = Surface();
Surface surface;// = Surface();
vec4 gbuffer1 = texture(colorBuffer, uv);
vec4 gbuffer2 = texture(matInfoBuffer, uv);
surface.depth = normDepth.a;
surface.P = wsEyePos + wsEyeRay * surface.depth;
surface.N = tMul(invView, vec4(normDepth.xyz,0)).xyz;
surface.V = normalize(wsEyePos - surface.P);
surface.baseColor = gbuffer1;
const float minRoughness=1e-4;
surface.roughness = clamp(1.0 - gbuffer2.b, minRoughness, 1.0); //t3d uses smoothness, so we convert to roughness.
surface.roughness_brdf = surface.roughness * surface.roughness;
surface.metalness = gbuffer2.a;
surface.ao = gbuffer2.g;
surface.matFlag = gbuffer2.r;
updateSurface(surface);
return surface;
vec4 gbuffer1 = texture(colorBuffer, uv);
vec4 gbuffer2 = texture(matInfoBuffer, uv);
surface.depth = normDepth.a;
surface.P = wsEyePos + wsEyeRay * surface.depth;
surface.N = tMul(invView, vec4(normDepth.xyz,0)).xyz;
surface.V = normalize(wsEyePos - surface.P);
surface.baseColor = gbuffer1;
const float minRoughness=1e-4;
surface.roughness = clamp(1.0 - gbuffer2.b, minRoughness, 1.0); //t3d uses smoothness, so we convert to roughness.
surface.roughness_brdf = surface.roughness * surface.roughness;
surface.metalness = gbuffer2.a;
surface.ao = gbuffer2.g;
surface.matFlag = gbuffer2.r;
updateSurface(surface);
return surface;
}
Surface createForwardSurface(vec4 baseColor, vec4 normal, vec4 pbrProperties, in vec2 uv, in vec3 wsPosition, in vec3 wsEyePos, in vec3 wsEyeRay, in mat4x4 invView)
Surface createForwardSurface(vec4 baseColor, vec3 normal, vec4 pbrProperties, in vec3 wsPosition, in vec3 wsEyePos, in vec3 wsEyeRay)
{
Surface surface;// = Surface();
Surface surface;// = Surface();
surface.depth = 0;
surface.P = wsPosition;
surface.N = tMul(invView, vec4(normal.xyz,0)).xyz;
surface.V = normalize(wsEyePos - surface.P);
surface.baseColor = baseColor;
const float minRoughness=1e-4;
surface.roughness = clamp(1.0 - pbrProperties.b, minRoughness, 1.0); //t3d uses smoothness, so we convert to roughness.
surface.roughness_brdf = surface.roughness * surface.roughness;
surface.metalness = pbrProperties.a;
surface.ao = pbrProperties.g;
surface.matFlag = pbrProperties.r;
surface.depth = 0;
surface.P = wsPosition;
surface.N = normal;
surface.V = normalize(wsEyePos - surface.P);
surface.baseColor = baseColor;
const float minRoughness=1e-4;
surface.roughness = clamp(1.0 - pbrProperties.b, minRoughness, 1.0); //t3d uses smoothness, so we convert to roughness.
surface.roughness_brdf = surface.roughness * surface.roughness;
surface.metalness = pbrProperties.a;
surface.ao = pbrProperties.g;
surface.matFlag = pbrProperties.r;
updateSurface(surface);
return surface;
updateSurface(surface);
return surface;
}
struct SurfaceToLight
@ -237,7 +213,7 @@ vec3 getDirectionalLight(in Surface surface, in SurfaceToLight surfaceToLight, v
vec3 diffuse = BRDF_GetDiffuse(surface,surfaceToLight) * factor;
vec3 spec = BRDF_GetSpecular(surface,surfaceToLight) * factor;
vec3 final = max(vec3(0.0f), diffuse + spec * surface.ao);
vec3 final = max(vec3(0.0f), diffuse + spec);
return final;
}
@ -249,45 +225,71 @@ vec3 getPunctualLight(in Surface surface, in SurfaceToLight surfaceToLight, vec3
vec3 diffuse = BRDF_GetDiffuse(surface,surfaceToLight) * factor;
vec3 spec = BRDF_GetSpecular(surface,surfaceToLight) * factor;
vec3 final = max(vec3(0.0f), diffuse + spec * surface.ao * surface.F);
vec3 final = max(vec3(0.0f), diffuse + spec * surface.F);
return final;
}
float G1V(float dotNV, float k)
vec4 compute4Lights( Surface surface,
vec4 shadowMask,
vec4 inLightPos[4],
vec4 inLightConfigData[4],
vec4 inLightColor[4],
vec4 inLightSpotDir[4],
vec4 lightSpotParams[4],
int hasVectorLight,
vec4 vectorLightDirection,
vec4 vectorLightingColor,
float vectorLightBrightness )
{
return 1.0f/(dotNV*(1.0f-k)+k);
}
vec3 finalLighting = vec3(0.0f);
vec3 directSpecular(vec3 N, vec3 V, vec3 L, float roughness, float F0)
{
float alpha = roughness*roughness;
int i;
for(i = 0; i < MAX_FORWARD_LIGHT; i++)
{
vec3 L = inLightPos[i].xyz - surface.P;
float dist = length(L);
float lightRange = inLightConfigData[i].z;
SurfaceToLight surfaceToLight = createSurfaceToLight(surface, L);
float shadowed = 1.0;
//TODO don't need to calculate all this again timmy!!!!!!
vec3 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);
vec3 lightCol = inLightColor[i].rgb;
float F, D, vis;
float lightBrightness = inLightConfigData[i].y;
float lightInvSqrRange= inLightConfigData[i].a;
// D
float alphaSqr = alpha*alpha;
float pi = 3.14159f;
float denom = dotNH * dotNH *(alphaSqr-1.0) + 1.0f;
D = alphaSqr/(pi * denom * denom);
vec3 lighting = vec3(0.0f);
// F
float dotLH5 = pow(1.0f-dotLH,5);
F = F0 + (1.0-F0)*(dotLH5);
if(dist < lightRange)
{
if(inLightConfigData[i].x == 0) //point
{
//get punctual light contribution
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadowed);
}
else //spot
{
//get Punctual light contribution
lighting = getPunctualLight(surface, surfaceToLight, lightCol, lightBrightness, lightInvSqrRange, shadowed);
//get spot angle attenuation
lighting *= getSpotAngleAtt(-surfaceToLight.L, inLightSpotDir[i].xyz, lightSpotParams[i].xy );
}
}
finalLighting += lighting;
}
// V
float k = alpha/2.0f;
vis = G1V(dotNL,k)*G1V(dotNV,k);
//Vector light
if(hasVectorLight == 1)
{
SurfaceToLight surfaceToVecLight = createSurfaceToLight(surface, -vectorLightDirection.xyz);
float specular = dotNL * D * F * vis;
return vec3(specular,specular,specular);
vec3 vecLighting = getDirectionalLight(surface, surfaceToVecLight, vectorLightingColor.rgb, vectorLightBrightness, 1);
finalLighting += vecLighting;
}
finalLighting *= shadowMask.rgb;
return vec4(finalLighting,1);
}
//Probe IBL stuff
@ -316,12 +318,12 @@ float defineBoxSpaceInfluence(vec3 wsPosition, mat4 worldToObj, float attenuatio
// Box Projected IBL Lighting
// Based on: http://www.gamedev.net/topic/568829-box-projected-cubemap-environment-mapping/
// and https://seblagarde.wordpress.com/2012/09/29/image-based-lighting-approaches-and-parallax-corrected-cubemap/
vec3 boxProject(vec3 wsPosition, vec3 wsReflectVec, mat4 worldToObj, vec3 bbMin, vec3 bbMax, vec3 refPosition)
vec3 boxProject(vec3 wsPosition, vec3 wsReflectVec, mat4 worldToObj, vec3 refBoxMin, vec3 refBoxMax, vec3 refPosition)
{
vec3 RayLS = tMul(worldToObj, vec4(wsReflectVec, 0.0)).xyz;
vec3 PositionLS = tMul(worldToObj, vec4(wsPosition, 1.0)).xyz;
vec3 unit = bbMax.xyz - bbMin.xyz;
vec3 unit = refBoxMax.xyz - refBoxMin.xyz;
vec3 plane1vec = (unit / 2 - PositionLS) / RayLS;
vec3 plane2vec = (-unit / 2 - PositionLS) / RayLS;
vec3 furthestPlane = max(plane1vec, plane2vec);
@ -333,12 +335,12 @@ vec3 boxProject(vec3 wsPosition, vec3 wsReflectVec, mat4 worldToObj, vec3 bbMin,
vec4 computeForwardProbes(Surface surface,
float cubeMips, float numProbes, mat4x4 worldToObjArray[MAX_FORWARD_PROBES], vec4 probeConfigData[MAX_FORWARD_PROBES],
vec4 inProbePosArray[MAX_FORWARD_PROBES], vec4 bbMinArray[MAX_FORWARD_PROBES], vec4 bbMaxArray[MAX_FORWARD_PROBES], vec4 inRefPosArray[MAX_FORWARD_PROBES],
float hasSkylight, sampler2D BRDFTexture,
samplerCube skylightIrradMap, samplerCube skylightSpecularMap,
vec4 inProbePosArray[MAX_FORWARD_PROBES], vec4 refBoxMinArray[MAX_FORWARD_PROBES], vec4 refBoxMaxArray[MAX_FORWARD_PROBES], vec4 inRefPosArray[MAX_FORWARD_PROBES],
float skylightCubemapIdx, sampler2D BRDFTexture,
samplerCubeArray irradianceCubemapAR, samplerCubeArray specularCubemapAR)
{
int i = 0;
int i = 0;
float alpha = 1;
float blendFactor[MAX_FORWARD_PROBES];
float blendSum = 0;
float blendFacSum = 0;
@ -399,15 +401,13 @@ vec4 computeForwardProbes(Surface surface,
// Radiance (Specular)
float lod = surface.roughness*cubeMips;
//1
float alpha = 1.0f;
for (i = 0; i < numProbes; ++i)
{
float contrib = contribution[i];
if (contrib != 0)
if (contrib > 0.0f)
{
int cubemapIdx = int(probeConfigData[i].a);
vec3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], bbMinArray[i].xyz, bbMaxArray[i].xyz, inRefPosArray[i].xyz);
vec3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refBoxMinArray[i].xyz, refBoxMaxArray[i].xyz, inRefPosArray[i].xyz);
irradiance += textureLod(irradianceCubemapAR, vec4(dir, cubemapIdx), 0).xyz * contrib;
specular += textureLod(specularCubemapAR, vec4(dir, cubemapIdx), lod).xyz * contrib;
@ -415,10 +415,10 @@ vec4 computeForwardProbes(Surface surface,
}
}
if (hasSkylight == 1 && alpha > 0.001)
if(skylightCubemapIdx != -1 && alpha >= 0.001)
{
irradiance += textureLod(skylightIrradMap, surface.R, 0).xyz * alpha;
specular += textureLod(skylightSpecularMap, surface.R, lod).xyz * alpha;
irradiance = mix(irradiance,textureLod(irradianceCubemapAR, vec4(surface.R, skylightCubemapIdx), 0).xyz, alpha);
specular = mix(specular,textureLod(specularCubemapAR, vec4(surface.R, skylightCubemapIdx), lod).xyz, alpha);
}
vec3 F = FresnelSchlickRoughness(surface.NdotV, surface.f0, surface.roughness);
@ -429,13 +429,12 @@ vec4 computeForwardProbes(Surface surface,
//apply brdf
//Do it once to save on texture samples
vec2 brdf = textureLod(BRDFTexture, vec2(surface.roughness, surface.NdotV),0).xy;
vec2 brdf = textureLod(BRDFTexture, vec2(surface.roughness, 1.0-surface.NdotV),0).xy;
specular *= brdf.x * F + brdf.y;
//final diffuse color
vec3 diffuse = kD * irradiance * surface.baseColor.rgb;
vec4 finalColor = vec4(diffuse + specular * surface.ao, 1.0);
finalColor = vec4(irradiance.rgb,1);
return finalColor;
}

View file

@ -99,6 +99,8 @@ struct Surface
}
};
inline Surface createSurface(float4 gbuffer0, TORQUE_SAMPLER2D(gbufferTex1), TORQUE_SAMPLER2D(gbufferTex2), in float2 uv, in float3 wsEyePos, in float3 wsEyeRay, in float4x4 invView)
{
Surface surface = (Surface)0;
@ -124,28 +126,28 @@ inline Surface createSurface(float4 gbuffer0, TORQUE_SAMPLER2D(gbufferTex1), TOR
inline Surface createForwardSurface(float4 baseColor, float3 normal, float4 pbrProperties, in float3 wsPosition, in float3 wsEyePos, in float3 wsEyeRay)
{
Surface surface = (Surface)0;
Surface surface = (Surface)0;
surface.depth = 0;
surface.P = wsPosition;
surface.N = normal;
surface.V = normalize(wsEyePos - surface.P);
surface.baseColor = baseColor;
const float minRoughness=1e-4;
surface.roughness = clamp(1.0 - pbrProperties.b, minRoughness, 1.0); //t3d uses smoothness, so we convert to roughness.
surface.roughness_brdf = surface.roughness * surface.roughness;
surface.metalness = pbrProperties.a;
surface.ao = pbrProperties.g;
surface.matFlag = pbrProperties.r;
surface.depth = 0;
surface.P = wsPosition;
surface.N = normal;
surface.V = normalize(wsEyePos - surface.P);
surface.baseColor = baseColor;
const float minRoughness=1e-4;
surface.roughness = clamp(1.0 - pbrProperties.b, minRoughness, 1.0); //t3d uses smoothness, so we convert to roughness.
surface.roughness_brdf = surface.roughness * surface.roughness;
surface.metalness = pbrProperties.a;
surface.ao = pbrProperties.g;
surface.matFlag = pbrProperties.r;
surface.Update();
return surface;
surface.Update();
return surface;
}
struct SurfaceToLight
{
float3 L; // surface to light vector
float3 Lu; // un-normalized surface to light vector
float3 Lu; // un-normalized surface to light vector
float3 H; // half-vector between view vector and light vector
float NdotL; // cos(angle between N and L)
float HdotV; // cos(angle between H and V) = HdotL = cos(angle between H and L)
@ -155,7 +157,7 @@ struct SurfaceToLight
inline SurfaceToLight createSurfaceToLight(in Surface surface, in float3 L)
{
SurfaceToLight surfaceToLight = (SurfaceToLight)0;
surfaceToLight.Lu = L;
surfaceToLight.Lu = L;
surfaceToLight.L = normalize(L);
surfaceToLight.H = normalize(surface.V + surfaceToLight.L);
surfaceToLight.NdotL = saturate(dot(surfaceToLight.L, surface.N));

View file

@ -22,7 +22,7 @@
#include "../../../gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"
#include "../../../postFx/gl/postFX.glsl"
#include "../../../postFx/gl/postFx.glsl"
#include "../../../gl/torque.glsl"
uniform sampler2D colorBufferTex;

View file

@ -175,7 +175,7 @@ void main()
#ifdef SHADOW_CUBE
// TODO: We need to fix shadow cube to handle soft shadows!
float occ = texture( shadowMap, ttMul( worldToLightProj, -surfaceToLight.L ) ).r;
float occ = texture( shadowMap, tMul( worldToLightProj, -surfaceToLight.L ) ).r;
float shadowed = saturate( exp( lightParams.y * ( occ - distToLight ) ) );
#else
@ -192,7 +192,7 @@ void main()
#ifdef USE_COOKIE_TEX
// Lookup the cookie sample.
vec4 cookie = texture(cookieMap, ttMul(worldToLightProj, -surfaceToLight.L));
vec4 cookie = texture(cookieMap, tMul(worldToLightProj, -surfaceToLight.L));
// Multiply the light with the cookie tex.
lightCol *= cookie.rgb;
// Use a maximum channel luminance to attenuate

View file

@ -1,68 +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.
//-----------------------------------------------------------------------------
#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;
uniform float radius;
uniform vec2 targetSize;
uniform int captureRez;
out vec4 OUT_col;
void main()
{
float depth = deferredUncondition( deferredTex, uv0 ).w;
if (depth>0.9999)
{
discard;
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 = vec4(colorBuffer, 1.0);
return;
}
vec4 diffuseLighting = texture( diffuseLightingBuffer, uv0 ); //shadowmap*specular
colorBuffer *= diffuseLighting.rgb;
vec2 relUV = uv0*targetSize/captureRez;
//we use a 1k depth range in the capture frustum.
//reduce that a bit to get something resembling depth fidelity out of 8 bits
depth*=2000/radius;
float rLen = length(vec3(relUV,depth)-vec3(0.5,0.5,0));
OUT_col = hdrEncode( vec4(colorBuffer,rLen));
}

View file

@ -27,15 +27,15 @@ uniform samplerCubeArray irradianceCubemapAR;
uniform vec4 inProbePosArray[MAX_PROBES];
uniform vec4 inRefPosArray[MAX_PROBES];
uniform mat4 worldToObjArray[MAX_PROBES];
uniform vec4 bbMinArray[MAX_PROBES];
uniform vec4 bbMaxArray[MAX_PROBES];
uniform vec4 refBoxMinArray[MAX_PROBES];
uniform vec4 refBoxMaxArray[MAX_PROBES];
uniform vec4 probeConfigData[MAX_PROBES]; //r,g,b/mode,radius,atten
#if DEBUGVIZ_CONTRIB
uniform vec4 probeContribColors[MAX_PROBES];
#endif
uniform float skylightCubemapIdx;
uniform int skylightCubemapIdx;
out vec4 OUT_col;
@ -55,7 +55,6 @@ void main()
float alpha = 1;
#ifdef SKYLIGHT_ONLY
#if SKYLIGHT_ONLY == 0
int i = 0;
float blendFactor[MAX_PROBES];
@ -66,8 +65,8 @@ void main()
//Set up our struct data
float contribution[MAX_PROBES];
//if (alpha > 0)
//{
if (alpha > 0)
{
//Process prooooobes
for (i = 0; i < numProbes; ++i)
{
@ -85,8 +84,6 @@ void main()
if (contribution[i]>0.0)
probehits++;
}
else
continue;
contribution[i] = max(contribution[i],0);
@ -99,32 +96,29 @@ void main()
// Weight1 = normalized inverted NDF, so we have 1 at center, 0 at boundary
// and respect constraint A.
if (probehits>1.0)
{
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];
}
if (probehits > 1.0)
{
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];
}
// Normalize blendVal
if (blendFacSum == 0.0f) // Possible with custom weight
{
blendFacSum = 1.0f;
}
// 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];
alpha -= contribution[i];
}
float invBlendSumWeighted = 1.0f / blendFacSum;
for (i = 0; i < numProbes; ++i)
{
blendFactor[i] *= invBlendSumWeighted;
contribution[i] *= blendFactor[i];
}
}
else
alpha -= blendSum;
#if DEBUGVIZ_ATTENUATION == 1
float contribAlpha = 1;
@ -148,14 +142,13 @@ void main()
//Skylight coloration for anything not covered by probes above
if(skylightCubemapIdx != -1)
finalContribColor += vec3(0.3, 0.3, 0.3) * contribAlpha;
finalContribColor += vec3(0, 1, 0) * contribAlpha;
OUT_col = vec4(finalContribColor, 1);
return;
#endif
//}
}
#endif
#endif //SKYLIGHT_ONLY
vec3 irradiance = vec3(0, 0, 0);
vec3 specular = vec3(0, 0, 0);
@ -167,16 +160,14 @@ void main()
float lod = 0;
#endif
#ifdef SKYLIGHT_ONLY
#if SKYLIGHT_ONLY == 0
alpha = 1;
for (i = 0; i < numProbes; ++i)
{
float contrib = contribution[i];
if (contrib != 0)
if (contrib > 0.0f)
{
float cubemapIdx = probeConfigData[i].a;
vec3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], bbMinArray[i].xyz, bbMaxArray[i].xyz, inRefPosArray[i].xyz);
vec3 dir = boxProject(surface.P, surface.R, worldToObjArray[i], refBoxMinArray[i].xyz, refBoxMaxArray[i].xyz, inRefPosArray[i].xyz);
irradiance += textureLod(irradianceCubemapAR, vec4(dir, cubemapIdx), 0).xyz * contrib;
specular += textureLod(specularCubemapAR, vec4(dir, cubemapIdx), lod).xyz * contrib;
@ -184,7 +175,6 @@ void main()
}
}
#endif
#endif //SKYLIGHT_ONLY
if (skylightCubemapIdx != -1 && alpha > 0.001)
{

View file

@ -1,162 +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.
//-----------------------------------------------------------------------------
#include "../../../gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"
#include "farFrustumQuad.glsl"
#include "../../../gl/torque.glsl"
#include "../../../gl/lighting.glsl"
#line 27
in vec4 pos;
in vec4 wsEyeDir;
in vec4 ssPos;
in vec4 vsEyeDir;
uniform sampler2D deferredBuffer;
uniform sampler2D colorBuffer;
uniform sampler2D matInfoBuffer;
uniform samplerCube cubeMap;
uniform samplerCube irradianceCubemap;
uniform sampler2D BRDFTexture;
uniform float cubeMips;
uniform vec4 rtParams0;
uniform vec3 probeWSPos;
uniform vec3 probeLSPos;
uniform vec4 vsFarPlane;
uniform float radius;
uniform vec2 attenuation;
uniform mat4 worldToObj;
uniform mat4 cameraToWorld;
uniform vec3 eyePosWorld;
uniform vec3 bbMin;
uniform vec3 bbMax;
uniform float useSphereMode;
// Box Projected IBL Lighting
// Based on: http://www.gamedev.net/topic/568829-box-projected-cubemap-environment-mapping/
// and https://seblagarde.wordpress.com/2012/09/29/image-based-lighting-approaches-and-parallax-corrected-cubemap/
vec3 boxProject(vec3 wsPosition, vec3 reflectDir, vec3 boxWSPos, vec3 boxMin, vec3 boxMax)
{
vec3 nrdir = reflectDir;
vec3 offset = wsPosition;
vec3 plane1vec = (boxMax - offset) / nrdir;
vec3 plane2vec = (boxMin - offset) / nrdir;
vec3 furthestPlane = max(plane1vec, plane2vec);
float dist = min(min(furthestPlane.x, furthestPlane.y), furthestPlane.z);
vec3 posonbox = offset + nrdir * dist;
return posonbox - boxWSPos;
}
vec3 iblBoxSpecular(vec3 normal, vec3 wsPos, float roughness, vec3 surfToEye,
sampler2D brdfTexture,
samplerCube radianceCube,
vec3 boxPos,
vec3 boxMin,
vec3 boxMax)
{
float ndotv = clamp(dot(normal, surfToEye), 0.0, 1.0);
// BRDF
vec2 brdf = textureLod(brdfTexture, vec2(roughness, ndotv),0).xy;
// Radiance (Specular)
float maxmip = pow(cubeMips+1,2);
float lod = roughness*maxmip;
vec3 r = reflect(surfToEye, normal);
vec3 cubeR = normalize(r);
cubeR = boxProject(wsPos, cubeR, boxPos, boxMin, boxMax);
vec3 radiance = textureLod(radianceCube, cubeR, lod).xyz * (brdf.x + brdf.y);
return radiance;
}
float defineBoxSpaceInfluence(vec3 surfPosWS, vec3 probePos, float radius, float atten)
{
vec3 surfPosLS = tMul( worldToObj, vec4(surfPosWS,1.0)).xyz;
vec3 boxMinLS = probePos-(vec3(1,1,1)*radius);
vec3 boxMaxLS = probePos+(vec3(1,1,1)*radius);
float boxOuterRange = length(boxMaxLS - boxMinLS);
float boxInnerRange = boxOuterRange / atten;
vec3 localDir = vec3(abs(surfPosLS.x), abs(surfPosLS.y), abs(surfPosLS.z));
localDir = (localDir - boxInnerRange) / (boxOuterRange - boxInnerRange);
return max(localDir.x, max(localDir.y, localDir.z)) * -1;
}
out vec4 OUT_col;
void main()
{
// Compute scene UV
vec2 uvScene = getUVFromSSPos( ssPos.xyz/ssPos.w, rtParams0 );
//eye ray WS/LS
vec3 vsEyeRay = getDistanceVectorToPlane( -vsFarPlane.w, vsEyeDir.xyz, vsFarPlane );
vec3 wsEyeRay = tMul(cameraToWorld, vec4(vsEyeRay, 0)).xyz;
//unpack normal and linear depth
vec4 normDepth = deferredUncondition(deferredBuffer, uvScene);
//create surface
Surface surface = createSurface( normDepth, colorBuffer, matInfoBuffer,
uvScene, eyePosWorld, wsEyeRay, cameraToWorld);
float blendVal = 1.0;
if(useSphereMode>0)
{
vec3 L = probeWSPos - surface.P;
blendVal = 1.0-length(L)/radius;
clip(blendVal);
}
else
{
float tempAttenVal = 3.5;
blendVal = defineBoxSpaceInfluence(surface.P, probeWSPos, radius, tempAttenVal);
clip(blendVal);
float compression = 0.05;
blendVal=(1.0-compression)+blendVal*compression;
}
//render into the bound space defined above
vec3 surfToEye = normalize(surface.P - eyePosWorld);
vec3 irradiance = textureLod(irradianceCubemap, surface.N,0).xyz;
vec3 specular = iblBoxSpecular(surface.N, surface.P, surface.roughness, surfToEye, BRDFTexture, cubeMap, probeWSPos, bbMin, bbMax);
vec3 F = FresnelSchlickRoughness(surface.NdotV, surface.f0, surface.roughness);
specular *= F;
//energy conservation
vec3 kD = vec3(1.0) - F;
kD *= 1.0 - surface.metalness;
//final diffuse color
vec3 diffuse = kD * irradiance * surface.baseColor.rgb;
OUT_col = vec4(diffuse + specular * surface.ao, blendVal);
}

View file

@ -1,32 +0,0 @@
#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;
}

View file

@ -93,7 +93,7 @@ float4 main(PFXVertToPix IN) : SV_TARGET
// and respect constraint A.
if (probehits > 1.0)
{
{
for (i = 0; i < numProbes; i++)
{
blendFactor[i] = ((contribution[i] / blendSum)) / probehits;

View file

@ -21,7 +21,7 @@
//-----------------------------------------------------------------------------
#include "../../../gl/hlslCompat.glsl"
#include "../../gl/postFX.glsl"
#include "../../gl/postFx.glsl"
#include "shadergen:/autogenConditioners.h"
uniform vec3 eyePosWorld;

View file

@ -21,7 +21,7 @@
//-----------------------------------------------------------------------------
#include "../../../gl/hlslCompat.glsl"
#include "../../gl/postFX.glsl"
#include "../../gl/postFx.glsl"
// These are set by the game engine.
uniform sampler2D shrunkSampler; // Output of DofDownsample()

View file

@ -22,7 +22,7 @@
#include "../../../gl/hlslCompat.glsl"
#include "../../../gl/torque.glsl"
#include "../../gl/postFX.glsl"
#include "../../gl/postFx.glsl"
uniform vec4 rtParams0;
uniform vec4 rtParams1;

View file

@ -22,7 +22,7 @@
#include "../../../gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"
#include "../../gl/postFX.glsl"
#include "../../gl/postFx.glsl"
uniform sampler2D colorSampler; // Original source image
uniform sampler2D smallBlurSampler; // Output of SmallBlurPS()
@ -73,7 +73,7 @@ half4 InterpolateDof( half3 small, half3 med, half3 large, half t )
// d0, the small to medium blur over distance d1, and the medium to
// large blur over distance d2, where d0 + d1 + d2 = 1.
//vec4 dofLerpScale = vec4( -1 / d0, -1 / d1, -1 / d2, 1 / d2 );
//vec4 dofLerpBias = vec4( 1, (1 d2) / d1, 1 / d2, (d2 1) / d2 );
//vec4 dofLerpBias = vec4( 1, (1 <EFBFBD> d2) / d1, 1 / d2, (d2 <20> 1) / d2 );
weights = saturate( t * dofLerpScale + dofLerpBias );
weights.yz = min( weights.yz, 1 - weights.xy );

View file

@ -22,7 +22,7 @@
#include "../../../gl/hlslCompat.glsl"
#include "../../../gl/torque.glsl"
#include "../../gl/postFX.glsl"
#include "../../gl/postFx.glsl"
uniform vec4 rtParams0;
uniform vec4 rtParams1;

View file

@ -22,7 +22,7 @@
#include "../../../gl/hlslCompat.glsl"
#include "../../../gl/torque.glsl"
#include "../../gl/postFX.glsl"
#include "../../gl/postFx.glsl"
uniform vec4 rtParams0;
uniform vec4 rtParams1;

View file

@ -22,7 +22,7 @@
#include "../../../gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"
#include "../../gl/postFX.glsl"
#include "../../gl/postFx.glsl"
uniform sampler2D edgeBuffer;
uniform sampler2D backBuffer;

View file

@ -22,7 +22,7 @@
#include "../../../gl/hlslCompat.glsl"
#include "../../../gl/torque.glsl"
#include "../../gl/postFX.glsl"
#include "../../gl/postFx.glsl"
uniform vec4 rtParams0;
uniform vec4 rtParams1;

View file

@ -20,10 +20,10 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
// Based on 'Cubic Lens Distortion HLSL Shader' by François Tarlier
// Based on 'Cubic Lens Distortion HLSL Shader' by Fran<EFBFBD>ois Tarlier
// www.francois-tarlier.com/blog/index.php/2009/11/cubic-lens-distortion-shader
#include "./postFX.glsl"
#include "./postFx.glsl"
#include "../../gl/torque.glsl"
#include "../../gl/hlslCompat.glsl"

View file

@ -20,7 +20,7 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "./postFX.glsl"
#include "./postFx.glsl"
#include "../../gl/torque.glsl"
#include "../../gl/hlslCompat.glsl"

View file

@ -23,7 +23,7 @@
#include "../../gl/hlslCompat.glsl"
#include "../../gl/torque.glsl"
#include "shadergen:/autogenConditioners.h"
#include "postFX.glsl"
#include "postFx.glsl"
#undef IN_uv0
#define _IN_uv0 uv0

View file

@ -22,7 +22,7 @@
#include "../../gl/hlslCompat.glsl"
#include "../../gl/torque.glsl"
#include "postFX.glsl"
#include "postFx.glsl"
#include "shadergen:/autogenConditioners.h"
//-----------------------------------------------------------------------------

View file

@ -22,7 +22,7 @@
#include "../../../gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"
#include "../../gl/postFX.glsl"
#include "../../gl/postFx.glsl"
uniform sampler2D inputTex ;
uniform vec2 oneOverTargetSize;

View file

@ -22,7 +22,7 @@
#include "../../../gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"
#include "../../gl/postFX.glsl"
#include "../../gl/postFx.glsl"
uniform sampler2D inputTex ;
uniform vec2 oneOverTargetSize;

View file

@ -23,7 +23,7 @@
#include "../../../gl/torque.glsl"
#include "../../../gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"
#include "../../gl/postFX.glsl"
#include "../../gl/postFx.glsl"
uniform sampler2D inputTex ;
uniform sampler2D luminanceTex ;

View file

@ -22,7 +22,7 @@
#include "../../../gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"
#include "../../gl/postFX.glsl"
#include "../../gl/postFx.glsl"
uniform sampler2D currLum;
uniform sampler2D lastAdaptedLum;

View file

@ -22,7 +22,7 @@
#include "../../../gl/torque.glsl"
#include "../../../gl/hlslCompat.glsl"
#include "../../gl/postFX.glsl"
#include "../../gl/postFx.glsl"
#include "shadergen:/autogenConditioners.h"
uniform sampler2D sceneTex;

View file

@ -23,7 +23,7 @@
#include "../../../gl/torque.glsl"
#include "../../../gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"
#include "../../gl/postFX.glsl"
#include "../../gl/postFx.glsl"
uniform sampler2D inputTex;
uniform float brightPassThreshold;

View file

@ -22,7 +22,7 @@
#include "../../../gl/torque.glsl"
#include "../../../gl/hlslCompat.glsl"
#include "../../gl/postFX.glsl"
#include "../../gl/postFx.glsl"
uniform sampler2D inputTex;
uniform vec2 texSize0;

View file

@ -21,7 +21,7 @@
//-----------------------------------------------------------------------------
#include "../../../gl/hlslCompat.glsl"
#include "../../gl/postFX.glsl"
#include "../../gl/postFx.glsl"
uniform sampler2D inputTex;
uniform vec2 oneOverTargetSize;

View file

@ -22,7 +22,7 @@
#include "../../../gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"
#include "../../gl/postFX.glsl"
#include "../../gl/postFx.glsl"
uniform sampler2D backBuffer; // The original backbuffer.
uniform sampler2D deferredTex; // The pre-pass depth and normals.

View file

@ -21,7 +21,7 @@
//-----------------------------------------------------------------------------
#include "../../../gl/hlslCompat.glsl"
#include "../../gl/postFX.glsl"
#include "../../gl/postFx.glsl"
uniform sampler2D frameSampler;
uniform sampler2D backBuffer;

View file

@ -22,7 +22,7 @@
#include "../../../gl/hlslCompat.glsl"
#include "shadergen:/autogenConditioners.h"
#include "../../gl/postFX.glsl"
#include "../../gl/postFx.glsl"
#define DOSMALL
#define DOLARGE

View file

@ -22,7 +22,7 @@
#include "../../../gl/torque.glsl"
#include "../../../gl/hlslCompat.glsl"
#include "../../gl/postFX.glsl"
#include "../../gl/postFx.glsl"
void main()
{

View file

@ -6,7 +6,6 @@
//else.
function ExampleModule::onCreate(%this)
{
%bool = true;
}
//Similar to the create function, this is defined in thye module file, and called
@ -70,6 +69,8 @@ function ExampleModule::onDestroyGameServer(%this)
function ExampleModule::initClient(%this)
{
AssetDatabase.acquireAsset("ExampleModule:exampleDatablock");
AssetDatabase.acquireAsset("ExampleModule:examplePostEffect");
AssetDatabase.acquireAsset("ExampleModule:exampleGUI");
//client scripts
//Here, we exec out keybind scripts so the player is able to move when they get into a game
@ -91,7 +92,7 @@ function ExampleModule::initClient(%this)
function ExampleModule::onCreateClientConnection(%this)
{
//This will push our keybind movemap onto the input stack, so we can control our camera in our ExampleGameMode
ExampleMoveMap.push();
//ExampleMoveMap.push();
}
//This is called when a client game session disconnects from a game server
@ -103,5 +104,5 @@ function ExampleModule::onCreateClientConnection(%this)
function ExampleModule::onDestroyClientConnection(%this)
{
//This will pop the keybind, cleaning it up from the input stack, as it no longer applies
ExampleMoveMap.pop();
//ExampleMoveMap.pop();
}

View file

@ -12,14 +12,4 @@
canSaveDynamicFields="true"
Extension="asset.taml"
Recurse="true" />
<AutoloadAssets
canSave="true"
canSaveDynamicFields="true"
AssetType="ComponentAsset"
Recurse="true" />
<AutoloadAssets
canSave="true"
canSaveDynamicFields="true"
AssetType="GUIAsset"
Recurse="true" />
</ModuleDefinition>

View file

@ -2,13 +2,16 @@
new Scene(EditorTemplateLevel) {
canSave = "1";
canSaveDynamicFields = "1";
isSubScene = "0";
isEditing = "0";
isDirty = "0";
gameModeName = "ExampleGameMode";
cdTrack = "2";
CTF_scoreLimit = "5";
enabled = "1";
Enabled = "1";
musicTrack = "lush";
gameModeName="ExampleGameMode";
new LevelInfo(TheLevelInfo) {
new LevelInfo(theLevelInfo) {
nearClip = "0.1";
visibleDistance = "1000";
visibleGhostDistance = "0";
@ -20,67 +23,14 @@ new Scene(EditorTemplateLevel) {
canvasClearColor = "0 0 0 255";
ambientLightBlendPhase = "1";
ambientLightBlendCurve = "0 0 -1 -1";
advancedLightmapSupport = "0";
soundAmbience = "AudioAmbienceDefault";
soundDistanceModel = "Linear";
canSave = "1";
canSaveDynamicFields = "1";
advancedLightmapSupport = "0";
desc0 = "A blank room template that acts as a starting point.";
enabled = "1";
levelName = "Blank Room Template";
};
new SkyBox(theSky) {
Material = "BlankSkyMat";
drawBottom = "0";
fogBandHeight = "0";
position = "0 0 0";
rotation = "1 0 0 0";
scale = "1 1 1";
canSave = "1";
canSaveDynamicFields = "1";
};
new Sun(theSun) {
azimuth = "230.396";
elevation = "45";
color = "0.968628 0.901961 0.901961 1";
ambient = "0.337255 0.533333 0.619608 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 = "200";
shadowSoftness = "0.25";
numSplits = "4";
logWeight = "0.9";
fadeStartDistance = "0";
lastSplitTerrainOnly = "0";
representedInLightmap = "0";
shadowDarkenColor = "0 0 0 -1";
includeLightmappedGeometryInShadow = "0";
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";
Enabled = "1";
LevelName = "Blank Room Template";
};
new GroundPlane() {
squareSize = "128";
@ -89,11 +39,69 @@ new Scene(EditorTemplateLevel) {
Material = "Grid_512_Grey";
canSave = "1";
canSaveDynamicFields = "1";
enabled = "1";
Enabled = "1";
position = "0 0 0";
rotation = "1 0 0 0";
scale = "1 1 1";
};
new ScatterSky() {
skyBrightness = "25";
sunSize = "1";
colorizeAmount = "0";
colorize = "0 0 0 1";
rayleighScattering = "0.0035";
sunScale = "1 1 1 1";
ambientScale = "1 1 1 1";
fogScale = "1 1 1 1";
exposure = "1";
zOffset = "0";
azimuth = "0";
elevation = "35";
moonAzimuth = "0";
moonElevation = "45";
castShadows = "1";
staticRefreshFreq = "8";
dynamicRefreshFreq = "8";
brightness = "1";
flareScale = "1";
nightColor = "0.0196078 0.0117647 0.109804 1";
nightFogColor = "0.0196078 0.0117647 0.109804 1";
moonEnabled = "1";
moonMat = "Moon_Glow_Mat";
moonScale = "0.2";
moonLightColor = "0.192157 0.192157 0.192157 1";
useNightCubemap = "1";
nightCubemap = "NightCubemap";
attenuationRatio = "0 1 1";
shadowType = "PSSM";
texSize = "1024";
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 = "-19.4839 100.725 -19.5889";
rotation = "1 0 0 0";
scale = "1 1 1";
canSave = "1";
canSaveDynamicFields = "1";
mieScattering = "0.0045";
};
new Skylight() {
Enabled = "1";
ReflectionMode = "Baked Cubemap";
position = "-2.09752 10.8435 53.7998";
rotation = "1 0 0 0";
canSave = "1";
canSaveDynamicFields = "1";
persistentId = "fff282f5-dced-11e9-a423-bb0e346e3870";
reflectionPath = "D:/Gamedev/T3DMIT/T3DPreview4_0/Bugfixaroo/My Projects/Bugfixaroo/game/data/ExampleModule/levels/ExampleLevel/probes/";
};
};
//--- OBJECT WRITE END ---

View file

@ -61,6 +61,12 @@ function ExamplePostEffect::preProcess( %this )
{
}
function ExamplePostEffect::onAdd(%this)
{
//Register the postFX with the manager
PostFXManager.registerPostEffect(%this);
}
function ExamplePostEffect::onEnabled( %this )
{
return true;
@ -70,6 +76,35 @@ function ExamplePostEffect::onDisabled( %this )
{
}
//This is used to populate the PostFXEditor's settings so the post FX can be edited
//This is automatically polled for any postFX that has been registered(in our onAdd) and the settings
//are thus exposed for editing
function ExamplePostEffect::populatePostFXSettings(%this)
{
PostEffectEditorInspector.startGroup("ExamplePostEffect - General");
PostEffectEditorInspector.addField("$PostFXManager::Settings::EnabledExamplePostEffect", "Enabled", "bool", "", $PostFXManager::PostFX::EnableExamplePostEffect, "");
PostEffectEditorInspector.endGroup();
}
//This function pair(applyFromPreset and settingsApply) are done the way they are, with the separated variables
//so that we can effectively store the 'settings' away from the live variables that the postFX's actually utilize
//when rendering. This allows us to modify things but still leave room for reverting or temporarily applying them
function ExamplePostEffect::applyFromPreset(%this)
{
//ExamplePostEffect Settings
$PostFXManager::PostFX::EnableExamplePostEffect = $PostFXManager::Settings::EnabledExamplePostEffect;
if($PostFXManager::PostFX::EnableExamplePostEffect)
%this.enable();
else
%this.disable();
}
function ExamplePostEffect::settingsApply(%this)
{
$PostFXManager::Settings::EnabledExamplePostEffect = $PostFXManager::PostFX::EnableExamplePostEffect;
}
singleton PostEffect( ExamplePostEffect )
{
isEnabled = false;

View file

@ -1,9 +0,0 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="player_Albedo"
imageFile="@assetFile=player_Albedo.png"
useMips="true"
isHDRImage="false"
originalFilePath="E:/Gamedev/Art/TorqueCharacters/OrcMage/player_Albedo.png"
VersionId="1" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 MiB

View file

@ -1,19 +0,0 @@
function Kork::onCreate(%this)
{
}
function Kork::onDestroy(%this)
{
}
function Kork::initServer(%this){}
function Kork::onCreateGameServer(%this){}
function Kork::onDestroyGameServer(%this){}
function Kork::initClient(%this){}
function Kork::onCreateClientConnection(%this){}
function Kork::onDestroyClientConnection(%this){}

View file

@ -1,25 +0,0 @@
<ModuleDefinition
canSave="true"
canSaveDynamicFields="true"
ModuleId="Kork"
VersionId="1"
Group="Game"
scriptFile="Kork.cs"
CreateFunction="onCreate"
DestroyFunction="onDestroy">
<DeclaredAssets
canSave="true"
canSaveDynamicFields="true"
Extension="asset.taml"
Recurse="true" />
<AutoloadAssets
canSave="true"
canSaveDynamicFields="true"
AssetType="ComponentAsset"
Recurse="true" />
<AutoloadAssets
canSave="true"
canSaveDynamicFields="true"
AssetType="GUIAsset"
Recurse="true" />
</ModuleDefinition>

View file

@ -1,9 +0,0 @@
<ShapeAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="OrcMage"
fileName="@assetFile=OrcMage.dts"
isNewShape="1"
materialSlot0="@Asset=Kork:player_mat"
originalFilePath="E:/Gamedev/Art/TorqueCharacters/OrcMage/OrcMage.dts"
VersionId="1" />

View file

@ -1,5 +0,0 @@
singleton TSShapeConstructor(OrcMageDts)
{
baseShape = "./OrcMage.dts";
};

View file

@ -1,9 +0,0 @@
<MaterialAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="player_mat"
scriptFile="@assetFile=player_mat.cs"
materialDefinitionName="player_mat"
imageMap0="@Asset=Kork:player_Albedo"
shaderGraph="data/Kork/materials/player.sgf"
VersionId="1" />

View file

@ -1,6 +0,0 @@
//--- OBJECT WRITE BEGIN ---
singleton Material(player_mat) {
mapTo = "player";
DiffuseMapAsset[0] = "Kork:player_Albedo";
};
//--- OBJECT WRITE END ---

View file

@ -1,9 +0,0 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="Orc_Material_BaseColor"
imageFile="@assetFile=Orc_Material_BaseColor.png"
useMips="true"
isHDRImage="false"
originalFilePath="E:/Gamedev/Art/SpaceOrcMage/Orc_Material_BaseColor.png"
VersionId="1" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 698 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

View file

@ -1,9 +0,0 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="Orc_Material_Metallic"
imageFile="@assetFile=Orc_Material_Metallic.png"
useMips="true"
isHDRImage="false"
originalFilePath="E:/Gamedev/Art/SpaceOrcMage/Orc_Material_Metallic.png"
VersionId="1" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 KiB

View file

@ -1,9 +0,0 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="Orc_Material_Roughness"
imageFile="@assetFile=Orc_Material_Roughness.png"
useMips="true"
isHDRImage="false"
originalFilePath="E:/Gamedev/Art/SpaceOrcMage/Orc_Material_Roughness.png"
VersionId="1" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 403 KiB

View file

@ -1,9 +0,0 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="Orc_Material_normal"
imageFile="@assetFile=Orc_Material_normal.png"
useMips="true"
isHDRImage="false"
originalFilePath="E:/Gamedev/Art/SpaceOrcMage/Orc_Material_normal.png"
VersionId="1" />

View file

@ -1,9 +0,0 @@
<ShapeAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="SpaceOrcMage"
fileName="@assetFile=SpaceOrcMage.dts"
isNewShape="1"
materialSlot0="@Asset=SpaceOrc:Orc_Material"
originalFilePath="E:/Gamedev/Art/SpaceOrcMage/SpaceOrcMage.dts"
VersionId="1" />

View file

@ -1,5 +0,0 @@
singleton TSShapeConstructor(SpaceOrcMageDts)
{
baseShape = "./SpaceOrcMage.dts";
};

View file

@ -1,19 +0,0 @@
function SpaceOrc::onCreate(%this)
{
}
function SpaceOrc::onDestroy(%this)
{
}
function SpaceOrc::initServer(%this){}
function SpaceOrc::onCreateGameServer(%this){}
function SpaceOrc::onDestroyGameServer(%this){}
function SpaceOrc::initClient(%this){}
function SpaceOrc::onCreateClientConnection(%this){}
function SpaceOrc::onDestroyClientConnection(%this){}

View file

@ -1,25 +0,0 @@
<ModuleDefinition
canSave="true"
canSaveDynamicFields="true"
ModuleId="SpaceOrc"
VersionId="1"
Group="Game"
scriptFile="SpaceOrc.cs"
CreateFunction="onCreate"
DestroyFunction="onDestroy">
<DeclaredAssets
canSave="true"
canSaveDynamicFields="true"
Extension="asset.taml"
Recurse="true" />
<AutoloadAssets
canSave="true"
canSaveDynamicFields="true"
AssetType="ComponentAsset"
Recurse="true" />
<AutoloadAssets
canSave="true"
canSaveDynamicFields="true"
AssetType="GUIAsset"
Recurse="true" />
</ModuleDefinition>

View file

@ -1,9 +0,0 @@
<MaterialAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="Orc_Material"
scriptFile="@assetFile=Orc_Material.cs"
materialDefinitionName="Orc_Material"
imageMap0="@Asset=SpaceOrc:Orc_Material_BaseColor"
shaderGraph="data/SpaceOrc/materials/Orc_Material.sgf"
VersionId="1" />

View file

@ -1,12 +0,0 @@
//--- OBJECT WRITE BEGIN ---
singleton Material(Orc_Material) {
mapTo = "Orc_Material";
DiffuseMapAsset[0] = "SpaceOrc:Orc_Material_BaseColor";
diffuseMap[0] = "data/SpaceOrc/Images/Orc_Material_BaseColor.png";
normalMap[0] = "data/SpaceOrc/Images/Orc_Material_normal.png";
invertSmoothness[0] = "1";
roughMap[0] = "data/SpaceOrc/Images/Orc_Material_Roughness.png";
metalMap[0] = "data/SpaceOrc/Images/Orc_Material_Metallic.png";
DiffuseMapAsset0 = "SpaceOrc:Orc_Material_BaseColor";
};
//--- OBJECT WRITE END ---

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

View file

@ -1,9 +0,0 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="Grid_512_orange_ALBEDO"
imageFile="@assetFile=Grid_512_orange.png"
useMips="true"
isHDRImage="false"
originalFilePath="E:/Gamedev/T3DMIT/clangtest/Templates/Full/game/core/art/grids/Grid_512_orange.png"
VersionId="1" />

View file

@ -1,9 +0,0 @@
<ShapeAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="Cube"
fileName="@assetFile=Cube.fbx"
isNewShape="1"
materialSlot0="@Asset=StaticShapeTest:Grid_512_orange"
originalFilePath="E:/Gamedev/T3DMIT/clangtest/My Projects/T3DPreview4_0/art/StarterContent/Cube.fbx"
VersionId="1" />

View file

@ -1,5 +0,0 @@
singleton TSShapeConstructor(CubeFbx)
{
baseShape = "./Cube.fbx";
};

View file

@ -1,8 +0,0 @@
<ShapeAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="Cylinder"
fileName="@assetFile=Cylinder.fbx"
isNewShape="1"
originalFilePath="E:/Gamedev/T3DMIT/clangtest/My Projects/T3DPreview4_0/art/StarterContent/Cylinder.fbx"
VersionId="1" />

View file

@ -1,5 +0,0 @@
singleton TSShapeConstructor(CylinderFbx)
{
baseShape = "./Cylinder.fbx";
};

View file

@ -1,21 +0,0 @@
singleton Material(Grid_512_Orange)
{
mapTo = "Grid_512_orange";
diffuseColor[0] = "0.8 0.8 0.8 1";
diffuseMap[0] = "tools/base/images/512_orange.png";
specular[0] = "0.8 0.8 0.8 1";
specularPower[0] = "0.25";
specularStrength[0] = "25";
translucentBlendOp = "LerpAlpha";
smoothness[0] = "1";
metalness[0] = "1";
DiffuseMapAsset0 = "StaticShapeTest:Grid_512_orange_ALBEDO";
specularStrength0 = "25";
specular0 = "0.8 0.8 0.8 1";
specularPower0 = "0.25";
emissive[0] = "0";
translucent = "1";
normalMap[0] = "data/pbr/images/FloorEbony_normal.png";
invertSmoothness[0] = "1";
};

View file

@ -1,19 +0,0 @@
function StaticShapeTest::onCreate(%this)
{
}
function StaticShapeTest::onDestroy(%this)
{
}
function StaticShapeTest::initServer(%this){}
function StaticShapeTest::onCreateGameServer(%this){}
function StaticShapeTest::onDestroyGameServer(%this){}
function StaticShapeTest::initClient(%this){}
function StaticShapeTest::onCreateClientConnection(%this){}
function StaticShapeTest::onDestroyClientConnection(%this){}

View file

@ -1,25 +0,0 @@
<ModuleDefinition
canSave="true"
canSaveDynamicFields="true"
ModuleId="StaticShapeTest"
VersionId="1"
Group="Game"
scriptFile="StaticShapeTest.cs"
CreateFunction="onCreate"
DestroyFunction="onDestroy">
<DeclaredAssets
canSave="true"
canSaveDynamicFields="true"
Extension="asset.taml"
Recurse="true" />
<AutoloadAssets
canSave="true"
canSaveDynamicFields="true"
AssetType="ComponentAsset"
Recurse="true" />
<AutoloadAssets
canSave="true"
canSaveDynamicFields="true"
AssetType="GUIAsset"
Recurse="true" />
</ModuleDefinition>

View file

@ -1,9 +0,0 @@
<MaterialAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="Grid_512_Orange"
scriptFile="@assetFile=data/StaticShapeTest/materials/Grid_512_orange.cs"
materialDefinitionName="Grid_512_Orange"
originalFilePath="E:/Gamedev/T3DMIT/clangtest/Templates/Full/game/core/art/grids/Grid_512_orange.png"
shaderGraph="data/StaticShapeTest/materials/Grid_512_orange.sgf"
VersionId="1" />

View file

@ -1,7 +0,0 @@
//--- OBJECT WRITE BEGIN ---
singleton Material(Grid_512_orange) {
mapTo = "Grid_512_orange";
DiffuseMap[0] = "data/StaticShapeTest/Images/Grid_512_orange.png";
DiffuseMapAsset[0] = "StaticShapeTest:Grid_512_orange_ALBEDO";
};
//--- OBJECT WRITE END ---

View file

@ -0,0 +1,2 @@
*.hlsl
*.glsl

Some files were not shown because too many files have changed in this diff Show more