diff options
author | Daniel Genrich <daniel.genrich@gmx.net> | 2010-01-25 18:10:14 +0300 |
---|---|---|
committer | Daniel Genrich <daniel.genrich@gmx.net> | 2010-01-25 18:10:14 +0300 |
commit | 83dfade37a746043dfc8d38f57514706d8505352 (patch) | |
tree | 71d291a00799e67ecc6d39a5c5fc2117037a1328 /source/blender/blenkernel | |
parent | 4b71eaa4d14af6f43c15f97d8bf70506afad724b (diff) |
Smoke: The well known Miika Hämäläinen (aka MiikaH) patch (http://blenderartists.org/forum/showthread.php?t=158317&page=42)
* 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. ;-)
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/smoke.c | 23 |
2 files changed, 21 insertions, 11 deletions
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index b31131554bd..9bdc700c313 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -710,7 +710,9 @@ static int ptcache_write_smoke(PTCacheFile *pf, void *smoke_v) unsigned char *obstacles; unsigned int in_len = sizeof(float)*(unsigned int)res; unsigned char *out = (unsigned char *)MEM_callocN(LZO_OUT_LEN(in_len)*4, "pointcache_lzo_buffer"); - int mode = res >= 1000000 ? 2 : 1; + //int mode = res >= 1000000 ? 2 : 1; + int mode=1; // light + if (sds->cache_comp == SM_CACHE_HEAVY) mode=2; // heavy smoke_export(sds->fluid, &dt, &dx, &dens, &densold, &heat, &heatold, &vx, &vy, &vz, &vxold, &vyold, &vzold, &obstacles); @@ -753,7 +755,10 @@ static int ptcache_write_smoke_turbulence(PTCacheFile *pf, void *smoke_v) smoke_turbulence_get_res(sds->wt, res_big_array); res_big = res_big_array[0]*res_big_array[1]*res_big_array[2]; - mode = res_big >= 1000000 ? 2 : 1; + //mode = res_big >= 1000000 ? 2 : 1; + mode = 1; // light + if (sds->cache_high_comp == SM_CACHE_HEAVY) mode=2; // heavy + in_len_big = sizeof(float) * (unsigned int)res_big; smoke_turbulence_export(sds->wt, &dens, &densold, &tcu, &tcv, &tcw); 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; } + } } |