Вход/Регистрация
Введение в написание скриптов на Питоне для Блендера 2.5x. Примеры кода
вернуться

Larsson Thomas

Шрифт:

pmod.name = 'SmokeParticles'

psys = pmod.particle_system

psys.seed = 4711

# Настройки частиц

pset = psys.settings

pset.type = 'EMITTER'

pset.lifetime = 1

pset.emit_from = 'VOLUME'

pset.use_render_emitter = False

pset.render_type = 'NONE'

pset.normal_factor = 8.0

# Добавление модификатора дыма

smod = flow.modifiers.new(name='Smoke',

type='SMOKE')

smod.smoke_type = 'FLOW'

sfset = smod.flow_settings

# Настройки потока

sfset.use_outflow = False

sfset.temperature = 0.7

sfset.density = 0.8

sfset.initial_velocity = True

sfset.particle_system = psys

return flow

def createVortexEffector(origin):

bpy.ops.object.effector_add(type='VORTEX', location=origin)

vortex = bpy.context.object

return vortex

def createVoxelTexture(domain):

tex = bpy.data.textures.new('VoxelTex', type = 'VOXEL_DATA')

voxdata = tex.voxel_data

voxdata.file_format = 'SMOKE'

voxdata.domain_object = domain

return tex

def createVolumeMaterial(tex):

mat = bpy.data.materials.new('VolumeMat')

mat.type = 'VOLUME'

vol = mat.volume

vol.density = 0.0

vol.density_scale = 8.0

vol.scattering = 6.0

vol.asymmetry = 0.3

vol.emission = 0.3

vol.emission_color = (1,1,1)

vol.transmission_color = (0.9,0.2,0)

vol.reflection = 0.7

vol.reflection_color = (0.8,0.9,0)

# Для удаления эффекта пикселизации

vol.step_size = 0.05

# Добавление текстуры Voxel data

mtex = mat.texture_slots.add

mtex.texture = tex

mtex.texture_coords = 'ORCO'

mtex.use_map_density = True

mtex.use_map_emission = True

mtex.use_map_scatter = False

mtex.use_map_reflect = True

mtex.use_map_color_emission = True

mtex.use_map_color_transmission = True

mtex.use_map_color_reflection = True

mtex.density_factor = 1.0

mtex.emission_factor = 0.2

mtex.scattering_factor = 0.2

mtex.reflection_factor = 0.3

mtex.emission_color_factor = 0.9

mtex.transmission_color_factor = 0.5

mtex.reflection_color_factor = 0.6

return mat

def addFloor(origin):

# Создание пола, который принимает прозрачные тени

bpy.ops.mesh.primitive_plane_add(

location = origin,

rotation = (0, 0, pi/4))

bpy.ops.transform.resize(value=(4, 4, 4))

bpy.ops.transform.resize(value=(2, 2, 2),

constraint_axis=(True, False, False),

constraint_orientation='LOCAL')

floor = bpy.context.object

mat = bpy.data.materials.new('Floor')

  • Читать дальше
  • 1
  • ...
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76

Ебукер (ebooker) – онлайн-библиотека на русском языке. Книги доступны онлайн, без утомительной регистрации. Огромный выбор и удобный дизайн, позволяющий читать без проблем. Добавляйте сайт в закладки! Все произведения загружаются пользователями: если считаете, что ваши авторские права нарушены – используйте форму обратной связи.

Полезные ссылки

  • Моя полка

Контакты

  • chitat.ebooker@gmail.com

Подпишитесь на рассылку: