元編程參考文件

海洋

15 個節點

本頁內容 15

新增海上的物體

函數

在海上放一個剛體後的海,剛體由長方體、球、膠囊等物體節點做出。比水(1025 千克/立方米)輕的物體浮著,隨波起伏、漂移、被波浪轉動;更重的會下沉。物體之間會碰撞。它們不擾動海面。

簽名
新增海上的物體 -> Ocean Scene Description
    場景: Ocean Scene Description
    物體: Body Description
OceanSceneDescription AddOceanBody(
    OceanSceneDescription scene,
    BodyDescription body)

參數

名稱型別預設值說明
場景Ocean Scene Description—The sea.
物體Body Description—The body; put it at about the sea's level, since one let go from high up plunges before it settles.

返回

結果Ocean Scene Description
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
海洋
所屬包
物理模擬

新增海洋觸發器

函數

給海上的物體加入一個觸發器後的海,觸發器由觸發器節點做出:到某一時刻,每隔一段時間,或者當一個物體碰到另一個、升過或落過某個高度、快過某個速度時,它推動一個物體、釋放一個被固定住的物體、生成一個物體的副本,或者移除一個物體。一箱一箱落水的貨物,被鬆開的浮標。觸發器在物體的每一步之後按加入順序被檢查;它們做了什麼,在“模擬海洋”的事件裡。海不接受“區域內有水”“引爆”“設定風”和“解除布料固定”,並且在這裡就說出來。

簽名
新增海洋觸發器 -> Ocean Scene Description
    場景: Ocean Scene Description
    觸發器: Trigger Description
OceanSceneDescription AddOceanTrigger(
    OceanSceneDescription scene,
    TriggerDescription trigger)

參數

名稱型別預設值說明
場景Ocean Scene Description—The sea.
觸發器Trigger Description—The trigger.

返回

結果Ocean Scene Description
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
海洋
所屬包
物理模擬

匯出海面網格

函數

把一段時間裡每一幀一個矩形範圍內的海面寫成網格檔案,單位為米,採用 Divooka 的座標軸(+Z 向上)。返回寫出的檔案。

簽名
匯出海面網格 -> 文字陣列
    場景: Ocean Scene Description
    資料夾: 文字
    中心: Vector3d
    X 大小: 數字
    Y 大小: 數字
    單元數: 整數
    時長: 數字
    每秒幀數: 數字
    字首: 文字
    格式: 文字
string[] ExportOceanMeshes(
    OceanSceneDescription scene,
    string folder,
    Vector3d center,
    double sizeX = 100,
    double sizeY = 100,
    int cells = 256,
    double duration = 2,
    double framesPerSecond = 24,
    string prefix = "ocean",
    string format = "ply")

參數

名稱型別預設值說明
場景Ocean Scene Description—The sea.
資料夾文字—The folder; created if missing.
中心Vector3d—The rectangle's middle (m).
X 大小數字100Its extent along X (m).
Y 大小數字100Its extent along Y (m).
單元數整數256Cells along its longer side.
時長數字2How long to run (s).
每秒幀數數字24Frames per second.
字首文字oceanFile name prefix: files are prefix.0001.ply and on.
格式文字plyThe file format: ply (binary, the smallest), obj or stl.

返回

結果文字陣列
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
海洋
所屬包
物理模擬

匯出海洋貼圖

函數

寫出一段時間裡海的貼圖:每一幀、三個區塊各一張位移貼圖(OpenEXR,16 位浮點,米)、一張法線貼圖和一張泡沫遮罩(PNG),命名為 字首.區塊.種類.幀號,另有一個文字檔案說明什麼按多大平鋪、各通道的含義。對於設了迴圈時間的海,執行這麼長,最後一幀就接回第一幀。返回寫出的檔案。

簽名
匯出海洋貼圖 -> 文字陣列
    場景: Ocean Scene Description
    資料夾: 文字
    時長: 數字
    每秒幀數: 數字
    字首: 文字
string[] ExportOceanTextures(
    OceanSceneDescription scene,
    string folder,
    double duration = 4,
    double framesPerSecond = 15,
    string prefix = "ocean")

參數

名稱型別預設值說明
場景Ocean Scene Description—The sea.
資料夾文字—The folder; created if missing.
時長數字4How long to run (s).
每秒幀數數字15Frames per second.
字首文字oceanFile name prefix.

返回

結果文字陣列
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
海洋
所屬包
物理模擬

新建海洋

函數

由風吹起的海,按風在一百公里水面上吹出的 JONSWAP 譜。它在三個各自重複的正方形區塊上算出,最大的是給定的大小,另兩個是它的五分之一和三十分之一,三者相加:長湧、波浪和漣漪。

簽名
新建海洋 -> Ocean Scene Description
    風速(米/秒): 數字
    風向(°): 數字
    大小: 數字
    解析度: 整數
    尖峭度: 數字
    種子: 整數
    迴圈: 數字
OceanSceneDescription NewOcean(
    double windSpeed = 10,
    double windDirection = 0,
    double size = 500,
    int resolution = 256,
    double choppiness = 1.1,
    int seed = 1,
    double loop = 0)

參數

名稱型別預設值說明
風速(米/秒)數字10The wind's speed (m/s): 5 is a breeze, 10 a fresh wind with whitecaps, 20 a gale with waves metres high.
風向(°)數字0Where the wind blows to, in degrees from +X towards +Y.
大小數字500The side (m) of the largest patch: the sea repeats beyond it, and its longest waves are shorter than it. A few hundred metres for an open sea, some tens for a close view of a light wind.
解析度整數256Texels along a side of each patch: 64, 128, 256, 512 or 1024.
尖峭度數字1.1How much the crests are sharpened: 0 a rolling swell, 1 as the theory has it, 1.3 folding into whitecaps.
種子整數1Another seed is another sea of the same wind.
迴圈數字0Make the sea repeat itself exactly after this time (s), for textures a game plays in a loop; 0: it never repeats.

返回

結果Ocean Scene Description
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
海洋
所屬包
物理模擬

海洋位移貼圖

函數

某一時刻海的一個區塊,作為可平鋪的位移貼圖:每個紋素記下那裡的水離開靜止位置移動了多遠(米),是一張浮點圖片,紅色是沿 X 的位移,綠色沿 Y,藍色是高度(Z)。列沿 +X,行沿 +Y,區塊的一角在原點。遊戲按三個區塊之和移動一張平面網格的頂點,每個區塊按自己的大小重複。在顯示卡上生成。

簽名
海洋位移貼圖 -> Hdr Pixel Image
    場景: Ocean Scene Description
    時間: 數字
    區塊: 整數
HdrPixelImage OceanDisplacementMap(
    OceanSceneDescription scene,
    double time,
    int patch = 0)

參數

名稱型別預設值說明
場景Ocean Scene Description—The sea.
時間數字—The time (s).
區塊整數0The patch, 0 (largest) to 2.

返回

結果Hdr Pixel Image
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
海洋
所屬包
物理模擬

海洋泡沫貼圖

函數

某一時刻海的一個區塊,作為可平鋪的泡沫遮罩:這個區塊的波峰尖起來的地方是白的,波峰剛經過的地方淡一些。微風幾乎不留泡沫;風速從大約 7 米/秒起有白浪,風越大越多。在顯示卡上生成。

簽名
海洋泡沫貼圖 -> Pixel Image
    場景: Ocean Scene Description
    時間: 數字
    區塊: 整數
PixelImage OceanFoamMap(
    OceanSceneDescription scene,
    double time,
    int patch = 0)

參數

名稱型別預設值說明
場景Ocean Scene Description—The sea.
時間數字—The time (s).
區塊整數0The patch, 0 (largest) to 2.

返回

結果Pixel Image
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
海洋
所屬包
物理模擬

海面高度

函數

某一時刻某一點上方的海面高度(米)。

簽名
海面高度 -> 數字
    場景: Ocean Scene Description
    時間: 數字
    位置: Vector3d
double OceanHeight(
    OceanSceneDescription scene,
    double time,
    Vector3d position)

參數

名稱型別預設值說明
場景Ocean Scene Description—The sea.
時間數字—The time (s).
位置Vector3d—The point; its Z is not used.

返回

結果數字
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
海洋
所屬包
物理模擬

海洋法線貼圖

函數

某一時刻海的一個區塊,作為可平鋪的法線貼圖:每個紋素記下表面朝向哪裡,紅和綠是沿 X 和 Y 的傾斜,藍是向上,各寫成 0.5 + 0.5 × 分量,即法線貼圖通常的存法。在顯示卡上生成。

簽名
海洋法線貼圖 -> Pixel Image
    場景: Ocean Scene Description
    時間: 數字
    區塊: 整數
PixelImage OceanNormalMap(
    OceanSceneDescription scene,
    double time,
    int patch = 0)

參數

名稱型別預設值說明
場景Ocean Scene Description—The sea.
時間數字—The time (s).
區塊整數0The patch, 0 (largest) to 2.

返回

結果Pixel Image
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
海洋
所屬包
物理模擬

海洋區塊大小

函數

海的三個區塊之一的邊長(米):0 是最大的(長湧),2 是最小的(漣漪)。每個區塊的貼圖按這個大小平鋪。

簽名
海洋區塊大小(場景: Ocean Scene Description, 區塊: 整數) -> 數字
double OceanPatchSize(
    OceanSceneDescription scene,
    int patch = 0)

參數

名稱型別預設值說明
場景Ocean Scene Description—The sea.
區塊整數0The patch, 0 to 2.

返回

結果數字
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
海洋
所屬包
物理模擬

海洋圖片

函數

某一時刻海的一張圖片,上面的物體在波浪那時把它們帶到的地方,由場景的太陽照亮。在顯示卡上生成。

簽名
海洋圖片 -> Pixel Image
    場景: Ocean Scene Description
    時間: 數字
    眼睛: Vector3d
    目標: Vector3d
    寬度: 整數
    高度: 整數
    視場角: 數字
PixelImage OceanPicture(
    OceanSceneDescription scene,
    double time,
    Vector3d eye,
    Vector3d target,
    int width = 640,
    int height = 480,
    double fieldOfView = 40)

參數

名稱型別預設值說明
場景Ocean Scene Description—The sea.
時間數字—The time (s).
眼睛Vector3d—Where the camera stands (m): a few metres above the water for a view from a deck.
目標Vector3d—What it looks at (m).
寬度整數640The picture's width in pixels.
高度整數480The picture's height in pixels.
視場角數字40The camera's vertical field of view in degrees.

返回

結果Pixel Image
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
海洋
所屬包
物理模擬

海面

函數

某一時刻一個矩形範圍內的海面,作為一個網格:一張敞開的面,它的頂點隨水移動,既上下也左右,所以波峰是尖的。三維檢視會把它畫出來;它是渲染器做靜幀要的海,一幀一個網格,就是一個鏡頭要的海。

簽名
海面 -> Streamed Vertex Mesh Data
    場景: Ocean Scene Description
    時間: 數字
    中心: Vector3d
    X 大小: 數字
    Y 大小: 數字
    單元數: 整數
StreamedVertexMeshData OceanSurface(
    OceanSceneDescription scene,
    double time,
    Vector3d center,
    double sizeX = 100,
    double sizeY = 100,
    int cells = 256)

參數

名稱型別預設值說明
場景Ocean Scene Description—The sea.
時間數字—The time (s).
中心Vector3d—The rectangle's middle (m); its Z is not used.
X 大小數字100Its extent along X (m).
Y 大小數字100Its extent along Y (m).
單元數整數256Cells along its longer side: 256 is 65 thousand vertices.

返回

結果Streamed Vertex Mesh Data
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
海洋
所屬包
物理模擬

海浪高度

函數

海的有效波高(米):最高的三分之一波浪從波谷到波峰的平均高度,大致就是觀察者口中的浪高。

簽名
海浪高度(scene: Ocean Scene Description) -> 數字
double OceanWaveHeight(OceanSceneDescription scene)

參數

名稱型別預設值說明
sceneOcean Scene Description—

返回

結果數字
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
海洋
所屬包
物理模擬

設定海洋的太陽

函數

換一個太陽後的海。

簽名
設定海洋的太陽 -> Ocean Scene Description
    場景: Ocean Scene Description
    太陽方向: Vector3d
OceanSceneDescription SetOceanSun(
    OceanSceneDescription scene,
    Vector3d sunDirection)

參數

名稱型別預設值說明
場景Ocean Scene Description—The sea.
太陽方向Vector3d—Where the sun stands, as a direction towards it: a low sun ahead of the camera puts a path of light on the water.

返回

結果Ocean Scene Description
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
海洋
所屬包
物理模擬

模擬海洋

函數

把帶著物體的海執行起來,記錄物體的運動:一個結果,結果節點(物體位置、物體路徑、物體網格)讀取它,三維檢視播放它。同一片海在任何機器上給出逐位相同的運動。海本身不需要記錄:“海面”給出執行中任何時刻的海。

簽名
模擬海洋 -> Simulation Result
    場景: Ocean Scene Description
    時長: 數字
    每秒幀數: 數字
SimulationResult SimulateOcean(
    OceanSceneDescription scene,
    double duration = 5,
    double framesPerSecond = 30)

參數

名稱型別預設值說明
場景Ocean Scene Description—A sea with bodies on it.
時長數字5How long to run (s).
每秒幀數數字30Frames per second of the recording.

返回

結果Simulation Result
所屬發行版
元編程(教育版)元編程(專業版)
可用的圖種類
資料流 函數 事件 例程 藍圖 狀態機狀態
宣告於
海洋
所屬包
物理模擬