Mistakes. Mistakes are great. They help you learn and improve. As they say, if you are not failing, you are not progressing or something to that effect. In our Mograph Multishader Setup in Houdini #QuickTip, we looked at how to texture planes with random images from a folder similar to Cinema 4D’s Multishader. We are back to look at some of the things I goofed up on. Are you ready?
If you recall, our setup was rather simple. A network for our frame and a network copying our frame to a bunch of scattered points. We wrote some VEX code to load up the images from a folder so we could map them on the faces of the frames. There were also some sliders that allowed us to modify the number of images used, a seed value, and the number of points or frames. There was also a Switch node that allowed me to pick between points created from a Scatter SOP or Point From Volume SOP. Check the previous #QuickTip if you are not sure how it was set up.
Here is where I screwed up. Notice that the number of points is enabled when I switch to the stream that creates points based on a Scatter SOP. This will add or remove frames from the scene. All I did was make a relative reference to the Scatter SOP’s Force Total Count (npts) parameter. There is no reason I should have added the variable
numPoints. It’s doing absolutely nothing in the value we get for the
@base attribute. Duh!
So that line of code should be the following:
[email protected] = int(fit01(rand(@primnum * imgSeed), 0, numimgs) % numimgs);
The next problem has to do with how many primitives are being assigned a texture. Right now every primitive has a corresponding image. No bueno. This is why the Spreadsheet is an invaluable tool in Houdini. It allows you to scan your data and check to see if you are getting the values you expect or getting more than you need. Use it!
We only want the primitive, which is our face, to have an image. This is an easy fix. We already have a group for those faces. Now it’s just a matter typing the name of the group in the Primitive Wrangle’s Group name parameter. Much better.
There you go folks. I’m sure I’ll find something else. Well, I hope not. Just goes to show you that you should always question and improve.