From 83dfade37a746043dfc8d38f57514706d8505352 Mon Sep 17 00:00:00 2001 From: Daniel Genrich Date: Mon, 25 Jan 2010 15:10:14 +0000 Subject: =?UTF-8?q?Smoke:=20The=20well=20known=20Miika=20H=C3=A4m=C3=A4l?= =?UTF-8?q?=C3=A4inen=20(aka=20MiikaH)=20patch=20(http://blenderartists.or?= =?UTF-8?q?g/forum/showthread.php=3Ft=3D158317&page=3D42)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Better (and windows enabled) OpenMP handling (> 2x-5x speed) * More Volumetric Texture mapping options (heat, etc) <-- Matt if that's not to your liking, just revert that part, it's separate anyway * Initial velocity taken from particle settings (no more slow starting) * Option to select compression method (there seem to be a bug in my high compression usage, at least it's been reported to result in exploding smoke - better use low compression for the time being) It's been tested since a while but as usual please report any (new!) bugs. ;-) --- source/blender/blenkernel/intern/smoke.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'source/blender/blenkernel/intern/smoke.c') diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 0a106b1920d..e921dadb9ba 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -872,11 +872,13 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd) heat[index] = sfs->temp; density[index] = sfs->density; - /* + + // Uses particle velocity as initial velocity for smoke + if(smd->domain->flags & MOD_SMOKE_INITVELOCITY) { velocity_x[index] = pa->state.vel[0]; velocity_y[index] = pa->state.vel[1]; velocity_z[index] = pa->state.vel[2]; - */ + } // obstacle[index] |= 2; // we need different handling for the high-res feature @@ -1396,8 +1398,9 @@ static void get_cell(float *p0, int res[3], float dx, float *pos, int *cell, int static void smoke_calc_transparency(float *result, float *input, float *p0, float *p1, int res[3], float dx, float *light, bresenham_callback cb, float correct) { - int x, y, z; + int z; float bv[6]; + int slabsize=res[0]*res[1]; memset(result, -1, sizeof(float)*res[0]*res[1]*res[2]); // x bv[0] = p0[0]; @@ -1409,19 +1412,20 @@ static void smoke_calc_transparency(float *result, float *input, float *p0, floa bv[4] = p0[2]; bv[5] = p1[2]; -#pragma omp parallel for schedule(static) private(y, z) - for(x = 0; x < res[0]; x++) +#pragma omp parallel for schedule(static,1) + for(z = 0; z < res[2]; z++) + { + size_t index = z*slabsize; + int x,y; + for(y = 0; y < res[1]; y++) - for(z = 0; z < res[2]; z++) + for(x = 0; x < res[0]; x++, index++) { float voxelCenter[3]; - size_t index; float pos[3]; int cell[3]; float tRay = 1.0; - index = smoke_get_index(x, res[0], y, res[1], z); - if(result[index] >= 0.0f) continue; voxelCenter[0] = p0[0] + dx * x + dx * 0.5; @@ -1446,5 +1450,6 @@ static void smoke_calc_transparency(float *result, float *input, float *p0, floa // #pragma omp critical result[index] = tRay; } + } } -- cgit v1.2.3