Mograph Multishader Setup in Houdini Revisited

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?

Oops!
Oops!

Mistake One

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.

VEX Code setup
VEX Code setup

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!

Adding the number of points error
Adding the number of points error

So that line of code should be the following:

[email protected] = int(fit01(rand(@primnum * imgSeed), 0, numimgs) % numimgs);

 

Mistake Two

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.

Way to many faces with a texture
Way to many faces with a texture

 

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.

Share:
990adjustments

990adjustments

I am a motion designer & developer based out of South Florida. When not designing or animating pixels, I wrangle some code. If all else fails, I watch Twilight Zone, I Love Lucy, or Three's Company reruns.