Jump to content

How To FLIP each FACE of BOX/GRID one by one


Recommended Posts

Hi,

How can I flip each face of the BOX or GRID one by one to create an effect.

1) TOP side of the BOX or GRID there is one texture

2) BOTTOM side of the BOX or GRID has another texture.

3) I want the faces of the box or grid to flip one by one to reveal the textured part underneath.

it will be great if you can post an example hip file of the scene.So that I can understand you concept better.

thanks

Zasid.

Link to comment
Share on other sites

Thank you very much Petz for sharing the file.

Petz can you explain me

why are you using the nodes

SORT abd FOR EACH

and what does this express means .

int(fit($F, $FSTART, $FEND, 0, nprims("../copy1")))

where did u declare these variables FSTART and FEND or are they the global variables like $F.

I tried to look for the foreach value in the help file but didn't get much from it .

Thanks.

Link to comment
Share on other sites

Hello

Thanks for the response I think FOR EACH fuction seems to be some kind of recursive function that calls individual faces of grid and flip it over but how it is doing it is still not clear to me plus I can't see any animation channel its just one xform getting flip at an angle of 90 in x.

Link to comment
Share on other sites

the foreachSOP might be getting slow on larger geometries.

I often use this setup for such tasks.

Use a facetSOP to break the geometry into unique primitives.

Then modify each primitve with the primitiveSOP.

The expression clamp(-$PR + $NPR * ch("flip"), 0, 1) returns a 0 to 1 value for each primitive.

flip is a sapre channel that is used to animate the flipping progress.

flipfunc is the sparechannel that holds the function - this is only for design purpose - for more speed skip this and pull the expression directly into the parameter.

A twosided shader is attached to color front and back differently.

rdg_flipemall.hipnc

Maybe there is a way to preview two-sided shaders in the viewport, but I am not aware of it.

So the final result is only visible after rendering.

Reading the posts on the SESIlist about pro/con of pointSOP expressions vs VEX - it might be faster to pull this into vex.

But to be honest: rotationMatrix and me were never good friends.

Georg

Link to comment
Share on other sites

NEVER THINK TO COMPLICATED!

That's right and the main reason I posted this approach is: I often get smarter files from petz for stuff I spent hours to overcomplexify.

On the other hand:

The 'smartness' of this particular setup took me almost a year.

Since I started learning houdini I work on the 'generic function for growth'. I use(d) copystamp deletes, chops, groups, expressions of the size of 'single-family detached houses' and monolithic combinations of those - until I it showed that this is the function I was looking for all the time.

Georg

Link to comment
Share on other sites

Hi there ,

I tired and play around with the file but when I try to plugin more complex geometry such as torus or any poly edited geo ,face rotation doesn't seems to work

The key point I see in this problem is that I need to rotate every face along its normal so that the rotation should look correct but I really don't know how to do it .

Please have a look at the file attached.

thank you very much.

rdg_flipemall_problem.hipnc

Link to comment
Share on other sites

The key point I see in this problem is that I need to rotate every face along its normal so that the rotation should look correct but I really don't know how to do it .

The normal is the vector that is perpendicular to the face, I don't think you want to rotate about this.

You are looking for a vector that is perpendicular to the normal.

you can find such vector with the cross product of the normal and a second vector constructed from point of the face.

I guess it's rather hard to find a generic way to calculate such vector - at least for me.

I stumbled over this a lot of times.

In my example the face rotates about the X axis no matter what. that's why the 'problem' appears.

There is a posting somewhere in this forum where it is explained how to construct a vopSOP that reorientates arbitrary faces to the world XYZ to align it to another face. This might help.

If this is too complicated, then you can find maybe a way to re-construct your geometry so all faces can rotate about X anytime.

Edited by rdg
Link to comment
Share on other sites

sometimes its handy to use the polyextrude-sop for things like that.

can you explain this? wouldn't this result in a myriad of polyextrudes?

as for the rhombic shapes:

you would need to convert the space of the face to something usable - like in shader spaces.

so pick a face (like foreach or copy/delete), align it to worldspace and place it at [0, 0, 0], do your rotations, push it back to were it belongs to, fin.

I believe that a simple crossproduct of the primitive normal and a world axis like [1, 0, 0] should give you the angles need.

Assuming that the face/primitive is planar.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...