虚幻插件Landscaping & Landscaping Mapbox

13 篇文章 1 订阅

虚幻插件Landscaping & Landscaping Mapbox

在这里插入图片描述
在这里插入图片描述
Landscaping offers an easy way to import GIS data as single Landscape or World Composition (UE4) or World Partition (UE5) or Procedural/Static Mesh.
提供了一种非常简单的方式来导入GIS数据,可以生成Landscape、静态网格体及程序化网格,支持导入shp数据等等,同时使用了Georeference插件,很好支持了常见的地理坐标。

  • 支持程序化生成道路;
  • 支持根据土地利用(landuse)shp数据生成地表植被;
  • 支持Mapbox在线地图纹理贴图;
  • 支持地形Landscape变形使得植被和道路贴合。

在这里插入图片描述

捕捉地面点代码片段

FVector SnapToFloor(FVector Location, float OffsetFromGround)
{
	UWorld* World = GEditor ? GEditor->GetEditorWorldContext(false).World() : nullptr;
	FVector HitPoint;
	FVector Start = FVector(Location.X, Location.Y, 900000);
	FVector End = Start + FVector::DownVector * 10000000;
	for (int i = 0; i < 3; i++)
	{
		if (GetSurfacePoint(Start, End, HitPoint, World))
		{
			return FVector(HitPoint.X, HitPoint.Y, HitPoint.Z + OffsetFromGround);
		}
		int sign = i % 2 == 0 ? -1 : 1;
		// if we are on the edge of a landscape, try a slight angle
		End = End + FVector(i * 15 * sign, i * 15 * sign, 0);
	}
	return Location;
}

bool GetSurfacePoint(FVector Start, FVector End, FVector& HitPoint, UWorld* InWorld)
{
	if (InWorld == nullptr)
	{
		return false;
	}
	FHitResult HitResult = FHitResult(ForceInitToZero);
	bool DidHit = InWorld->LineTraceSingleByChannel(
		HitResult,
		Start,
		End,
		ECC_Visibility
	);

	HitPoint = HitResult.ImpactPoint;
	return DidHit;
}

Github 相关内容

在这里插入图片描述

参考

  1. https://github.com/TensorWorks/LandscapeGen
  2. https://blog.csdn.net/mrbaolong/article/details/131731716
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值