Jump to content
ISUther

How to make object occure on specific time frame in Houdini?

Recommended Posts

Hello,

How to make object occure on specific time frame in Houdini?
For example: i want to animate objects.
And i need specific object occure in specific time frame
How to do it?
I can animate objects no problem but i need those to be occuring in specific time frames.

Best regeards.
ISUther

Share this post


Link to post
Share on other sites

Hello,
Thank you for reply.
But question regarding that node named as "Attribute Wrangle"
It has also VEX expresion in it.
I am fairly new in houdini and do not know much about coding or expresions.
Can you provide insight what does this expression do?

float Alpha =1;
if (@Frame < 10)
{
f@Alpha = 0;
}



Thank you for trying to help me!!!

Edited by ISUther

Share this post


Link to post
Share on other sites

my bad I should have left some comments in there.

float Alpha =1;   // setting my Alpha to be 1 (meaning solid)
if (@Frame < 10) // if current frame is smaller than 10 
       {
       f@Alpha = 0;  // set Alpha to 0.
       }

 

so basically I am stating that Alpha has to be 1 always, UNLESS the current frame is smaller than 10, then my Alpha is 0.

Share this post


Link to post
Share on other sites

Note! I never done coding only tried to learn JAVA for one week in university and i failed :D

Regarding Alpha
I did google and found this info:
-------------------------------------------------------------------------
Alpha mapping is a technique in 3D computer graphics where an image is mapped (assigned) to a 3D object, and designates certain areas of the object to be transparent or translucent. The transparency can vary in strength, based on the image texture, which can be greyscale, or the alpha channel of an RGBA image texture.
-------------------------------------------------------------------------
Does that apply also here?
Or in here it feels like it is oposite.
That when Alpha is set 1 (using = sign)
Example: float Alpha =1;

Atm i understand that this states that alpha is 1
But what is function of float?
Float is = as object? (what ever that object is?)
The part where you wrote if that statement i rememeber from JAVA also it dictades condition.

So if at frame that is less then 10 f@alpha is zero

so what is f?

I also noticed that "swich" node has expression $F > 10

I am sorry i am dumb regarinbg vex and coding but trying to educate myself and learn.

Also note that in file you provided and what i created (trying to copy what you have) both will render also object.
Eaven when it shoudl be invisible.
My goal is to animate object so at frame one to frame 10 (this is just an example) you cant see the object and then at frame 11 it will occure in one spot and start mooving in to anothet spot.

Edited by ISUther

Share this post


Link to post
Share on other sites

Animate_vision_SS.thumb.png.49c2ead36e297db4aab8fe6b44117caa.png

 

Okay I apologize, I did assume at first that you had a little more knowledge in Houdini, so I will try to elaborate a little, and hopefully you learn a thing or two :).

"Alpha mapping is a technique in 3D computer graphics where an image is mapped (assigned) to a 3D object, and designates certain areas of the object to be transparent or translucent. The transparency can vary in strength, based on the image texture, which can be greyscale, or the alpha channel of an RGBA image texture."

This is correct, and I am using that technique to make the sphere 100% transparent as long as the current frame number is less than 10.

if you look at the attached image, I have drawn some numbers and, an explanation will follow:

 

1. "But what is function of float?"  Float is not a function but a way to tell Houdini if the number we are working with are of the type integer (1,2,3,4,5,6,7 etc.), Float (1.0,2.0,3.0,3.3,4.5,7.9 etc) or vector (0,0,0). Because the Alpha attribute as default, span in the range from 0.0-1.0, meaning that if the value is 0.5 the sphere would be 50% transparent, I created the attribute Alpha as a float.

1.1 "so what is f?".  f@Alpha also specifies that the value of Alpha is of the type float.
 

2. In order for my Alpha attribute, which I created with the code, to work, I have to assign a shader to the sphere. Transparency is by default calculated in the shading step during the render process. In order for the shading to recognize that the Alpha exist I have to tick the box "Use Point Alpha" (I knew that the tix box existed on the shader, which is why I wrote a value to the Alpha attribute in my code).

3. apparently in my world 4 comes after 2 which is why I did not put a step 3 on the image :P LOL

4,5 and 6: "Also note that in file you provided and what i created (trying to copy what you have) both will render also object."   In order for you to be able to tell Houdini what to draw in the viewport, which object to display templates of, and which object to render, you have access to 3 flags as they are called. Blue, Pink and Purple..

now what are these flags.

Blue flag is the display flag. My blue display  flag is currently sitting on the material sop, so we should be able to see the sphere drawn in the viewport? well remember the code that I wrote? that said that only if the current frame was 10 or bigger would the sphere be visible. scrub the timeline and you will see the sphere on frame 10.

Pink flag is your template flag. The pink flag lets you template an object. In this example I have templated the sphere node, which is why you see the wireframe of the sphere in the viewport. But hey.. what about that code we wrote? Well as all nodes are evaluated from top down, Houdini evaluates the sphere node as the first object, then the code, then the material sop etc.. so the code have not been applied to the node that we have our template flag on. 

Purple flag is your render flag. Stated in the name of the flag, the purple flag has to be set on the node as which you wish to render. In this example I have created a null sop (which is a dummy node) and put the render flag on that. You can try to move the connection from the switch node to the material node if you want and it will render whatever node it is connected to. if you want to make sure that it is rendering the two different nodes, you can put down a color node after the switch node and make the sphere red.

 

 

Hope this can enlighten you a little.

Let me know if you have further questions and I will be happy to help the best I can.

Cheers

 

 

 

animate_visibility_v02.hipnc

Share this post


Link to post
Share on other sites

"I also noticed that "swich" node has expression $F > 10" 

This is the same thing as the VEX code that I wrote, this is just using Hscript expressions instead of VEX. I could have typed: @Frame > 10

$F/@Frame meaning current frame.

<> meaning smaller or bigger than

10 being my set value.

Share this post


Link to post
Share on other sites

but why would you bother to say float Alpha ? doesn't this make it a local var ? isn't Alpha already defined ?

like...why would you declare vector P, as P or N is already defined in Houdini ?

or why would you declare vector v, as v is already there ? (I think...maybe I'm stretchin' it a bit here..:) )

i@myattrib, yes I can understand..this defines an attrib that from this point onwards I can use further down the line, while int tempnumber is local and temporary only....which brings me back to the point float Alpha...doesn't this potentially create some conflicts or confuse the little guy pedalling away madly inside my machine ?

this works:

Torus>AttribWrangle>

@Alpha = 0; // invisible initially

if(20<@Frame && @Frame<50) @Alpha = 1; // visible between frames 21 - 49

Edited by Noobini

Share this post


Link to post
Share on other sites

Yeah really you should have f@Alpha = 1; and then go on to modify later with the if statement. The 'float Alpha = 1;" line isn't doing anything in that example as it's creating a local variable that isn't called later. In the case of Alpha, where Houdini already considers objects to have an Alpha value of 1 by default (even though it doesn't show you) you don't have to initialise it first, but for arbitrary values you do (Example attached).

And yes, there are some attributes you don't need to explicitly declare (like Alpha), but to be honest given it doesn't make a difference if you do or not, it's good practice to just declare everything anyway. Sure in the case of @P I don't bother, but unless you know exactly which attributes Houdini recognises, better be safe than sorry. You'll only end up calling a vector as a float somewhere and breaking something. 

 

 

Initialize_attributes_01.hip

Share this post


Link to post
Share on other sites

The Jesper offered solution seem to work but need to investigate some more.
I will get back to it shortly as i want to write down my questions correct way. One thing is not to undferstand something but other thing is asking the right question and forumalting question right way so people understand what i am asking.
This is some times hard task as english not my native(so time to time i have to use google translate for specifc words. Never translate all text im not that stupid :D ).


Atm trying to figure out how to move that transform tool (handles to move object) on center to the object not center to the world

 

Edited by ISUther

Share this post


Link to post
Share on other sites
10 hours ago, Noobini said:

but why would you bother to say float Alpha ? doesn't this make it a local var ? isn't Alpha already defined ?

like...why would you declare vector P, as P or N is already defined in Houdini ?

or why would you declare vector v, as v is already there ? (I think...maybe I'm stretchin' it a bit here..:) )

i@myattrib, yes I can understand..this defines an attrib that from this point onwards I can use further down the line, while int tempnumber is local and temporary only....which brings me back to the point float Alpha...doesn't this potentially create some conflicts or confuse the little guy pedalling away madly inside my machine ?

this works:

Torus>AttribWrangle>

@Alpha = 0; // invisible initially

if(20<@Frame && @Frame<50) @Alpha = 1; // visible between frames 21 - 49

Ha! You are absolutely right. The float Alpha declaration makes no difference in my example.. I was going for, as Adrianr is also explaning, visualizing that I am initializing an attribute even though it already exist. Not everyone knows that Alpha is a preexisting attribute and therefore I find it good practice to just initialize it.

however if I should have initialized it properly it should have been initialized as a global attribute like this: float @Alpha = 1;

This way I am forcing an override on the f@Alpha attribute, and I can then do my condition.

Share this post


Link to post
Share on other sites

So if i ant to move now the object i can add transform node behind material node?
And what if i need next same object to be also animated same way but now next opne should occure at time frame 48 and then start mooving specific path.
It seems not to work this way when i just dupliacte the nodes and then change the code and expressions as cant have displat flags same time on both object groups.
I did also to create separate geo node (so that all have same nodegraph inside) and clöeared animation and changed "Attribute Wrangle" VEX expression to:

float Alpha =1; //creates Alpha attribute and set it to 1.
if (@Frame < 48) // if current frame is less than 48
{
f@Alpha = 0; // set Alpha attribute to 0;
}

And also swich node input to $F > 48
Tried animation but cant get second object occur.
 

1.JPG

2.JPG

3.JPG

4.JPG

Update! Got it working if i create seoarate node and on top level and just use that method but if i need or want to animate those both objects in same node how to do it. As that display flag issue. And hot to do it in the way that both move in same speed?

Test.hiplc

Edited by ISUther

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×