Search - User list
Full Version: help:VEX shader swimming with geometry deformation
Root » Technical Discussion » help:VEX shader swimming with geometry deformation
muigoan
Hi everyone,

I have a problem with a basic splatter shader made in VEX. It swims when it is applied to a geometry that deforms (i.e. when it bends). I have read that Prman can let you specify a reference geometry (the state of the geometry before it deforms) in order to let the renderer “track” the surface regardless of what deformations the surface undergoes. Is that how it works with mantra too? If not, how can i make it “stick” to the surface?

any help will be appreciated.
thanks!
stevenong
Hey there,

Look into using a Rest Position SOP and/or the rest parameter in your shader.

Cheers!
steven
muigoan
the rest position seems to be useful when the geometry is undergoing rigid transformations not when the geometry itself is deforming. For instance, I made a soda can with a splatter texture applied to it (with a rest position vop in the network) but the shader swims when i animate a bend deformation on the can… it doesn't stick to the deforming surface of the geometry.
Mario Marengo
muigoan
the rest position seems to be useful when the geometry is undergoing rigid transformations not when the geometry itself is deforming.

Rest position is useful whenever your shader uses position to “do its thing” (e.g. noise based on shader-space P). If it used normals, then you'd need rest normals. If it used some other attribute that is somehow affected by topology, then you'd need a “rest” version of that attribute. In all cases, the mechanism is identical to what you would use for prman, and it works every time – there's no mystery: it's just one more attribute bound to the geometry that comes into the shader as a parameter.

So; I suspect your problem has to do with how you're setting up your rest position, and how it is used inside the shader. Not with whether rest position works… it does.

Some things to check for:

1. Use a “Rest Position” sop, and make sure you feed it a non-deforming version of your geometry. This sop will add an attribute called “rest” by default.

2. In your shader, make sure you have a (vector) “rest” parameter. Transform it to object space, and use that instead of P (wherever P is used to create the effect).


Cheers!
muigoan
thanks a lot, it works just fine!
simagic3d
Mario Marengo
1. Use a “Rest Position” sop, and make sure you feed it a non-deforming version of your geometry. This sop will add an attribute called “rest” by default.

2. In your shader, make sure you have a (vector) “rest” parameter. Transform it to object space, and use that instead of P (wherever P is used to create the effect).

I'm having the same swimming textures issue and being new to Houdini,
I'm not understanding the procedure. When I add a Rest Pos, sop under
my Shader sop, I get red error buttons down the rest of the network in
which the one for Rest says invalid file. OK, I got to select a HIP file and
the dialog box doesn't show any… so, what “non-deforming version of
my geometry” am I supposed to feed it?

Second, I'm NOT a vex programmer, so what will adding this sop
do for the default vex shaders that came with houdini, like VEX_Marble?
I don't see how these shaders can use the sop without going into them and hacking the code, of which I have clue how to do, nor wanting to know.

I just want the marble shader to stop swimming over my moving object.
Does it HAVE to be this hard? I do have a love for buttons that take care
of things like this without having to get an advanced degree in houdini and renderman. I mean, texture maps/images aren't suffering from this, so why should prodecurals? Oh… UVs. well… hmmm… would be nice to click on a “convert to UVs” button for procedural textures.


Your help is appreciated. Thanks.
simagic3d
Mario Marengo
1. Use a “Rest Position” sop, and make sure you feed it a non-deforming version of your geometry. This sop will add an attribute called “rest” by default.

2. In your shader, make sure you have a (vector) “rest” parameter. Transform it to object space, and use that instead of P (wherever P is used to create the effect).

I'm having the same swimming textures issue and being new to Houdini,
I'm not understanding the procedure. When I add a Rest Pos, sop under
my Shader sop, I get red error buttons down the rest of the network in
which the one for Rest says invalid file. OK, I got to select a HIP file and
the dialog box doesn't show any… so, what “non-deforming version of
my geometry” am I supposed to feed it?

Second, I'm NOT a vex programmer, so what will adding this sop
do for the default vex shaders that came with houdini, like VEX_Marble?
I don't see how these shaders can use the sop without going into them and hacking the code, of which I have NO clue how to do, nor want to.

I just want the marble shader to stop swimming over my moving object.
Does it HAVE to be this hard? I do have a love for buttons that take care
of things like this without having to get an advanced degree in houdini and renderman. I mean, texture maps/images aren't suffering from this, so why should prodecurals? Oh… UVs. well… hmmm… would be nice to click on a “convert to UVs” button for procedural textures.


Your help is appreciated. Thanks.
JColdrick
You don't need to have a degree in math to do this, but please understand you're working with a professional tool here and it's to be expected that you will need to learn some new things. You get increased flexibility with Houdini, it's the only truly procedural package out there, expect some learning time. If I was looking to hire someone, I'd have a lot more confidence in someone that actually understands what's going on as opposed to knowing how to punch a button. I used to say Houdini takes a little more time to set up but it's worth it, but with the interactive modelling tools and the idiosyncratic behaviour of every package out there, I don't think that's true anymore. Sorry, pet peeve of mine…anyway…

First off - you have options apart from the Rest SOP.

1. Do all animation on the object level. This won't let you do any deformation apart from scaling in x/y/z, but it's sometimes enough for a given object.

2. Assign uv/st's to the object using the UVTexture or UV Project SOP in the SOP chain *before* you do your deformations. If your object is using st for texture maps only then this is usually enough and a much simpler way to handle things. Even if you were doing a procedural noise, as long as you had access to the VOP network you used to build your shader, you can use the incoming ST and convert it to a new P and things will stick.


Now, if neither of these options apply to the particular needs of the object you're working on, then you should use Rest Postition. What this does is assign a Rest attribute to the data, so it can keep track of how the points are deforming. If you look at the inputs of the Rest SOP(MMB over the inputs), one is for the deforming geo, the other the “rest” geo. You feed the original, non-deformed geo into one, and your animated geo into the other - voila - you have data that carries a Rest attribute. As already mentioned, if you are writing your own VOP shaders(which I strongly recommend you learn - it's very very powerful and actually not complicated at all for basic shaders), just follow the instructions already given.


It's worth noting all the things I've talked about are the same basic principles in *any* major animation package. I just think either you've been isolated from what's actually going on, or the interface is simply too new to you.

If you haven't already, try investing some time in the video and in-session tutorials - they're very useful.

Cheers,

J.C.
Mario Marengo
simagic3d
OK, I got to select a HIP file and
the dialog box doesn't show any… so, what “non-deforming version of
my geometry” am I supposed to feed it?

You don't feed it a hip file; you feed it a geometry file (e.g: extension geo or bgeo). But it doesn't even need to be a file at all. The rest position SOP also lets you wire the rest geometry as the second input to the SOP (bypassing the need for files in many cases). Please see the documentation on the RestPosition SOP for more details.

simagic3d
Second, I'm NOT a vex programmer, so what will adding this sop
do for the default vex shaders that came with houdini, like VEX_Marble?

If used correctly (and that's an important if), it will stop the texture from “swimming”.

simagic3d
I don't see how these shaders can use the sop without going into them and hacking the code, of which I have NO clue how to do, nor want to.

If you're not interested in “hacking the code” (a completely valid position by the way), then you shouldn't expect to be able to “see how these shaders can use the sop without going into them and hacking the code”, yes?
So let's just say that, as far as I can tell (by looking at a few, not all), the vex shaders that ship with houdini will use the attribute “rest” if it exists. And whether it exists, is directly dependent on whether you added a rest position SOP (i.e: whether your geometry has a “resr” attribute bound to it)

simagic3d
I just want the marble shader to stop swimming over my moving object.

And we're trying to help you achieve this.

simagic3d
Does it HAVE to be this hard?

Define hard.

simagic3d
I do have a love for buttons that take care
of things like this without having to get an advanced degree in houdini and renderman. I mean, texture maps/images aren't suffering from this, so why should prodecurals?

Because “procedurals” are slightly different animals. You're used to thinking about “texture UVs”, whereas many “procedurals” will sometimes use “texture Position” (a.k.a: “Rest Position”). Same basic idea, but different data.

simagic3d
Oh… UVs. well… hmmm… would be nice to click on a “convert to UVs” button for procedural textures.

It would have to be something like “UVW” instead of plain-old “UV”, since we need a 3D position (not 2D). And anyway; the “button” is already there: it's called a “Rest Position” SOP. (no; seriously. I'm not being sarcastic here).


simagic3d
Your help is appreciated. Thanks.

You're welcome.


Cheers!
simagic3d
JColdrick
You don't need to have a degree in math to do this, but… it's to be expected that you will need to learn some new things.

It's worth noting all the things I've talked about are the same basic principles in *any* major animation package. I just think either you've been isolated from what's actually going on, or the interface is simply too new to you.

Correct on the latter. Only been using Houdini for 8 weeks (41 yr old grad student) and true on the former as I've never gotten into the heart of shader writing… letting the software work its magic for me under the hood. That is until now as I've been working with some of the power in PRman and RSL.
I know Vex is very similar to RSL in syntax, but time constraints on this assignment dictates not being able to venture into Vex builder, etc.

I was happy to see that if I added a UVproject sop after each shader sop that the procedural texture appeared to become locked to the translating
geos. There is no deformation going on as was the case for the person starting this thread.

Thanks for your understanding and help. Nice to see the absence of arrogance and belittlement in this forum, which seems to be the case for other 3D package specific forums at times.

:-)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB