[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47464] branches/soc-2012-fried_chicken: * Added ability to emit smoke directly from mesh surface and volume without particles .
Miika Hamalainen
miika.hamalainen at kolumbus.fi
Tue Jun 5 15:13:24 CEST 2012
Revision: 47464
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47464
Author: miikah
Date: 2012-06-05 13:13:17 +0000 (Tue, 05 Jun 2012)
Log Message:
-----------
* Added ability to emit smoke directly from mesh surface and volume without particles. (Now default flow type)
* Surface emission strength can be controlled using vertex groups.
* Surface emission can have normal or mesh movement directional initial velocity.
* Refactor and cleanup of smoke emission code.
* Fixed "quick smoke" to work with branch changes.
* Added debug code for visualization of velocity and heat.
Modified Paths:
--------------
branches/soc-2012-fried_chicken/intern/smoke/intern/FLUID_3D.cpp
branches/soc-2012-fried_chicken/release/scripts/startup/bl_operators/object_quick_effects.py
branches/soc-2012-fried_chicken/release/scripts/startup/bl_ui/properties_physics_smoke.py
branches/soc-2012-fried_chicken/source/blender/blenkernel/intern/smoke.c
branches/soc-2012-fried_chicken/source/blender/blenloader/intern/readfile.c
branches/soc-2012-fried_chicken/source/blender/editors/space_view3d/drawobject.c
branches/soc-2012-fried_chicken/source/blender/editors/space_view3d/drawvolume.c
branches/soc-2012-fried_chicken/source/blender/editors/space_view3d/view3d_intern.h
branches/soc-2012-fried_chicken/source/blender/makesdna/DNA_smoke_types.h
branches/soc-2012-fried_chicken/source/blender/makesrna/intern/rna_modifier.c
branches/soc-2012-fried_chicken/source/blender/makesrna/intern/rna_smoke.c
Modified: branches/soc-2012-fried_chicken/intern/smoke/intern/FLUID_3D.cpp
===================================================================
--- branches/soc-2012-fried_chicken/intern/smoke/intern/FLUID_3D.cpp 2012-06-05 12:58:17 UTC (rev 47463)
+++ branches/soc-2012-fried_chicken/intern/smoke/intern/FLUID_3D.cpp 2012-06-05 13:13:17 UTC (rev 47464)
@@ -262,15 +262,6 @@
}
#endif
- for (int index = 0; index < _totalCells; index++)
- {
- _xVelocityOld[index] = -99999.f;
- _yVelocityOld[index] = -99999.f;
- _zVelocityOld[index] = -99999.f;
- _densityOld[index] = -99999.f;
- _fuelOld[index] = -99999.f;
- }
-
// DG: TODO for the moment redo border for every timestep since it's been deleted every time by moving obstacles
setBorderCollisions();
Modified: branches/soc-2012-fried_chicken/release/scripts/startup/bl_operators/object_quick_effects.py
===================================================================
--- branches/soc-2012-fried_chicken/release/scripts/startup/bl_operators/object_quick_effects.py 2012-06-05 12:58:17 UTC (rev 47463)
+++ branches/soc-2012-fried_chicken/release/scripts/startup/bl_operators/object_quick_effects.py 2012-06-05 13:13:17 UTC (rev 47464)
@@ -298,7 +298,6 @@
style = EnumProperty(
name="Smoke Style",
items=(('STREAM', "Stream", ""),
- ('PUFF', "Puff", ""),
('FIRE', "Fire", ""),
),
default='STREAM',
@@ -327,20 +326,9 @@
bpy.ops.object.modifier_add(fake_context, type='SMOKE')
obj.modifiers[-1].smoke_type = 'FLOW'
- psys = obj.particle_systems[-1]
- if self.style == 'PUFF':
- psys.settings.frame_end = psys.settings.frame_start
- psys.settings.emit_from = 'VOLUME'
- psys.settings.distribution = 'RAND'
- elif self.style == 'FIRE':
- psys.settings.effector_weights.gravity = -1
- psys.settings.lifetime = 5
- psys.settings.count = 100000
+ if self.style == 'FIRE':
+ obj.modifiers[-1].flow_settings.smoke_flow_type = 'FIRE'
- obj.modifiers[-2].flow_settings.initial_velocity = True
- obj.modifiers[-2].flow_settings.temperature = 2
-
- psys.settings.use_render_emitter = self.show_flows
if not self.show_flows:
obj.draw_type = 'WIRE'
@@ -360,8 +348,6 @@
bpy.ops.object.modifier_add(type='SMOKE')
obj.modifiers[-1].smoke_type = 'DOMAIN'
if self.style == 'FIRE':
- obj.modifiers[-1].domain_settings.use_dissolve_smoke = True
- obj.modifiers[-1].domain_settings.dissolve_speed = 20
obj.modifiers[-1].domain_settings.use_high_resolution = True
# create a volume material with a voxel data texture for the domain
@@ -383,9 +369,10 @@
# for fire add a second texture for emission and emission color
if self.style == 'FIRE':
- mat.volume.emission = 5
- tex = bpy.data.textures.new("Smoke Heat", 'VOXEL_DATA')
+ mat.volume.emission_color = Vector((0.0, 0.0, 0.0))
+ tex = bpy.data.textures.new("Flame", 'VOXEL_DATA')
tex.voxel_data.domain_object = obj
+ tex.voxel_data.smoke_data_type = 'SMOKEFLAME'
tex.use_color_ramp = True
tex_slot = mat.texture_slots.add()
@@ -401,8 +388,9 @@
elem.color[0] = elem.color[1] = elem.color[3] = 1
elem.color[2] = 0
+ mat.texture_slots[1].use_map_density = True
mat.texture_slots[1].use_map_emission = True
- mat.texture_slots[1].blend_type = 'MULTIPLY'
+ mat.texture_slots[1].emission_factor = 5
return {'FINISHED'}
Modified: branches/soc-2012-fried_chicken/release/scripts/startup/bl_ui/properties_physics_smoke.py
===================================================================
--- branches/soc-2012-fried_chicken/release/scripts/startup/bl_ui/properties_physics_smoke.py 2012-06-05 12:58:17 UTC (rev 47463)
+++ branches/soc-2012-fried_chicken/release/scripts/startup/bl_ui/properties_physics_smoke.py 2012-06-05 13:13:17 UTC (rev 47464)
@@ -84,15 +84,25 @@
if flow.smoke_flow_type != "OUTFLOW":
split = layout.split()
col = split.column()
- col.label(text="Particle System:")
- col.prop_search(flow, "particle_system", ob, "particle_systems", text="")
+ col.label(text="Flow Source:")
+ col.prop(flow, "smoke_flow_source", expand=False, text="")
+ if flow.smoke_flow_source == "PARTICLES":
+ col.label(text="Particle System:")
+ col.prop_search(flow, "particle_system", ob, "particle_systems", text="")
+ else:
+ col.prop(flow, "surface_distance")
+ col.prop_search(flow, "density_vertex_group", ob, "vertex_groups", text="")
+ col.prop(flow, "volume_density")
- sub = col.column()
+ sub = col.column(align=True)
- sub.prop(flow, "initial_velocity", text="Initial Velocity")
+ sub.prop(flow, "initial_velocity")
sub = sub.column()
sub.active = flow.initial_velocity
- sub.prop(flow, "velocity_factor", text="Multiplier")
+ sub.prop(flow, "velocity_factor")
+ if flow.smoke_flow_source == "MESH":
+ sub.prop(flow, "velocity_normal")
+ #sub.prop(flow, "velocity_random")
sub = split.column()
sub.label(text="Initial Values:")
Modified: branches/soc-2012-fried_chicken/source/blender/blenkernel/intern/smoke.c
===================================================================
--- branches/soc-2012-fried_chicken/source/blender/blenkernel/intern/smoke.c 2012-06-05 12:58:17 UTC (rev 47463)
+++ branches/soc-2012-fried_chicken/source/blender/blenkernel/intern/smoke.c 2012-06-05 13:13:17 UTC (rev 47464)
@@ -52,18 +52,6 @@
#include "BLI_kdopbvh.h"
#include "BLI_utildefines.h"
-#include "BKE_bvhutils.h"
-#include "BKE_cdderivedmesh.h"
-#include "BKE_collision.h"
-#include "BKE_customdata.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_effect.h"
-#include "BKE_modifier.h"
-#include "BKE_particle.h"
-#include "BKE_pointcache.h"
-#include "BKE_smoke.h"
-
-
#include "DNA_customdata_types.h"
#include "DNA_group_types.h"
#include "DNA_lamp_types.h"
@@ -75,6 +63,16 @@
#include "DNA_scene_types.h"
#include "DNA_smoke_types.h"
+#include "BKE_bvhutils.h"
+#include "BKE_cdderivedmesh.h"
+#include "BKE_collision.h"
+#include "BKE_customdata.h"
+#include "BKE_deform.h"
+#include "BKE_DerivedMesh.h"
+#include "BKE_effect.h"
+#include "BKE_modifier.h"
+#include "BKE_particle.h"
+#include "BKE_pointcache.h"
#include "BKE_smoke.h"
/* UNUSED so far, may be enabled later */
@@ -90,6 +88,10 @@
#include <conio.h>
#include <windows.h>
+#define ADD_IF_LOWER_POS(a,b) (MIN2((a)+(b), MAX2((a),(b))))
+#define ADD_IF_LOWER_NEG(a,b) (MAX2((a)+(b), MIN2((a),(b))))
+#define ADD_IF_LOWER(a,b) (((b)>0)?ADD_IF_LOWER_POS((a),(b)):ADD_IF_LOWER_NEG((a),(b)))
+
static LARGE_INTEGER liFrequency;
static LARGE_INTEGER liStartTime;
static LARGE_INTEGER liCurrentTime;
@@ -759,6 +761,8 @@
}
smd->flow->bvh = NULL;
*/
+ if (smd->flow->dm) smd->flow->dm->release(smd->flow->dm);
+ if (smd->flow->verts_old) MEM_freeN(smd->flow->verts_old);
MEM_freeN(smd->flow);
smd->flow = NULL;
}
@@ -945,7 +949,10 @@
smd->flow->temp = 1.0;
smd->flow->flags = MOD_SMOKE_FLOW_ABSOLUTE;
smd->flow->vel_multi = 1.0;
+ smd->flow->surface_distance = 1.5;
+ smd->flow->source = MOD_SMOKE_FLOW_SOURCE_MESH;
+ smd->flow->dm = NULL;
smd->flow->psys = NULL;
}
@@ -997,17 +1004,32 @@
tsmd->domain->vorticity = smd->domain->vorticity;
tsmd->domain->time_scale = smd->domain->time_scale;
tsmd->domain->border_collisions = smd->domain->border_collisions;
+
+ tsmd->domain->burning_rate = smd->domain->burning_rate;
+ tsmd->domain->flame_smoke = smd->domain->flame_smoke;
+ tsmd->domain->flame_vorticity = smd->domain->flame_vorticity;
+ tsmd->domain->flame_ignition = smd->domain->flame_ignition;
+ tsmd->domain->flame_max_temp = smd->domain->flame_max_temp;
MEM_freeN(tsmd->domain->effector_weights);
tsmd->domain->effector_weights = MEM_dupallocN(smd->domain->effector_weights);
}
else if (tsmd->flow) {
- tsmd->flow->density = smd->flow->density;
- tsmd->flow->temp = smd->flow->temp;
tsmd->flow->psys = smd->flow->psys;
tsmd->flow->type = smd->flow->type;
tsmd->flow->flags = smd->flow->flags;
tsmd->flow->vel_multi = smd->flow->vel_multi;
+ tsmd->flow->vel_normal = smd->flow->vel_normal;
+ tsmd->flow->vel_random = smd->flow->vel_random;
+
+ tsmd->flow->density = smd->flow->density;
+ tsmd->flow->fuel_amount = smd->flow->fuel_amount;
+ tsmd->flow->temp = smd->flow->temp;
+ tsmd->flow->volume_density = smd->flow->volume_density;
+ tsmd->flow->surface_distance = smd->flow->surface_distance;
+ tsmd->flow->vgroup_density = smd->flow->vgroup_density;
+
+ tsmd->flow->source = smd->flow->source;
}
else if (tsmd->coll) {
;
@@ -1226,315 +1248,478 @@
MEM_freeN(collobjs);
}
-static void update_flowsfluids(Scene *scene, Object *ob, SmokeDomainSettings *sds, float time)
+static void emit_from_particles(Object *flow_ob, SmokeDomainSettings *sds, SmokeFlowSettings *sfs, float *emission_map, float *velocity_map, Scene *scene, float time)
{
- Object **flowobjs = NULL;
- unsigned int numflowobj = 0;
- unsigned int flowIndex;
+ if(sfs && sfs->psys && sfs->psys->part && sfs->psys->part->type==PART_EMITTER) // is particle system selected
+ {
+ ParticleSimulationData sim;
+ ParticleSystem *psys = sfs->psys;
+ int totpart=psys->totpart, totchild;
+ int p = 0;
- flowobjs = get_collisionobjects(scene, ob, sds->fluid_group, &numflowobj, eModifierType_Smoke);
+ sim.scene = scene;
+ sim.ob = flow_ob;
+ sim.psys = psys;
- // update obstacle tags in cells
- for(flowIndex = 0; flowIndex < numflowobj; flowIndex++)
- {
- Object *collob= flowobjs[flowIndex];
- SmokeModifierData *smd2 = (SmokeModifierData*)modifiers_findByType(collob, eModifierType_Smoke);
+ if(psys->part->type==PART_HAIR)
+ {
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list