カメラ出力をテクスチャにする
2010/4/18
Blender2.49
カメラの出力結果をテクスチャとして表示。 VideoTexture モジュールを使う。
Dev:Source/GameEngine/2.49/VideoTexture
http://wiki.blender.org/index.php/Dev:Source/GameEngine/2.49/VideoTexture
マテリアルは適当なダミー画像をUVマップで貼っておく。
scene = GameLogic.getCurrentScene()
cont = GameLogic.getCurrentController()
obj = cont.owner
render_camera = "Camera"
render_material = "Material"
def main():
if obj.has_key("texture"):
update()
else:
init()
def init():
import VideoTexture
cam = scene.objects["OB"+render_camera]
matID = VideoTexture.materialID(obj,"MA"+render_material)
texture = VideoTexture.Texture(obj, matID)
texture.source = VideoTexture.ImageRender(scene,cam)
obj["texture"] = texture
def update():
obj["texture"].refresh(True)
main()
詳しくは
Render to Texture -- Blender 3D Game Engine
http://www.tutorialsforblender3d.com/Game_Engine/VideoTexture/VideoTexture_Render_1.html