1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

babylon.jsでのテクスチャの貼り方

Posted at

はじめに

Babylon.jsでのテクスチャの貼り方を忘れてしまっていたので記事化する。
またPlaygroundでのセーブのやり方も忘れていたので同時に記載し備忘録とする。

やり方

テクスチャ

BABYLON.MeshBuilderを使いboxを作成
テクスチャ用のマットをBABYLON.StandardMaterialで作成
作成したマットをテクスチャに割り当てる
boxのマテリアルに付与してやる

var box = BABYLON.MeshBuilder.CreateBox("box", {diameter:2, segments: 8}, scene);

const boxMat = new BABYLON.StandardMaterial("boxMat");
boxMat.diffuseTexture = new BABYLON.Texture("textures/albedo.png", scene);

box.material = boxMat;

保存方法

1.再生ボタンの隣のボタンを選択(ctrl+sでも可)
image.png

2.詳細を記載する画面が出てくるので記入をしてOkを押す
image.png

3.これでURLが変化し、共有がされる。
image.png

今回作ったコード

参考サイトなど

テクスチャ情報
https://doc.babylonjs.com/toolsAndResources/assetLibraries/availableTextures

保存方法関係
https://www.crossroad-tech.com/entry/GetStartedBabylonjs2022_winter

チュートリアルの日本語版
https://zenn.dev/chomado/books/babylonjs-tutorial-ja/viewer/2-05

終わりに

しばらくぶりにBabylon.jsを触ったのでどの機能がどこにあったのかを失念していた。
技術書の執筆までに要素を分解し、記事化をすることで知見の共有を行うとともに執筆の練習とする。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?