Aaron/floorheightfix (#5909)
* Added local frame option. Fixed inputs for NN * Add Textures * Changed texture to grayscale RGB and added check for 'air' particles * Updated 2k and 4k textures enable parameter for select res texture for deformation * Fix issue where trying to access TMap when loading * Use contains functions instead of checking num of elemnts on tmap to make a secure access * Used ParticlesHeightmap optimization and clear some log * Fixed number of particles inputs. Removed debug output. Fixed mutex creating cpu stalls * Decoupling visualization with gamethread * Make work optimisations * Disable deformation visualization * Updated collisions parameters, collisions itself are not updated * Disable Collisions vehicle with landscape * Add in pytorch output wheel normal and put them into UE4 and apply to wheels * Added factors based on distance, never negative, check if there are particles * Fix compilation error * Removed unused code and normals related code * Fixed compiling error * Fix floor height Co-authored-by: Axel <axellopez92@outlook.com>
This commit is contained in:
parent
f963a4b2c3
commit
1d6fa23770
|
@ -184,6 +184,7 @@ void FDenseTile::InitializeTile(uint32_t TextureSize, float AffectedRadius, floa
|
|||
PartialHeightMapSize = TileSize * TextureSize / (2*AffectedRadius);
|
||||
std::string FileName = std::string(TCHAR_TO_UTF8(*( SavePath + TileOrigin.ToString() + ".tile" ) ) );
|
||||
|
||||
//UE_LOG(LogCarla, Log, TEXT("Tile origin %s"), *TileOrigin.ToString() );
|
||||
if( FPaths::FileExists(FString(FileName.c_str())) )
|
||||
{
|
||||
|
||||
|
@ -214,7 +215,6 @@ void FDenseTile::InitializeTile(uint32_t TextureSize, float AffectedRadius, floa
|
|||
{
|
||||
FDVector ParticleLocalPosition = FDVector(i*ParticleSize, j*ParticleSize, 0.0f);
|
||||
FDVector ParticlePosition = TileOrigin + ParticleLocalPosition;
|
||||
// UE_LOG(LogCarla, Log, TEXT(" Particle position %s"), *ParticlePosition.ToString());
|
||||
float Height = HeightMap.GetHeight(ParticlePosition);
|
||||
for(uint32_t k = 0; k < NumParticles_Z; k++)
|
||||
{
|
||||
|
@ -617,11 +617,8 @@ FDVector FSparseHighDetailMap::GetTilePosition(uint64_t TileId)
|
|||
|
||||
FDVector FSparseHighDetailMap::GetTilePosition(uint32_t Tile_X, uint32_t Tile_Y)
|
||||
{
|
||||
|
||||
FDVector Position = FDVector(Tile_X*TileSize, Tile_Y*TileSize, 0);
|
||||
FDVector Position = FDVector(Tile_X*TileSize, Tile_Y*TileSize, FloorHeight);
|
||||
Position = Position + Tile0Position;
|
||||
//UE_LOG(LogCarla, Log, TEXT("Getting location from id (%lu, %lu) %s"),
|
||||
// (unsigned long)Tile_X, (unsigned long)Tile_Y, *(Position).ToString());
|
||||
return Position;
|
||||
}
|
||||
|
||||
|
@ -1272,7 +1269,7 @@ void UCustomTerrainPhysicsComponent::BeginPlay()
|
|||
UE_LOG(LogCarla, Warning,
|
||||
TEXT("ParticleDiameter %f"), ParticleDiameter);
|
||||
|
||||
SparseMap.Init(TextureToUpdate->GetSizeX(), TextureRadius, ParticleDiameter * CMToM, TerrainDepth * CMToM);
|
||||
SparseMap.Init(TextureToUpdate->GetSizeX(), TextureRadius, ParticleDiameter * CMToM, TerrainDepth * CMToM, FloorHeight * CMToM );
|
||||
RootComponent = Cast<UPrimitiveComponent>(GetOwner()->GetRootComponent());
|
||||
if(LargeMapManager)
|
||||
{
|
||||
|
@ -1281,7 +1278,6 @@ void UCustomTerrainPhysicsComponent::BeginPlay()
|
|||
// UE_LOG(LogCarla, Log,
|
||||
// TEXT("World Size %s"), *(WorldSize.ToString()));
|
||||
}
|
||||
Tile0Origin.Z += FloorHeight;
|
||||
// SparseMap.InitializeMap(HeightMap, UEFrameToSI(Tile0Origin), UEFrameToSI(WorldSize),
|
||||
// 1.f, MinHeight, MaxHeight, HeightMapScaleFactor.Z);
|
||||
if (DataAsset)
|
||||
|
@ -1460,7 +1456,7 @@ void UCustomTerrainPhysicsComponent::TickComponent(float DeltaTime,
|
|||
FVector TilePosition = HeightMapOffset + LargeMapManager->GetTileLocation(CurrentLargeMapTileId) - 0.5f*FVector(LargeMapManager->GetTileSize(), -LargeMapManager->GetTileSize(), 0);
|
||||
UE_LOG(LogCarla, Log, TEXT("Updating height map to location %s in tile location %s"),
|
||||
*TilePosition.ToString(), *LargeMapManager->GetTileLocation(CurrentLargeMapTileId).ToString());
|
||||
TilePosition.Z += FloorHeight;
|
||||
TilePosition.Z += UEFrameToSI(FloorHeight) ;
|
||||
SparseMap.UpdateHeightMap(
|
||||
HeightMapDataAsset, UEFrameToSI(TilePosition), UEFrameToSI(FVector(
|
||||
LargeMapManager->GetTileSize(),-LargeMapManager->GetTileSize(), 0)),
|
||||
|
|
|
@ -115,12 +115,14 @@ public:
|
|||
FSparseHighDetailMap(float ParticleDiameter = 0.02f, float Depth = 0.4f)
|
||||
: ParticleSize(ParticleDiameter), TerrainDepth(Depth) {};
|
||||
|
||||
void Init( uint32 NewTextureSize, float NewAffectedRadius, float ParticleDiameter, float Depth)
|
||||
void Init( uint32 NewTextureSize, float NewAffectedRadius, float ParticleDiameter,
|
||||
float Depth, float NewFloorHeight )
|
||||
{
|
||||
ParticleSize = ParticleDiameter;
|
||||
TerrainDepth = Depth;
|
||||
TextureSize = NewTextureSize;
|
||||
AffectedRadius = NewAffectedRadius;
|
||||
FloorHeight = NewFloorHeight;
|
||||
UE_LOG(LogCarla, Warning,
|
||||
TEXT("ParticleSize %f"), ParticleSize);
|
||||
}
|
||||
|
@ -211,6 +213,7 @@ private:
|
|||
FHeightMapData Heightmap;
|
||||
float ParticleSize = 0.02f;
|
||||
float TerrainDepth = 0.4f;
|
||||
float FloorHeight = 0.0f;
|
||||
uint32 TextureSize = 0;
|
||||
float AffectedRadius = 0.0f;
|
||||
FVector PositionToUpdate;
|
||||
|
|
Loading…
Reference in New Issue