Jump to content

custom noiseSOP


itriix

Recommended Posts

Hi there,

I'm trying to create a custom noise vop sop. I want it to be able to take in any attribute, pump it into a noise vop, and output it to any attribute. I'm running into a few issues though that i'm not sure how to take care of.

From my understanding, i'm using an import attribute vop, exposing the attribute param *that way i can input whatever param i want*... then pumping the output of that into the P input of a turbulent noise vop... I then do the necessary "bells and whistles" for the noise *such as exponential vop and fit*... then I add the output of the noise to the original input... This goes into an "add attribute vop", that has the attribute param exposed so that I can output this to any paramater I want.

However, i'm obviously doing something wrong. First off, Nothing is being pumped into my actual "output" node. I just leave it at the "add attribute" vop. Is that correct?

Secondly, If i just try a simple example of using this on Cd, it seems that everything works. But as soon as I try something like P, it doesn't work. I think it has to do with "type", like vector, float, etc. However, i'm not sure how to go about fixing this so that any attrib that comes in will work.

Any ideas or help would be awesome!

Thanks so much

Jonathan

Link to comment
Share on other sites

First off, Nothing is being pumped into my actual "output" node. I just leave it at the "add attribute" vop. Is that correct?

I think that's fine ... especially if it works. :)

Secondly, If i just try a simple example of using this on Cd, it seems that everything works. But as soon as I try something like P, it doesn't work. I think it has to do with "type", like vector, float, etc. However, i'm not sure how to go about fixing this so that any attrib that comes in will work.

Have you tried some non-default attribute name like "foo"? "P" is a special global variable so you might need to special case that to connect to the output node's P input instead.

Link to comment
Share on other sites

I think that's fine ... especially if it works. :)

Okay great! I needed the peice of mind :)

Have you tried some non-default attribute name like "foo"? "P" is a special global variable so you might need to special case that to connect to the output node's P input instead.

Well, I haven't tried non-default attributes but i will. But I do think I see where the problem lies. In the case of Cd, when I look at the details view, the Cd values are being updated... BUT in the case of using P,

I end up seeing the common: P[x], P[y], P[z], P[w]... BUT now I also see P[0], P[1], P[2]... So it makes sense to me, WHY the Position isn't being updated with my setup. I'm just not sure how to account for this...

By the way, thanks so much for your response

Jonathan

Link to comment
Share on other sites

Can't you just check if the attribute name from the user is "P" and then switch over to the output node?

Sounds good to me but i haven't done much "conditional" vop work before so i'm unsure "how" to do the check and which vops to be using to make the connections. Could you explain a bit more please?

To start:

I tried to plug in the "import attribute's exposed attribute" into the first input of a compare vop, then i set the "compare the string" to P... (i thought maybe this is how to go about doing the check)... Not sure if that's right or not, but aside from that, i'm not sure how to "tell it" i want to send the output of the "noise" to the P input of the OUTPUT VOP, otherwise, use the "add attribute" vop...

Thanks again for your time,

Jonathan

Link to comment
Share on other sites

I think I got it. Cd, OR Position, works for now!

here's a pic.

I just used the "compare" vop, if the result was true *meaning the param was P*, i pipe in the output from the "add attribute" into the first input of a switch vop... the second input is just a globals P... the output of the switch goes into P of the OUTPUT VOP...

Looks good?

I really appreciate the help

Jonathan

*NOTE*

I do however notice that with this method, if i set my input and output to Cd, i get noisey Cd, which is correct... in the details view, Cd is being updated. But, this time, unlike the last time, when I use input and output P, the position is being effected correctly, HOWEVER, in the details view, i'm still getting: both the P[x], P[y], P[z], P[w]... and a P[0], P[1], P[2]... but the values of px,y,z are the same as p0,1,2... So therefore, the Position is being effected by noise! So that works, but i'm still curious, why and how to get rid of that "second" P[0], P[1], P[2], data... because i guess it means i'm still doing "technically" something incorrecty here

Edited by itriix
Link to comment
Share on other sites

Ah thanks so much Edward! It's exactly what i was trying to figure out!

I've made quite a bit of headway. I've started implementing "type" support for the various input/output combinations by copying and pasting the vopsop many times, and inside the individual vop sop, i've made the necessary adjustments. all of the vopsops are then fed into a switch, that allows the user to choose the input/output type combination. This is wrapped into a single hda.

Example Support combinations with an individual vopsop for:

input/output:

float/float

float/float3

float/vector

int/float

int/float3

int/vector

vector/float3

vector/vector

Does this sound correct to you?

I really thank you for all your help here,

Jonathan

Link to comment
Share on other sites

this would definitely have the benefit of making updates not so much of a hassle. as of now, with the multiple copies of vop sops, if i need to make a general overall change, i have to go back and rehook up all the "type" support again for each individual vopsop.

curious though, is your suggested method more "efficient" aside from the updatability issue?

One more question... (in a rampSOP HDA), I'm using a FIT RANGE vop to get some values into a 0 to 1 range to prepare for RAMP INPUT...

My intentions are to detect the min and max values of the incoming data, and use that as the srcmin and srcmax of the Fit Range, in order to get a smooth interpolation of values between 0 to 1 *because destmin is 0 and destmax is 1*

I'm getting errors with my setup however

If i use an import attribute... plug that into a Min and also plug it into a Max... Then plug the Min output into the "src min" of a Fit Range Vop, and the Max into the "src max" of the Fit Range Vop...

I assume it's not working because the Min and Max nodes need at least two inputs? And that since it's only doing it one point at a time, it's not able to compare the data of the points with eachother. What would be the correct way to just get the min and max values of the incoming data?

I really appreciate it,

Jonathan

I just noticed this post:

http://forums.odforc...__fromsearch__1

I'm going to take a look at the network. However, it seems there should be a more efficient way???

Edited by itriix
Link to comment
Share on other sites

I assume it's not working because the Min and Max nodes need at least two inputs? And that since it's only doing it one point at a time, it's not able to compare the data of the points with eachother. What would be the correct way to just get the min and max values of the incoming data?

It's not possible to so efficiently in VEX/VOPs because the VOP network is executed per point. This allows it to be trivially run in a SIMD manner (as well as being parallelizable). You will have to do it outside of VOPs.

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...