• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cropping simulation area
#1
hello,
i´m looking for an effective way to get rid of areas of the simulation grid, when i don´t need them anymore. i have some kind of rolling effect emitted by particles. i´m interested in the moving front of that effect but i want to get rid of the smoke after a while to speed up the simulation. i´m still quite new to the program, and i did like my first try with the scripted access to reset the values to 0.0 when the voxel is inside the area of another object. I used a box for this, to chop parts of the simulation off. i know this is really done like a dirty hack and it actually seems slower than the complete simulation without script. I´m looking for an effective way to do that. any ideas?

Thanks for any input,
julian

this was my first try, unefficient and slow. and it crashed when i had the viewport preview active. when that was off it worked...

-------------------------
fn PostObjects = (

blocker = $FFX_blocker
measurePoint = dummy boxsize:[0,0,0]

for i in 0 to (nx - 1) do
(
for j in 0 to (ny - 1) do
(
for k in 0 to (nz - 1) do
(
voxWorld = ffxVoxelPtToWorld [i,j,k]
measurePoint.pos = voxWorld
if ( intersects blocker measurePoint ) do
(
setSmoke i j k 0.
setTemp i j k 0.
--setFuel i j k 0.
)
)
)
)
delete measurePoint
)
  Reply
#2
fn CutAdaptive st tt vt = (
for i in 0 to (voxels-1) do (
if (GetFuelByIndex i) > 0.0 then continue -- leave fire alone
if (GetSmokeByIndex i) > st then continue
if (GetTempByIndex i) > tt then continue
v = GetVelByIndex i
if (length v) > vt then continue
-- otherwise...
SetFuelByIndex i 0.0 -- clean unburnt fuel remains (fuel
<!-- w --><a class="postlink" href="http://www.cgfluids.com">http://www.cgfluids.com</a><!-- w -->
  Reply
#3
thanks a lot. good to see examples. as far as i see you do cropping by thresholds. i´m looking for a chance to do that by position in space. ideally with an object, bounding box would also do, or something similar. the density in my simulation is quite dense, so thresholds would not really work.
thank you anyway. that looks useful.
julian
  Reply
#4
if you higher density on this treshold , the function will take whatever density treshold to tell it to cut from , it dosnt matter if its super dense or not , u adjust fn poststep = ( cutadaptive 0.1 100 0.1 ) with ur numbers and it should work the way u want it.. i dont know of another idea right out the batt..
<!-- w --><a class="postlink" href="http://www.cgfluids.com">http://www.cgfluids.com</a><!-- w -->
  Reply
#5
thresholds unfortunately will not work since i also want the low density voxels for the detail in one part of the scene but cut away all, so also high density voxels, in the other part. thanks a lot for your examples. maybe i can control the adaptive grid directly. i will keep on looking. thanks. julian
  Reply
#6
not sure how voxels are defined in maxscript, but they should have a position value.
so then you could animate a object, and test for x-value for exampe:
if voxel.xpos < movingObject.xpos then setSmokebyIndex 0.0

unfortunately i don't have alot experience in maxscript, so I can't tell you the exact solution. maybe Kresimir can.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)