主要工作:
本週完成的第一個工作是完成了材質,系統進入界面和動畫的製作。
工作介紹:
1.首先創建一個空的關卡:名字取爲start
2.進行地形的搭建,這裏的材質製作採用了多材質混合的方法。具體步驟如下:
a.創建一個材質球,爲了方便識別取名爲m_Mont:
b.利用LandscapeLayerWeight方法進行Texture的融合。base表示被添加的對象,Layer表示要添加的層對象,LandscapeLayerCoords(景觀層座標)用來生成UV座標,這個座標是將材質網絡映射到地形地貌上。
c.將這個材質球賦給landscape.可以看到在地貌-描畫-窗口看到添加上去的材質,這時的材質會發現還無法使用,需要點擊加號創建層信息,一般選擇權重法向那個,之後就會發現生成了地貌層信息文件,這樣材質纔可以開始使用:
d.使用時需要那個材質就點擊那個材質用描畫工具在landscape上進行操作,最終結果圖:
3.進行水面材質的製作:爲了讓水面達到一種波光鱗裏的效果,需要對材質進行重複偏移。下面是具體操作步驟:
a .將材質類型改爲Translucent
b.在基礎色上添加自己想要的水面顏色:
c.爲了製造波光粼粼的效果,添加法線方向的偏移,獲取系統的時間,利用Panner控制UV的偏移速度,選擇一張高度貼圖,可以產生動態效果:
d.之後設置反射光和折射光,lerp實現線性過渡,Feature Level Switch方法,輸出參數爲5個,下面表示的是四種不同的設備,是爲了保證在不同的設備上都可以平滑過渡。:
e.看一下總的:
#include "CoreMinimal.h" #include "UObject/ObjectMacros.h" #include "Misc/Guid.h" #include "RenderCommandFence.h" #include "Materials/MaterialInterface.h" #include "StaticParameterSet.h" #include "MaterialShared.h" #include "Materials/MaterialExpressionMaterialFunctionCall.h" #include "Materials/Material.h" #include "Materials/MaterialInstanceBasePropertyOverrides.h" #include "Misc/App.h" #include "MaterialInstance.generated.h" class ITargetPlatform; class UPhysicalMaterial; class USubsurfaceProfile; class UTexture;
UCLASS(abstract, BlueprintType,MinimalAPI)
USTRUCT(BlueprintType)
struct FTextureParameterValue
{
GENERATED_USTRUCT_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=TextureParameterValue)
FName ParameterName;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=TextureParameterValue)
class UTexture* ParameterValue;
UPROPERTY()
FGuid ExpressionGUID;
FTextureParameterValue()
: ParameterValue(NULL)
{
}
typedef const UTexture* ValueType;
static ValueType GetValue(const FTextureParameterValue& Parameter) { return Parameter.ParameterValue; }
};
USTRUCT(BlueprintType)
struct FVectorParameter
{
GENERATED_USTRUCT_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=VectorParameterValue)
FName ParameterName;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=VectorParameterValue)
FLinearColor ParameterValue;
UPROPERTY()
FGuid ExpressionGUID;
FVectorParameterValue()
: ParameterValue(ForceInit)
{
}
typedef FLinearColor ValueType;
static ValueType GetValue(const FVectorParameterValue& Parameter) { return Parameter.ParameterValue; }
};
4.進行UI界面的製作:
a.創建一個用戶交互控件:
b.簡單做出一個demo:
c.button上的字體是在button上增加text產生的。
d.綁定button的觸發事件,利用Execute Console Command方法,實現退出,Open Level方法實現關卡的切換:
e.在關卡藍圖中添加該控件,纔可以顯示出來,利用show Mouse Cursor方法,讓鼠標在UI時顯示出來,Set Input Mode UI Only 可以將用戶的操控控制在UI上面,無法進行其他操作: