mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Re-submission of the Volumetric Fog PR, with cleanup.
This commit is contained in:
parent
272e3138a0
commit
a90eb9762b
|
|
@ -321,8 +321,11 @@ void GuiCanvas::setWindowTitle(const char *newTitle)
|
|||
mPlatformWindow->setCaption(newTitle);
|
||||
}
|
||||
|
||||
CanvasSizeChangeSignal GuiCanvas::smCanvasSizeChangeSignal;
|
||||
|
||||
void GuiCanvas::handleResize( WindowId did, S32 width, S32 height )
|
||||
{
|
||||
getCanvasSizeChangeSignal().trigger(this);
|
||||
if (Journal::IsPlaying() && mPlatformWindow)
|
||||
{
|
||||
mPlatformWindow->lockSize(false);
|
||||
|
|
|
|||
|
|
@ -33,6 +33,10 @@
|
|||
#include "platform/platformInput.h"
|
||||
#endif
|
||||
|
||||
#ifndef _SIGNAL_H_
|
||||
#include "core/util/tSignal.h"
|
||||
#endif
|
||||
|
||||
#include "component/interfaces/IProcessInput.h"
|
||||
#include "windowManager/platformWindowMgr.h"
|
||||
#include "gfx/gfxFence.h"
|
||||
|
|
@ -74,6 +78,8 @@
|
|||
/// screen will be painted normally. If you are making an animated GuiControl
|
||||
/// you need to add your control to the dirty areas of the canvas.
|
||||
///
|
||||
class guiCanvas;
|
||||
typedef Signal<void(GuiCanvas* canvas)> CanvasSizeChangeSignal;
|
||||
class GuiCanvas : public GuiControl, public IProcessInput
|
||||
{
|
||||
|
||||
|
|
@ -183,6 +189,8 @@ protected:
|
|||
virtual void setupFences();
|
||||
|
||||
void checkLockMouseMove( const GuiEvent& event );
|
||||
//Signal used to let others know this canvas has changed size.
|
||||
static CanvasSizeChangeSignal smCanvasSizeChangeSignal;
|
||||
|
||||
GuiControl *mMenuBarCtrl;
|
||||
|
||||
|
|
@ -200,6 +208,8 @@ public:
|
|||
|
||||
static void initPersistFields();
|
||||
|
||||
static CanvasSizeChangeSignal& getCanvasSizeChangeSignal() { return smCanvasSizeChangeSignal; }
|
||||
|
||||
/// @name Rendering methods
|
||||
///
|
||||
/// @{
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ const RenderInstType RenderPassManager::RIT_ObjectTranslucent("ObjectTranslucent
|
|||
const RenderInstType RenderPassManager::RIT_Decal("Decal");
|
||||
const RenderInstType RenderPassManager::RIT_Water("Water");
|
||||
const RenderInstType RenderPassManager::RIT_Foliage("Foliage");
|
||||
const RenderInstType RenderPassManager::RIT_VolumetricFog("ObjectVolumetricFog");
|
||||
const RenderInstType RenderPassManager::RIT_Translucent("Translucent");
|
||||
const RenderInstType RenderPassManager::RIT_Begin("Begin");
|
||||
const RenderInstType RenderPassManager::RIT_Custom("Custom");
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ public:
|
|||
static const RenderInstType RIT_Decal;
|
||||
static const RenderInstType RIT_Water;
|
||||
static const RenderInstType RIT_Foliage;
|
||||
static const RenderInstType RIT_VolumetricFog;
|
||||
static const RenderInstType RIT_Translucent;
|
||||
static const RenderInstType RIT_Begin;
|
||||
static const RenderInstType RIT_Custom;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ RenderTranslucentMgr::RenderTranslucentMgr()
|
|||
{
|
||||
notifyType( RenderPassManager::RIT_ObjectTranslucent );
|
||||
notifyType( RenderPassManager::RIT_Particle );
|
||||
notifyType( RenderPassManager::RIT_VolumetricFog);
|
||||
}
|
||||
|
||||
RenderTranslucentMgr::~RenderTranslucentMgr()
|
||||
|
|
@ -187,6 +188,15 @@ void RenderTranslucentMgr::render( SceneRenderState *state )
|
|||
j++;
|
||||
continue;
|
||||
}
|
||||
else if (baseRI->type == RenderPassManager::RIT_VolumetricFog)
|
||||
{
|
||||
ObjectRenderInst* objRI = static_cast<ObjectRenderInst*>(baseRI);
|
||||
objRI->renderDelegate(objRI, state, NULL);
|
||||
lastVB = NULL;
|
||||
lastPB = NULL;
|
||||
j++;
|
||||
continue;
|
||||
}
|
||||
else if ( baseRI->type == RenderPassManager::RIT_Particle )
|
||||
{
|
||||
ParticleRenderInst *ri = static_cast<ParticleRenderInst*>(baseRI);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "windowManager/platformWindow.h"
|
||||
|
||||
|
||||
ScreenResChangeSignal PlatformWindow::smScreenResChangeSignal;
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void PlatformWindow::setFullscreen( const bool fullscreen )
|
||||
|
|
@ -48,3 +48,8 @@ bool PlatformWindow::shouldNotTranslate( U32 modifiers, U32 keyCode ) const
|
|||
else
|
||||
return false;
|
||||
}
|
||||
void PlatformWindow::setVideoMode(const GFXVideoMode &mode)
|
||||
{
|
||||
_setVideoMode(mode);
|
||||
getScreenResChangeSignal().trigger(this, true);
|
||||
}
|
||||
|
|
@ -28,6 +28,9 @@
|
|||
#include "core/util/safeDelete.h"
|
||||
#include "windowManager/platformCursorController.h"
|
||||
#include "windowManager/windowInputGenerator.h"
|
||||
#ifndef _SIGNAL_H_ //Volumetric Fog
|
||||
#include "core/util/tSignal.h"
|
||||
#endif
|
||||
|
||||
//forward decl's
|
||||
class PlatformWindowManager;
|
||||
|
|
@ -35,7 +38,7 @@ class GFXDevice;
|
|||
struct GFXVideoMode;
|
||||
class GFXWindowTarget;
|
||||
class IProcessInput;
|
||||
|
||||
typedef Signal<void(PlatformWindow *PlatformWindow, bool resize)> ScreenResChangeSignal;
|
||||
/// Abstract representation of a native OS window.
|
||||
///
|
||||
/// Every windowing system has its own representations and conventions as
|
||||
|
|
@ -110,7 +113,7 @@ protected:
|
|||
// This controller maps window input (Mouse/Keyboard) to a generic input consumer
|
||||
mWindowInputGenerator = new WindowInputGenerator( this );
|
||||
}
|
||||
|
||||
static ScreenResChangeSignal smScreenResChangeSignal;
|
||||
public:
|
||||
|
||||
/// To get rid of a window, just delete it. Make sure the GFXDevice is
|
||||
|
|
@ -158,7 +161,7 @@ public:
|
|||
virtual GFXWindowTarget *getGFXTarget()=0;
|
||||
|
||||
/// Set the video mode for this window.
|
||||
virtual void setVideoMode(const GFXVideoMode &mode)=0;
|
||||
virtual void setVideoMode(const GFXVideoMode &mode);
|
||||
|
||||
/// Get our current video mode - if the window has been resized, it will
|
||||
/// reflect this.
|
||||
|
|
@ -497,6 +500,7 @@ public:
|
|||
IdleEvent idleEvent;
|
||||
|
||||
/// @}
|
||||
static ScreenResChangeSignal& getScreenResChangeSignal() { return smScreenResChangeSignal; }
|
||||
|
||||
/// Get the platform specific object needed to create or attach an accelerated
|
||||
/// graohics drawing context on or to the window
|
||||
|
|
@ -507,6 +511,7 @@ public:
|
|||
virtual void* getPlatformDrawable() const = 0;
|
||||
protected:
|
||||
virtual void _setFullscreen(const bool fullScreen) {};
|
||||
virtual void _setVideoMode(const GFXVideoMode &mode) {};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -287,6 +287,8 @@ void Win32Window::setVideoMode( const GFXVideoMode &mode )
|
|||
mOwningManager->raiseCurtain();
|
||||
|
||||
SetForegroundWindow(getHWND());
|
||||
|
||||
getScreenResChangeSignal().trigger(this, true);
|
||||
}
|
||||
|
||||
bool Win32Window::clearFullscreen()
|
||||
|
|
|
|||
BIN
Templates/Empty/game/art/environment/FogMod_heavy.dds
Normal file
BIN
Templates/Empty/game/art/environment/FogMod_heavy.dds
Normal file
Binary file not shown.
BIN
Templates/Empty/game/art/environment/FogMod_light.dds
Normal file
BIN
Templates/Empty/game/art/environment/FogMod_light.dds
Normal file
Binary file not shown.
BIN
Templates/Empty/game/art/environment/FogMod_med.dds
Normal file
BIN
Templates/Empty/game/art/environment/FogMod_med.dds
Normal file
Binary file not shown.
177
Templates/Empty/game/art/environment/Fog_Cube.DAE
Normal file
177
Templates/Empty/game/art/environment/Fog_Cube.DAE
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
|
||||
<asset>
|
||||
<contributor>
|
||||
<author>Richard</author>
|
||||
<authoring_tool>OpenCOLLADA for 3ds Max; Version: 1.4.1; Revision: exported; Platform: x64; Configuration: Release_Max2011_static</authoring_tool>
|
||||
<source_data>file:///G:/Documents%20and%20Settings/Richard/Mijn%20documenten/3dsmax/scenes/FogVolumes.max</source_data>
|
||||
</contributor>
|
||||
<created>2014-08-16T10:10:23</created>
|
||||
<modified>2014-08-16T10:10:23</modified>
|
||||
<unit name="meter" meter="1"/>
|
||||
<up_axis>Z_UP</up_axis>
|
||||
</asset>
|
||||
<library_effects>
|
||||
<effect id="NoMat">
|
||||
<profile_COMMON>
|
||||
<technique sid="common">
|
||||
<blinn>
|
||||
<emission>
|
||||
<color>0 0 0 1</color>
|
||||
</emission>
|
||||
<ambient>
|
||||
<color>0.588 0.588 0.588 1</color>
|
||||
</ambient>
|
||||
<diffuse>
|
||||
<color>0.588 0.588 0.588 1</color>
|
||||
</diffuse>
|
||||
<specular>
|
||||
<color>0.9 0.9 0.9 1</color>
|
||||
</specular>
|
||||
<shininess>
|
||||
<float>0</float>
|
||||
</shininess>
|
||||
<reflective>
|
||||
<color>0 0 0 1</color>
|
||||
</reflective>
|
||||
<transparent opaque="A_ONE">
|
||||
<color>1 1 1 1</color>
|
||||
</transparent>
|
||||
<transparency>
|
||||
<float>1</float>
|
||||
</transparency>
|
||||
</blinn>
|
||||
</technique>
|
||||
</profile_COMMON>
|
||||
<extra>
|
||||
<technique profile="OpenCOLLADA3dsMax">
|
||||
<extended_shader>
|
||||
<apply_reflection_dimming>0</apply_reflection_dimming>
|
||||
<dim_level>0</dim_level>
|
||||
<falloff_type>0</falloff_type>
|
||||
<index_of_refraction>1.5</index_of_refraction>
|
||||
<opacity_type>0</opacity_type>
|
||||
<reflection_level>3</reflection_level>
|
||||
<wire_size>1</wire_size>
|
||||
<wire_units>0</wire_units>
|
||||
</extended_shader>
|
||||
<shader>
|
||||
<ambient_diffuse_lock>1</ambient_diffuse_lock>
|
||||
<ambient_diffuse_texture_lock>1</ambient_diffuse_texture_lock>
|
||||
<diffuse_specular_lock>0</diffuse_specular_lock>
|
||||
<soften>0.1</soften>
|
||||
<use_self_illum_color>0</use_self_illum_color>
|
||||
</shader>
|
||||
</technique>
|
||||
</extra>
|
||||
</effect>
|
||||
</library_effects>
|
||||
<library_materials>
|
||||
<material id="NoMat-material" name="NoMat">
|
||||
<instance_effect url="#NoMat"/>
|
||||
</material>
|
||||
</library_materials>
|
||||
<library_geometries>
|
||||
<geometry id="geom-FogCube1" name="FogCube1">
|
||||
<mesh>
|
||||
<source id="geom-FogCube1-positions">
|
||||
<float_array id="geom-FogCube1-positions-array" count="72">-0.85 -1 -0.85 0.85 -0.85 -1 -1 0.85 -0.85 0.85 0.85 -1 -0.85 -1 0.85 1 -0.85 0.85 -1 0.85 0.85 0.85 1 0.85 -1 -0.85 -0.85 -0.85 -0.85 -1 1 -0.85 -0.85 0.85 -1 -0.85 -0.85 1 -0.85 -0.85 0.85 -1 0.85 1 -0.85 1 0.85 -0.85 -0.85 -0.85 1 -1 -0.85 0.85 0.85 -0.85 1 0.85 -1 0.85 -0.85 0.85 1 -0.85 1 0.85 0.85 0.85 1 1 0.85 0.85</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#geom-FogCube1-positions-array" count="24" stride="3">
|
||||
<param name="X" type="float"/>
|
||||
<param name="Y" type="float"/>
|
||||
<param name="Z" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<source id="geom-FogCube1-normals">
|
||||
<float_array id="geom-FogCube1-normals-array" count="72">-0.341586 -0.341586 -0.8755786 -0.341586 0.341586 -0.8755788 0.341586 0.341586 -0.8755788 0.341586 -0.341586 -0.8755788 -0.341586 -0.341586 0.8755786 0.341586 -0.341586 0.8755788 0.341586 0.341586 0.8755788 -0.341586 0.341586 0.8755788 -0.341586 -0.8755786 -0.341586 0.341586 -0.8755788 -0.341586 0.341586 -0.8755786 0.341586 -0.341586 -0.8755788 0.341586 0.8755786 -0.341586 -0.341586 0.8755788 0.341586 -0.341586 0.8755786 0.341586 0.341586 0.8755788 -0.341586 0.341586 0.341586 0.8755786 -0.341586 -0.341586 0.8755788 -0.341586 -0.341586 0.8755786 0.341586 0.341586 0.8755788 0.341586 -0.8755786 0.341586 -0.341586 -0.8755788 -0.341586 -0.341586 -0.8755786 -0.341586 0.341586 -0.8755788 0.341586 0.341586</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#geom-FogCube1-normals-array" count="24" stride="3">
|
||||
<param name="X" type="float"/>
|
||||
<param name="Y" type="float"/>
|
||||
<param name="Z" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<source id="geom-FogCube1-map1">
|
||||
<float_array id="geom-FogCube1-map1-array" count="228">0 0 0 1 0 0 0 1 0 1 1 0 0 0 0 1 0 0 0 1 0 1 1 0 0 0 0 1 0 0 0 1 0 1 1 0 0.07542458 0.07542461 4.99755e-4 0.07542479 0.07542461 4.99547e-4 0.07542455 0.07542461 4.99755e-4 0.07542461 0.9245752 4.99547e-4 0.07542458 0.9245754 4.99755e-4 0.07542458 0.9245754 0.9995003 0.07542455 0.9245754 4.99755e-4 0.07542455 0.9245754 0.9995003 0.9245752 0.07542461 4.99576e-4 0.9245754 0.07542479 4.99547e-4 0.07542458 0.07542461 0.9995003 0.9245752 0.07542461 4.99576e-4 0.9245752 0.07542461 0.9995004 0.9245752 0.9245754 4.99547e-4 0.07542455 0.07542461 0.9995003 0.9245752 0.07542461 0.9995004 0.07542461 0.07542479 0.9995005 0.9245752 0.9245754 4.99576e-4 0.9245752 0.07542461 0.9995005 0.9245752 0.9245754 4.99576e-4 0.07542479 0.9245754 0.9995005 0.9245752 0.9245754 0.9995004 0.9245754 0.9245752 0.9995005 0.9245752 0.9245754 0.9995004 0.9995003 0.07542461 0.07542458 0.9245752 4.99547e-4 0.07542461 0.9245752 4.99547e-4 0.07542461 0.9995003 0.07542461 0.07542458 0.9995003 0.07542461 0.9245754 0.9245752 4.99547e-4 0.9245754 0.9245752 4.99547e-4 0.9245754 0.9995003 0.07542461 0.9245754 0.9995003 0.9245754 0.07542458 0.9245752 0.9995005 0.07542461 0.9995003 0.9245754 0.07542458 0.9245752 0.9995005 0.07542461 0.9995003 0.9245754 0.9245754 0.9245752 0.9995005 0.9245754 0.9995003 0.9245754 0.9245754 0.9245752 0.9995005 0.9245754 0.9995004 0.07542482 0.07542461 0.9995003 0.9245754 0.07542461 0.9245752 0.9995004 0.07542461 0.07542455 0.9995003 0.07542461 4.99606e-4 0.9245752 0.07542461 4.99725e-4 0.07542458 0.07542461 0.07542479 4.99576e-4 0.07542461 0.9245754 4.99755e-4 0.07542461 0.07542458 4.99755e-4 0.9245754 0.9245752 4.99576e-4 0.9245754 0.9995003 0.07542458 0.9245754 0.9995004 0.9245752 0.9245754 0.9245754 0.9995003 0.9245754 0.07542482 0.9995004 0.9245754 4.99755e-4 0.9245754 0.9245754 4.99576e-4 0.07542482 0.9245754 0.9995003 0.07542461 0.07542458 0.9995003 0.9245754 0.07542458 0.9995003 0.9245754 0.07542458 0.9995003 0.07542461 0.07542458 0.9995003 0.07542461 0.9245754 0.9995003 0.9245754 0.9245754 0.9995003 0.07542461 0.9245754 0.9995003 0.9245754 0.9245754</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#geom-FogCube1-map1-array" count="76" stride="3">
|
||||
<param name="S" type="float"/>
|
||||
<param name="T" type="float"/>
|
||||
<param name="P" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<source id="geom-FogCube1-map1-textangents">
|
||||
<float_array id="geom-FogCube1-map1-textangents-array" count="192">-0.8644259 0.01841655 0.3300502 -0.8715108 -0.05526615 0.3184382 -0.8644259 0.01841664 -0.3300501 -0.8715108 -0.05526611 -0.3184382 0.8738725 -0.06754867 0.3145678 0.8597026 -0.006149054 -0.3377912 0.8738725 -0.06754874 -0.3145678 0.8597026 -0.006148929 0.3377911 0.883319 -0.2990854 -0.116681 0.8478944 0.3571441 -0.06756432 0.8597026 0.3377913 0.00614921 0.883319 -0.2990854 0.116681 0.2990854 0.883319 -0.116681 -0.3571441 0.8478944 -0.06756432 -0.3377913 0.8597026 0.00614921 0.2990854 0.883319 0.116681 -0.883319 0.2990854 -0.116681 -0.8478944 -0.3571441 -0.06756432 -0.8597026 -0.3377913 0.00614921 -0.883319 0.2990854 0.116681 -0.2990854 -0.883319 -0.116681 0.3571441 -0.8478944 -0.06756432 0.3377913 -0.8597026 0.00614921 -0.2990854 -0.883319 0.116681 0.8360862 -0.3764972 0.1289794 0.7071068 -0.7071068 0 0.7071068 0.7071068 0 0.3764972 0.8360862 0.1289794 -0.3764972 -0.8360862 0.1289794 -0.7071068 -0.7071068 0 -0.7071068 0.7071068 0 -0.8360862 0.3764972 0.1289794 0.8360862 -0.3764971 -0.1289794 0.7071068 -0.7071068 0 0.3764971 0.8360862 -0.1289794 0.7071068 0.7071068 0 -0.3764971 -0.8360862 -0.1289794 -0.7071068 -0.7071068 0 -0.8360862 0.3764971 -0.1289794 -0.7071068 0.7071068 0 -0.376497 0.1289792 0.8360862 -0.3764973 -0.1289798 0.8360861 -0.8833191 -0.2990855 0.1166808 -0.883319 0.2990853 -0.1166812 -0.3764971 0.1289794 -0.8360862 -0.3764972 -0.1289795 -0.8360862 -0.8833191 -0.2990855 -0.1166807 -0.883319 0.2990853 0.1166812 0.883319 -0.2990853 0.1166812 0.8833191 0.2990855 -0.1166807 0.3764971 0.1289797 -0.8360862 0.3764971 -0.1289793 -0.8360862 0.883319 -0.2990853 -0.1166811 0.8833191 0.2990855 0.1166808 0.3764972 0.1289799 0.8360861 0.3764971 -0.128979 0.8360862 0.3764972 0.8360862 0.1289794 0.3764971 0.8360862 -0.1289794 0.8360862 -0.3764971 -0.1289794 0.8360862 -0.3764972 0.1289794 -0.8360862 0.3764972 0.1289794 -0.8360862 0.3764971 -0.1289794 -0.3764972 -0.8360862 0.1289794 -0.3764971 -0.8360862 -0.1289794</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#geom-FogCube1-map1-textangents-array" count="64" stride="3">
|
||||
<param name="X" type="float"/>
|
||||
<param name="Y" type="float"/>
|
||||
<param name="Z" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<source id="geom-FogCube1-map1-texbinormals">
|
||||
<float_array id="geom-FogCube1-map1-texbinormals-array" count="192">0.1043954 -0.9396398 0.3258505 -0.06496345 -0.9379679 -0.3405817 0.1043953 -0.9396398 -0.3258505 -0.06496349 -0.937968 0.3405817 0.05187585 -0.9370471 -0.3453283 -0.1307439 -0.939827 -0.3156443 0.05187577 -0.9370471 0.3453283 -0.1307438 -0.939827 0.3156443 0 0.3634471 -0.9316148 -0.196368 0.2889368 -0.9369926 0.1307441 -0.3156442 -0.939827 0 -0.3634471 -0.9316148 -0.3634471 0 -0.9316148 -0.2889368 -0.196368 -0.9369926 0.3156442 0.1307441 -0.939827 0.3634471 0 -0.9316148 0 -0.3634471 -0.9316148 0.196368 -0.2889368 -0.9369926 -0.1307441 0.3156442 -0.939827 0 0.3634471 -0.9316148 0.3634471 0 -0.9316148 0.2889368 0.196368 -0.9369926 -0.3156442 -0.1307441 -0.939827 -0.3634471 0 -0.9316148 0.2608475 0.2608475 -0.9294714 0.6191276 0.6191276 -0.4830755 -0.6191276 0.6191276 -0.4830755 -0.2608475 0.2608475 -0.9294714 0.2608475 -0.2608475 -0.9294714 0.6191276 -0.6191276 -0.4830755 -0.6191276 -0.6191276 -0.4830755 -0.2608475 -0.2608475 -0.9294714 -0.2608475 -0.2608475 -0.9294714 -0.6191276 -0.6191276 -0.4830755 0.2608475 -0.2608475 -0.9294714 0.6191276 -0.6191276 -0.4830755 -0.2608475 0.2608475 -0.9294714 -0.6191276 0.6191276 -0.4830755 0.2608475 0.2608475 -0.9294714 0.6191276 0.6191276 -0.4830755 0.2608476 -0.9294715 0.2608473 -0.2608474 -0.9294714 -0.2608479 1.81809e-7 -0.363447 -0.9316149 2.27262e-7 -0.3634472 -0.9316148 0.2608475 -0.9294714 -0.2608475 -0.2608475 -0.9294714 0.2608477 2.72714e-7 -0.363447 0.9316149 2.72714e-7 -0.3634472 0.9316148 2.72714e-7 -0.3634472 -0.9316148 2.72714e-7 -0.363447 -0.9316149 -0.2608474 -0.9294714 -0.2608478 0.2608476 -0.9294714 0.2608474 1.81809e-7 -0.3634472 0.9316148 2.27262e-7 -0.3634471 0.9316149 -0.2608473 -0.9294714 0.260848 0.2608477 -0.9294715 -0.2608472 -0.2608475 0.2608475 -0.9294714 0.2608475 -0.2608475 -0.9294714 -0.2608475 -0.2608475 -0.9294714 0.2608475 0.2608475 -0.9294714 -0.2608475 -0.2608475 -0.9294714 0.2608475 0.2608475 -0.9294714 0.2608475 -0.2608475 -0.9294714 -0.2608475 0.2608475 -0.9294714</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#geom-FogCube1-map1-texbinormals-array" count="64" stride="3">
|
||||
<param name="X" type="float"/>
|
||||
<param name="Y" type="float"/>
|
||||
<param name="Z" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<vertices id="geom-FogCube1-vertices">
|
||||
<input semantic="POSITION" source="#geom-FogCube1-positions"/>
|
||||
</vertices>
|
||||
<triangles material="NoMat" count="44">
|
||||
<input semantic="VERTEX" source="#geom-FogCube1-vertices" offset="0"/>
|
||||
<input semantic="NORMAL" source="#geom-FogCube1-normals" offset="1"/>
|
||||
<input semantic="TEXCOORD" source="#geom-FogCube1-map1" offset="2" set="0"/>
|
||||
<input semantic="TEXTANGENT" source="#geom-FogCube1-map1-textangents" offset="3" set="1"/>
|
||||
<input semantic="TEXBINORMAL" source="#geom-FogCube1-map1-texbinormals" offset="3" set="1"/>
|
||||
<p>9 0 21 0 13 1 25 1 3 2 15 2 3 2 15 2 1 3 13 3 9 0 21 0 16 4 28 4 18 5 30 5 22 6 34 6 22 6 34 6 20 7 32 7 16 4 28 4 0 8 12 8 11 9 23 9 19 10 31 10 19 10 31 10 4 11 16 11 0 8 12 8 10 12 22 12 15 13 27 13 23 14 35 14 23 14 35 14 5 15 17 15 10 12 22 12 14 16 26 16 12 17 24 17 21 18 33 18 21 18 33 18 7 19 19 19 14 16 26 16 2 20 14 20 8 21 20 21 17 22 29 22 17 22 29 22 6 23 18 23 2 20 14 20 0 8 36 24 8 21 20 21 9 0 37 25 1 3 38 26 10 12 39 27 11 9 23 9 2 20 40 28 12 17 24 17 13 1 41 29 3 2 42 30 14 16 43 31 15 13 27 13 4 11 44 32 16 4 45 33 17 22 29 22 5 15 46 34 18 5 47 35 19 10 31 10 6 23 48 36 20 7 49 37 21 18 33 18 7 19 50 38 22 6 51 39 23 14 35 14 9 0 21 0 8 21 52 40 2 20 53 41 2 20 53 41 13 1 25 1 9 0 21 0 13 1 25 1 12 17 54 42 14 16 55 43 14 16 55 43 3 2 15 2 13 1 25 1 3 2 15 2 15 13 56 44 10 12 57 45 10 12 57 45 1 3 13 3 3 2 15 2 1 3 13 3 11 9 58 46 0 8 59 47 0 8 59 47 9 0 21 0 1 3 13 3 16 4 28 4 4 11 60 48 19 10 61 49 19 10 61 49 18 5 30 5 16 4 28 4 18 5 30 5 5 15 62 50 23 14 63 51 23 14 63 51 22 6 34 6 18 5 30 5 22 6 34 6 7 19 64 52 21 18 65 53 21 18 65 53 20 7 32 7 22 6 34 6 20 7 32 7 6 23 66 54 17 22 67 55 17 22 67 55 16 4 28 4 20 7 32 7 11 9 23 9 10 12 68 56 5 15 69 57 5 15 69 57 19 10 31 10 11 9 23 9 4 11 70 58 17 22 29 22 8 21 20 21 8 21 20 21 0 8 71 59 4 11 70 58 15 13 27 13 14 16 72 60 7 19 73 61 7 19 73 61 23 14 35 14 15 13 27 13 12 17 24 17 2 20 74 62 6 23 75 63 6 23 75 63 21 18 33 18 12 17 24 17</p>
|
||||
</triangles>
|
||||
</mesh>
|
||||
</geometry>
|
||||
</library_geometries>
|
||||
<library_lights>
|
||||
<light id="EnvironmentAmbientLight" name="EnvironmentAmbientLight">
|
||||
<technique_common>
|
||||
<ambient>
|
||||
<color>0 0 0</color>
|
||||
</ambient>
|
||||
</technique_common>
|
||||
</light>
|
||||
</library_lights>
|
||||
<library_visual_scenes>
|
||||
<visual_scene id="MaxScene">
|
||||
<node name="EnvironmentAmbientLight">
|
||||
<instance_light url="#EnvironmentAmbientLight"/>
|
||||
</node>
|
||||
<node id="node-FogCube1" name="FogCube1">
|
||||
<instance_geometry url="#geom-FogCube1">
|
||||
<bind_material>
|
||||
<technique_common>
|
||||
<instance_material symbol="NoMat" target="#NoMat-material"/>
|
||||
</technique_common>
|
||||
</bind_material>
|
||||
</instance_geometry>
|
||||
<extra>
|
||||
<technique profile="OpenCOLLADA">
|
||||
<cast_shadows>1</cast_shadows>
|
||||
<primary_visibility>1</primary_visibility>
|
||||
<receive_shadows>1</receive_shadows>
|
||||
<secondary_visibility>1</secondary_visibility>
|
||||
</technique>
|
||||
</extra>
|
||||
</node>
|
||||
</visual_scene>
|
||||
</library_visual_scenes>
|
||||
<scene>
|
||||
<instance_visual_scene url="#MaxScene"/>
|
||||
</scene>
|
||||
</COLLADA>
|
||||
8
Templates/Empty/game/art/environment/Fog_Cube.cs
Normal file
8
Templates/Empty/game/art/environment/Fog_Cube.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
singleton TSShapeConstructor(Fog_CubeDAE)
|
||||
{
|
||||
baseShape = "./Fog_Cube.DAE";
|
||||
lodType = "TrailingNumber";
|
||||
neverImport = "env*";
|
||||
loadLights = "0";
|
||||
};
|
||||
|
|
@ -106,3 +106,79 @@ singleton PostEffect( GlowPostFx )
|
|||
target = "$backBuffer";
|
||||
};
|
||||
};
|
||||
|
||||
singleton ShaderData( PFX_VolFogGlowBlurVertShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/glowBlurV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/VolFogGlowP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/glowBlurV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/gl/VolFogGlowP.glsl";
|
||||
|
||||
defines = "BLUR_DIR=float2(0.0,1.0)";
|
||||
samplerNames[0] = "$diffuseMap";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
singleton ShaderData( PFX_VolFogGlowBlurHorzShader : PFX_VolFogGlowBlurVertShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/glowBlurV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/VolFogGlowP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/glowBlurV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/gl/VolFogGlowP.glsl";
|
||||
|
||||
defines = "BLUR_DIR=float2(1.0,0.0)";
|
||||
};
|
||||
|
||||
$VolFogGlowPostFx::glowStrength = 0.3;
|
||||
|
||||
singleton PostEffect( VolFogGlowPostFx )
|
||||
{
|
||||
// Do not allow the glow effect to work in reflection
|
||||
// passes by default so we don't do the extra drawing.
|
||||
allowReflectPass = false;
|
||||
renderTime = "PFXAfterBin";
|
||||
renderBin = "FogBin";
|
||||
renderPriority = 1;
|
||||
// First we down sample the glow buffer.
|
||||
shader = PFX_PassthruShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
texture[0] = "$backbuffer";
|
||||
target = "$outTex";
|
||||
targetScale = "0.5 0.5";
|
||||
isEnabled = true;
|
||||
// Blur vertically
|
||||
new PostEffect()
|
||||
{
|
||||
shader = PFX_VolFogGlowBlurVertShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
internalName = "vert";
|
||||
texture[0] = "$inTex";
|
||||
target = "$outTex";
|
||||
};
|
||||
// Blur horizontally
|
||||
new PostEffect()
|
||||
{
|
||||
shader = PFX_VolFogGlowBlurHorzShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
internalName = "hor";
|
||||
texture[0] = "$inTex";
|
||||
target = "$outTex";
|
||||
};
|
||||
// Upsample and combine with the back buffer.
|
||||
new PostEffect()
|
||||
{
|
||||
shader = PFX_PassthruShader;
|
||||
stateBlock = PFX_GlowCombineStateBlock;
|
||||
texture[0] = "$inTex";
|
||||
target = "$backBuffer";
|
||||
};
|
||||
};
|
||||
|
||||
function VolFogGlowPostFx::setShaderConsts( %this )
|
||||
{
|
||||
%vp=%this-->vert;
|
||||
%vp.setShaderConst( "$strength", $VolFogGlowPostFx::glowStrength );
|
||||
%vp=%this-->hor;
|
||||
%vp.setShaderConst( "$strength", $VolFogGlowPostFx::glowStrength );
|
||||
}
|
||||
|
|
@ -70,6 +70,7 @@ function PostFXManager::settingsSetEnabled(%this, %bEnablePostFX)
|
|||
|
||||
postVerbose("% - PostFX Manager - PostFX disabled");
|
||||
}
|
||||
VolFogGlowPostFx.disable();
|
||||
}
|
||||
|
||||
function PostFXManager::settingsEffectSetEnabled(%this, %sName, %bEnable)
|
||||
|
|
|
|||
|
|
@ -75,6 +75,8 @@ function initRenderManager()
|
|||
DiffuseRenderPassManager.addManager( new RenderParticleMgr() { renderOrder = 1.35; processAddOrder = 1.35; } );
|
||||
DiffuseRenderPassManager.addManager( new RenderTranslucentMgr() { renderOrder = 1.4; processAddOrder = 1.4; } );
|
||||
|
||||
DiffuseRenderPassManager.addManager(new RenderObjectMgr(FogBin){ bintype = "ObjectVolumetricFog"; renderOrder = 1.45; processAddOrder = 1.45; } );
|
||||
|
||||
// Note that the GlowPostFx is triggered after this bin.
|
||||
DiffuseRenderPassManager.addManager( new RenderGlowMgr(GlowBin) { renderOrder = 1.5; processAddOrder = 1.5; } );
|
||||
|
||||
|
|
|
|||
106
Templates/Empty/game/scripts/server/VolumetricFog.cs
Normal file
106
Templates/Empty/game/scripts/server/VolumetricFog.cs
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VolumetricFog::onEnterFog(%this,%obj)
|
||||
{
|
||||
// This method is called whenever the control object (Camera or Player)
|
||||
// %obj enters the fog area.
|
||||
|
||||
// echo("Control Object " @ %obj @ " enters fog " @ %this);
|
||||
}
|
||||
|
||||
function VolumetricFog::onLeaveFog(%this,%obj)
|
||||
{
|
||||
// This method is called whenever the control object (Camera or Player)
|
||||
// %obj leaves the fog area.
|
||||
|
||||
// echo("Control Object " @ %obj @ " left fog " @ %this);
|
||||
}
|
||||
|
||||
function VolumetricFog::Dissolve(%this,%speed,%delete)
|
||||
{
|
||||
// This method dissolves the fog at speed milliseconds
|
||||
%this.isBuilding = true;
|
||||
if (%this.FogDensity > 0)
|
||||
{
|
||||
%this.setFogDensity(%this.FogDensity - 0.005);
|
||||
%this.schedule(%speed,Dissolve,%speed,%delete);
|
||||
}
|
||||
else
|
||||
{
|
||||
%this.isBuilding = false;
|
||||
%this.SetFogDensity(0.0);
|
||||
if (%delete !$= "" && %delete !$="0" && %delete !$="false")
|
||||
%this.schedule(250,delete);
|
||||
}
|
||||
}
|
||||
|
||||
function VolumetricFog::Thicken(%this,%speed, %end_density)
|
||||
{
|
||||
// This method thickens the fog at speed milliseconds to a density of %end_density
|
||||
|
||||
%this.isBuilding = true;
|
||||
if (%this.FogDensity + 0.005 < %end_density)
|
||||
{
|
||||
%this.setFogDensity(%this.FogDensity + 0.005);
|
||||
%this.schedule(%speed,Thicken,%speed, %end_density);
|
||||
}
|
||||
else
|
||||
{
|
||||
%this.setFogDensity(%end_density);
|
||||
%this.isBuilding = false;
|
||||
}
|
||||
}
|
||||
|
||||
function GenerateFog(%pos,%scale,%color,%density)
|
||||
{
|
||||
// This function can be used to generate some fog caused by massive gunfire etc.
|
||||
// Change shape and modulation data to your likings.
|
||||
|
||||
%fog=new VolumetricFog() {
|
||||
shapeName = "art/environment/Fog_Sphere.dts";
|
||||
fogColor = %color;
|
||||
fogDensity = "0.0";
|
||||
ignoreWater = "0";
|
||||
MinSize = "250";
|
||||
FadeSize = "750";
|
||||
texture = "art/environment/FogMod_heavy.dds";
|
||||
tiles = "1";
|
||||
modStrength = "0.2";
|
||||
PrimSpeed = "-0.01 0.04";
|
||||
SecSpeed = "0.02 0.02";
|
||||
position = %pos;
|
||||
rotation = "0 0 1 20.354";
|
||||
scale = %scale;
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "1";
|
||||
};
|
||||
|
||||
if (isObject(%fog))
|
||||
{
|
||||
MissionCleanup.add(%fog);
|
||||
|
||||
%fog.Thicken(500,%density);
|
||||
}
|
||||
|
||||
return %fog;
|
||||
}
|
||||
|
|
@ -22,3 +22,4 @@
|
|||
|
||||
// Load up all scripts. This function is called when
|
||||
// a server is constructed.
|
||||
exec("./VolumetricFog.cs");
|
||||
87
Templates/Empty/game/shaders/common/VolumetricFog/VFogP.hlsl
Normal file
87
Templates/Empty/game/shaders/common/VolumetricFog/VFogP.hlsl
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog final pixel shader V2.00
|
||||
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
#include "../torque.hlsl"
|
||||
|
||||
uniform sampler2D prepassTex : register(S0);
|
||||
uniform sampler2D depthBuffer : register(S1);
|
||||
uniform sampler2D frontBuffer : register(S2);
|
||||
uniform sampler2D density : register(S3);
|
||||
|
||||
uniform float accumTime;
|
||||
uniform float4 fogColor;
|
||||
uniform float fogDensity;
|
||||
uniform float preBias;
|
||||
uniform float textured;
|
||||
uniform float modstrength;
|
||||
uniform float4 modspeed;//xy speed layer 1, zw speed layer 2
|
||||
uniform float2 viewpoint;
|
||||
uniform float2 texscale;
|
||||
uniform float3 ambientColor;
|
||||
uniform float numtiles;
|
||||
uniform float fadesize;
|
||||
uniform float2 PixelSize;
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 htpos : TEXCOORD0;
|
||||
float2 uv0 : TEXCOORD1;
|
||||
};
|
||||
|
||||
float4 main( ConnectData IN ) : COLOR0
|
||||
{
|
||||
float2 uvscreen=((IN.htpos.xy/IN.htpos.w) + 1.0 ) / 2.0;
|
||||
uvscreen.y = 1.0 - uvscreen.y;
|
||||
|
||||
float obj_test = prepassUncondition( prepassTex, uvscreen).w * preBias;
|
||||
float depth = tex2D(depthBuffer,uvscreen).r;
|
||||
float front = tex2D(frontBuffer,uvscreen).r;
|
||||
|
||||
if (depth <= front)
|
||||
return float4(0,0,0,0);
|
||||
else if ( obj_test < depth )
|
||||
depth = obj_test;
|
||||
if ( front >= 0.0)
|
||||
depth -= front;
|
||||
|
||||
float diff = 1.0;
|
||||
float3 col = fogColor.rgb;
|
||||
if (textured != 0.0)
|
||||
{
|
||||
float2 offset = viewpoint + ((-0.5 + (texscale * uvscreen)) * numtiles);
|
||||
|
||||
float2 mod1 = tex2D(density,(offset + (modspeed.xy*accumTime))).rg;
|
||||
float2 mod2= tex2D(density,(offset + (modspeed.zw*accumTime))).rg;
|
||||
diff = (mod2.r + mod1.r) * modstrength;
|
||||
col *= (2.0 - ((mod1.g + mod2.g) * fadesize))/2.0;
|
||||
}
|
||||
|
||||
col *= ambientColor;
|
||||
|
||||
float4 resultColor = float4(col, 1.0 - saturate(exp(-fogDensity * depth * diff * fadesize)));
|
||||
|
||||
return hdrEncode(resultColor);
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog prepass pixel shader V1.00
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 pos : TEXCOORD0;
|
||||
};
|
||||
|
||||
float4 main( ConnectData IN ) : COLOR0
|
||||
{
|
||||
float OUT;
|
||||
|
||||
clip( IN.pos.w );
|
||||
OUT = IN.pos.w;
|
||||
|
||||
return float4(OUT,0,0,1);
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog prepass vertex shader V1.00
|
||||
|
||||
#include "shaders/common/hlslstructs.h"
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 pos : TEXCOORD0;
|
||||
};
|
||||
|
||||
uniform float4x4 modelView;
|
||||
|
||||
ConnectData main( VertexIn_P IN)
|
||||
{
|
||||
ConnectData OUT;
|
||||
|
||||
float4 inPos = IN.pos;
|
||||
inPos.w = 1.0;
|
||||
|
||||
OUT.hpos = mul( modelView, inPos );
|
||||
OUT.pos = OUT.hpos;
|
||||
|
||||
return OUT;
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
uniform float4 fogColor;
|
||||
uniform float fogDensity;
|
||||
uniform float reflStrength;
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 pos : TEXCOORD0;
|
||||
};
|
||||
|
||||
float4 main( ConnectData IN ) : COLOR0
|
||||
{
|
||||
return float4(fogColor.rgb,saturate(fogDensity*reflStrength));
|
||||
}
|
||||
45
Templates/Empty/game/shaders/common/VolumetricFog/VFogV.hlsl
Normal file
45
Templates/Empty/game/shaders/common/VolumetricFog/VFogV.hlsl
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog final vertex shader V1.00
|
||||
|
||||
#include "shaders/common/hlslstructs.h"
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 htpos : TEXCOORD0;
|
||||
float2 uv0 : TEXCOORD1;
|
||||
};
|
||||
|
||||
uniform float4x4 modelView;
|
||||
|
||||
ConnectData main( VertexIn_PNT IN)
|
||||
{
|
||||
ConnectData OUT;
|
||||
|
||||
OUT.hpos = mul(modelView, IN.pos);
|
||||
OUT.htpos = OUT.hpos;
|
||||
OUT.uv0 = IN.uv0;
|
||||
|
||||
return OUT;
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
#include "../../gl/torque.glsl"
|
||||
|
||||
uniform sampler2D prepassTex;
|
||||
uniform sampler2D depthBuffer;
|
||||
uniform sampler2D frontBuffer;
|
||||
uniform sampler2D density;
|
||||
|
||||
uniform float accumTime;
|
||||
uniform vec4 fogColor;
|
||||
uniform float fogDensity;
|
||||
uniform float preBias;
|
||||
uniform float textured;
|
||||
uniform float modstrength;
|
||||
uniform vec4 modspeed;//xy speed layer 1, zw speed layer 2
|
||||
uniform vec2 viewpoint;
|
||||
uniform vec2 texscale;
|
||||
uniform vec3 ambientColor;
|
||||
uniform float numtiles;
|
||||
uniform float fadesize;
|
||||
uniform vec2 PixelSize;
|
||||
|
||||
in vec4 _hpos;
|
||||
#define IN_hpos _hpos
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uvscreen=((IN_hpos.xy/IN_hpos.w) + 1.0 ) / 2.0;
|
||||
uvscreen.y = 1.0 - uvscreen.y;
|
||||
|
||||
float obj_test = prepassUncondition( prepassTex, uvscreen).w * preBias;
|
||||
float depth = tex2D(depthBuffer,uvscreen).r;
|
||||
float front = tex2D(frontBuffer,uvscreen).r;
|
||||
|
||||
if (depth <= front)
|
||||
{
|
||||
OUT_col = vec4(0,0,0,0);
|
||||
return;
|
||||
}
|
||||
|
||||
else if ( obj_test < depth )
|
||||
depth = obj_test;
|
||||
if ( front >= 0.0)
|
||||
depth -= front;
|
||||
|
||||
float diff = 1.0;
|
||||
vec3 col = fogColor.rgb;
|
||||
if (textured != 0.0)
|
||||
{
|
||||
vec2 offset = viewpoint + ((-0.5 + (texscale * uvscreen)) * numtiles);
|
||||
|
||||
vec2 mod1 = tex2D(density,(offset + (modspeed.xy*accumTime))).rg;
|
||||
vec2 mod2= tex2D(density,(offset + (modspeed.zw*accumTime))).rg;
|
||||
diff = (mod2.r + mod1.r) * modstrength;
|
||||
col *= (2.0 - ((mod1.g + mod2.g) * fadesize))/2.0;
|
||||
}
|
||||
|
||||
col *= ambientColor;
|
||||
|
||||
vec4 returnColor = vec4(col, 1.0 - saturate(exp(-fogDensity * depth * diff * fadesize)));
|
||||
|
||||
OUT_col = hdrEncode(returnColor);
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
|
||||
in vec4 _hpos;
|
||||
#define IN_hpos _hpos
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
float OUT;
|
||||
clip( IN_hpos.w );
|
||||
OUT = IN_hpos.w;
|
||||
|
||||
OUT_col = vec4(OUT,0,0,1);
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
|
||||
in vec4 vPosition;
|
||||
#define IN_position vPosition
|
||||
|
||||
out vec4 _hpos;
|
||||
#define OUT_hpos _hpos
|
||||
|
||||
uniform mat4 modelView;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 inPos = IN_position;
|
||||
inPos.w = 1.0;
|
||||
|
||||
OUT_hpos = tMul( modelView, inPos );
|
||||
|
||||
gl_Position = OUT_hpos;
|
||||
correctSSP(gl_Position);
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
|
||||
uniform vec4 fogColor;
|
||||
uniform float fogDensity;
|
||||
uniform float reflStrength;
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_col = vec4(fogColor.rgb,saturate(fogDensity*reflStrength));
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
|
||||
in vec4 vPosition;
|
||||
#define IN_position vPosition
|
||||
|
||||
out vec4 _hpos;
|
||||
#define OUT_hpos _hpos
|
||||
|
||||
uniform mat4 modelView;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_hpos = tMul(modelView, IN_position);
|
||||
gl_Position = OUT_hpos;
|
||||
correctSSP(gl_Position);
|
||||
}
|
||||
74
Templates/Empty/game/shaders/common/postFx/VolFogGlowP.hlsl
Normal file
74
Templates/Empty/game/shaders/common/postFx/VolFogGlowP.hlsl
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2014 R.G.S. - Richards Game Studio, the Netherlands
|
||||
// http://www.richardsgamestudio.com/
|
||||
//
|
||||
// If you find this code useful or you are feeling particularly generous I
|
||||
// would ask that you please go to http://www.richardsgamestudio.com/ then
|
||||
// choose Donations from the menu on the left side and make a donation to
|
||||
// Richards Game Studio. It will be highly appreciated.
|
||||
//
|
||||
// The MIT License:
|
||||
//
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog Glow postFx pixel shader V1.00
|
||||
|
||||
#include "./postFx.hlsl"
|
||||
|
||||
uniform sampler2D diffuseMap : register(S0);
|
||||
uniform float strength;
|
||||
|
||||
struct VertToPix
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
|
||||
float2 uv0 : TEXCOORD0;
|
||||
float2 uv1 : TEXCOORD1;
|
||||
float2 uv2 : TEXCOORD2;
|
||||
float2 uv3 : TEXCOORD3;
|
||||
|
||||
float2 uv4 : TEXCOORD4;
|
||||
float2 uv5 : TEXCOORD5;
|
||||
float2 uv6 : TEXCOORD6;
|
||||
float2 uv7 : TEXCOORD7;
|
||||
};
|
||||
|
||||
float4 main( VertToPix IN ) : COLOR
|
||||
{
|
||||
float4 kernel = float4( 0.175, 0.275, 0.375, 0.475 ) * strength;
|
||||
|
||||
float4 OUT = 0;
|
||||
OUT += tex2D( diffuseMap, IN.uv0 ) * kernel.x;
|
||||
OUT += tex2D( diffuseMap, IN.uv1 ) * kernel.y;
|
||||
OUT += tex2D( diffuseMap, IN.uv2 ) * kernel.z;
|
||||
OUT += tex2D( diffuseMap, IN.uv3 ) * kernel.w;
|
||||
|
||||
OUT += tex2D( diffuseMap, IN.uv4 ) * kernel.x;
|
||||
OUT += tex2D( diffuseMap, IN.uv5 ) * kernel.y;
|
||||
OUT += tex2D( diffuseMap, IN.uv6 ) * kernel.z;
|
||||
OUT += tex2D( diffuseMap, IN.uv7 ) * kernel.w;
|
||||
|
||||
// Calculate a lumenance value in the alpha so we
|
||||
// can use alpha test to save fillrate.
|
||||
float3 rgb2lum = float3( 0.30, 0.59, 0.11 );
|
||||
OUT.a = dot( OUT.rgb, rgb2lum );
|
||||
|
||||
return OUT;
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2014 R.G.S. - Richards Game Studio, the Netherlands
|
||||
// http://www.richardsgamestudio.com/
|
||||
//
|
||||
// If you find this code useful or you are feeling particularly generous I
|
||||
// would ask that you please go to http://www.richardsgamestudio.com/ then
|
||||
// choose Donations from the menu on the left side and make a donation to
|
||||
// Richards Game Studio. It will be highly appreciated.
|
||||
//
|
||||
// The MIT License:
|
||||
//
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog Glow postFx pixel shader V1.00
|
||||
|
||||
uniform sampler2D diffuseMap;
|
||||
uniform float strength;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
in vec2 uv0;
|
||||
in vec2 uv1;
|
||||
in vec2 uv2;
|
||||
in vec2 uv3;
|
||||
|
||||
in vec2 uv4;
|
||||
in vec2 uv5;
|
||||
in vec2 uv6;
|
||||
in vec2 uv7;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 kernel = vec4( 0.175, 0.275, 0.375, 0.475 ) * strength;
|
||||
|
||||
OUT_col = vec4(0);
|
||||
OUT_col += texture( diffuseMap, uv0 ) * kernel.x;
|
||||
OUT_col += texture( diffuseMap, uv1 ) * kernel.y;
|
||||
OUT_col += texture( diffuseMap, uv2 ) * kernel.z;
|
||||
OUT_col += texture( diffuseMap, uv3 ) * kernel.w;
|
||||
|
||||
OUT_col += texture( diffuseMap, uv4 ) * kernel.x;
|
||||
OUT_col += texture( diffuseMap, uv5 ) * kernel.y;
|
||||
OUT_col += texture( diffuseMap, uv6 ) * kernel.z;
|
||||
OUT_col += texture( diffuseMap, uv7 ) * kernel.w;
|
||||
|
||||
// Calculate a lumenance value in the alpha so we
|
||||
// can use alpha test to save fillrate.
|
||||
vec3 rgb2lum = vec3( 0.30, 0.59, 0.11 );
|
||||
OUT_col.a = dot( OUT_col.rgb, rgb2lum );
|
||||
}
|
||||
BIN
Templates/Empty/game/tools/classIcons/VolumetricFog.png
Normal file
BIN
Templates/Empty/game/tools/classIcons/VolumetricFog.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
|
|
@ -980,7 +980,19 @@ function ObjectBuilderGui::buildObserverDropPoint(%this)
|
|||
//------------------------------------------------------------------------------
|
||||
// System
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function ObjectBuilderGui::buildVolumetricFog(%this)
|
||||
{
|
||||
// Change this if you want to default to another Folder
|
||||
// Otherwise every time you want to add a Fog you will go this.
|
||||
%defShape = "/art/environment/Fog_Cube.dts";
|
||||
%this.lastPath=getMainDotCsDir() @ %defShape;
|
||||
OBObjectName.setValue( "" );
|
||||
%this.objectClassName = "VolumetricFog";
|
||||
%this.addField( "shapeName", "TypeFile", "Shape (Fog volume)", "", "*.dts;*.dae");
|
||||
%this.addField("Scale", "TypePoint3", "Scale", "1 1 1");
|
||||
%this.addField("FogColor", "TypeColorI", "FogColor", "200 200 200 255");
|
||||
%this.process();
|
||||
}
|
||||
function ObjectBuilderGui::buildPhysicsEntity(%this)
|
||||
{
|
||||
%this.objectClassName = "PhysicsEntity";
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ function EWCreatorWindow::init( %this )
|
|||
%this.registerMissionObject( "SFXEmitter", "Sound Emitter" );
|
||||
%this.registerMissionObject( "Precipitation" );
|
||||
%this.registerMissionObject( "ParticleEmitterNode", "Particle Emitter" );
|
||||
%this.registerMissionObject( "VolumetricFog", "Volumetric Fog" );
|
||||
%this.registerMissionObject( "RibbonNode", "Ribbon" );
|
||||
|
||||
// Legacy features. Users should use Ground Cover and the Forest Editor.
|
||||
|
|
|
|||
BIN
Templates/Full/game/art/environment/FogMod_heavy.dds
Normal file
BIN
Templates/Full/game/art/environment/FogMod_heavy.dds
Normal file
Binary file not shown.
BIN
Templates/Full/game/art/environment/FogMod_light.dds
Normal file
BIN
Templates/Full/game/art/environment/FogMod_light.dds
Normal file
Binary file not shown.
BIN
Templates/Full/game/art/environment/FogMod_med.dds
Normal file
BIN
Templates/Full/game/art/environment/FogMod_med.dds
Normal file
Binary file not shown.
177
Templates/Full/game/art/environment/Fog_Cube.DAE
Normal file
177
Templates/Full/game/art/environment/Fog_Cube.DAE
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
|
||||
<asset>
|
||||
<contributor>
|
||||
<author>Richard</author>
|
||||
<authoring_tool>OpenCOLLADA for 3ds Max; Version: 1.4.1; Revision: exported; Platform: x64; Configuration: Release_Max2011_static</authoring_tool>
|
||||
<source_data>file:///G:/Documents%20and%20Settings/Richard/Mijn%20documenten/3dsmax/scenes/FogVolumes.max</source_data>
|
||||
</contributor>
|
||||
<created>2014-08-16T10:10:23</created>
|
||||
<modified>2014-08-16T10:10:23</modified>
|
||||
<unit name="meter" meter="1"/>
|
||||
<up_axis>Z_UP</up_axis>
|
||||
</asset>
|
||||
<library_effects>
|
||||
<effect id="NoMat">
|
||||
<profile_COMMON>
|
||||
<technique sid="common">
|
||||
<blinn>
|
||||
<emission>
|
||||
<color>0 0 0 1</color>
|
||||
</emission>
|
||||
<ambient>
|
||||
<color>0.588 0.588 0.588 1</color>
|
||||
</ambient>
|
||||
<diffuse>
|
||||
<color>0.588 0.588 0.588 1</color>
|
||||
</diffuse>
|
||||
<specular>
|
||||
<color>0.9 0.9 0.9 1</color>
|
||||
</specular>
|
||||
<shininess>
|
||||
<float>0</float>
|
||||
</shininess>
|
||||
<reflective>
|
||||
<color>0 0 0 1</color>
|
||||
</reflective>
|
||||
<transparent opaque="A_ONE">
|
||||
<color>1 1 1 1</color>
|
||||
</transparent>
|
||||
<transparency>
|
||||
<float>1</float>
|
||||
</transparency>
|
||||
</blinn>
|
||||
</technique>
|
||||
</profile_COMMON>
|
||||
<extra>
|
||||
<technique profile="OpenCOLLADA3dsMax">
|
||||
<extended_shader>
|
||||
<apply_reflection_dimming>0</apply_reflection_dimming>
|
||||
<dim_level>0</dim_level>
|
||||
<falloff_type>0</falloff_type>
|
||||
<index_of_refraction>1.5</index_of_refraction>
|
||||
<opacity_type>0</opacity_type>
|
||||
<reflection_level>3</reflection_level>
|
||||
<wire_size>1</wire_size>
|
||||
<wire_units>0</wire_units>
|
||||
</extended_shader>
|
||||
<shader>
|
||||
<ambient_diffuse_lock>1</ambient_diffuse_lock>
|
||||
<ambient_diffuse_texture_lock>1</ambient_diffuse_texture_lock>
|
||||
<diffuse_specular_lock>0</diffuse_specular_lock>
|
||||
<soften>0.1</soften>
|
||||
<use_self_illum_color>0</use_self_illum_color>
|
||||
</shader>
|
||||
</technique>
|
||||
</extra>
|
||||
</effect>
|
||||
</library_effects>
|
||||
<library_materials>
|
||||
<material id="NoMat-material" name="NoMat">
|
||||
<instance_effect url="#NoMat"/>
|
||||
</material>
|
||||
</library_materials>
|
||||
<library_geometries>
|
||||
<geometry id="geom-FogCube1" name="FogCube1">
|
||||
<mesh>
|
||||
<source id="geom-FogCube1-positions">
|
||||
<float_array id="geom-FogCube1-positions-array" count="72">-0.85 -1 -0.85 0.85 -0.85 -1 -1 0.85 -0.85 0.85 0.85 -1 -0.85 -1 0.85 1 -0.85 0.85 -1 0.85 0.85 0.85 1 0.85 -1 -0.85 -0.85 -0.85 -0.85 -1 1 -0.85 -0.85 0.85 -1 -0.85 -0.85 1 -0.85 -0.85 0.85 -1 0.85 1 -0.85 1 0.85 -0.85 -0.85 -0.85 1 -1 -0.85 0.85 0.85 -0.85 1 0.85 -1 0.85 -0.85 0.85 1 -0.85 1 0.85 0.85 0.85 1 1 0.85 0.85</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#geom-FogCube1-positions-array" count="24" stride="3">
|
||||
<param name="X" type="float"/>
|
||||
<param name="Y" type="float"/>
|
||||
<param name="Z" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<source id="geom-FogCube1-normals">
|
||||
<float_array id="geom-FogCube1-normals-array" count="72">-0.341586 -0.341586 -0.8755786 -0.341586 0.341586 -0.8755788 0.341586 0.341586 -0.8755788 0.341586 -0.341586 -0.8755788 -0.341586 -0.341586 0.8755786 0.341586 -0.341586 0.8755788 0.341586 0.341586 0.8755788 -0.341586 0.341586 0.8755788 -0.341586 -0.8755786 -0.341586 0.341586 -0.8755788 -0.341586 0.341586 -0.8755786 0.341586 -0.341586 -0.8755788 0.341586 0.8755786 -0.341586 -0.341586 0.8755788 0.341586 -0.341586 0.8755786 0.341586 0.341586 0.8755788 -0.341586 0.341586 0.341586 0.8755786 -0.341586 -0.341586 0.8755788 -0.341586 -0.341586 0.8755786 0.341586 0.341586 0.8755788 0.341586 -0.8755786 0.341586 -0.341586 -0.8755788 -0.341586 -0.341586 -0.8755786 -0.341586 0.341586 -0.8755788 0.341586 0.341586</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#geom-FogCube1-normals-array" count="24" stride="3">
|
||||
<param name="X" type="float"/>
|
||||
<param name="Y" type="float"/>
|
||||
<param name="Z" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<source id="geom-FogCube1-map1">
|
||||
<float_array id="geom-FogCube1-map1-array" count="228">0 0 0 1 0 0 0 1 0 1 1 0 0 0 0 1 0 0 0 1 0 1 1 0 0 0 0 1 0 0 0 1 0 1 1 0 0.07542458 0.07542461 4.99755e-4 0.07542479 0.07542461 4.99547e-4 0.07542455 0.07542461 4.99755e-4 0.07542461 0.9245752 4.99547e-4 0.07542458 0.9245754 4.99755e-4 0.07542458 0.9245754 0.9995003 0.07542455 0.9245754 4.99755e-4 0.07542455 0.9245754 0.9995003 0.9245752 0.07542461 4.99576e-4 0.9245754 0.07542479 4.99547e-4 0.07542458 0.07542461 0.9995003 0.9245752 0.07542461 4.99576e-4 0.9245752 0.07542461 0.9995004 0.9245752 0.9245754 4.99547e-4 0.07542455 0.07542461 0.9995003 0.9245752 0.07542461 0.9995004 0.07542461 0.07542479 0.9995005 0.9245752 0.9245754 4.99576e-4 0.9245752 0.07542461 0.9995005 0.9245752 0.9245754 4.99576e-4 0.07542479 0.9245754 0.9995005 0.9245752 0.9245754 0.9995004 0.9245754 0.9245752 0.9995005 0.9245752 0.9245754 0.9995004 0.9995003 0.07542461 0.07542458 0.9245752 4.99547e-4 0.07542461 0.9245752 4.99547e-4 0.07542461 0.9995003 0.07542461 0.07542458 0.9995003 0.07542461 0.9245754 0.9245752 4.99547e-4 0.9245754 0.9245752 4.99547e-4 0.9245754 0.9995003 0.07542461 0.9245754 0.9995003 0.9245754 0.07542458 0.9245752 0.9995005 0.07542461 0.9995003 0.9245754 0.07542458 0.9245752 0.9995005 0.07542461 0.9995003 0.9245754 0.9245754 0.9245752 0.9995005 0.9245754 0.9995003 0.9245754 0.9245754 0.9245752 0.9995005 0.9245754 0.9995004 0.07542482 0.07542461 0.9995003 0.9245754 0.07542461 0.9245752 0.9995004 0.07542461 0.07542455 0.9995003 0.07542461 4.99606e-4 0.9245752 0.07542461 4.99725e-4 0.07542458 0.07542461 0.07542479 4.99576e-4 0.07542461 0.9245754 4.99755e-4 0.07542461 0.07542458 4.99755e-4 0.9245754 0.9245752 4.99576e-4 0.9245754 0.9995003 0.07542458 0.9245754 0.9995004 0.9245752 0.9245754 0.9245754 0.9995003 0.9245754 0.07542482 0.9995004 0.9245754 4.99755e-4 0.9245754 0.9245754 4.99576e-4 0.07542482 0.9245754 0.9995003 0.07542461 0.07542458 0.9995003 0.9245754 0.07542458 0.9995003 0.9245754 0.07542458 0.9995003 0.07542461 0.07542458 0.9995003 0.07542461 0.9245754 0.9995003 0.9245754 0.9245754 0.9995003 0.07542461 0.9245754 0.9995003 0.9245754 0.9245754</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#geom-FogCube1-map1-array" count="76" stride="3">
|
||||
<param name="S" type="float"/>
|
||||
<param name="T" type="float"/>
|
||||
<param name="P" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<source id="geom-FogCube1-map1-textangents">
|
||||
<float_array id="geom-FogCube1-map1-textangents-array" count="192">-0.8644259 0.01841655 0.3300502 -0.8715108 -0.05526615 0.3184382 -0.8644259 0.01841664 -0.3300501 -0.8715108 -0.05526611 -0.3184382 0.8738725 -0.06754867 0.3145678 0.8597026 -0.006149054 -0.3377912 0.8738725 -0.06754874 -0.3145678 0.8597026 -0.006148929 0.3377911 0.883319 -0.2990854 -0.116681 0.8478944 0.3571441 -0.06756432 0.8597026 0.3377913 0.00614921 0.883319 -0.2990854 0.116681 0.2990854 0.883319 -0.116681 -0.3571441 0.8478944 -0.06756432 -0.3377913 0.8597026 0.00614921 0.2990854 0.883319 0.116681 -0.883319 0.2990854 -0.116681 -0.8478944 -0.3571441 -0.06756432 -0.8597026 -0.3377913 0.00614921 -0.883319 0.2990854 0.116681 -0.2990854 -0.883319 -0.116681 0.3571441 -0.8478944 -0.06756432 0.3377913 -0.8597026 0.00614921 -0.2990854 -0.883319 0.116681 0.8360862 -0.3764972 0.1289794 0.7071068 -0.7071068 0 0.7071068 0.7071068 0 0.3764972 0.8360862 0.1289794 -0.3764972 -0.8360862 0.1289794 -0.7071068 -0.7071068 0 -0.7071068 0.7071068 0 -0.8360862 0.3764972 0.1289794 0.8360862 -0.3764971 -0.1289794 0.7071068 -0.7071068 0 0.3764971 0.8360862 -0.1289794 0.7071068 0.7071068 0 -0.3764971 -0.8360862 -0.1289794 -0.7071068 -0.7071068 0 -0.8360862 0.3764971 -0.1289794 -0.7071068 0.7071068 0 -0.376497 0.1289792 0.8360862 -0.3764973 -0.1289798 0.8360861 -0.8833191 -0.2990855 0.1166808 -0.883319 0.2990853 -0.1166812 -0.3764971 0.1289794 -0.8360862 -0.3764972 -0.1289795 -0.8360862 -0.8833191 -0.2990855 -0.1166807 -0.883319 0.2990853 0.1166812 0.883319 -0.2990853 0.1166812 0.8833191 0.2990855 -0.1166807 0.3764971 0.1289797 -0.8360862 0.3764971 -0.1289793 -0.8360862 0.883319 -0.2990853 -0.1166811 0.8833191 0.2990855 0.1166808 0.3764972 0.1289799 0.8360861 0.3764971 -0.128979 0.8360862 0.3764972 0.8360862 0.1289794 0.3764971 0.8360862 -0.1289794 0.8360862 -0.3764971 -0.1289794 0.8360862 -0.3764972 0.1289794 -0.8360862 0.3764972 0.1289794 -0.8360862 0.3764971 -0.1289794 -0.3764972 -0.8360862 0.1289794 -0.3764971 -0.8360862 -0.1289794</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#geom-FogCube1-map1-textangents-array" count="64" stride="3">
|
||||
<param name="X" type="float"/>
|
||||
<param name="Y" type="float"/>
|
||||
<param name="Z" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<source id="geom-FogCube1-map1-texbinormals">
|
||||
<float_array id="geom-FogCube1-map1-texbinormals-array" count="192">0.1043954 -0.9396398 0.3258505 -0.06496345 -0.9379679 -0.3405817 0.1043953 -0.9396398 -0.3258505 -0.06496349 -0.937968 0.3405817 0.05187585 -0.9370471 -0.3453283 -0.1307439 -0.939827 -0.3156443 0.05187577 -0.9370471 0.3453283 -0.1307438 -0.939827 0.3156443 0 0.3634471 -0.9316148 -0.196368 0.2889368 -0.9369926 0.1307441 -0.3156442 -0.939827 0 -0.3634471 -0.9316148 -0.3634471 0 -0.9316148 -0.2889368 -0.196368 -0.9369926 0.3156442 0.1307441 -0.939827 0.3634471 0 -0.9316148 0 -0.3634471 -0.9316148 0.196368 -0.2889368 -0.9369926 -0.1307441 0.3156442 -0.939827 0 0.3634471 -0.9316148 0.3634471 0 -0.9316148 0.2889368 0.196368 -0.9369926 -0.3156442 -0.1307441 -0.939827 -0.3634471 0 -0.9316148 0.2608475 0.2608475 -0.9294714 0.6191276 0.6191276 -0.4830755 -0.6191276 0.6191276 -0.4830755 -0.2608475 0.2608475 -0.9294714 0.2608475 -0.2608475 -0.9294714 0.6191276 -0.6191276 -0.4830755 -0.6191276 -0.6191276 -0.4830755 -0.2608475 -0.2608475 -0.9294714 -0.2608475 -0.2608475 -0.9294714 -0.6191276 -0.6191276 -0.4830755 0.2608475 -0.2608475 -0.9294714 0.6191276 -0.6191276 -0.4830755 -0.2608475 0.2608475 -0.9294714 -0.6191276 0.6191276 -0.4830755 0.2608475 0.2608475 -0.9294714 0.6191276 0.6191276 -0.4830755 0.2608476 -0.9294715 0.2608473 -0.2608474 -0.9294714 -0.2608479 1.81809e-7 -0.363447 -0.9316149 2.27262e-7 -0.3634472 -0.9316148 0.2608475 -0.9294714 -0.2608475 -0.2608475 -0.9294714 0.2608477 2.72714e-7 -0.363447 0.9316149 2.72714e-7 -0.3634472 0.9316148 2.72714e-7 -0.3634472 -0.9316148 2.72714e-7 -0.363447 -0.9316149 -0.2608474 -0.9294714 -0.2608478 0.2608476 -0.9294714 0.2608474 1.81809e-7 -0.3634472 0.9316148 2.27262e-7 -0.3634471 0.9316149 -0.2608473 -0.9294714 0.260848 0.2608477 -0.9294715 -0.2608472 -0.2608475 0.2608475 -0.9294714 0.2608475 -0.2608475 -0.9294714 -0.2608475 -0.2608475 -0.9294714 0.2608475 0.2608475 -0.9294714 -0.2608475 -0.2608475 -0.9294714 0.2608475 0.2608475 -0.9294714 0.2608475 -0.2608475 -0.9294714 -0.2608475 0.2608475 -0.9294714</float_array>
|
||||
<technique_common>
|
||||
<accessor source="#geom-FogCube1-map1-texbinormals-array" count="64" stride="3">
|
||||
<param name="X" type="float"/>
|
||||
<param name="Y" type="float"/>
|
||||
<param name="Z" type="float"/>
|
||||
</accessor>
|
||||
</technique_common>
|
||||
</source>
|
||||
<vertices id="geom-FogCube1-vertices">
|
||||
<input semantic="POSITION" source="#geom-FogCube1-positions"/>
|
||||
</vertices>
|
||||
<triangles material="NoMat" count="44">
|
||||
<input semantic="VERTEX" source="#geom-FogCube1-vertices" offset="0"/>
|
||||
<input semantic="NORMAL" source="#geom-FogCube1-normals" offset="1"/>
|
||||
<input semantic="TEXCOORD" source="#geom-FogCube1-map1" offset="2" set="0"/>
|
||||
<input semantic="TEXTANGENT" source="#geom-FogCube1-map1-textangents" offset="3" set="1"/>
|
||||
<input semantic="TEXBINORMAL" source="#geom-FogCube1-map1-texbinormals" offset="3" set="1"/>
|
||||
<p>9 0 21 0 13 1 25 1 3 2 15 2 3 2 15 2 1 3 13 3 9 0 21 0 16 4 28 4 18 5 30 5 22 6 34 6 22 6 34 6 20 7 32 7 16 4 28 4 0 8 12 8 11 9 23 9 19 10 31 10 19 10 31 10 4 11 16 11 0 8 12 8 10 12 22 12 15 13 27 13 23 14 35 14 23 14 35 14 5 15 17 15 10 12 22 12 14 16 26 16 12 17 24 17 21 18 33 18 21 18 33 18 7 19 19 19 14 16 26 16 2 20 14 20 8 21 20 21 17 22 29 22 17 22 29 22 6 23 18 23 2 20 14 20 0 8 36 24 8 21 20 21 9 0 37 25 1 3 38 26 10 12 39 27 11 9 23 9 2 20 40 28 12 17 24 17 13 1 41 29 3 2 42 30 14 16 43 31 15 13 27 13 4 11 44 32 16 4 45 33 17 22 29 22 5 15 46 34 18 5 47 35 19 10 31 10 6 23 48 36 20 7 49 37 21 18 33 18 7 19 50 38 22 6 51 39 23 14 35 14 9 0 21 0 8 21 52 40 2 20 53 41 2 20 53 41 13 1 25 1 9 0 21 0 13 1 25 1 12 17 54 42 14 16 55 43 14 16 55 43 3 2 15 2 13 1 25 1 3 2 15 2 15 13 56 44 10 12 57 45 10 12 57 45 1 3 13 3 3 2 15 2 1 3 13 3 11 9 58 46 0 8 59 47 0 8 59 47 9 0 21 0 1 3 13 3 16 4 28 4 4 11 60 48 19 10 61 49 19 10 61 49 18 5 30 5 16 4 28 4 18 5 30 5 5 15 62 50 23 14 63 51 23 14 63 51 22 6 34 6 18 5 30 5 22 6 34 6 7 19 64 52 21 18 65 53 21 18 65 53 20 7 32 7 22 6 34 6 20 7 32 7 6 23 66 54 17 22 67 55 17 22 67 55 16 4 28 4 20 7 32 7 11 9 23 9 10 12 68 56 5 15 69 57 5 15 69 57 19 10 31 10 11 9 23 9 4 11 70 58 17 22 29 22 8 21 20 21 8 21 20 21 0 8 71 59 4 11 70 58 15 13 27 13 14 16 72 60 7 19 73 61 7 19 73 61 23 14 35 14 15 13 27 13 12 17 24 17 2 20 74 62 6 23 75 63 6 23 75 63 21 18 33 18 12 17 24 17</p>
|
||||
</triangles>
|
||||
</mesh>
|
||||
</geometry>
|
||||
</library_geometries>
|
||||
<library_lights>
|
||||
<light id="EnvironmentAmbientLight" name="EnvironmentAmbientLight">
|
||||
<technique_common>
|
||||
<ambient>
|
||||
<color>0 0 0</color>
|
||||
</ambient>
|
||||
</technique_common>
|
||||
</light>
|
||||
</library_lights>
|
||||
<library_visual_scenes>
|
||||
<visual_scene id="MaxScene">
|
||||
<node name="EnvironmentAmbientLight">
|
||||
<instance_light url="#EnvironmentAmbientLight"/>
|
||||
</node>
|
||||
<node id="node-FogCube1" name="FogCube1">
|
||||
<instance_geometry url="#geom-FogCube1">
|
||||
<bind_material>
|
||||
<technique_common>
|
||||
<instance_material symbol="NoMat" target="#NoMat-material"/>
|
||||
</technique_common>
|
||||
</bind_material>
|
||||
</instance_geometry>
|
||||
<extra>
|
||||
<technique profile="OpenCOLLADA">
|
||||
<cast_shadows>1</cast_shadows>
|
||||
<primary_visibility>1</primary_visibility>
|
||||
<receive_shadows>1</receive_shadows>
|
||||
<secondary_visibility>1</secondary_visibility>
|
||||
</technique>
|
||||
</extra>
|
||||
</node>
|
||||
</visual_scene>
|
||||
</library_visual_scenes>
|
||||
<scene>
|
||||
<instance_visual_scene url="#MaxScene"/>
|
||||
</scene>
|
||||
</COLLADA>
|
||||
8
Templates/Full/game/art/environment/Fog_Cube.cs
Normal file
8
Templates/Full/game/art/environment/Fog_Cube.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
singleton TSShapeConstructor(Fog_CubeDAE)
|
||||
{
|
||||
baseShape = "./Fog_Cube.DAE";
|
||||
lodType = "TrailingNumber";
|
||||
neverImport = "env*";
|
||||
loadLights = "0";
|
||||
};
|
||||
423
Templates/Full/game/art/environment/LightVolume_Sphere.DAE
Normal file
423
Templates/Full/game/art/environment/LightVolume_Sphere.DAE
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
singleton TSShapeConstructor(LightVolume_SphereDAE)
|
||||
{
|
||||
baseShape = "./LightVolume_Sphere.DAE";
|
||||
lodType = "TrailingNumber";
|
||||
neverImport = "env*";
|
||||
loadLights = "0";
|
||||
};
|
||||
BIN
Templates/Full/game/art/environment/LightVolume_Sphere.dts
Normal file
BIN
Templates/Full/game/art/environment/LightVolume_Sphere.dts
Normal file
Binary file not shown.
|
|
@ -106,3 +106,79 @@ singleton PostEffect( GlowPostFx )
|
|||
target = "$backBuffer";
|
||||
};
|
||||
};
|
||||
|
||||
singleton ShaderData( PFX_VolFogGlowBlurVertShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/glowBlurV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/VolFogGlowP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/glowBlurV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/gl/VolFogGlowP.glsl";
|
||||
|
||||
defines = "BLUR_DIR=float2(0.0,1.0)";
|
||||
samplerNames[0] = "$diffuseMap";
|
||||
pixVersion = 2.0;
|
||||
};
|
||||
singleton ShaderData( PFX_VolFogGlowBlurHorzShader : PFX_VolFogGlowBlurVertShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/postFx/glowBlurV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/postFx/VolFogGlowP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/postFx/gl/glowBlurV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/postFx/gl/VolFogGlowP.glsl";
|
||||
|
||||
defines = "BLUR_DIR=float2(1.0,0.0)";
|
||||
};
|
||||
|
||||
$VolFogGlowPostFx::glowStrength = 0.3;
|
||||
|
||||
singleton PostEffect( VolFogGlowPostFx )
|
||||
{
|
||||
// Do not allow the glow effect to work in reflection
|
||||
// passes by default so we don't do the extra drawing.
|
||||
allowReflectPass = false;
|
||||
renderTime = "PFXAfterBin";
|
||||
renderBin = "FogBin";
|
||||
renderPriority = 1;
|
||||
// First we down sample the glow buffer.
|
||||
shader = PFX_PassthruShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
texture[0] = "$backbuffer";
|
||||
target = "$outTex";
|
||||
targetScale = "0.5 0.5";
|
||||
isEnabled = true;
|
||||
// Blur vertically
|
||||
new PostEffect()
|
||||
{
|
||||
shader = PFX_VolFogGlowBlurVertShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
internalName = "vert";
|
||||
texture[0] = "$inTex";
|
||||
target = "$outTex";
|
||||
};
|
||||
// Blur horizontally
|
||||
new PostEffect()
|
||||
{
|
||||
shader = PFX_VolFogGlowBlurHorzShader;
|
||||
stateBlock = PFX_DefaultStateBlock;
|
||||
internalName = "hor";
|
||||
texture[0] = "$inTex";
|
||||
target = "$outTex";
|
||||
};
|
||||
// Upsample and combine with the back buffer.
|
||||
new PostEffect()
|
||||
{
|
||||
shader = PFX_PassthruShader;
|
||||
stateBlock = PFX_GlowCombineStateBlock;
|
||||
texture[0] = "$inTex";
|
||||
target = "$backBuffer";
|
||||
};
|
||||
};
|
||||
|
||||
function VolFogGlowPostFx::setShaderConsts( %this )
|
||||
{
|
||||
%vp=%this-->vert;
|
||||
%vp.setShaderConst( "$strength", $VolFogGlowPostFx::glowStrength );
|
||||
%vp=%this-->hor;
|
||||
%vp.setShaderConst( "$strength", $VolFogGlowPostFx::glowStrength );
|
||||
}
|
||||
|
|
@ -70,6 +70,7 @@ function PostFXManager::settingsSetEnabled(%this, %bEnablePostFX)
|
|||
|
||||
postVerbose("% - PostFX Manager - PostFX disabled");
|
||||
}
|
||||
VolFogGlowPostFx.disable();
|
||||
}
|
||||
|
||||
function PostFXManager::settingsEffectSetEnabled(%this, %sName, %bEnable)
|
||||
|
|
|
|||
|
|
@ -75,6 +75,8 @@ function initRenderManager()
|
|||
DiffuseRenderPassManager.addManager( new RenderParticleMgr() { renderOrder = 1.35; processAddOrder = 1.35; } );
|
||||
DiffuseRenderPassManager.addManager( new RenderTranslucentMgr() { renderOrder = 1.4; processAddOrder = 1.4; } );
|
||||
|
||||
DiffuseRenderPassManager.addManager(new RenderObjectMgr(FogBin){ bintype = "ObjectVolumetricFog"; renderOrder = 1.45; processAddOrder = 1.45; } );
|
||||
|
||||
// Note that the GlowPostFx is triggered after this bin.
|
||||
DiffuseRenderPassManager.addManager( new RenderGlowMgr(GlowBin) { renderOrder = 1.5; processAddOrder = 1.5; } );
|
||||
|
||||
|
|
|
|||
|
|
@ -101,4 +101,40 @@ new ShaderData( fxFoliageReplicatorShader )
|
|||
samplerNames[1] = "$alphaMap";
|
||||
|
||||
pixVersion = 1.4;
|
||||
};
|
||||
|
||||
singleton ShaderData( VolumetricFogPrePassShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/VolumetricFog/VFogPreV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/VolumetricFog/VFogPreP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/VolumetricFog/gl/VFogPreV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/VolumetricFog/gl/VFogPreP.glsl";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
singleton ShaderData( VolumetricFogShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/VolumetricFog/VFogV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/VolumetricFog/VFogP.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/VolumetricFog/gl/VFogV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/VolumetricFog/gl/VFogP.glsl";
|
||||
|
||||
samplerNames[0] = "$prepassTex";
|
||||
samplerNames[1] = "$depthBuffer";
|
||||
samplerNames[2] = "$frontBuffer";
|
||||
samplerNames[3] = "$density";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
singleton ShaderData( VolumetricFogReflectionShader )
|
||||
{
|
||||
DXVertexShaderFile = "shaders/common/VolumetricFog/VFogPreV.hlsl";
|
||||
DXPixelShaderFile = "shaders/common/VolumetricFog/VFogRefl.hlsl";
|
||||
|
||||
OGLVertexShaderFile = "shaders/common/VolumetricFog/gl/VFogPreV.glsl";
|
||||
OGLPixelShaderFile = "shaders/common/VolumetricFog/gl/VFogRefl.glsl";
|
||||
|
||||
pixVersion = 3.0;
|
||||
};
|
||||
106
Templates/Full/game/scripts/server/VolumetricFog.cs
Normal file
106
Templates/Full/game/scripts/server/VolumetricFog.cs
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function VolumetricFog::onEnterFog(%this,%obj)
|
||||
{
|
||||
// This method is called whenever the control object (Camera or Player)
|
||||
// %obj enters the fog area.
|
||||
|
||||
// echo("Control Object " @ %obj @ " enters fog " @ %this);
|
||||
}
|
||||
|
||||
function VolumetricFog::onLeaveFog(%this,%obj)
|
||||
{
|
||||
// This method is called whenever the control object (Camera or Player)
|
||||
// %obj leaves the fog area.
|
||||
|
||||
// echo("Control Object " @ %obj @ " left fog " @ %this);
|
||||
}
|
||||
|
||||
function VolumetricFog::Dissolve(%this,%speed,%delete)
|
||||
{
|
||||
// This method dissolves the fog at speed milliseconds
|
||||
%this.isBuilding = true;
|
||||
if (%this.FogDensity > 0)
|
||||
{
|
||||
%this.setFogDensity(%this.FogDensity - 0.005);
|
||||
%this.schedule(%speed,Dissolve,%speed,%delete);
|
||||
}
|
||||
else
|
||||
{
|
||||
%this.isBuilding = false;
|
||||
%this.SetFogDensity(0.0);
|
||||
if (%delete !$= "" && %delete !$="0" && %delete !$="false")
|
||||
%this.schedule(250,delete);
|
||||
}
|
||||
}
|
||||
|
||||
function VolumetricFog::Thicken(%this,%speed, %end_density)
|
||||
{
|
||||
// This method thickens the fog at speed milliseconds to a density of %end_density
|
||||
|
||||
%this.isBuilding = true;
|
||||
if (%this.FogDensity + 0.005 < %end_density)
|
||||
{
|
||||
%this.setFogDensity(%this.FogDensity + 0.005);
|
||||
%this.schedule(%speed,Thicken,%speed, %end_density);
|
||||
}
|
||||
else
|
||||
{
|
||||
%this.setFogDensity(%end_density);
|
||||
%this.isBuilding = false;
|
||||
}
|
||||
}
|
||||
|
||||
function GenerateFog(%pos,%scale,%color,%density)
|
||||
{
|
||||
// This function can be used to generate some fog caused by massive gunfire etc.
|
||||
// Change shape and modulation data to your likings.
|
||||
|
||||
%fog=new VolumetricFog() {
|
||||
shapeName = "art/environment/Fog_Sphere.dts";
|
||||
fogColor = %color;
|
||||
fogDensity = "0.0";
|
||||
ignoreWater = "0";
|
||||
MinSize = "250";
|
||||
FadeSize = "750";
|
||||
texture = "art/environment/FogMod_heavy.dds";
|
||||
tiles = "1";
|
||||
modStrength = "0.2";
|
||||
PrimSpeed = "-0.01 0.04";
|
||||
SecSpeed = "0.02 0.02";
|
||||
position = %pos;
|
||||
rotation = "0 0 1 20.354";
|
||||
scale = %scale;
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "1";
|
||||
};
|
||||
|
||||
if (isObject(%fog))
|
||||
{
|
||||
MissionCleanup.add(%fog);
|
||||
|
||||
%fog.Thicken(500,%density);
|
||||
}
|
||||
|
||||
return %fog;
|
||||
}
|
||||
|
|
@ -24,6 +24,7 @@
|
|||
// a server is constructed.
|
||||
exec("./camera.cs");
|
||||
exec("./triggers.cs");
|
||||
exec("./VolumetricFog.cs");
|
||||
exec("./inventory.cs");
|
||||
exec("./shapeBase.cs");
|
||||
exec("./item.cs");
|
||||
|
|
|
|||
87
Templates/Full/game/shaders/common/VolumetricFog/VFogP.hlsl
Normal file
87
Templates/Full/game/shaders/common/VolumetricFog/VFogP.hlsl
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog final pixel shader V2.00
|
||||
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
#include "../torque.hlsl"
|
||||
|
||||
uniform sampler2D prepassTex : register(S0);
|
||||
uniform sampler2D depthBuffer : register(S1);
|
||||
uniform sampler2D frontBuffer : register(S2);
|
||||
uniform sampler2D density : register(S3);
|
||||
|
||||
uniform float accumTime;
|
||||
uniform float4 fogColor;
|
||||
uniform float fogDensity;
|
||||
uniform float preBias;
|
||||
uniform float textured;
|
||||
uniform float modstrength;
|
||||
uniform float4 modspeed;//xy speed layer 1, zw speed layer 2
|
||||
uniform float2 viewpoint;
|
||||
uniform float2 texscale;
|
||||
uniform float3 ambientColor;
|
||||
uniform float numtiles;
|
||||
uniform float fadesize;
|
||||
uniform float2 PixelSize;
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 htpos : TEXCOORD0;
|
||||
float2 uv0 : TEXCOORD1;
|
||||
};
|
||||
|
||||
float4 main( ConnectData IN ) : COLOR0
|
||||
{
|
||||
float2 uvscreen=((IN.htpos.xy/IN.htpos.w) + 1.0 ) / 2.0;
|
||||
uvscreen.y = 1.0 - uvscreen.y;
|
||||
|
||||
float obj_test = prepassUncondition( prepassTex, uvscreen).w * preBias;
|
||||
float depth = tex2D(depthBuffer,uvscreen).r;
|
||||
float front = tex2D(frontBuffer,uvscreen).r;
|
||||
|
||||
if (depth <= front)
|
||||
return float4(0,0,0,0);
|
||||
else if ( obj_test < depth )
|
||||
depth = obj_test;
|
||||
if ( front >= 0.0)
|
||||
depth -= front;
|
||||
|
||||
float diff = 1.0;
|
||||
float3 col = fogColor.rgb;
|
||||
if (textured != 0.0)
|
||||
{
|
||||
float2 offset = viewpoint + ((-0.5 + (texscale * uvscreen)) * numtiles);
|
||||
|
||||
float2 mod1 = tex2D(density,(offset + (modspeed.xy*accumTime))).rg;
|
||||
float2 mod2= tex2D(density,(offset + (modspeed.zw*accumTime))).rg;
|
||||
diff = (mod2.r + mod1.r) * modstrength;
|
||||
col *= (2.0 - ((mod1.g + mod2.g) * fadesize))/2.0;
|
||||
}
|
||||
|
||||
col *= ambientColor;
|
||||
|
||||
float4 resultColor = float4(col, 1.0 - saturate(exp(-fogDensity * depth * diff * fadesize)));
|
||||
|
||||
return hdrEncode(resultColor);
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog prepass pixel shader V1.00
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 pos : TEXCOORD0;
|
||||
};
|
||||
|
||||
float4 main( ConnectData IN ) : COLOR0
|
||||
{
|
||||
float OUT;
|
||||
|
||||
clip( IN.pos.w );
|
||||
OUT = IN.pos.w;
|
||||
|
||||
return float4(OUT,0,0,1);
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog prepass vertex shader V1.00
|
||||
|
||||
#include "shaders/common/hlslstructs.h"
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 pos : TEXCOORD0;
|
||||
};
|
||||
|
||||
uniform float4x4 modelView;
|
||||
|
||||
ConnectData main( VertexIn_P IN)
|
||||
{
|
||||
ConnectData OUT;
|
||||
|
||||
float4 inPos = IN.pos;
|
||||
inPos.w = 1.0;
|
||||
|
||||
OUT.hpos = mul( modelView, inPos );
|
||||
OUT.pos = OUT.hpos;
|
||||
|
||||
return OUT;
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog Reflection pixel shader V1.00
|
||||
uniform float4 fogColor;
|
||||
uniform float fogDensity;
|
||||
uniform float reflStrength;
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 pos : TEXCOORD0;
|
||||
};
|
||||
|
||||
float4 main( ConnectData IN ) : COLOR0
|
||||
{
|
||||
return float4(fogColor.rgb,saturate(fogDensity*reflStrength));
|
||||
}
|
||||
45
Templates/Full/game/shaders/common/VolumetricFog/VFogV.hlsl
Normal file
45
Templates/Full/game/shaders/common/VolumetricFog/VFogV.hlsl
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog final vertex shader V1.00
|
||||
|
||||
#include "shaders/common/hlslstructs.h"
|
||||
|
||||
struct ConnectData
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 htpos : TEXCOORD0;
|
||||
float2 uv0 : TEXCOORD1;
|
||||
};
|
||||
|
||||
uniform float4x4 modelView;
|
||||
|
||||
ConnectData main( VertexIn_PNT IN)
|
||||
{
|
||||
ConnectData OUT;
|
||||
|
||||
OUT.hpos = mul(modelView, IN.pos);
|
||||
OUT.htpos = OUT.hpos;
|
||||
OUT.uv0 = IN.uv0;
|
||||
|
||||
return OUT;
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
#include "shadergen:/autogenConditioners.h"
|
||||
#include "../../gl/torque.glsl"
|
||||
|
||||
uniform sampler2D prepassTex;
|
||||
uniform sampler2D depthBuffer;
|
||||
uniform sampler2D frontBuffer;
|
||||
uniform sampler2D density;
|
||||
|
||||
uniform float accumTime;
|
||||
uniform vec4 fogColor;
|
||||
uniform float fogDensity;
|
||||
uniform float preBias;
|
||||
uniform float textured;
|
||||
uniform float modstrength;
|
||||
uniform vec4 modspeed;//xy speed layer 1, zw speed layer 2
|
||||
uniform vec2 viewpoint;
|
||||
uniform vec2 texscale;
|
||||
uniform vec3 ambientColor;
|
||||
uniform float numtiles;
|
||||
uniform float fadesize;
|
||||
uniform vec2 PixelSize;
|
||||
|
||||
in vec4 _hpos;
|
||||
#define IN_hpos _hpos
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uvscreen=((IN_hpos.xy/IN_hpos.w) + 1.0 ) / 2.0;
|
||||
uvscreen.y = 1.0 - uvscreen.y;
|
||||
|
||||
float obj_test = prepassUncondition( prepassTex, uvscreen).w * preBias;
|
||||
float depth = tex2D(depthBuffer,uvscreen).r;
|
||||
float front = tex2D(frontBuffer,uvscreen).r;
|
||||
|
||||
if (depth <= front)
|
||||
{
|
||||
OUT_col = vec4(0,0,0,0);
|
||||
return;
|
||||
}
|
||||
|
||||
else if ( obj_test < depth )
|
||||
depth = obj_test;
|
||||
if ( front >= 0.0)
|
||||
depth -= front;
|
||||
|
||||
float diff = 1.0;
|
||||
vec3 col = fogColor.rgb;
|
||||
if (textured != 0.0)
|
||||
{
|
||||
vec2 offset = viewpoint + ((-0.5 + (texscale * uvscreen)) * numtiles);
|
||||
|
||||
vec2 mod1 = tex2D(density,(offset + (modspeed.xy*accumTime))).rg;
|
||||
vec2 mod2= tex2D(density,(offset + (modspeed.zw*accumTime))).rg;
|
||||
diff = (mod2.r + mod1.r) * modstrength;
|
||||
col *= (2.0 - ((mod1.g + mod2.g) * fadesize))/2.0;
|
||||
}
|
||||
|
||||
col *= ambientColor;
|
||||
|
||||
vec4 returnColor = vec4(col, 1.0 - saturate(exp(-fogDensity * depth * diff * fadesize)));
|
||||
|
||||
OUT_col = hdrEncode(returnColor);
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
|
||||
in vec4 _hpos;
|
||||
#define IN_hpos _hpos
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
float OUT;
|
||||
clip( IN_hpos.w );
|
||||
OUT = IN_hpos.w;
|
||||
|
||||
OUT_col = vec4(OUT,0,0,1);
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
|
||||
in vec4 vPosition;
|
||||
#define IN_position vPosition
|
||||
|
||||
out vec4 _hpos;
|
||||
#define OUT_hpos _hpos
|
||||
|
||||
uniform mat4 modelView;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 inPos = IN_position;
|
||||
inPos.w = 1.0;
|
||||
|
||||
OUT_hpos = tMul( modelView, inPos );
|
||||
|
||||
gl_Position = OUT_hpos;
|
||||
correctSSP(gl_Position);
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
|
||||
uniform vec4 fogColor;
|
||||
uniform float fogDensity;
|
||||
uniform float reflStrength;
|
||||
out vec4 OUT_col;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_col = vec4(fogColor.rgb,saturate(fogDensity*reflStrength));
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2012 GarageGames, LLC
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "../../gl/hlslCompat.glsl"
|
||||
|
||||
in vec4 vPosition;
|
||||
#define IN_position vPosition
|
||||
|
||||
out vec4 _hpos;
|
||||
#define OUT_hpos _hpos
|
||||
|
||||
uniform mat4 modelView;
|
||||
|
||||
void main()
|
||||
{
|
||||
OUT_hpos = tMul(modelView, IN_position);
|
||||
gl_Position = OUT_hpos;
|
||||
correctSSP(gl_Position);
|
||||
}
|
||||
74
Templates/Full/game/shaders/common/postFx/VolFogGlowP.hlsl
Normal file
74
Templates/Full/game/shaders/common/postFx/VolFogGlowP.hlsl
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2014 R.G.S. - Richards Game Studio, the Netherlands
|
||||
// http://www.richardsgamestudio.com/
|
||||
//
|
||||
// If you find this code useful or you are feeling particularly generous I
|
||||
// would ask that you please go to http://www.richardsgamestudio.com/ then
|
||||
// choose Donations from the menu on the left side and make a donation to
|
||||
// Richards Game Studio. It will be highly appreciated.
|
||||
//
|
||||
// The MIT License:
|
||||
//
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog Glow postFx pixel shader V1.00
|
||||
|
||||
#include "./postFx.hlsl"
|
||||
|
||||
uniform sampler2D diffuseMap : register(S0);
|
||||
uniform float strength;
|
||||
|
||||
struct VertToPix
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
|
||||
float2 uv0 : TEXCOORD0;
|
||||
float2 uv1 : TEXCOORD1;
|
||||
float2 uv2 : TEXCOORD2;
|
||||
float2 uv3 : TEXCOORD3;
|
||||
|
||||
float2 uv4 : TEXCOORD4;
|
||||
float2 uv5 : TEXCOORD5;
|
||||
float2 uv6 : TEXCOORD6;
|
||||
float2 uv7 : TEXCOORD7;
|
||||
};
|
||||
|
||||
float4 main( VertToPix IN ) : COLOR
|
||||
{
|
||||
float4 kernel = float4( 0.175, 0.275, 0.375, 0.475 ) * strength;
|
||||
|
||||
float4 OUT = 0;
|
||||
OUT += tex2D( diffuseMap, IN.uv0 ) * kernel.x;
|
||||
OUT += tex2D( diffuseMap, IN.uv1 ) * kernel.y;
|
||||
OUT += tex2D( diffuseMap, IN.uv2 ) * kernel.z;
|
||||
OUT += tex2D( diffuseMap, IN.uv3 ) * kernel.w;
|
||||
|
||||
OUT += tex2D( diffuseMap, IN.uv4 ) * kernel.x;
|
||||
OUT += tex2D( diffuseMap, IN.uv5 ) * kernel.y;
|
||||
OUT += tex2D( diffuseMap, IN.uv6 ) * kernel.z;
|
||||
OUT += tex2D( diffuseMap, IN.uv7 ) * kernel.w;
|
||||
|
||||
// Calculate a lumenance value in the alpha so we
|
||||
// can use alpha test to save fillrate.
|
||||
float3 rgb2lum = float3( 0.30, 0.59, 0.11 );
|
||||
OUT.a = dot( OUT.rgb, rgb2lum );
|
||||
|
||||
return OUT;
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (c) 2014 R.G.S. - Richards Game Studio, the Netherlands
|
||||
// http://www.richardsgamestudio.com/
|
||||
//
|
||||
// If you find this code useful or you are feeling particularly generous I
|
||||
// would ask that you please go to http://www.richardsgamestudio.com/ then
|
||||
// choose Donations from the menu on the left side and make a donation to
|
||||
// Richards Game Studio. It will be highly appreciated.
|
||||
//
|
||||
// The MIT License:
|
||||
//
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Volumetric Fog Glow postFx pixel shader V1.00
|
||||
|
||||
uniform sampler2D diffuseMap;
|
||||
uniform float strength;
|
||||
|
||||
out vec4 OUT_col;
|
||||
|
||||
in vec2 uv0;
|
||||
in vec2 uv1;
|
||||
in vec2 uv2;
|
||||
in vec2 uv3;
|
||||
|
||||
in vec2 uv4;
|
||||
in vec2 uv5;
|
||||
in vec2 uv6;
|
||||
in vec2 uv7;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 kernel = vec4( 0.175, 0.275, 0.375, 0.475 ) * strength;
|
||||
|
||||
OUT_col = vec4(0);
|
||||
OUT_col += texture( diffuseMap, uv0 ) * kernel.x;
|
||||
OUT_col += texture( diffuseMap, uv1 ) * kernel.y;
|
||||
OUT_col += texture( diffuseMap, uv2 ) * kernel.z;
|
||||
OUT_col += texture( diffuseMap, uv3 ) * kernel.w;
|
||||
|
||||
OUT_col += texture( diffuseMap, uv4 ) * kernel.x;
|
||||
OUT_col += texture( diffuseMap, uv5 ) * kernel.y;
|
||||
OUT_col += texture( diffuseMap, uv6 ) * kernel.z;
|
||||
OUT_col += texture( diffuseMap, uv7 ) * kernel.w;
|
||||
|
||||
// Calculate a lumenance value in the alpha so we
|
||||
// can use alpha test to save fillrate.
|
||||
vec3 rgb2lum = vec3( 0.30, 0.59, 0.11 );
|
||||
OUT_col.a = dot( OUT_col.rgb, rgb2lum );
|
||||
}
|
||||
BIN
Templates/Full/game/tools/classIcons/VolumetricFog.png
Normal file
BIN
Templates/Full/game/tools/classIcons/VolumetricFog.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
|
|
@ -980,7 +980,19 @@ function ObjectBuilderGui::buildObserverDropPoint(%this)
|
|||
//------------------------------------------------------------------------------
|
||||
// System
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
function ObjectBuilderGui::buildVolumetricFog(%this)
|
||||
{
|
||||
// Change this if you want to default to another Folder
|
||||
// Otherwise every time you want to add a Fog you will go this.
|
||||
%defShape = "/art/environment/Fog_Cube.dts";
|
||||
%this.lastPath=getMainDotCsDir() @ %defShape;
|
||||
OBObjectName.setValue( "" );
|
||||
%this.objectClassName = "VolumetricFog";
|
||||
%this.addField( "shapeName", "TypeFile", "Shape (Fog volume)", "", "*.dts;*.dae");
|
||||
%this.addField("Scale", "TypePoint3", "Scale", "1 1 1");
|
||||
%this.addField("FogColor", "TypeColorI", "FogColor", "200 200 200 255");
|
||||
%this.process();
|
||||
}
|
||||
function ObjectBuilderGui::buildPhysicsEntity(%this)
|
||||
{
|
||||
%this.objectClassName = "PhysicsEntity";
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ function EWCreatorWindow::init( %this )
|
|||
%this.registerMissionObject( "SFXEmitter", "Sound Emitter" );
|
||||
%this.registerMissionObject( "Precipitation" );
|
||||
%this.registerMissionObject( "ParticleEmitterNode", "Particle Emitter" );
|
||||
%this.registerMissionObject( "VolumetricFog", "Volumetric Fog" );
|
||||
%this.registerMissionObject( "RibbonNode", "Ribbon" );
|
||||
|
||||
// Legacy features. Users should use Ground Cover and the Forest Editor.
|
||||
|
|
|
|||
Loading…
Reference in a new issue