The method of volume retiming slowing down in Houdini

Source: Internet
Author: User



Read this blog reader may need to grasp the concept of volume is relatively high, if the concept is not too familiar with the physical discomfort in reading, but also please go back to make up your own lessons.



The main reason for designing this solution is that some shots may have a good firework effect, but they feel that the speed needs to be slowed down. And precisely Houdini the Retiming method to do interpolation, it will appear similar ghost shadow problems, often results are not used. Yesterday, through Norwegian colleagues pointing out, I also made a plan, here to talk about my ideas.



The first is the effect:






As can be seen, although the use of this method still can not avoid the existence of jitter, but the overall transition is really smooth much smoother, the traditional method effect is the whole smoke regardless of speed or slow will appear a certain degree of jitter, and the improved method of jitter is the speed of the place is too fast resulting in increased error. So if the rate of smoke is at a certain level, or if the density is thicker and less transparent, the interpolation method can accurately express the transition.



For example, we assume that the current voxel to be computed is p, we need to calculate the transition from N to n+1 of the density value in this voxel, assuming that our substep is set to 0.1, then it is equivalent to slowing down by 10 times times and inserting nine frames in the middle.






Let's consider the first substep case, that is, the first 0.1. Because it is a transition from N to n+1 frame, the base frame of the current frame we will use the nth frame, sampling his speed is vel1, by the speed multiplied by Timeinc and substep after the vector scale is quite a substep span (here we can only assume that the frame and the frame is linearly variable , even if it's definitely not linear). Although Vel1 must be forward in understanding, we have been discussing a certain value on a fixed point in the calculation of voxel, this is density, so we can't use the usual thinking in SOP vop to think about changes in the physical location. We first consider N.1 step when the density value of p is most likely the location of the density transfer over, we can only from two frames to do the judgement, in the N frame we put the Vel1 calculated vector back one step to get A1. In determining which position in the n+1 frame density most likely to comprise N.1 density, we first need to get the speed of the second P point at the n+1 frame, assuming Vel2. According to this speed we can guess (can only guess) n frames in the point P density very likely in the n+1 frame at the point pnext position, so N.1 density in the n+1 frame is likely in B1 position. Similarly, the most reliable values in N.9 steps are in the D2 of the N-frame C2 and n+1 frames. is not very around Ah, there is no way to judge a fixed place by a certain value of the past life is actually more energy-consuming.



In how to mix A1 and B1 These two density problems, we also have to understand the point P for the reference calculation, the more points from the point P near the value of the more accurate, because the greater the speed, the greater the span, so that the density in the accumulation of speed, the more scattered, so the less accurate. So in the calculation of N.1 step, if the use of linear mixing method, then the more accurate way is density = a1*0.9+b1*0.1. Similarly, in n.9 step density = c2*0.1 + d2*0.9.



So far our interpolation model is completed, then how to achieve, I simply cut the method with volume VoP and directly with Vex write the method two, much the same, the computational time is not very different.



Before linking volume VOP, you need to get the N frames and n+1 frames after timeshift, linked as follows:






The links inside the volume VoP are:






This is the method of Vex, which is written by the direct translation of the prototype through the VOP connection, there is not much to say.


 
float subProcess = ch("subProcess");

float currentVelX, currentVelY, currentVelZ;
float nextVelX, nextVelY,nextVelZ;

int curAttribValueX, curAttribValueY, curAttribValueZ;
int nextAttribValueX, nextAttribValueY, nextAttribValueZ;

//find the primitive index for each input
//find the right way to get the velocity values
curAttribValueX = findattribval( @OpInput1, "primitive", "name", "vel.x");
curAttribValueY = findattribval( @OpInput1, "primitive", "name", "vel.y");
curAttribValueZ = findattribval( @OpInput1, "primitive", "name", "vel.z");

nextAttribValueX = findattribval( @OpInput2, "primitive", "name", "vel.x");
nextAttribValueY = findattribval( @OpInput2, "primitive", "name", "vel.y");
nextAttribValueZ = findattribval( @OpInput2, "primitive", "name", "vel.z");

//get the velocity of frame n
currentVelX = volumesample(@OpInput1, curAttribValueX, @P);
currentVelY = volumesample(@OpInput1, curAttribValueY, @P);
currentVelZ = volumesample(@OpInput1, curAttribValueZ, @P);
vector currentVel = set(currentVelX, currentVelY, currentVelZ);

//get the velocity of n+1 frame
nextVelX = volumesample(@OpInput2, nextAttribValueX, @P);
nextVelY = volumesample(@OpInput2, nextAttribValueY, @P);
nextVelZ = volumesample(@OpInput2, nextAttribValueZ, @P);
vector nextVel = set(nextVelX, nextVelY, nextVelZ);

//get the density sample position from frame n
vector forbackCurrentDirection, currentCheckPos;
forbackCurrentDirection = -1 * currentVel * @TimeInc * subProcess;
currentCheckPos = @P + forbackCurrentDirection;

//get the density sample position from frame n+1
vector forwardNextDirection, nextCheckPos;
forwardNextDirection = nextVel * @TimeInc * (1 - subProcess);
nextCheckPos = @P + forwardNextDirection;

//sample the density
float forbackCurrentDensity, forwardNextDensity;
int curAttribValueDensity, nextAttribValueDensity;
curAttribValueDensity  = findattribval( @OpInput1, "primitive", "name", "density");
nextAttribValueDensity = findattribval( @OpInput2, "primitive", "name", "density");

forbackCurrentDensity = volumesample(@OpInput1, curAttribValueDensity, currentCheckPos);
forwardNextDensity = volumesample(@OpInput2, nextAttribValueDensity, nextCheckPos);

//mix the density by the distance from the current sample position
float finalDensity;
finalDensity = subProcess * forbackCurrentDensity + (1 - subProcess) * forwardNextDensity;
@density = finalDensity;





The method of volume retiming slowing down in Houdini


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.