Jump to content

Repeated Textures in VOPs


Guest Swann

Recommended Posts

Guest Swann

Hello Masters,

I tried to make tiling texture based on renderman shader but I can't find repeat function in Vops,

In renderman it looks like this

ss = repeat(s, freq);

tt = repeat(t, freq);

So how to make repeated pattern in Vops ?

How I have to rebuil my shader to achieve this task ?

Line_and_Ring.hipnc

post-3552-1206728289_thumb.jpg

Edited by SWANN
Link to comment
Share on other sites

I tried to make tiling texture based on renderman shader but I can't find repeat function in Vops.

I'm fairly certain that there is no function called "repeat" in RSL. This must be a user function. Please check the #include files in the source code you're copying from -- the function is likely in an external module.

However, given the way you're using it in the code snippet, I suspect it looks something like this:

float repeat(float var, freq) {
   return mod(var*freq,1);
}

And in VEX, that would looke like this:

#include <prman.h>
float repeat(float var, freq) {
   return prman_mod(var*freq,1);
}

Please note the #include line in that last snippet -- it includes the header that contains the definition of the prman_mod function.

If doing this as an InLine VOP, then remember to add "prman.h" to the includes there as well.

HTH.

Link to comment
Share on other sites

Guest Swann
If doing this as an InLine VOP, then remember to add "prman.h" to the includes there as well.

basicaly I have to just put this code

#include <prman.h>

float repeat(float var, freq) {

return prman_mod(var*freq,1);

}

into inlineVOP and in include files direct him to ../houdini/vex/include/prman.h, and it should work ?

well as you can see in the attached picture, somewhere in my thinking is error

Need MORE Light Mario, light from your candle is not enought.

Thanks

post-3552-1206734563_thumb.jpg

Edited by SWANN
Link to comment
Share on other sites

basicaly I have to just put this code

into inlineVOP and in include files direct him to ../houdini/vex/include/prman.h, and it should work ?

well as you can see in the attached picture, somewhere in my thinking is error

Need MORE Light Mario, your candle is not enought.

My suggestion was based on the RSL code you posted, not on looking at the hipfile.

Since you were translating RSL *code*, not VOPs, I thought that would be enough info to go on... (BTW, did you check for include files and find the actual definition of that "repeat" function?)

Anyway... I just opened the hipfile, so let me see if I can turn up the volume on my candle... ;)

1. You're assigning texture UVs to the grid (UVProject SOP) but they are being blissfully ignored by your shader, which uses {s,t}. I added a ShadingLayerParameter VOP to bring these into your shader.

2. Looking at your last post, I see that you're using the Modulo VOP. This is *not* the same as PRMan's mod() function. VEX's % operator, which the ModVOP is a wrapper for, calculates the "remainder after division" (same as '%' or fmod() in C/C++). PRMan's mod() calculates the actual modulo. This won't be a problem while your texture UV's (assuming you used them) stay positive. As soon as either U or V straddle the 0-line or go negative you'll see the difference. This is why I pointed you to the prman_mod() function (in $HH/vex/include/prman.h), and not VEX's '%' operator (which, again, is what the ModVOP is).

3. The problem you had when attempting to set the code I gave you inside the InlineVOP, was that you included the line "#include <prman.h>" in the actual body. Don't. That's what the "Include Files" parameter of the InlineVOP is for. As you will see from the modified hipfile I'm attaching here, implementing the code I gave you as an InlineVop really *is* as simple as copy/pasting what I gave you (minus the include line, which goes in as a separate parameter).

Hope that's a little more light to see by. Here's the modified hip file.

Line_and_Ring_mgm1.hipnc

PS: This is not necessarily directed at you, SWANN, but a general comment since I keep seeing this in a lot of posts: I find that images of VOP networks, generally manage to convey a grand total of zero information -- and making them really big doesn't improve the situation much. Since you *have* to download and open the hipfile to have any hope of knowing what is going on anyway, might as well skip the VOP image altogether. Alternatively, if possible, include the 4 lines of code that the monster VOP network actually represents.

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