複数の画像を重ねたテクスチャ
2011/8/7
Blender2.58
複数の画像を重ねたテクスチャをつくる。ImageMixはVideoFFmpegやImageFFmpegなどのテクスチャソースを混ぜることが出来る。
import bge
obj = bge.logic.getCurrentController().owner
mat = "MAMaterial.001"
im0 = bge.texture.ImageFFmpeg("0.png")
im1 = bge.texture.ImageFFmpeg("1.png")
im2 = bge.texture.ImageFFmpeg("2.png")
im3 = bge.texture.ImageFFmpeg("3.png")
im4 = bge.texture.ImageFFmpeg("4.png")
imMix = bge.texture.ImageMix()
imMix.setSource("src0",im0)
imMix.setSource("src1",im1)
imMix.setSource("src2",im2)
imMix.setSource("src3",im3)
imMix.setSource("src4",im4)
imMix.setWeight("src0",256)
imMix.setWeight("src1",224)
imMix.setWeight("src2",192)
imMix.setWeight("src3",160)
imMix.setWeight("src4",128)
matID = bge.texture.materialID(obj,mat)
texture = bge.texture.Texture(obj,matID)
texture.source = imMix
obj["texture"] = texture
obj["texture"].refresh(True)
ImageMix.setWeight は0~256の範囲で重さを設定できる。
Video Texture (bge.texture) — Blender v2.58.1 - API documentation
http://www.blender.org/documentation/blender_python_api_2_58_1/bge.texture.html
The VideoTexture module
http://wiki.blender.org/index.php/Dev:Source/GameEngine/2.49/VideoTexture
VideoTexture モジュール
http://blender.jp/modules/xfsection/article.php?articleid=279