Город МОСКОВСКИЙ
00:11:50

Blender Realtime Refraction And Reflection Tutorial

Аватар
JS Кодер
Просмотры:
22
Дата загрузки:
03.12.2023 12:45
Длительность:
00:11:50
Категория:
Обучение

Описание

Hey guys its been a while :P

Anyway in this tutorial I show you how to create a realtime refraction/reflection effect using blender render to texture module! enjoy :)

LINKS:-

Vitorbablio -
http://www.youtube.com/watch?v=iLhnD3X_sWA

Script -

!! SCRIPT HAS BEEN UPDATED TO 2.69 AND WORKS !!

##################################################

### Blender 3D 2.6x Game Engine
### Taken from www.tutorialsforblender3d.com
### Edited by koala_boy166
### Video Texture ImageRender

###################################################

#import bge module
import bge

# get the current controller
cont = bge.logic.getCurrentController()

# get object script is attached to
obj = cont.owner

# check to see variable RenderToTexture has been created
if "RenderToTexture" in obj:

# get renderToTexture
renderToTexture = obj["RenderToTexture"]

# update the texture
renderToTexture.refresh(True)

# if variable RenderToTexture hasn't been created
else:

## get current scene
scene = bge.logic.getCurrentScene()

# get a list of objects in the scene
objList = scene.objects

# get camera name being used for render to texture
camName = obj["camera"]

# get camera object
cam = objList[camName]

# get the texture material ID
matID = bge.texture.materialID(obj, "MA"+obj["material"])

# set the texture
renderToTexture = bge.texture.Texture(obj, matID)

# get the texture image
renderToTexture.source = bge.texture.ImageRender(scene,cam)

# save RenderToTexture as an object variable
obj["RenderToTexture"] = renderToTexture

Рекомендуемые видео