From a552471e4e2150b1eea217cbdd9bc4ba48adfc74 Mon Sep 17 00:00:00 2001 From: Areloch Date: Tue, 4 Jun 2019 00:21:52 -0500 Subject: [PATCH] Reorg of the probe initialization/update code to streamline parts of it, and make it flow more obviously Added some initial asset stuffs for Das Boot for building out a better testing level. --- .../T3D/lighting/boxEnvironmentProbe.cpp | 26 +- .../source/T3D/lighting/boxEnvironmentProbe.h | 5 +- .../source/T3D/lighting/reflectionProbe.cpp | 383 ++++++++++-------- Engine/source/T3D/lighting/reflectionProbe.h | 19 +- Engine/source/T3D/lighting/skylight.cpp | 42 +- Engine/source/T3D/lighting/skylight.h | 5 +- .../T3D/lighting/sphereEnvironmentProbe.cpp | 21 +- .../T3D/lighting/sphereEnvironmentProbe.h | 5 +- .../source/renderInstance/renderProbeMgr.cpp | 107 +++-- Engine/source/renderInstance/renderProbeMgr.h | 62 +-- .../data/shaderCache/76d48535f69be600_P.hlsl | 94 ----- .../data/shaderCache/76d48535f69be600_V.hlsl | 74 ---- .../data/shaderCache/7a74ac0558b62462_P.hlsl | 52 --- .../data/shaderCache/7a74ac0558b62462_V.hlsl | 51 --- .../data/shaderCache/8625023c97ea6cf9_P.hlsl | 72 ---- .../data/shaderCache/8625023c97ea6cf9_V.hlsl | 59 --- .../data/shaderCache/a1a7a101cca9ce72_P.hlsl | 54 --- .../data/shaderCache/a1a7a101cca9ce72_V.hlsl | 58 --- .../data/shaderCache/autogenConditioners.h | 36 -- .../data/shaderCache/b524839793fade4e_P.hlsl | 80 ---- .../data/shaderCache/b524839793fade4e_V.hlsl | 57 --- .../data/shaderCache/c5e4ec9bb49846a9_P.hlsl | 87 ---- .../data/shaderCache/c5e4ec9bb49846a9_V.hlsl | 70 ---- .../data/shaderCache/c74b275969540357_P.hlsl | 47 --- .../data/shaderCache/c74b275969540357_V.hlsl | 61 --- .../data/shaderCache/d653a08573e79020_P.hlsl | 52 --- .../data/shaderCache/d653a08573e79020_V.hlsl | 51 --- .../data/shaderCache/efef832dc37c8755_P.hlsl | 69 ---- .../data/shaderCache/efef832dc37c8755_V.hlsl | 63 --- .../data/shaderCache/f04ad263e891c04c_P.hlsl | 52 --- .../data/shaderCache/f04ad263e891c04c_V.hlsl | 67 --- .../data/shaderCache/fd1301c841a0c80b_P.hlsl | 84 ---- .../data/shaderCache/fd1301c841a0c80b_V.hlsl | 73 ---- 33 files changed, 317 insertions(+), 1821 deletions(-) delete mode 100644 Templates/BaseGame/game/data/shaderCache/76d48535f69be600_P.hlsl delete mode 100644 Templates/BaseGame/game/data/shaderCache/76d48535f69be600_V.hlsl delete mode 100644 Templates/BaseGame/game/data/shaderCache/7a74ac0558b62462_P.hlsl delete mode 100644 Templates/BaseGame/game/data/shaderCache/7a74ac0558b62462_V.hlsl delete mode 100644 Templates/BaseGame/game/data/shaderCache/8625023c97ea6cf9_P.hlsl delete mode 100644 Templates/BaseGame/game/data/shaderCache/8625023c97ea6cf9_V.hlsl delete mode 100644 Templates/BaseGame/game/data/shaderCache/a1a7a101cca9ce72_P.hlsl delete mode 100644 Templates/BaseGame/game/data/shaderCache/a1a7a101cca9ce72_V.hlsl delete mode 100644 Templates/BaseGame/game/data/shaderCache/autogenConditioners.h delete mode 100644 Templates/BaseGame/game/data/shaderCache/b524839793fade4e_P.hlsl delete mode 100644 Templates/BaseGame/game/data/shaderCache/b524839793fade4e_V.hlsl delete mode 100644 Templates/BaseGame/game/data/shaderCache/c5e4ec9bb49846a9_P.hlsl delete mode 100644 Templates/BaseGame/game/data/shaderCache/c5e4ec9bb49846a9_V.hlsl delete mode 100644 Templates/BaseGame/game/data/shaderCache/c74b275969540357_P.hlsl delete mode 100644 Templates/BaseGame/game/data/shaderCache/c74b275969540357_V.hlsl delete mode 100644 Templates/BaseGame/game/data/shaderCache/d653a08573e79020_P.hlsl delete mode 100644 Templates/BaseGame/game/data/shaderCache/d653a08573e79020_V.hlsl delete mode 100644 Templates/BaseGame/game/data/shaderCache/efef832dc37c8755_P.hlsl delete mode 100644 Templates/BaseGame/game/data/shaderCache/efef832dc37c8755_V.hlsl delete mode 100644 Templates/BaseGame/game/data/shaderCache/f04ad263e891c04c_P.hlsl delete mode 100644 Templates/BaseGame/game/data/shaderCache/f04ad263e891c04c_V.hlsl delete mode 100644 Templates/BaseGame/game/data/shaderCache/fd1301c841a0c80b_P.hlsl delete mode 100644 Templates/BaseGame/game/data/shaderCache/fd1301c841a0c80b_V.hlsl diff --git a/Engine/source/T3D/lighting/boxEnvironmentProbe.cpp b/Engine/source/T3D/lighting/boxEnvironmentProbe.cpp index 701fc9d2c..2b9ece957 100644 --- a/Engine/source/T3D/lighting/boxEnvironmentProbe.cpp +++ b/Engine/source/T3D/lighting/boxEnvironmentProbe.cpp @@ -122,24 +122,12 @@ void BoxEnvironmentProbe::onRemove() Parent::onRemove(); } -void BoxEnvironmentProbe::setTransform(const MatrixF & mat) -{ - // Let SceneObject handle all of the matrix manipulation - Parent::setTransform(mat); - - mDirty = true; - - // Dirty our network mask so that the new transform gets - // transmitted to the client object - setMaskBits(TransformMask); -} - U32 BoxEnvironmentProbe::packUpdate(NetConnection *conn, U32 mask, BitStream *stream) { // Allow the Parent to get a crack at writing its info U32 retMask = Parent::packUpdate(conn, mask, stream); - if (stream->writeFlag(mask & UpdateMask)) + if (stream->writeFlag(mask & StaticDataMask)) { stream->write(mAtten); } @@ -152,7 +140,7 @@ void BoxEnvironmentProbe::unpackUpdate(NetConnection *conn, BitStream *stream) // Let the Parent read any info it sent Parent::unpackUpdate(conn, stream); - if (stream->readFlag()) // UpdateMask + if (stream->readFlag()) // StaticDataMask { stream->read(&mAtten); } @@ -164,17 +152,11 @@ void BoxEnvironmentProbe::unpackUpdate(NetConnection *conn, BitStream *stream) void BoxEnvironmentProbe::updateProbeParams() { - Parent::updateProbeParams(); - - mProbeInfo->mProbeShapeType = ProbeRenderInst::Box; + mProbeShapeType = ProbeRenderInst::Box; mProbeInfo->mAtten = mAtten; - - PROBEMGR->updateProbes(); - - updateCubemaps(); } void BoxEnvironmentProbe::setPreviewMatParameters(SceneRenderState* renderState, BaseMatInstance* mat) { Parent::setPreviewMatParameters(renderState, mat); -} \ No newline at end of file +} diff --git a/Engine/source/T3D/lighting/boxEnvironmentProbe.h b/Engine/source/T3D/lighting/boxEnvironmentProbe.h index c6d23cb48..b70bd4ee5 100644 --- a/Engine/source/T3D/lighting/boxEnvironmentProbe.h +++ b/Engine/source/T3D/lighting/boxEnvironmentProbe.h @@ -87,9 +87,6 @@ public: bool onAdd(); void onRemove(); - // Override this so that we can dirty the network flag when it is called - void setTransform(const MatrixF &mat); - // This function handles sending the relevant data from the server // object to the client object U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream); @@ -113,4 +110,4 @@ public: void setPreviewMatParameters(SceneRenderState* renderState, BaseMatInstance* mat); }; -#endif // BOX_ENVIRONMENT_PROBE_H \ No newline at end of file +#endif // BOX_ENVIRONMENT_PROBE_H diff --git a/Engine/source/T3D/lighting/reflectionProbe.cpp b/Engine/source/T3D/lighting/reflectionProbe.cpp index d60778fa8..b2f7d5900 100644 --- a/Engine/source/T3D/lighting/reflectionProbe.cpp +++ b/Engine/source/T3D/lighting/reflectionProbe.cpp @@ -104,6 +104,7 @@ ReflectionProbe::ReflectionProbe() mEnabled = true; mBake = false; mDirty = false; + mCubemapDirty = false; mRadius = 10; mObjScale = Point3F::One * 10; @@ -134,8 +135,6 @@ ReflectionProbe::ReflectionProbe() mProbeRefOffset = Point3F::Zero; mEditPosOffset = false; - mProbeInfoIdx = -1; - mCaptureMask = REFLECTION_PROBE_CAPTURE_TYPEMASK; } @@ -292,7 +291,9 @@ bool ReflectionProbe::onAdd() // Refresh this object's material (if any) if (isClientObject()) { - createGeometry(); + if (!createClientResources()) + return false; + updateProbeParams(); } @@ -305,8 +306,9 @@ void ReflectionProbe::onRemove() { if (isClientObject()) { - PROBEMGR->unregisterProbe(mProbeInfoIdx); + PROBEMGR->unregisterProbe(mProbeInfo->mProbeIdx); } + // Remove this object from the scene removeFromScene(); @@ -318,16 +320,19 @@ void ReflectionProbe::handleDeleteAction() //we're deleting it? //Then we need to clear out the processed cubemaps(if we have them) - String prefilPath = getPrefilterMapPath(); - if (Platform::isFile(prefilPath)) + if (mReflectionModeType != StaticCubemap) { - Platform::fileDelete(prefilPath); - } + String prefilPath = getPrefilterMapPath(); + if (Platform::isFile(prefilPath)) + { + Platform::fileDelete(prefilPath); + } - String irrPath = getIrradianceMapPath(); - if (Platform::isFile(irrPath)) - { - Platform::fileDelete(irrPath); + String irrPath = getIrradianceMapPath(); + if (Platform::isFile(irrPath)) + { + Platform::fileDelete(irrPath); + } } Parent::handleDeleteAction(); @@ -406,19 +411,13 @@ U32 ReflectionProbe::packUpdate(NetConnection *conn, U32 mask, BitStream *stream mathWrite(*stream, mProbeRefScale); } - if (stream->writeFlag(mask & ShapeTypeMask)) + if (stream->writeFlag(mask & StaticDataMask)) { stream->write((U32)mProbeShapeType); - } - - if (stream->writeFlag(mask & UpdateMask)) - { stream->write(mRadius); - } - - if (stream->writeFlag(mask & BakeInfoMask)) - { stream->write(mProbeUniqueID); + stream->write((U32)mReflectionModeType); + stream->write(mCubemapName); } if (stream->writeFlag(mask & EnabledMask)) @@ -426,16 +425,6 @@ U32 ReflectionProbe::packUpdate(NetConnection *conn, U32 mask, BitStream *stream stream->writeFlag(mEnabled); } - if (stream->writeFlag(mask & ModeMask)) - { - stream->write((U32)mReflectionModeType); - } - - if (stream->writeFlag(mask & CubemapMask)) - { - stream->write(mCubemapName); - } - return retMask; } @@ -460,28 +449,28 @@ void ReflectionProbe::unpackUpdate(NetConnection *conn, BitStream *stream) mDirty = true; } - if (stream->readFlag()) // ShapeTypeMask + if (stream->readFlag()) // StaticDataMask { U32 shapeType = ProbeRenderInst::Sphere; stream->read(&shapeType); mProbeShapeType = (ProbeRenderInst::ProbeShapeType)shapeType; - createGeometry(); - mDirty = true; - } - - if (stream->readFlag()) // UpdateMask - { stream->read(&mRadius); - mDirty = true; - } - - if (stream->readFlag()) // BakeInfoMask - { stream->read(&mProbeUniqueID); + U32 oldReflectModeType = mReflectionModeType; + U32 reflectModeType = BakedCubemap; + stream->read(&reflectModeType); + mReflectionModeType = (ReflectionModeType)reflectModeType; + + String oldCubemapName = mCubemapName; + stream->read(&mCubemapName); + + if(oldReflectModeType != mReflectionModeType || oldCubemapName != mCubemapName) + mCubemapDirty = true; + mDirty = true; } @@ -492,28 +481,6 @@ void ReflectionProbe::unpackUpdate(NetConnection *conn, BitStream *stream) mDirty = true; } - if (stream->readFlag()) // ModeMask - { - U32 reflectModeType = BakedCubemap; - stream->read(&reflectModeType); - mReflectionModeType = (ReflectionModeType)reflectModeType; - - mDirty = true; - } - - if (stream->readFlag()) // CubemapMask - { - String newCubemapName; - stream->read(&mCubemapName); - - //if (newCubemapName != mCubemapName) - { - processStaticCubemap(); - } - - mDirty = true; - } - if (mDirty) { updateProbeParams(); @@ -525,101 +492,80 @@ void ReflectionProbe::unpackUpdate(NetConnection *conn, BitStream *stream) //----------------------------------------------------------------------------- void ReflectionProbe::updateProbeParams() { - if (mProbeInfo == nullptr) - { - mProbeInfo = new ProbeRenderInst(); - mProbeInfoIdx = ProbeRenderInst::all.size() - 1; - mProbeInfo->mIsEnabled = false; - - //PROBEMGR->registerProbe(mProbeInfoIdx); - } + if (!mProbeInfo) + return; mProbeInfo->mProbeShapeType = mProbeShapeType; - MatrixF transform = getTransform(); - mProbeInfo->mPosition = getPosition(); - if (mProbeShapeType == ProbeRenderInst::Sphere) mObjScale.set(mRadius, mRadius, mRadius); - transform.scale(getScale()); - mProbeInfo->mTransform = transform.inverse(); + Box3F bounds; + + if (mProbeShapeType == ProbeRenderInst::Skylight) + { + mProbeInfo->mPosition = Point3F::Zero; + mProbeInfo->mTransform = MatrixF::Identity; + + mProbeInfo->mIsSkylight = true; + + F32 visDist = gClientSceneGraph->getVisibleDistance(); + Box3F skylightBounds = Box3F(visDist * 2); + + skylightBounds.setCenter(Point3F::Zero); + + bounds = skylightBounds; + + setGlobalBounds(); + + mProbeInfo->mScore = -1.0f; + } + else + { + MatrixF transform = getTransform(); + mProbeInfo->mPosition = getPosition(); + + transform.scale(getScale()); + mProbeInfo->mTransform = transform.inverse(); + + mProbeInfo->mIsSkylight = false; + + bounds = mWorldBox; + + mProbeInfo->mScore = mMaxDrawDistance; + } // Skip our transform... it just dirties mask bits. Parent::setTransform(mObjToWorld); resetWorldBox(); - mProbeInfo->mBounds = mWorldBox; + mProbeInfo->mBounds = bounds; mProbeInfo->mExtents = getScale(); mProbeInfo->mRadius = mRadius; - mProbeInfo->mIsSkylight = false; - mProbeInfo->mProbeRefOffset = mProbeRefOffset; mProbeInfo->mProbeRefScale = mProbeRefScale; mProbeInfo->mDirty = true; - mProbeInfo->mScore = mMaxDrawDistance; + + if (mCubemapDirty) + { + if (mReflectionModeType == StaticCubemap) + processStaticCubemap(); + else + processDynamicCubemap(); + } + + PROBEMGR->updateProbes(); } -void ReflectionProbe::processStaticCubemap() +void ReflectionProbe::processDynamicCubemap() { - if (mReflectionModeType != StaticCubemap) + if (!mProbeInfo) return; - createClientResources(); - - Sim::findObject(mCubemapName, mStaticCubemap); - - if (!mStaticCubemap) - { - Con::errorf("ReflectionProbe::updateMaterial() - unable to find static cubemap file!"); - return; - } - - if (mStaticCubemap->mCubemap == nullptr) - { - mStaticCubemap->createMap(); - mStaticCubemap->updateFaces(); - } - - String prefilPath = getPrefilterMapPath(); - String irrPath = getIrradianceMapPath(); - - if (mUseHDRCaptures) - { - mIrridianceMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR16G16B16A16F); - mPrefilterMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR16G16B16A16F); - } - else - { - mIrridianceMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR8G8B8A8); - mPrefilterMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR8G8B8A8); - } - - //if (!Platform::isFile(irrPath) || !Platform::isFile(prefilPath)) - { - GFXTextureTargetRef renderTarget = GFX->allocRenderToTextureTarget(false); - - IBLUtilities::GenerateIrradianceMap(renderTarget, mStaticCubemap->mCubemap, mIrridianceMap->mCubemap); - IBLUtilities::GeneratePrefilterMap(renderTarget, mStaticCubemap->mCubemap, mPrefilterMipLevels, mPrefilterMap->mCubemap); - - IBLUtilities::SaveCubeMap(getIrradianceMapPath(), mIrridianceMap->mCubemap); - IBLUtilities::SaveCubeMap(getPrefilterMapPath(), mPrefilterMap->mCubemap); - } - - mProbeInfo->mPrefilterCubemap = mPrefilterMap->mCubemap; - mProbeInfo->mIrradianceCubemap = mIrridianceMap->mCubemap; - - //Update the probe manager with our new texture! - if(!mProbeInfo->mIsSkylight) - PROBEMGR->updateProbeTexture(mProbeInfo); -} - -void ReflectionProbe::updateCubemaps() -{ - createClientResources(); + mEnabled = false; if (mReflectionModeType != DynamicCubemap) { @@ -627,22 +573,36 @@ void ReflectionProbe::updateCubemaps() if ((mReflectionModeType == BakedCubemap) && !mProbeUniqueID.isEmpty()) { - if (mPrefilterMap != nullptr && mPrefilterMap->mCubemap.isValid()) + String irrPath = getIrradianceMapPath(); + if (Platform::isFile(irrPath)) { - mProbeInfo->mPrefilterCubemap = mPrefilterMap->mCubemap; + mIrridianceMap->setCubemapFile(FileName(irrPath)); + //mIrridianceMap->updateFaces(); } - else + + if (mIrridianceMap == nullptr || mIrridianceMap->mCubemap.isNull()) { - mEnabled = false; + Con::errorf("ReflectionProbe::processDynamicCubemap() - Unable to load baked irradiance map at %s", getIrradianceMapPath().c_str()); + return; } - if (mIrridianceMap != nullptr && mIrridianceMap->mCubemap.isValid()) + + String prefilPath = getPrefilterMapPath(); + if (Platform::isFile(prefilPath)) { - mProbeInfo->mIrradianceCubemap = mIrridianceMap->mCubemap; + mPrefilterMap->setCubemapFile(FileName(prefilPath)); + //mPrefilterMap->updateFaces(); } - else + + if (mPrefilterMap == nullptr || mPrefilterMap->mCubemap.isNull()) { - mEnabled = false; + Con::errorf("ReflectionProbe::processDynamicCubemap() - Unable to load baked prefilter map at %s", getPrefilterMapPath().c_str()); + return; } + + //mProbeInfo->mPrefilterCubemap = mPrefilterMap->mCubemap; + //mProbeInfo->mIrradianceCubemap = mIrridianceMap->mCubemap; + + mEnabled = true; } } else @@ -659,18 +619,120 @@ void ReflectionProbe::updateCubemaps() } } - //Make us ready to render if (mEnabled) mProbeInfo->mIsEnabled = true; else mProbeInfo->mIsEnabled = false; + //Update the probe manager with our new texture! + //if (!mProbeInfo->mIsSkylight && mProbeInfo->mPrefilterCubemap->isInitialized() && mProbeInfo->mIrradianceCubemap->isInitialized()) + // PROBEMGR->updateProbeTexture(mProbeInfo->mProbeIdx); +} + +void ReflectionProbe::processStaticCubemap() +{ + if (!mProbeInfo) + return; + + mEnabled = false; + + String path = Con::getVariable("$pref::ReflectionProbes::CurrentLevelPath", "levels/"); + + char irradFileName[256]; + dSprintf(irradFileName, 256, "%s_Irradiance.dds", path.c_str(), mCubemapName.c_str()); + + if (Platform::isFile(irradFileName)) + { + mIrridianceMap->setCubemapFile(FileName(irradFileName)); + mIrridianceMap->updateFaces(); + } + + if (mIrridianceMap == nullptr || mIrridianceMap->mCubemap.isNull()) + { + Con::errorf("ReflectionProbe::processStaticCubemap() - Unable to load baked irradiance map at %s", irradFileName); + return; + } + + char prefilterFileName[256]; + dSprintf(prefilterFileName, 256, "%s%s_Prefilter.dds", path.c_str(), mCubemapName.c_str()); + + if (Platform::isFile(prefilterFileName)) + { + mPrefilterMap->setCubemapFile(FileName(prefilterFileName)); + mPrefilterMap->updateFaces(); + } + + if (mPrefilterMap == nullptr || mPrefilterMap->mCubemap.isNull()) + { + Con::errorf("ReflectionProbe::processStaticCubemap() - Unable to load baked prefilter map at %s", prefilterFileName); + return; + } + + if (!Platform::isFile(prefilterFileName) || !Platform::isFile(irradFileName)) + { + //If we are missing either of the files, just re-run the bake + Sim::findObject(mCubemapName, mStaticCubemap); + + if (!mStaticCubemap) + { + Con::errorf("ReflectionProbe::updateMaterial() - unable to find static cubemap file!"); + return; + } + + if (mStaticCubemap->mCubemap == nullptr) + { + mStaticCubemap->createMap(); + mStaticCubemap->updateFaces(); + } + + if (mUseHDRCaptures) + { + mIrridianceMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR16G16B16A16F); + mPrefilterMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR16G16B16A16F); + } + else + { + mIrridianceMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR8G8B8A8); + mPrefilterMap->mCubemap->initDynamic(mPrefilterSize, GFXFormatR8G8B8A8); + } + + GFXTextureTargetRef renderTarget = GFX->allocRenderToTextureTarget(false); + + IBLUtilities::GenerateIrradianceMap(renderTarget, mStaticCubemap->mCubemap, mIrridianceMap->mCubemap); + IBLUtilities::GeneratePrefilterMap(renderTarget, mStaticCubemap->mCubemap, mPrefilterMipLevels, mPrefilterMap->mCubemap); + + IBLUtilities::SaveCubeMap(irradFileName, mIrridianceMap->mCubemap); + IBLUtilities::SaveCubeMap(prefilterFileName, mPrefilterMap->mCubemap); + } + + if ((mIrridianceMap != nullptr || !mIrridianceMap->mCubemap.isNull()) && (mPrefilterMap != nullptr || !mPrefilterMap->mCubemap.isNull())) + { + mProbeInfo->mPrefilterCubemap = mPrefilterMap->mCubemap; + mProbeInfo->mIrradianceCubemap = mIrridianceMap->mCubemap; + mEnabled = true; + } + + if (mEnabled) + mProbeInfo->mIsEnabled = true; + else + mProbeInfo->mIsEnabled = false; + + //Update the probe manager with our new texture! if (!mProbeInfo->mIsSkylight && mProbeInfo->mPrefilterCubemap->isInitialized() && mProbeInfo->mIrradianceCubemap->isInitialized()) - PROBEMGR->updateProbeTexture(mProbeInfo); + PROBEMGR->updateProbeTexture(mProbeInfo->mProbeIdx); } bool ReflectionProbe::createClientResources() { + if (mProbeInfo == nullptr) + { + mProbeInfo = PROBEMGR->registerProbe(mProbeShapeType == ProbeRenderInst::Skylight); + if (!mProbeInfo) + return false; + + mProbeInfo->mIsEnabled = false; + } + //irridiance resources if (!mIrridianceMap) { @@ -680,16 +742,6 @@ bool ReflectionProbe::createClientResources() mIrridianceMap->createMap(); } - String irrPath = getIrradianceMapPath(); - if (Platform::isFile(irrPath)) - { - mIrridianceMap->setCubemapFile(FileName(irrPath)); - mIrridianceMap->updateFaces(); - } - - if (mIrridianceMap->mCubemap.isNull()) - Con::errorf("ReflectionProbe::createClientResources() - Unable to load baked irradiance map at %s", getIrradianceMapPath().c_str()); - // if (!mPrefilterMap) { @@ -699,17 +751,8 @@ bool ReflectionProbe::createClientResources() mPrefilterMap->createMap(); } - String prefilPath = getPrefilterMapPath(); - if (Platform::isFile(prefilPath)) - { - mPrefilterMap->setCubemapFile(FileName(prefilPath)); - mPrefilterMap->updateFaces(); - } - - if (mPrefilterMap->mCubemap.isNull()) - Con::errorf("ReflectionProbe::createClientResources() - Unable to load baked prefilter map at %s", getPrefilterMapPath().c_str()); - mResourcesCreated = true; + mCubemapDirty = true; return true; } @@ -753,8 +796,9 @@ void ReflectionProbe::bake() PROBEMGR->bakeProbe(this); - setMaskBits(CubemapMask); + setMaskBits(StaticDataMask); } + //----------------------------------------------------------------------------- //Rendering of editing/debug stuff //----------------------------------------------------------------------------- @@ -812,8 +856,11 @@ void ReflectionProbe::prepRenderImage(SceneRenderState *state) //Register //PROBEMGR->registerProbe(mProbeInfoIdx); - if (ReflectionProbe::smRenderPreviewProbes && gEditingMission && mEditorShapeInst && mPrefilterMap != nullptr) + if (ReflectionProbe::smRenderPreviewProbes && gEditingMission && mPrefilterMap != nullptr) { + if(!mEditorShapeInst) + createGeometry(); + GFXTransformSaver saver; // Calculate the distance of this object from the camera diff --git a/Engine/source/T3D/lighting/reflectionProbe.h b/Engine/source/T3D/lighting/reflectionProbe.h index 696091771..eaf2e0d42 100644 --- a/Engine/source/T3D/lighting/reflectionProbe.h +++ b/Engine/source/T3D/lighting/reflectionProbe.h @@ -82,19 +82,15 @@ protected: enum MaskBits { TransformMask = Parent::NextFreeMask << 0, - UpdateMask = Parent::NextFreeMask << 1, + StaticDataMask = Parent::NextFreeMask << 1, EnabledMask = Parent::NextFreeMask << 2, - CubemapMask = Parent::NextFreeMask << 3, - ModeMask = Parent::NextFreeMask << 4, - RadiusMask = Parent::NextFreeMask << 5, - ShapeTypeMask = Parent::NextFreeMask << 6, - BakeInfoMask = Parent::NextFreeMask << 7, - NextFreeMask = Parent::NextFreeMask << 8 + NextFreeMask = Parent::NextFreeMask << 3 }; bool mBake; bool mEnabled; bool mDirty; + bool mCubemapDirty; Resource mEditorShape; TSShapeInstance* mEditorShapeInst; @@ -105,7 +101,6 @@ protected: ProbeRenderInst::ProbeShapeType mProbeShapeType; ProbeRenderInst* mProbeInfo; - U32 mProbeInfoIdx; //Reflection Contribution stuff ReflectionModeType mReflectionModeType; @@ -221,13 +216,11 @@ public: // Create the geometry for rendering void createGeometry(); - // Get the Material instance - void updateCubemaps(); - virtual void updateProbeParams(); bool createClientResources(); + void processDynamicCubemap(); void processStaticCubemap(); // This is the function that allows this object to submit itself for rendering @@ -243,8 +236,6 @@ public: String getPrefilterMapPath(); String getIrradianceMapPath(); void bake(); - - const U32 getProbeInfoIndex() { return mProbeInfoIdx; } }; typedef ProbeRenderInst::ProbeShapeType ReflectProbeType; @@ -253,4 +244,4 @@ DefineEnumType(ReflectProbeType); typedef ReflectionProbe::ReflectionModeType ReflectionModeEnum; DefineEnumType(ReflectionModeEnum); -#endif // _ReflectionProbe_H_ \ No newline at end of file +#endif // _ReflectionProbe_H_ diff --git a/Engine/source/T3D/lighting/skylight.cpp b/Engine/source/T3D/lighting/skylight.cpp index 4ba6ba10c..45b44c903 100644 --- a/Engine/source/T3D/lighting/skylight.cpp +++ b/Engine/source/T3D/lighting/skylight.cpp @@ -123,18 +123,6 @@ void Skylight::onRemove() Parent::onRemove(); } -void Skylight::setTransform(const MatrixF & mat) -{ - // Let SceneObject handle all of the matrix manipulation - Parent::setTransform(mat); - - mDirty = true; - - // Dirty our network mask so that the new transform gets - // transmitted to the client object - setMaskBits(TransformMask); -} - U32 Skylight::packUpdate(NetConnection *conn, U32 mask, BitStream *stream) { // Allow the Parent to get a crack at writing its info @@ -155,34 +143,8 @@ void Skylight::unpackUpdate(NetConnection *conn, BitStream *stream) void Skylight::updateProbeParams() { + mProbeShapeType = ProbeRenderInst::Skylight; Parent::updateProbeParams(); - - mProbeInfo->mProbeShapeType = ProbeRenderInst::Skylight; - - mProbeInfo->setPosition(getPosition()); - - // Skip our transform... it just dirties mask bits. - Parent::setTransform(mObjToWorld); - - resetWorldBox(); - - F32 visDist = gClientSceneGraph->getVisibleDistance(); - Box3F skylightBounds = Box3F(visDist * 2); - - skylightBounds.setCenter(Point3F::Zero); - - mProbeInfo->setPosition(Point3F::Zero); - - mProbeInfo->mBounds = skylightBounds; - - setGlobalBounds(); - - mProbeInfo->mIsSkylight = true; - mProbeInfo->mScore = -1.0f; //sky comes first - - PROBEMGR->updateProbes(); - - updateCubemaps(); } void Skylight::prepRenderImage(SceneRenderState *state) @@ -273,4 +235,4 @@ DefineEngineMethod(Skylight, postApply, void, (), , "A utility method for forcing a network update.\n") { object->inspectPostApply(); -} \ No newline at end of file +} diff --git a/Engine/source/T3D/lighting/skylight.h b/Engine/source/T3D/lighting/skylight.h index 5fbe02419..6db62a019 100644 --- a/Engine/source/T3D/lighting/skylight.h +++ b/Engine/source/T3D/lighting/skylight.h @@ -86,9 +86,6 @@ public: bool onAdd(); void onRemove(); - // Override this so that we can dirty the network flag when it is called - void setTransform(const MatrixF &mat); - // This function handles sending the relevant data from the server // object to the client object U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream); @@ -112,4 +109,4 @@ public: void setPreviewMatParameters(SceneRenderState* renderState, BaseMatInstance* mat); }; -#endif // _Skylight_H_ \ No newline at end of file +#endif // _Skylight_H_ diff --git a/Engine/source/T3D/lighting/sphereEnvironmentProbe.cpp b/Engine/source/T3D/lighting/sphereEnvironmentProbe.cpp index 8cbcd8a98..487f7c698 100644 --- a/Engine/source/T3D/lighting/sphereEnvironmentProbe.cpp +++ b/Engine/source/T3D/lighting/sphereEnvironmentProbe.cpp @@ -119,18 +119,6 @@ void SphereEnvironmentProbe::onRemove() Parent::onRemove(); } -void SphereEnvironmentProbe::setTransform(const MatrixF & mat) -{ - // Let SceneObject handle all of the matrix manipulation - Parent::setTransform(mat); - - mDirty = true; - - // Dirty our network mask so that the new transform gets - // transmitted to the client object - setMaskBits(TransformMask); -} - U32 SphereEnvironmentProbe::packUpdate(NetConnection *conn, U32 mask, BitStream *stream) { // Allow the Parent to get a crack at writing its info @@ -151,13 +139,8 @@ void SphereEnvironmentProbe::unpackUpdate(NetConnection *conn, BitStream *stream void SphereEnvironmentProbe::updateProbeParams() { + mProbeShapeType = ProbeRenderInst::Sphere; Parent::updateProbeParams(); - - mProbeInfo->mProbeShapeType = ProbeRenderInst::Sphere; - - PROBEMGR->updateProbes(); - - updateCubemaps(); } void SphereEnvironmentProbe::prepRenderImage(SceneRenderState *state) @@ -234,4 +217,4 @@ void SphereEnvironmentProbe::prepRenderImage(SceneRenderState *state) void SphereEnvironmentProbe::setPreviewMatParameters(SceneRenderState* renderState, BaseMatInstance* mat) { Parent::setPreviewMatParameters(renderState, mat); -} \ No newline at end of file +} diff --git a/Engine/source/T3D/lighting/sphereEnvironmentProbe.h b/Engine/source/T3D/lighting/sphereEnvironmentProbe.h index 59c602cc3..dc3c9a1a6 100644 --- a/Engine/source/T3D/lighting/sphereEnvironmentProbe.h +++ b/Engine/source/T3D/lighting/sphereEnvironmentProbe.h @@ -82,9 +82,6 @@ public: bool onAdd(); void onRemove(); - // Override this so that we can dirty the network flag when it is called - void setTransform(const MatrixF &mat); - // This function handles sending the relevant data from the server // object to the client object U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream); @@ -108,4 +105,4 @@ public: void setPreviewMatParameters(SceneRenderState* renderState, BaseMatInstance* mat); }; -#endif // SPHERE_ENVIRONMENT_PROBE_H \ No newline at end of file +#endif // SPHERE_ENVIRONMENT_PROBE_H diff --git a/Engine/source/renderInstance/renderProbeMgr.cpp b/Engine/source/renderInstance/renderProbeMgr.cpp index 4e217f749..aa2e53592 100644 --- a/Engine/source/renderInstance/renderProbeMgr.cpp +++ b/Engine/source/renderInstance/renderProbeMgr.cpp @@ -73,7 +73,8 @@ S32 QSORT_CALLBACK AscendingReflectProbeInfluence(const void* a, const void* b) // // -ProbeRenderInst::ProbeRenderInst() : SystemInterface(), +ProbeRenderInst::ProbeRenderInst() : + mIsEnabled(true), mTransform(true), mDirty(false), mPriority(1.0f), @@ -85,7 +86,8 @@ ProbeRenderInst::ProbeRenderInst() : SystemInterface(), mProbeRefScale(1,1,1), mAtten(0.0), mCubemapIndex(0), - mIsSkylight(false) + mIsSkylight(false), + mProbeIdx(0) { } @@ -267,12 +269,12 @@ bool RenderProbeMgr::onAdd() return false; } - /*String brdfTexturePath = GFXTextureManager::getBRDFTexturePath(); + String brdfTexturePath = GFXTextureManager::getBRDFTexturePath(); if (!mBRDFTexture.set(brdfTexturePath, &GFXTexturePersistentSRGBProfile, "BRDFTexture")) { Con::errorf("RenderProbeMgr::onAdd: Failed to load BRDF Texture"); return false; - }*/ + } return true; } @@ -312,21 +314,21 @@ void RenderProbeMgr::addElement(RenderInst *inst) }*/ } -void RenderProbeMgr::registerProbe(U32 probeIdx) +ProbeRenderInst* RenderProbeMgr::registerProbe(const bool &isSkylight) { - //Mostly for consolidation, but also lets us sanity check or prep any other data we need for rendering this in one place at time of flagging for render - if (probeIdx >= ProbeRenderInst::all.size()) - return; + ProbeRenderInst newProbe; + newProbe.mIsSkylight = isSkylight; - mRegisteredProbes.push_back_unique(probeIdx); + mRegisteredProbes.push_back(newProbe); + newProbe.mProbeIdx = mRegisteredProbes.size(); - if (!ProbeRenderInst::all[probeIdx]->mIsSkylight) + if (!newProbe.mIsSkylight) { const U32 cubeIndex = _findNextEmptyCubeSlot(); if (cubeIndex == INVALID_CUBE_SLOT) { Con::warnf("RenderProbeMgr::addProbe: Invalid cubemap slot."); - return; + return nullptr; } //check if we need to resize the cubemap array @@ -349,33 +351,34 @@ void RenderProbeMgr::registerProbe(U32 probeIdx) mCubeSlotCount += PROBE_ARRAY_SLOT_BUFFER_SIZE; } - ProbeRenderInst::all[probeIdx]->mCubemapIndex = cubeIndex; + newProbe.mCubemapIndex = cubeIndex; //mark cubemap slot as taken mCubeMapSlots[cubeIndex] = true; mCubeMapCount++; - Con::warnf("RenderProbeMgr::registerProbe: Registered probe %u to cubeIndex %u", probeIdx, cubeIndex); + Con::warnf("RenderProbeMgr::registerProbe: Registered probe %u to cubeIndex %u", newProbe.mProbeIdx, cubeIndex); } - //rebuild our probe data - _setupStaticParameters(); + mProbesDirty = true; + + return &mRegisteredProbes.last(); } void RenderProbeMgr::unregisterProbe(U32 probeIdx) { //Mostly for consolidation, but also lets us sanity check or prep any other data we need for rendering this in one place at time of flagging for render - if (probeIdx >= ProbeRenderInst::all.size()) + if (probeIdx >= mRegisteredProbes.size()) return; - mRegisteredProbes.remove(probeIdx); - - if (ProbeRenderInst::all[probeIdx]->mCubemapIndex == INVALID_CUBE_SLOT) + if (mRegisteredProbes[probeIdx].mCubemapIndex == INVALID_CUBE_SLOT) return; //mark cubemap slot as available now - mCubeMapSlots[ProbeRenderInst::all[probeIdx]->mCubemapIndex] = false; + mCubeMapSlots[mRegisteredProbes[probeIdx].mCubemapIndex] = false; mCubeMapCount--; + mRegisteredProbes.erase(probeIdx); + //rebuild our probe data _setupStaticParameters(); } @@ -407,7 +410,7 @@ void RenderProbeMgr::updateProbes() void RenderProbeMgr::_setupStaticParameters() { //Array rendering - U32 probeCount = ProbeRenderInst::all.size(); + U32 probeCount = mRegisteredProbes.size(); mEffectiveProbeCount = 0; mMipCount = 0; @@ -433,10 +436,10 @@ void RenderProbeMgr::_setupStaticParameters() irradMaps.clear(); Vector cubemapIdxes; - if (probeCount != 0 && ProbeRenderInst::all[0]->mPrefilterCubemap != nullptr) + if (probeCount != 0 && mRegisteredProbes[0].mPrefilterCubemap != nullptr) { //Get our mipCount - mMipCount = ProbeRenderInst::all[0]->mPrefilterCubemap.getPointer()->getMipMapLevels(); + mMipCount = mRegisteredProbes[0].mPrefilterCubemap.getPointer()->getMipMapLevels(); } else { @@ -448,7 +451,7 @@ void RenderProbeMgr::_setupStaticParameters() if (mEffectiveProbeCount >= MAXPROBECOUNT) break; - const ProbeRenderInst& curEntry = *ProbeRenderInst::all[i]; + const ProbeRenderInst& curEntry = mRegisteredProbes[i]; if (!curEntry.mIsEnabled) continue; @@ -489,29 +492,21 @@ void RenderProbeMgr::_setupStaticParameters() mProbesDirty = false; } -void RenderProbeMgr::updateProbeTexture(ProbeRenderInst* probe) -{ - //We don't stuff skylights into the array, so we can just skip out on this if it's a skylight - if (probe->mIsSkylight) - return; - - S32 probeIdx = ProbeRenderInst::all.find_next(probe); - - if (probeIdx != -1) //i mean, the opposite shouldn't even be possible - updateProbeTexture(probeIdx); -} - void RenderProbeMgr::updateProbeTexture(U32 probeIdx) { - if (probeIdx >= ProbeRenderInst::all.size()) + if (probeIdx >= mRegisteredProbes.size()) return; - const U32 cubeIndex = ProbeRenderInst::all[probeIdx]->mCubemapIndex; - mIrradianceArray->updateTexture(ProbeRenderInst::all[probeIdx]->mIrradianceCubemap, cubeIndex); - mPrefilterArray->updateTexture(ProbeRenderInst::all[probeIdx]->mPrefilterCubemap, cubeIndex); + //We don't stuff skylights into the array, so we can just skip out on this if it's a skylight + if (mRegisteredProbes[probeIdx].mIsSkylight) + return; + + const U32 cubeIndex = mRegisteredProbes[probeIdx].mCubemapIndex; + mIrradianceArray->updateTexture(mRegisteredProbes[probeIdx].mIrradianceCubemap, cubeIndex); + mPrefilterArray->updateTexture(mRegisteredProbes[probeIdx].mPrefilterCubemap, cubeIndex); Con::warnf("UpdatedProbeTexture - probeIdx: %u on cubeIndex %u, Irrad validity: %d, Prefilter validity: %d", probeIdx, cubeIndex, - ProbeRenderInst::all[probeIdx]->mIrradianceCubemap->isInitialized(), ProbeRenderInst::all[probeIdx]->mPrefilterCubemap->isInitialized()); + mRegisteredProbes[probeIdx].mIrradianceCubemap->isInitialized(), mRegisteredProbes[probeIdx].mPrefilterCubemap->isInitialized()); } void RenderProbeMgr::_setupPerFrameParameters(const SceneRenderState *state) @@ -593,7 +588,7 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData, matSet.restoreSceneViewProjection(); //Array rendering - U32 probeCount = ProbeRenderInst::all.size(); + U32 probeCount = mRegisteredProbes.size(); S8 bestPickProbes[4] = { -1,-1,-1,-1 }; @@ -603,7 +598,7 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData, //if (effectiveProbeCount >= MAX_FORWARD_PROBES) // break; - const ProbeRenderInst& curEntry = *ProbeRenderInst::all[i]; + const ProbeRenderInst& curEntry = mRegisteredProbes[i]; if (!curEntry.mIsEnabled) continue; @@ -614,13 +609,13 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData, if (dist > curEntry.mRadius || dist > curEntry.mExtents.len()) continue; - if(bestPickProbes[0] == -1 || (Point3F(sgData.objTrans->getPosition() - ProbeRenderInst::all[bestPickProbes[0]]->mPosition).len() > dist)) + if(bestPickProbes[0] == -1 || (Point3F(sgData.objTrans->getPosition() - mRegisteredProbes[bestPickProbes[0]].mPosition).len() > dist)) bestPickProbes[0] = i; - else if (bestPickProbes[1] == -1 || (Point3F(sgData.objTrans->getPosition() - ProbeRenderInst::all[bestPickProbes[1]]->mPosition).len() > dist)) + else if (bestPickProbes[1] == -1 || (Point3F(sgData.objTrans->getPosition() - mRegisteredProbes[bestPickProbes[1]].mPosition).len() > dist)) bestPickProbes[1] = i; - else if (bestPickProbes[2] == -1 || (Point3F(sgData.objTrans->getPosition() - ProbeRenderInst::all[bestPickProbes[2]]->mPosition).len() > dist)) + else if (bestPickProbes[2] == -1 || (Point3F(sgData.objTrans->getPosition() - mRegisteredProbes[bestPickProbes[2]].mPosition).len() > dist)) bestPickProbes[2] = i; - else if (bestPickProbes[3] == -1 || (Point3F(sgData.objTrans->getPosition() - ProbeRenderInst::all[bestPickProbes[3]]->mPosition).len() > dist)) + else if (bestPickProbes[3] == -1 || (Point3F(sgData.objTrans->getPosition() - mRegisteredProbes[bestPickProbes[3]].mPosition).len() > dist)) bestPickProbes[3] = i; } } @@ -631,7 +626,7 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData, if (bestPickProbes[i] == -1) continue; - const ProbeRenderInst& curEntry = *ProbeRenderInst::all[bestPickProbes[i]]; + const ProbeRenderInst& curEntry = mRegisteredProbes[bestPickProbes[i]]; probePositionArray[effectiveProbeCount] = curEntry.getPosition(); probeRefPositionArray[effectiveProbeCount] = curEntry.mProbeRefOffset; @@ -666,8 +661,8 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData, shaderConsts->setSafe(probeShaderConsts->mProbeBoxMaxSC, probeBoxMaxArray); shaderConsts->setSafe(probeShaderConsts->mProbeConfigDataSC, probeConfigArray); - //if (mBRDFTexture.isValid()) - // GFX->setTexture(3, mBRDFTexture); + if (mBRDFTexture.isValid()) + GFX->setTexture(3, mBRDFTexture); if(probeShaderConsts->mProbeSpecularCubemapSC->getSamplerRegister() != -1) GFX->setCubeArrayTexture(probeShaderConsts->mProbeSpecularCubemapSC->getSamplerRegister(), mPrefilterArray); @@ -680,12 +675,12 @@ void RenderProbeMgr::_update4ProbeConsts(const SceneData &sgData, && probeShaderConsts->mSkylightSpecularMap->isValid()) { //Array rendering - U32 probeCount = ProbeRenderInst::all.size(); + U32 probeCount = mRegisteredProbes.size(); bool hasSkylight = false; for (U32 i = 0; i < probeCount; i++) { - const ProbeRenderInst& curEntry = *ProbeRenderInst::all[i]; + const ProbeRenderInst& curEntry = mRegisteredProbes[i]; if (!curEntry.mIsEnabled) continue; @@ -754,8 +749,6 @@ void RenderProbeMgr::setProbeInfo(ProcessedMaterial *pmat, //----------------------------------------------------------------------------- void RenderProbeMgr::render( SceneRenderState *state ) { - return; - //PROFILE_SCOPE(RenderProbeMgr_render); if (getProbeArrayEffect() == nullptr) return; @@ -763,7 +756,7 @@ void RenderProbeMgr::render( SceneRenderState *state ) _setupStaticParameters(); // Early out if nothing to draw. - if (!RenderProbeMgr::smRenderReflectionProbes || !state->isDiffusePass() || (!ProbeRenderInst::all.size() || mEffectiveProbeCount == 0 || mCubeMapCount != 0 ) && !mHasSkylight) + if (!RenderProbeMgr::smRenderReflectionProbes || !state->isDiffusePass() || (!mRegisteredProbes.size() || mEffectiveProbeCount == 0 || mCubeMapCount != 0 ) && !mHasSkylight) { getProbeArrayEffect()->setSkip(true); return; @@ -791,7 +784,7 @@ void RenderProbeMgr::render( SceneRenderState *state ) mProbeArrayEffect->setShaderMacro("DEBUGVIZ_CONTRIB", useDebugContrib); //Array rendering - //U32 probeCount = ProbeRenderInst::all.size(); + //U32 probeCount = mRegisteredProbes.size(); mProbeArrayEffect->setShaderConst("$hasSkylight", (float)mHasSkylight); if (mHasSkylight) @@ -805,7 +798,7 @@ void RenderProbeMgr::render( SceneRenderState *state ) mProbeArrayEffect->setShaderConst("$cubeMips", (float)mMipCount); if (mEffectiveProbeCount != 0) { - //mProbeArrayEffect->setTexture(3, mBRDFTexture); + mProbeArrayEffect->setTexture(3, mBRDFTexture); mProbeArrayEffect->setCubemapArrayTexture(4, mPrefilterArray); mProbeArrayEffect->setCubemapArrayTexture(5, mIrradianceArray); diff --git a/Engine/source/renderInstance/renderProbeMgr.h b/Engine/source/renderInstance/renderProbeMgr.h index bdc0af248..4ec9584ff 100644 --- a/Engine/source/renderInstance/renderProbeMgr.h +++ b/Engine/source/renderInstance/renderProbeMgr.h @@ -57,8 +57,10 @@ static U32 MAXPROBECOUNT = 50; class PostEffect; class ReflectionProbe; -struct ProbeRenderInst : public SystemInterface +struct ProbeRenderInst { + bool mIsEnabled; + MatrixF mTransform; F32 mRadius; @@ -99,6 +101,8 @@ struct ProbeRenderInst : public SystemInterface U32 mCubemapIndex; + U32 mProbeIdx; + public: ProbeRenderInst(); @@ -124,6 +128,11 @@ public: F32 getScore() const { return mScore; } void clear(); + + inline bool ProbeRenderInst::operator ==(const ProbeRenderInst& b) const + { + return mProbeIdx == b.mProbeIdx; + } }; struct ProbeShaderConstants @@ -168,7 +177,7 @@ class RenderProbeMgr : public RenderBinManager { typedef RenderBinManager Parent; - Vector mRegisteredProbes; + Vector mRegisteredProbes; bool mProbesDirty; @@ -254,7 +263,6 @@ protected: GFXShaderConstBuffer *shaderConsts); void _setupStaticParameters(); - void updateProbeTexture(U32 probeIdx); void _setupPerFrameParameters(const SceneRenderState *state); virtual void addElement(RenderInst *inst); virtual void render(SceneRenderState * state); @@ -263,29 +271,6 @@ protected: PostEffect* getProbeArrayEffect(); -public: - // RenderBinMgr - void updateProbes(); - void updateProbeTexture(ProbeRenderInst* probe); - - /// Returns the active LM. - static inline RenderProbeMgr* getProbeManager(); - - void registerProbe(U32 probeIdx); - void unregisterProbe(U32 probeIdx); - - virtual void setProbeInfo(ProcessedMaterial *pmat, - const Material *mat, - const SceneData &sgData, - const SceneRenderState *state, - U32 pass, - GFXShaderConstBuffer *shaderConsts); - - /// Debug rendering - static bool smRenderReflectionProbes; - - void bakeProbe(ReflectionProbe *probeInfo); - void bakeProbes(); U32 _findNextEmptyCubeSlot() { @@ -296,6 +281,31 @@ public: } return INVALID_CUBE_SLOT; } + +public: + // RenderBinMgr + void updateProbes(); + + /// Returns the active LM. + static inline RenderProbeMgr* getProbeManager(); + + ProbeRenderInst* registerProbe(const bool& isSkylight); + void unregisterProbe(U32 probeIdx); + + virtual void setProbeInfo(ProcessedMaterial *pmat, + const Material *mat, + const SceneData &sgData, + const SceneRenderState *state, + U32 pass, + GFXShaderConstBuffer *shaderConsts); + + void updateProbeTexture(U32 probeIdx); + + /// Debug rendering + static bool smRenderReflectionProbes; + + void bakeProbe(ReflectionProbe *probeInfo); + void bakeProbes(); }; RenderProbeMgr* RenderProbeMgr::getProbeManager() diff --git a/Templates/BaseGame/game/data/shaderCache/76d48535f69be600_P.hlsl b/Templates/BaseGame/game/data/shaderCache/76d48535f69be600_P.hlsl deleted file mode 100644 index 4780388ec..000000000 --- a/Templates/BaseGame/game/data/shaderCache/76d48535f69be600_P.hlsl +++ /dev/null @@ -1,94 +0,0 @@ -//***************************************************************************** -// Torque -- HLSL procedural shader -//***************************************************************************** - -// Dependencies: -#include "core/rendering/shaders/torque.hlsl" - -// Features: -// Vert Position -// Base Texture -// Diffuse Color -// Deferred Shading: Empty Specular -// Deferred Shading: Mat Info Flags -// Eye Space Depth (Out) -// Visibility -// GBuffer Conditioner -// Deferred Material - -struct ConnectData -{ - float4 vpos : SV_Position; - float2 texCoord : TEXCOORD0; - float4 wsEyeVec : TEXCOORD1; - float3 gbNormal : TEXCOORD2; -}; - - -struct Fragout -{ - float4 col : SV_Target0; - float4 col1 : SV_Target1; - float4 col2 : SV_Target2; -}; - - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- -Fragout main( ConnectData IN, - uniform SamplerState diffuseMap : register(S0), - uniform Texture2D diffuseMapTex : register(T0), - uniform float4 diffuseMaterialColor : register(C0), - uniform float matInfoFlags : register(C1), - uniform float3 vEye : register(C3), - uniform float4 oneOverFarplane : register(C4), - uniform float visibility : register(C2) -) -{ - Fragout OUT; - - // Vert Position - - // Base Texture -float4 diffuseColor = diffuseMapTex.Sample(diffuseMap, IN.texCoord); - OUT.col1 = diffuseColor; - - // Diffuse Color - OUT.col1 *= diffuseMaterialColor; - - // Deferred Shading: Empty Specular - OUT.col2.g = 1.0; - OUT.col2.ba = 0.0; - - // Deferred Shading: Mat Info Flags - OUT.col2.r = matInfoFlags; - - // Eye Space Depth (Out) -#ifndef CUBE_SHADOW_MAP - float eyeSpaceDepth = dot(vEye, (IN.wsEyeVec.xyz / IN.wsEyeVec.w)); -#else - float eyeSpaceDepth = length( IN.wsEyeVec.xyz / IN.wsEyeVec.w ) * oneOverFarplane.x; -#endif - - // Visibility - fizzle( IN.vpos.xy, visibility ); - - // GBuffer Conditioner - float4 normal_depth = float4(normalize(IN.gbNormal), eyeSpaceDepth); - - // output buffer format: GFXFormatR16G16B16A16F - // g-buffer conditioner: float4(normal.X, normal.Y, depth Hi, depth Lo) - float4 _gbConditionedOutput = float4(sqrt(half(2.0/(1.0 - normal_depth.y))) * half2(normal_depth.xz), 0.0, normal_depth.a); - - // Encode depth into hi/lo - float2 _tempDepth = frac(normal_depth.a * float2(1.0, 65535.0)); - _gbConditionedOutput.zw = _tempDepth.xy - _tempDepth.yy * float2(1.0/65535.0, 0.0); - - OUT.col = _gbConditionedOutput; - - // Deferred Material - - - return OUT; -} diff --git a/Templates/BaseGame/game/data/shaderCache/76d48535f69be600_V.hlsl b/Templates/BaseGame/game/data/shaderCache/76d48535f69be600_V.hlsl deleted file mode 100644 index a323a9608..000000000 --- a/Templates/BaseGame/game/data/shaderCache/76d48535f69be600_V.hlsl +++ /dev/null @@ -1,74 +0,0 @@ -//***************************************************************************** -// Torque -- HLSL procedural shader -//***************************************************************************** - -// Dependencies: -#include "core/rendering/shaders/torque.hlsl" - -// Features: -// Vert Position -// Base Texture -// Diffuse Color -// Deferred Shading: Empty Specular -// Deferred Shading: Mat Info Flags -// Eye Space Depth (Out) -// Visibility -// GBuffer Conditioner -// Deferred Material - -struct VertData -{ - float3 position : POSITION; - float3 normal : NORMAL; - float3 T : TANGENT; - float3 B : BINORMAL; - float2 texCoord : TEXCOORD0; -}; - - -struct ConnectData -{ - float4 hpos : SV_Position; - float2 out_texCoord : TEXCOORD0; - float4 wsEyeVec : TEXCOORD1; - float3 gbNormal : TEXCOORD2; -}; - - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- -ConnectData main( VertData IN, - uniform float4x4 modelview : register(C0), - uniform float4x4 objTrans : register(C4), - uniform float3 eyePosWorld : register(C12), - uniform float4x4 worldViewOnly : register(C8) -) -{ - ConnectData OUT; - - // Vert Position - OUT.hpos = mul(modelview, float4(IN.position.xyz,1)); - - // Base Texture - OUT.out_texCoord = (float2)IN.texCoord; - - // Diffuse Color - - // Deferred Shading: Empty Specular - - // Deferred Shading: Mat Info Flags - - // Eye Space Depth (Out) - float3 depthPos = mul( objTrans, float4( IN.position.xyz, 1 ) ).xyz; - OUT.wsEyeVec = float4( depthPos.xyz - eyePosWorld, 1 ); - - // Visibility - - // GBuffer Conditioner - OUT.gbNormal = mul(worldViewOnly, float4( normalize(IN.normal), 0.0 ) ).xyz; - - // Deferred Material - - return OUT; -} diff --git a/Templates/BaseGame/game/data/shaderCache/7a74ac0558b62462_P.hlsl b/Templates/BaseGame/game/data/shaderCache/7a74ac0558b62462_P.hlsl deleted file mode 100644 index 2c0e0ccda..000000000 --- a/Templates/BaseGame/game/data/shaderCache/7a74ac0558b62462_P.hlsl +++ /dev/null @@ -1,52 +0,0 @@ -//***************************************************************************** -// Torque -- HLSL procedural shader -//***************************************************************************** - -// Dependencies: -#include "core/rendering/shaders/torque.hlsl" - -// Features: -// Vert Position -// Eye Space Depth (Out) -// Visibility - -struct ConnectData -{ - float4 vpos : SV_Position; - float4 wsEyeVec : TEXCOORD0; -}; - - -struct Fragout -{ - float4 col : SV_Target0; -}; - - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- -Fragout main( ConnectData IN, - uniform float3 vEye : register(C1), - uniform float4 oneOverFarplane : register(C2), - uniform float visibility : register(C0) -) -{ - Fragout OUT; - - // Vert Position - - // Eye Space Depth (Out) -#ifndef CUBE_SHADOW_MAP - float eyeSpaceDepth = dot(vEye, (IN.wsEyeVec.xyz / IN.wsEyeVec.w)); -#else - float eyeSpaceDepth = length( IN.wsEyeVec.xyz / IN.wsEyeVec.w ) * oneOverFarplane.x; -#endif - OUT.col = float4(eyeSpaceDepth.rrr,1); - - // Visibility - fizzle( IN.vpos.xy, visibility ); - - - return OUT; -} diff --git a/Templates/BaseGame/game/data/shaderCache/7a74ac0558b62462_V.hlsl b/Templates/BaseGame/game/data/shaderCache/7a74ac0558b62462_V.hlsl deleted file mode 100644 index f7db2ba1f..000000000 --- a/Templates/BaseGame/game/data/shaderCache/7a74ac0558b62462_V.hlsl +++ /dev/null @@ -1,51 +0,0 @@ -//***************************************************************************** -// Torque -- HLSL procedural shader -//***************************************************************************** - -// Dependencies: -#include "core/rendering/shaders/torque.hlsl" - -// Features: -// Vert Position -// Eye Space Depth (Out) -// Visibility - -struct VertData -{ - float3 position : POSITION; - float3 normal : NORMAL; - float3 T : TANGENT; - float3 B : BINORMAL; - float2 texCoord : TEXCOORD0; -}; - - -struct ConnectData -{ - float4 hpos : SV_Position; - float4 wsEyeVec : TEXCOORD0; -}; - - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- -ConnectData main( VertData IN, - uniform float4x4 modelview : register(C0), - uniform float4x4 objTrans : register(C4), - uniform float3 eyePosWorld : register(C8) -) -{ - ConnectData OUT; - - // Vert Position - OUT.hpos = mul(modelview, float4(IN.position.xyz,1)); - - // Eye Space Depth (Out) - float3 depthPos = mul( objTrans, float4( IN.position.xyz, 1 ) ).xyz; - OUT.wsEyeVec = float4( depthPos.xyz - eyePosWorld, 1 ); - - // Visibility - - return OUT; -} diff --git a/Templates/BaseGame/game/data/shaderCache/8625023c97ea6cf9_P.hlsl b/Templates/BaseGame/game/data/shaderCache/8625023c97ea6cf9_P.hlsl deleted file mode 100644 index baae3874a..000000000 --- a/Templates/BaseGame/game/data/shaderCache/8625023c97ea6cf9_P.hlsl +++ /dev/null @@ -1,72 +0,0 @@ -//***************************************************************************** -// Torque -- HLSL procedural shader -//***************************************************************************** - -// Dependencies: -#include "core/rendering/shaders/lighting.hlsl" -#include "core/rendering/shaders/torque.hlsl" - -// Features: -// Vert Position -// Diffuse Color -// Deferred RT Lighting -// Visibility -// HDR Output - -struct ConnectData -{ - float4 vpos : SV_Position; - float3 wsNormal : TEXCOORD0; - float3 wsPosition : TEXCOORD1; -}; - - -struct Fragout -{ - float4 col : SV_Target0; -}; - - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- -Fragout main( ConnectData IN, - uniform float4 diffuseMaterialColor : register(C0), - uniform float3 eyePosWorld : register(C17), - uniform float4 inLightPos[3] : register(C1), - uniform float4 inLightInvRadiusSq : register(C4), - uniform float4 inLightColor[4] : register(C5), - uniform float4 inLightSpotDir[3] : register(C9), - uniform float4 inLightSpotAngle : register(C12), - uniform float4 inLightSpotFalloff : register(C13), - uniform float smoothness : register(C14), - uniform float metalness : register(C15), - uniform float4 ambient : register(C18), - uniform float visibility : register(C16) -) -{ - Fragout OUT; - - // Vert Position - - // Diffuse Color - OUT.col = diffuseMaterialColor; - - // Deferred RT Lighting - IN.wsNormal = normalize( half3( IN.wsNormal ) ); - float3 wsView = normalize( eyePosWorld - IN.wsPosition ); - float4 rtShading; float4 specular; - compute4Lights( wsView, IN.wsPosition, IN.wsNormal, float4( 1, 1, 1, 1 ), - inLightPos, inLightInvRadiusSq, inLightColor, inLightSpotDir, inLightSpotAngle, inLightSpotFalloff, smoothness, metalness, OUT.col, - rtShading, specular ); - OUT.col *= float4( rtShading.rgb + ambient.rgb, 1 ); - - // Visibility - fizzle( IN.vpos.xy, visibility ); - - // HDR Output - OUT.col = hdrEncode( OUT.col ); - - - return OUT; -} diff --git a/Templates/BaseGame/game/data/shaderCache/8625023c97ea6cf9_V.hlsl b/Templates/BaseGame/game/data/shaderCache/8625023c97ea6cf9_V.hlsl deleted file mode 100644 index 144225bb5..000000000 --- a/Templates/BaseGame/game/data/shaderCache/8625023c97ea6cf9_V.hlsl +++ /dev/null @@ -1,59 +0,0 @@ -//***************************************************************************** -// Torque -- HLSL procedural shader -//***************************************************************************** - -// Dependencies: -#include "core/rendering/shaders/lighting.hlsl" -#include "core/rendering/shaders/torque.hlsl" - -// Features: -// Vert Position -// Diffuse Color -// Deferred RT Lighting -// Visibility -// HDR Output - -struct VertData -{ - float3 position : POSITION; - float3 normal : NORMAL; - float3 T : TANGENT; - float3 B : BINORMAL; - float2 texCoord : TEXCOORD0; - float2 texCoord2 : TEXCOORD1; -}; - - -struct ConnectData -{ - float4 hpos : SV_Position; - float3 wsNormal : TEXCOORD0; - float3 outWsPosition : TEXCOORD1; -}; - - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- -ConnectData main( VertData IN, - uniform float4x4 modelview : register(C0), - uniform float4x4 objTrans : register(C4) -) -{ - ConnectData OUT; - - // Vert Position - OUT.hpos = mul(modelview, float4(IN.position.xyz,1)); - - // Diffuse Color - - // Deferred RT Lighting - OUT.wsNormal = mul( objTrans, float4( normalize( IN.normal ), 0.0 ) ).xyz; - OUT.outWsPosition = mul( objTrans, float4( IN.position.xyz, 1 ) ).xyz; - - // Visibility - - // HDR Output - - return OUT; -} diff --git a/Templates/BaseGame/game/data/shaderCache/a1a7a101cca9ce72_P.hlsl b/Templates/BaseGame/game/data/shaderCache/a1a7a101cca9ce72_P.hlsl deleted file mode 100644 index 2b0cb5f0e..000000000 --- a/Templates/BaseGame/game/data/shaderCache/a1a7a101cca9ce72_P.hlsl +++ /dev/null @@ -1,54 +0,0 @@ -//***************************************************************************** -// Torque -- HLSL procedural shader -//***************************************************************************** - -// Dependencies: -#include "core/rendering/shaders/torque.hlsl" - -// Features: -// Vert Position -// skybox -// Diffuse Color -// Reflect Cube -// HDR Output - -struct ConnectData -{ - float4 vpos : SV_Position; - float3 reflectVec : TEXCOORD0; -}; - - -struct Fragout -{ - float4 col : SV_Target0; -}; - - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- -Fragout main( ConnectData IN, - uniform float4 diffuseMaterialColor : register(C0), - uniform SamplerState cubeMap : register(S0), - uniform TextureCube cubeMapTex : register(T0) -) -{ - Fragout OUT; - - // Vert Position - - // skybox - - // Diffuse Color - OUT.col = diffuseMaterialColor; - - // Reflect Cube - OUT.col *= cubeMapTex.Sample( cubeMap, IN.reflectVec ); - - // HDR Output - OUT.col = hdrEncode( OUT.col ); - - - return OUT; -} diff --git a/Templates/BaseGame/game/data/shaderCache/a1a7a101cca9ce72_V.hlsl b/Templates/BaseGame/game/data/shaderCache/a1a7a101cca9ce72_V.hlsl deleted file mode 100644 index f4e6f087d..000000000 --- a/Templates/BaseGame/game/data/shaderCache/a1a7a101cca9ce72_V.hlsl +++ /dev/null @@ -1,58 +0,0 @@ -//***************************************************************************** -// Torque -- HLSL procedural shader -//***************************************************************************** - -// Dependencies: -#include "core/rendering/shaders/torque.hlsl" - -// Features: -// Vert Position -// skybox -// Diffuse Color -// Reflect Cube -// HDR Output - -struct VertData -{ - float3 position : POSITION; - float3 normal : NORMAL; - float2 texCoord : TEXCOORD0; -}; - - -struct ConnectData -{ - float4 hpos : SV_Position; - float3 reflectVec : TEXCOORD0; -}; - - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- -ConnectData main( VertData IN, - uniform float4x4 modelview : register(C0), - uniform float4x4 objTrans : register(C4), - uniform float3 eyePosWorld : register(C8) -) -{ - ConnectData OUT; - - // Vert Position - OUT.hpos = mul(modelview, float4(IN.position.xyz,1)); - - // skybox - - // Diffuse Color - - // Reflect Cube - float3 cubeVertPos = mul(objTrans, float4(IN.position,1)).xyz; - float3 cubeNormal = ( mul( (objTrans), float4(IN.normal, 0) ) ).xyz; - cubeNormal = bool(length(cubeNormal)) ? normalize(cubeNormal) : cubeNormal; - float3 eyeToVert = cubeVertPos - eyePosWorld; - OUT.reflectVec = reflect(eyeToVert, cubeNormal); - - // HDR Output - - return OUT; -} diff --git a/Templates/BaseGame/game/data/shaderCache/autogenConditioners.h b/Templates/BaseGame/game/data/shaderCache/autogenConditioners.h deleted file mode 100644 index e8b089810..000000000 --- a/Templates/BaseGame/game/data/shaderCache/autogenConditioners.h +++ /dev/null @@ -1,36 +0,0 @@ -//------------------------------------------------------------------------------ -// Autogenerated 'GBuffer Conditioner' Condition Method -//------------------------------------------------------------------------------ -vec4 autogenCondition_55070f7a(vec4 unconditionedOutput) -{ - // g-buffer conditioner: float4(normal.X, normal.Y, depth Hi, depth Lo) - float4 _gbConditionedOutput = float4(sqrt(half(2.0/(1.0 - unconditionedOutput.y))) * half2(unconditionedOutput.xz), 0.0, unconditionedOutput.a); - - // Encode depth into hi/lo - float2 _tempDepth = frac(unconditionedOutput.a * float2(1.0, 65535.0)); - _gbConditionedOutput.zw = _tempDepth.xy - _tempDepth.yy * float2(1.0/65535.0, 0.0); - - - return _gbConditionedOutput; -} - - -//------------------------------------------------------------------------------ -// Autogenerated 'GBuffer Conditioner' Uncondition Method -//------------------------------------------------------------------------------ -float4 autogenUncondition_55070f7a(sampler2D deferredSamplerVar, float2 screenUVVar) -{ - // Sampler g-buffer -float4 bufferSample = tex2Dlod(deferredSamplerVar, float4(screenUVVar,0,0)); - // g-buffer unconditioner: float4(normal.X, normal.Y, depth Hi, depth Lo) - float2 _inpXY = bufferSample.xy; - float _xySQ = dot(_inpXY, _inpXY); - float4 _gbUnconditionedInput = float4( sqrt(half(1.0 - (_xySQ / 4.0))) * _inpXY, -1.0 + (_xySQ / 2.0), bufferSample.a).xzyw; - - // Decode depth - _gbUnconditionedInput.w = dot( bufferSample.zw, float2(1.0, 1.0/65535.0)); - - return _gbUnconditionedInput; -} - - diff --git a/Templates/BaseGame/game/data/shaderCache/b524839793fade4e_P.hlsl b/Templates/BaseGame/game/data/shaderCache/b524839793fade4e_P.hlsl deleted file mode 100644 index e935e60ba..000000000 --- a/Templates/BaseGame/game/data/shaderCache/b524839793fade4e_P.hlsl +++ /dev/null @@ -1,80 +0,0 @@ -//***************************************************************************** -// Torque -- HLSL procedural shader -//***************************************************************************** - -// Dependencies: -#include "core/rendering/shaders/lighting.hlsl" -//------------------------------------------------------------------------------ -// Autogenerated 'Light Buffer Conditioner [RGB]' Uncondition Method -//------------------------------------------------------------------------------ -inline void autogenUncondition_bde4cbab(in float4 bufferSample, out float3 lightColor, out float NL_att, out float specular) -{ - lightColor = bufferSample.rgb; - NL_att = dot(bufferSample.rgb, float3(0.3576, 0.7152, 0.1192)); - specular = bufferSample.a; -} - - -#include "core/rendering/shaders/torque.hlsl" - -// Features: -// Vert Position -// Base Texture -// Deferred RT Lighting -// Visibility -// HDR Output - -struct ConnectData -{ - float4 vpos : SV_Position; - float2 texCoord : TEXCOORD0; - float4 screenspacePos : TEXCOORD1; -}; - - -struct Fragout -{ - float4 col : SV_Target0; -}; - - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- -Fragout main( ConnectData IN, - uniform SamplerState diffuseMap : register(S0), - uniform Texture2D diffuseMapTex : register(T0), - uniform float4 rtParamslightInfoBuffer : register(C1), - uniform SamplerState lightInfoBuffer : register(S1), - uniform Texture2D lightInfoBufferTex : register(T1), - uniform float visibility : register(C0) -) -{ - Fragout OUT; - - // Vert Position - - // Base Texture -float4 diffuseColor = diffuseMapTex.Sample(diffuseMap, IN.texCoord); - OUT.col = diffuseColor; - - // Deferred RT Lighting - float2 uvScene = IN.screenspacePos.xy / IN.screenspacePos.w; - uvScene = ( uvScene + 1.0 ) / 2.0; - uvScene.y = 1.0 - uvScene.y; - uvScene = ( uvScene * rtParamslightInfoBuffer.zw ) + rtParamslightInfoBuffer.xy; - float3 d_lightcolor; - float d_NL_Att; - float d_specular; - lightinfoUncondition(lightInfoBufferTex.Sample(lightInfoBuffer, uvScene), d_lightcolor, d_NL_Att, d_specular); - OUT.col *= float4(d_lightcolor, 1.0); - - // Visibility - fizzle( IN.vpos.xy, visibility ); - - // HDR Output - OUT.col = hdrEncode( OUT.col ); - - - return OUT; -} diff --git a/Templates/BaseGame/game/data/shaderCache/b524839793fade4e_V.hlsl b/Templates/BaseGame/game/data/shaderCache/b524839793fade4e_V.hlsl deleted file mode 100644 index 3d55cf201..000000000 --- a/Templates/BaseGame/game/data/shaderCache/b524839793fade4e_V.hlsl +++ /dev/null @@ -1,57 +0,0 @@ -//***************************************************************************** -// Torque -- HLSL procedural shader -//***************************************************************************** - -// Dependencies: -#include "core/rendering/shaders/lighting.hlsl" -#include "core/rendering/shaders/torque.hlsl" - -// Features: -// Vert Position -// Base Texture -// Deferred RT Lighting -// Visibility -// HDR Output - -struct VertData -{ - float3 position : POSITION; - float3 normal : NORMAL; - float3 T : TANGENT; - float3 B : BINORMAL; - float2 texCoord : TEXCOORD0; -}; - - -struct ConnectData -{ - float4 hpos : SV_Position; - float2 out_texCoord : TEXCOORD0; - float4 screenspacePos : TEXCOORD1; -}; - - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- -ConnectData main( VertData IN, - uniform float4x4 modelview : register(C0) -) -{ - ConnectData OUT; - - // Vert Position - OUT.hpos = mul(modelview, float4(IN.position.xyz,1)); - - // Base Texture - OUT.out_texCoord = (float2)IN.texCoord; - - // Deferred RT Lighting - OUT.screenspacePos = OUT.hpos; - - // Visibility - - // HDR Output - - return OUT; -} diff --git a/Templates/BaseGame/game/data/shaderCache/c5e4ec9bb49846a9_P.hlsl b/Templates/BaseGame/game/data/shaderCache/c5e4ec9bb49846a9_P.hlsl deleted file mode 100644 index e85bd696f..000000000 --- a/Templates/BaseGame/game/data/shaderCache/c5e4ec9bb49846a9_P.hlsl +++ /dev/null @@ -1,87 +0,0 @@ -//***************************************************************************** -// Torque -- HLSL procedural shader -//***************************************************************************** - -// Dependencies: -#include "core/rendering/shaders/torque.hlsl" - -// Features: -// Vert Position -// Diffuse Color -// Deferred Shading: Empty Specular -// Deferred Shading: Mat Info Flags -// Eye Space Depth (Out) -// Visibility -// GBuffer Conditioner -// Deferred Material - -struct ConnectData -{ - float4 vpos : SV_Position; - float4 wsEyeVec : TEXCOORD0; - float3 gbNormal : TEXCOORD1; -}; - - -struct Fragout -{ - float4 col : SV_Target0; - float4 col1 : SV_Target1; - float4 col2 : SV_Target2; -}; - - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- -Fragout main( ConnectData IN, - uniform float4 diffuseMaterialColor : register(C0), - uniform float matInfoFlags : register(C1), - uniform float3 vEye : register(C3), - uniform float4 oneOverFarplane : register(C4), - uniform float visibility : register(C2) -) -{ - Fragout OUT; - - // Vert Position - - // Diffuse Color - OUT.col1 = float4(1.0,1.0,1.0,1.0); - OUT.col1 = diffuseMaterialColor; - - // Deferred Shading: Empty Specular - OUT.col2.g = 1.0; - OUT.col2.ba = 0.0; - - // Deferred Shading: Mat Info Flags - OUT.col2.r = matInfoFlags; - - // Eye Space Depth (Out) -#ifndef CUBE_SHADOW_MAP - float eyeSpaceDepth = dot(vEye, (IN.wsEyeVec.xyz / IN.wsEyeVec.w)); -#else - float eyeSpaceDepth = length( IN.wsEyeVec.xyz / IN.wsEyeVec.w ) * oneOverFarplane.x; -#endif - - // Visibility - fizzle( IN.vpos.xy, visibility ); - - // GBuffer Conditioner - float4 normal_depth = float4(normalize(IN.gbNormal), eyeSpaceDepth); - - // output buffer format: GFXFormatR16G16B16A16F - // g-buffer conditioner: float4(normal.X, normal.Y, depth Hi, depth Lo) - float4 _gbConditionedOutput = float4(sqrt(half(2.0/(1.0 - normal_depth.y))) * half2(normal_depth.xz), 0.0, normal_depth.a); - - // Encode depth into hi/lo - float2 _tempDepth = frac(normal_depth.a * float2(1.0, 65535.0)); - _gbConditionedOutput.zw = _tempDepth.xy - _tempDepth.yy * float2(1.0/65535.0, 0.0); - - OUT.col = _gbConditionedOutput; - - // Deferred Material - - - return OUT; -} diff --git a/Templates/BaseGame/game/data/shaderCache/c5e4ec9bb49846a9_V.hlsl b/Templates/BaseGame/game/data/shaderCache/c5e4ec9bb49846a9_V.hlsl deleted file mode 100644 index e27e33019..000000000 --- a/Templates/BaseGame/game/data/shaderCache/c5e4ec9bb49846a9_V.hlsl +++ /dev/null @@ -1,70 +0,0 @@ -//***************************************************************************** -// Torque -- HLSL procedural shader -//***************************************************************************** - -// Dependencies: -#include "core/rendering/shaders/torque.hlsl" - -// Features: -// Vert Position -// Diffuse Color -// Deferred Shading: Empty Specular -// Deferred Shading: Mat Info Flags -// Eye Space Depth (Out) -// Visibility -// GBuffer Conditioner -// Deferred Material - -struct VertData -{ - float3 position : POSITION; - float3 normal : NORMAL; - float3 T : TANGENT; - float3 B : BINORMAL; - float2 texCoord : TEXCOORD0; - float2 texCoord2 : TEXCOORD1; -}; - - -struct ConnectData -{ - float4 hpos : SV_Position; - float4 wsEyeVec : TEXCOORD0; - float3 gbNormal : TEXCOORD1; -}; - - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- -ConnectData main( VertData IN, - uniform float4x4 modelview : register(C0), - uniform float4x4 objTrans : register(C4), - uniform float3 eyePosWorld : register(C12), - uniform float4x4 worldViewOnly : register(C8) -) -{ - ConnectData OUT; - - // Vert Position - OUT.hpos = mul(modelview, float4(IN.position.xyz,1)); - - // Diffuse Color - - // Deferred Shading: Empty Specular - - // Deferred Shading: Mat Info Flags - - // Eye Space Depth (Out) - float3 depthPos = mul( objTrans, float4( IN.position.xyz, 1 ) ).xyz; - OUT.wsEyeVec = float4( depthPos.xyz - eyePosWorld, 1 ); - - // Visibility - - // GBuffer Conditioner - OUT.gbNormal = mul(worldViewOnly, float4( normalize(IN.normal), 0.0 ) ).xyz; - - // Deferred Material - - return OUT; -} diff --git a/Templates/BaseGame/game/data/shaderCache/c74b275969540357_P.hlsl b/Templates/BaseGame/game/data/shaderCache/c74b275969540357_P.hlsl deleted file mode 100644 index 3933a59ca..000000000 --- a/Templates/BaseGame/game/data/shaderCache/c74b275969540357_P.hlsl +++ /dev/null @@ -1,47 +0,0 @@ -//***************************************************************************** -// Torque -- HLSL procedural shader -//***************************************************************************** - -// Dependencies: -#include "core/rendering/shaders/torque.hlsl" - -// Features: -// Paraboloid Vert Transform -// Visibility -// Depth (Out) - -struct ConnectData -{ - float4 vpos : SV_Position; - float2 posXY : TEXCOORD0; - float depth : TEXCOORD1; -}; - - -struct Fragout -{ - float4 col : SV_Target0; -}; - - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- -Fragout main( ConnectData IN, - uniform float visibility : register(C0) -) -{ - Fragout OUT; - - // Paraboloid Vert Transform - clip( 1.0 - abs(IN.posXY.x) ); - - // Visibility - fizzle( IN.vpos.xy, visibility ); - - // Depth (Out) - OUT.col = float4( IN.depth, 0, 0, 1 ); - - - return OUT; -} diff --git a/Templates/BaseGame/game/data/shaderCache/c74b275969540357_V.hlsl b/Templates/BaseGame/game/data/shaderCache/c74b275969540357_V.hlsl deleted file mode 100644 index be4cd1c15..000000000 --- a/Templates/BaseGame/game/data/shaderCache/c74b275969540357_V.hlsl +++ /dev/null @@ -1,61 +0,0 @@ -//***************************************************************************** -// Torque -- HLSL procedural shader -//***************************************************************************** - -// Dependencies: -#include "core/rendering/shaders/torque.hlsl" - -// Features: -// Paraboloid Vert Transform -// Visibility -// Depth (Out) - -struct VertData -{ - float3 position : POSITION; - float3 normal : NORMAL; - float3 T : TANGENT; - float3 B : BINORMAL; - float2 texCoord : TEXCOORD0; -}; - - -struct ConnectData -{ - float4 hpos : SV_Position; - float2 posXY : TEXCOORD0; - float depth : TEXCOORD1; -}; - - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- -ConnectData main( VertData IN, - uniform float2 atlasScale : register(C4), - uniform float4x4 worldViewOnly : register(C0), - uniform float4 lightParams : register(C5), - uniform float2 atlasXOffset : register(C6) -) -{ - ConnectData OUT; - - // Paraboloid Vert Transform - OUT.hpos = mul(worldViewOnly, float4(IN.position.xyz,1)).xzyw; - float L = length(OUT.hpos.xyz); - OUT.hpos /= L; - OUT.hpos.z = OUT.hpos.z + 1.0; - OUT.hpos.xy /= OUT.hpos.z; - OUT.hpos.z = L / lightParams.x; - OUT.hpos.w = 1.0; - OUT.posXY = OUT.hpos.xy; - OUT.hpos.xy *= atlasScale.xy; - OUT.hpos.xy += atlasXOffset; - - // Visibility - - // Depth (Out) - OUT.depth = OUT.hpos.z / OUT.hpos.w; - - return OUT; -} diff --git a/Templates/BaseGame/game/data/shaderCache/d653a08573e79020_P.hlsl b/Templates/BaseGame/game/data/shaderCache/d653a08573e79020_P.hlsl deleted file mode 100644 index 2c0e0ccda..000000000 --- a/Templates/BaseGame/game/data/shaderCache/d653a08573e79020_P.hlsl +++ /dev/null @@ -1,52 +0,0 @@ -//***************************************************************************** -// Torque -- HLSL procedural shader -//***************************************************************************** - -// Dependencies: -#include "core/rendering/shaders/torque.hlsl" - -// Features: -// Vert Position -// Eye Space Depth (Out) -// Visibility - -struct ConnectData -{ - float4 vpos : SV_Position; - float4 wsEyeVec : TEXCOORD0; -}; - - -struct Fragout -{ - float4 col : SV_Target0; -}; - - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- -Fragout main( ConnectData IN, - uniform float3 vEye : register(C1), - uniform float4 oneOverFarplane : register(C2), - uniform float visibility : register(C0) -) -{ - Fragout OUT; - - // Vert Position - - // Eye Space Depth (Out) -#ifndef CUBE_SHADOW_MAP - float eyeSpaceDepth = dot(vEye, (IN.wsEyeVec.xyz / IN.wsEyeVec.w)); -#else - float eyeSpaceDepth = length( IN.wsEyeVec.xyz / IN.wsEyeVec.w ) * oneOverFarplane.x; -#endif - OUT.col = float4(eyeSpaceDepth.rrr,1); - - // Visibility - fizzle( IN.vpos.xy, visibility ); - - - return OUT; -} diff --git a/Templates/BaseGame/game/data/shaderCache/d653a08573e79020_V.hlsl b/Templates/BaseGame/game/data/shaderCache/d653a08573e79020_V.hlsl deleted file mode 100644 index f7db2ba1f..000000000 --- a/Templates/BaseGame/game/data/shaderCache/d653a08573e79020_V.hlsl +++ /dev/null @@ -1,51 +0,0 @@ -//***************************************************************************** -// Torque -- HLSL procedural shader -//***************************************************************************** - -// Dependencies: -#include "core/rendering/shaders/torque.hlsl" - -// Features: -// Vert Position -// Eye Space Depth (Out) -// Visibility - -struct VertData -{ - float3 position : POSITION; - float3 normal : NORMAL; - float3 T : TANGENT; - float3 B : BINORMAL; - float2 texCoord : TEXCOORD0; -}; - - -struct ConnectData -{ - float4 hpos : SV_Position; - float4 wsEyeVec : TEXCOORD0; -}; - - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- -ConnectData main( VertData IN, - uniform float4x4 modelview : register(C0), - uniform float4x4 objTrans : register(C4), - uniform float3 eyePosWorld : register(C8) -) -{ - ConnectData OUT; - - // Vert Position - OUT.hpos = mul(modelview, float4(IN.position.xyz,1)); - - // Eye Space Depth (Out) - float3 depthPos = mul( objTrans, float4( IN.position.xyz, 1 ) ).xyz; - OUT.wsEyeVec = float4( depthPos.xyz - eyePosWorld, 1 ); - - // Visibility - - return OUT; -} diff --git a/Templates/BaseGame/game/data/shaderCache/efef832dc37c8755_P.hlsl b/Templates/BaseGame/game/data/shaderCache/efef832dc37c8755_P.hlsl deleted file mode 100644 index bc61ae75d..000000000 --- a/Templates/BaseGame/game/data/shaderCache/efef832dc37c8755_P.hlsl +++ /dev/null @@ -1,69 +0,0 @@ -//***************************************************************************** -// Torque -- HLSL procedural shader -//***************************************************************************** - -// Dependencies: -#include "core/rendering/shaders/torque.hlsl" - -// Features: -// Vert Position -// Diffuse Color -// Diffuse Vertex Color -// Visibility -// Fog -// HDR Output -// Forward Shaded Material -// Translucent - -struct ConnectData -{ - float4 vpos : SV_Position; - float4 vertColor : COLOR; - float3 wsPosition : TEXCOORD0; -}; - - -struct Fragout -{ - float4 col : SV_Target0; -}; - - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- -Fragout main( ConnectData IN, - uniform float4 diffuseMaterialColor : register(C0), - uniform float visibility : register(C1), - uniform float4 fogColor : register(C2), - uniform float3 eyePosWorld : register(C3), - uniform float3 fogData : register(C4) -) -{ - Fragout OUT; - - // Vert Position - - // Diffuse Color - OUT.col = diffuseMaterialColor; - - // Diffuse Vertex Color - OUT.col *= IN.vertColor; - - // Visibility - OUT.col.a *= visibility; - - // Fog - float fogAmount = saturate( computeSceneFog( eyePosWorld, IN.wsPosition, fogData.r, fogData.g, fogData.b ) ); - OUT.col.rgb = lerp( fogColor.rgb, OUT.col.rgb, fogAmount ); - - // HDR Output - OUT.col = hdrEncode( OUT.col ); - - // Forward Shaded Material - - // Translucent - - - return OUT; -} diff --git a/Templates/BaseGame/game/data/shaderCache/efef832dc37c8755_V.hlsl b/Templates/BaseGame/game/data/shaderCache/efef832dc37c8755_V.hlsl deleted file mode 100644 index b3f3e673f..000000000 --- a/Templates/BaseGame/game/data/shaderCache/efef832dc37c8755_V.hlsl +++ /dev/null @@ -1,63 +0,0 @@ -//***************************************************************************** -// Torque -- HLSL procedural shader -//***************************************************************************** - -// Dependencies: -#include "core/rendering/shaders/torque.hlsl" - -// Features: -// Vert Position -// Diffuse Color -// Diffuse Vertex Color -// Visibility -// Fog -// HDR Output -// Forward Shaded Material -// Translucent - -struct VertData -{ - float3 position : POSITION; - float4 diffuse : COLOR; -}; - - -struct ConnectData -{ - float4 hpos : SV_Position; - float4 vertColor : COLOR; - float3 outWsPosition : TEXCOORD0; -}; - - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- -ConnectData main( VertData IN, - uniform float4x4 modelview : register(C0), - uniform float4x4 objTrans : register(C4) -) -{ - ConnectData OUT; - - // Vert Position - OUT.hpos = mul(modelview, float4(IN.position.xyz,1)); - - // Diffuse Color - - // Diffuse Vertex Color - OUT.vertColor = IN.diffuse; - - // Visibility - - // Fog - OUT.outWsPosition = mul( objTrans, float4( IN.position.xyz, 1 ) ).xyz; - - // HDR Output - - // Forward Shaded Material - - // Translucent - - return OUT; -} diff --git a/Templates/BaseGame/game/data/shaderCache/f04ad263e891c04c_P.hlsl b/Templates/BaseGame/game/data/shaderCache/f04ad263e891c04c_P.hlsl deleted file mode 100644 index d549fabd2..000000000 --- a/Templates/BaseGame/game/data/shaderCache/f04ad263e891c04c_P.hlsl +++ /dev/null @@ -1,52 +0,0 @@ -//***************************************************************************** -// Torque -- HLSL procedural shader -//***************************************************************************** - -// Dependencies: -#include "core/rendering/shaders/torque.hlsl" - -// Features: -// Paraboloid Vert Transform -// Visibility -// Depth (Out) -// Single Pass Paraboloid - -struct ConnectData -{ - float4 vpos : SV_Position; - float isBack : TEXCOORD0; - float2 posXY : TEXCOORD1; - float depth : TEXCOORD2; -}; - - -struct Fragout -{ - float4 col : SV_Target0; -}; - - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- -Fragout main( ConnectData IN, - uniform float visibility : register(C0) -) -{ - Fragout OUT; - - // Paraboloid Vert Transform - clip( abs( IN.isBack ) - 0.999 ); - clip( 1.0 - abs(IN.posXY.x) ); - - // Visibility - fizzle( IN.vpos.xy, visibility ); - - // Depth (Out) - OUT.col = float4( IN.depth, 0, 0, 1 ); - - // Single Pass Paraboloid - - - return OUT; -} diff --git a/Templates/BaseGame/game/data/shaderCache/f04ad263e891c04c_V.hlsl b/Templates/BaseGame/game/data/shaderCache/f04ad263e891c04c_V.hlsl deleted file mode 100644 index 847482580..000000000 --- a/Templates/BaseGame/game/data/shaderCache/f04ad263e891c04c_V.hlsl +++ /dev/null @@ -1,67 +0,0 @@ -//***************************************************************************** -// Torque -- HLSL procedural shader -//***************************************************************************** - -// Dependencies: -#include "core/rendering/shaders/torque.hlsl" - -// Features: -// Paraboloid Vert Transform -// Visibility -// Depth (Out) -// Single Pass Paraboloid - -struct VertData -{ - float3 position : POSITION; - float3 normal : NORMAL; - float3 T : TANGENT; - float3 B : BINORMAL; - float2 texCoord : TEXCOORD0; -}; - - -struct ConnectData -{ - float4 hpos : SV_Position; - float isBack : TEXCOORD0; - float2 posXY : TEXCOORD1; - float depth : TEXCOORD2; -}; - - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- -ConnectData main( VertData IN, - uniform float2 atlasScale : register(C4), - uniform float4x4 worldViewOnly : register(C0), - uniform float4 lightParams : register(C5) -) -{ - ConnectData OUT; - - // Paraboloid Vert Transform - OUT.hpos = mul(worldViewOnly, float4(IN.position.xyz,1)).xzyw; - float L = length(OUT.hpos.xyz); - bool isBack = OUT.hpos.z < 0.0; - OUT.isBack = isBack ? -1.0 : 1.0; - if ( isBack ) OUT.hpos.z = -OUT.hpos.z; - OUT.hpos /= L; - OUT.hpos.z = OUT.hpos.z + 1.0; - OUT.hpos.xy /= OUT.hpos.z; - OUT.hpos.z = L / lightParams.x; - OUT.hpos.w = 1.0; - OUT.posXY = OUT.hpos.xy; - OUT.hpos.xy *= atlasScale.xy; - OUT.hpos.x += isBack ? 0.5 : -0.5; - - // Visibility - - // Depth (Out) - OUT.depth = OUT.hpos.z / OUT.hpos.w; - - // Single Pass Paraboloid - - return OUT; -} diff --git a/Templates/BaseGame/game/data/shaderCache/fd1301c841a0c80b_P.hlsl b/Templates/BaseGame/game/data/shaderCache/fd1301c841a0c80b_P.hlsl deleted file mode 100644 index e10b01aa1..000000000 --- a/Templates/BaseGame/game/data/shaderCache/fd1301c841a0c80b_P.hlsl +++ /dev/null @@ -1,84 +0,0 @@ -//***************************************************************************** -// Torque -- HLSL procedural shader -//***************************************************************************** - -// Dependencies: -#include "core/rendering/shaders/lighting.hlsl" -//------------------------------------------------------------------------------ -// Autogenerated 'Light Buffer Conditioner [RGB]' Uncondition Method -//------------------------------------------------------------------------------ -inline void autogenUncondition_bde4cbab(in float4 bufferSample, out float3 lightColor, out float NL_att, out float specular) -{ - lightColor = bufferSample.rgb; - NL_att = dot(bufferSample.rgb, float3(0.3576, 0.7152, 0.1192)); - specular = bufferSample.a; -} - - -#include "core/rendering/shaders/torque.hlsl" - -// Features: -// Vert Position -// Detail -// Diffuse Color -// Deferred RT Lighting -// Visibility -// HDR Output - -struct ConnectData -{ - float4 vpos : SV_Position; - float2 detCoord : TEXCOORD0; - float4 screenspacePos : TEXCOORD1; -}; - - -struct Fragout -{ - float4 col : SV_Target0; -}; - - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- -Fragout main( ConnectData IN, - uniform SamplerState detailMap : register(S0), - uniform Texture2D detailMapTex : register(T0), - uniform float4 diffuseMaterialColor : register(C0), - uniform float4 rtParamslightInfoBuffer : register(C2), - uniform SamplerState lightInfoBuffer : register(S1), - uniform Texture2D lightInfoBufferTex : register(T1), - uniform float visibility : register(C1) -) -{ - Fragout OUT; - - // Vert Position - - // Detail - OUT.col = ( detailMapTex.Sample(detailMap, IN.detCoord) * 2.0 ) - 1.0; - - // Diffuse Color - OUT.col = diffuseMaterialColor; - - // Deferred RT Lighting - float2 uvScene = IN.screenspacePos.xy / IN.screenspacePos.w; - uvScene = ( uvScene + 1.0 ) / 2.0; - uvScene.y = 1.0 - uvScene.y; - uvScene = ( uvScene * rtParamslightInfoBuffer.zw ) + rtParamslightInfoBuffer.xy; - float3 d_lightcolor; - float d_NL_Att; - float d_specular; - lightinfoUncondition(lightInfoBufferTex.Sample(lightInfoBuffer, uvScene), d_lightcolor, d_NL_Att, d_specular); - OUT.col *= float4(d_lightcolor, 1.0); - - // Visibility - fizzle( IN.vpos.xy, visibility ); - - // HDR Output - OUT.col = hdrEncode( OUT.col ); - - - return OUT; -} diff --git a/Templates/BaseGame/game/data/shaderCache/fd1301c841a0c80b_V.hlsl b/Templates/BaseGame/game/data/shaderCache/fd1301c841a0c80b_V.hlsl deleted file mode 100644 index ae63bd6d3..000000000 --- a/Templates/BaseGame/game/data/shaderCache/fd1301c841a0c80b_V.hlsl +++ /dev/null @@ -1,73 +0,0 @@ -//***************************************************************************** -// Torque -- HLSL procedural shader -//***************************************************************************** - -// Dependencies: -#include "core/rendering/shaders/lighting.hlsl" -//------------------------------------------------------------------------------ -// Autogenerated 'Light Buffer Conditioner [RGB]' Uncondition Method -//------------------------------------------------------------------------------ -inline void autogenUncondition_bde4cbab(in float4 bufferSample, out float3 lightColor, out float NL_att, out float specular) -{ - lightColor = bufferSample.rgb; - NL_att = dot(bufferSample.rgb, float3(0.3576, 0.7152, 0.1192)); - specular = bufferSample.a; -} - - -#include "core/rendering/shaders/torque.hlsl" - -// Features: -// Vert Position -// Detail -// Diffuse Color -// Deferred RT Lighting -// Visibility -// HDR Output - -struct VertData -{ - float3 position : POSITION; - float3 normal : NORMAL; - float3 T : TANGENT; - float3 B : BINORMAL; - float2 texCoord : TEXCOORD0; - float2 texCoord2 : TEXCOORD1; -}; - - -struct ConnectData -{ - float4 hpos : SV_Position; - float2 detCoord : TEXCOORD0; - float4 screenspacePos : TEXCOORD1; -}; - - -//----------------------------------------------------------------------------- -// Main -//----------------------------------------------------------------------------- -ConnectData main( VertData IN, - uniform float4x4 modelview : register(C0), - uniform float2 detailScale : register(C4) -) -{ - ConnectData OUT; - - // Vert Position - OUT.hpos = mul(modelview, float4(IN.position.xyz,1)); - - // Detail - OUT.detCoord = IN.texCoord * detailScale; - - // Diffuse Color - - // Deferred RT Lighting - OUT.screenspacePos = OUT.hpos; - - // Visibility - - // HDR Output - - return OUT; -}