Various terrain improvements: (#3942)

* Various terrain improvements:
- Height now stored in a R16_unorm to decrease the amount of memory / memory bandwidth needed for the height field
- Many simplifications to the feature processor
- Added a shader to render to the depth pre pass
- Pulled common functionality needed by depth and forward to a common include shader
- Forward shader now outputs to all the expected render targets
- Adjusted the way normals and lighting are being calculated

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Adding missing shader files. Updated terrain shader to alter the color slightly with height.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Removed pixel shader code from terrain depth pass

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Renamed the depth pass shaders to no longer indicate they include a pixel shader.

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>

* Removing unneeded code from TerrainCommon.azsli

Signed-off-by: Ken Pruiksma <pruiksma@amazon.com>
This commit is contained in:
Ken Pruiksma
2021-09-09 12:56:16 -05:00
committed by GitHub
parent 6cb2222da8
commit d17ac748ac
11 changed files with 357 additions and 237 deletions
-1
View File
@@ -27,7 +27,6 @@ enum ObjectEvent
EVENT_OUTOFGAME, //!< Signals that editor is switching out of the game mode.
EVENT_REFRESH, //!< Signals that editor is refreshing level.
EVENT_DBLCLICK, //!< Signals that object have been double clicked.
EVENT_KEEP_HEIGHT, //!< Signals that object must preserve its height over changed terrain.
EVENT_RELOAD_ENTITY,//!< Signals that entities scripts must be reloaded.
EVENT_RELOAD_GEOM, //!< Signals that all possible geometries should be reloaded.
EVENT_UNLOAD_GEOM, //!< Signals that all possible geometries should be unloaded.
-14
View File
@@ -618,12 +618,6 @@ bool CBaseObject::SetPos(const Vec3& pos, int flags)
StoreUndo("Position", true, flags);
}
float terrainElevation = AzFramework::Terrain::TerrainDataRequests::GetDefaultTerrainHeight();
AzFramework::Terrain::TerrainDataRequestBus::BroadcastResult(terrainElevation
, &AzFramework::Terrain::TerrainDataRequests::GetHeightFromFloats
, pos.x, pos.y, AzFramework::Terrain::TerrainDataRequests::Sampler::BILINEAR, nullptr);
m_height = pos.z - terrainElevation;
if (!bPositionDelegated)
{
m_pos = pos;
@@ -1275,14 +1269,6 @@ void CBaseObject::OnEvent(ObjectEvent event)
{
switch (event)
{
case EVENT_KEEP_HEIGHT:
{
float h = m_height;
float newz = GetIEditor()->GetTerrainElevation(m_pos.x, m_pos.y) + m_height;
SetPos(Vec3(m_pos.x, m_pos.y, newz));
m_height = h;
}
break;
case EVENT_CONFIG_SPEC_CHANGE:
UpdateVisibility(!IsHidden());
break;
-2
View File
@@ -798,8 +798,6 @@ private:
//////////////////////////////////////////////////////////////////////////
//! Area radius around object, where terrain is flatten and static objects removed.
float m_flattenArea;
//! Every object keeps for itself height above terrain.
float m_height;
//! Object's name.
QString m_name;
//! Class description for this object.