mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-27 16:19:34 +00:00
Add blend contrast slider
This commit is contained in:
parent
6f23dd191d
commit
1ffec9ab56
7 changed files with 152 additions and 29 deletions
|
|
@ -1425,6 +1425,16 @@ void TerrainHeightMapBlendHLSL::processPix(Vector<ShaderComponent*>& componentLi
|
|||
blendDepth->constSortPos = cspPrimitive;
|
||||
}
|
||||
|
||||
Var* blendContrast = (Var*)LangElement::find(String::ToString("blendContrast%d", idx));
|
||||
if (!blendContrast)
|
||||
{
|
||||
blendContrast = new Var;
|
||||
blendContrast->setType("float");
|
||||
blendContrast->setName(String::ToString("blendContrast%d", idx));
|
||||
blendContrast->uniform = true;
|
||||
blendContrast->constSortPos = cspPrimitive;
|
||||
}
|
||||
|
||||
Var* detailH = (Var*)LangElement::find(String::ToString("detailH%d", idx));
|
||||
if (!detailH)
|
||||
{
|
||||
|
|
@ -1445,6 +1455,10 @@ void TerrainHeightMapBlendHLSL::processPix(Vector<ShaderComponent*>& componentLi
|
|||
meta->addStatement(new GenOp(" @ = clamp(0.5 + @, 0.0, 1.0);\r\n",
|
||||
detailH, blendDepth));
|
||||
}
|
||||
|
||||
meta->addStatement(new GenOp(" @ = ((@ - 0.5f) * max(@, 0.0f)) + 0.5f;\r\n",
|
||||
detailH, detailH, blendContrast));
|
||||
|
||||
meta->addStatement(new GenOp(" }\r\n"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -648,6 +648,7 @@ bool TerrainCellMaterial::_initShader(bool deferredMat,
|
|||
continue;
|
||||
|
||||
mMaterialInfos[i]->mBlendDepthConst = mShader->getShaderConstHandle(avar("$blendDepth%d", i));
|
||||
mMaterialInfos[i]->mBlendContrastConst = mShader->getShaderConstHandle(avar("$blendContrast%d", i));
|
||||
}
|
||||
|
||||
// If we're doing deferred it requires some
|
||||
|
|
@ -719,6 +720,7 @@ void TerrainCellMaterial::_updateMaterialConsts( )
|
|||
detailInfoArray[j] = detailIdStrengthParallax;
|
||||
|
||||
mConsts->setSafe(matInfo->mBlendDepthConst, matInfo->mat->getBlendDepth());
|
||||
mConsts->setSafe(matInfo->mBlendContrastConst, matInfo->mat->getBlendContrast());
|
||||
}
|
||||
|
||||
mConsts->setSafe(mDetailInfoVArrayConst, detailScaleAndFadeArray);
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ protected:
|
|||
TerrainMaterial *mat;
|
||||
U32 layerId;
|
||||
GFXShaderConstHandle* mBlendDepthConst;
|
||||
GFXShaderConstHandle* mBlendContrastConst;
|
||||
};
|
||||
|
||||
///
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ TerrainMaterial::TerrainMaterial()
|
|||
mMacroDistance( 500.0f ),
|
||||
mParallaxScale( 0.0f ),
|
||||
mBlendDepth( 0.5f ),
|
||||
mBlendContrast( 1.0f ),
|
||||
mIsSRGB(false),
|
||||
mInvertRoughness(false)
|
||||
{
|
||||
|
|
@ -92,7 +93,10 @@ void TerrainMaterial::initPersistFields()
|
|||
addField( "parallaxScale", TypeF32, Offset( mParallaxScale, TerrainMaterial ), "Used to scale the height from the normal map to give some self "
|
||||
"occlusion effect (aka parallax) to the terrain material" );
|
||||
|
||||
addField("blendDepth", TypeF32, Offset(mBlendDepth, TerrainMaterial), "Depth for blending the textures using the new blending method by Lukas Joergensen."
|
||||
addField("blendHeightBase", TypeF32, Offset(mBlendDepth, TerrainMaterial), "A fixed value to add while blending using heightmap-based blending."
|
||||
"Higher numbers = larger blend radius.");
|
||||
|
||||
addField("blendHeightContrast", TypeF32, Offset(mBlendContrast, TerrainMaterial), "A fixed value to add while blending using heightmap-based blending."
|
||||
"Higher numbers = larger blend radius.");
|
||||
|
||||
scriptBindMapSlot(DetailMap, TerrainMaterial, "Raises and lowers the RGB result of the Base Albedo up close.");
|
||||
|
|
|
|||
|
|
@ -90,6 +90,8 @@ protected:
|
|||
/// radius.
|
||||
F32 mBlendDepth;
|
||||
|
||||
F32 mBlendContrast;
|
||||
|
||||
public:
|
||||
|
||||
TerrainMaterial();
|
||||
|
|
@ -129,6 +131,8 @@ public:
|
|||
|
||||
F32 getBlendDepth() const { return mBlendDepth; }
|
||||
|
||||
F32 getBlendContrast() const { return mBlendContrast; }
|
||||
|
||||
bool getIsSRGB() const { return mIsSRGB; }
|
||||
|
||||
bool getInvertRoughness() const { return mInvertRoughness; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue