Okay, Il again won’t give you the .blend with a full setup for Suzanne, otherwise where’s the learning fun?
Instead, I’ll give you a simple example .blend as well as some explanations.
First of all, to explain this little example: I want to make a material (or rather, a group of nodes) that will represent Suzanne being cut in half by a vertical plane (a section plane). I want to be able to rotate that section plane to change the angle of section.
The section is easily represented by a simple black-and-white mask, where black colors are on one side of the section plane and white colors on the other. If I can somehow color Suzanne this way, my problem will be solved and I’ll be able to use my mask to actually control how Suzanne is rendered (i.e. make “white” part transparent, change diffuse color of “black” part, etc.).
Look at this screenshot:
First of all, look at the left viewport. I intentionally enabled edit mode and switched 3D manipulator mode to Local. This way I can see where Suzanne’s coordinates are going. I see that her Y axis is directed up, her X axis goes from her right to her left, and her Z axis goes from her back to her front. Thus now I know that my section plane will rotate around Y axis.
Now let’s dissect my node setup.
Lets skip Texture Coordinates and Mapping nodes for now. Look at two green nodes (Separate and Less Than). Separate node takes a vector and separates it to its three components. Though technically this is a “Separate RGB” node, think of it a a “Separate XYZ” node. So R is X, G is Y, B is Z. Now Less Than node will take one of the coordinates, compare it’s value to 0.5, and whenever the coordinate is less than 0.5, it will output 1. Otherwise, it will ouput 0. So this Less Than node is what’ll give me my black-and-white mask.
Now for the coordinates themselves. As in your previous problem, I’ll be using Texture coordinates (see end of post for other possibility). Looking again at my viewport I want to start by cutting Suzanne along her XY plane. So I take Object coodrinates and put them through Mapping node. Now, in this Mapping node I set Location to (0.5,0.5,0.5), so that the section plane goes right through the middle of Suzanne. I then proceed to select a coordinate that will actually represent my section plane. In this case, I choose Z (because I wanted XY as initial section plane, remember?). Now I can simply rotate my section plane around Y axis (Y Rotation input in Mapping node) to get the angle of section that I need. Problem solved. Now I can create several of these section planes and combine them in any way I want: it’s only a matter of duplicating those four nodes, selecting coordinates and changing values.
Remember what I said about this not being universal shader? Well now you can see why: it’s tied to Suzanne’s transform, i.e. to the direction of her orientation axii. Instead of using Texture Coordinates, you can use Position output of the Geometry node. Then you’ll need to tweak your setup accordingly (i.e. different axii will be used). But that still won’t make this approach universal, because objects may be transformed in space (translated, rotated…), so that initial Location values of the Mapping node would differ for different objects.
I’m attaching .blend with which I made the screenshot. Feel free to ask any questions, I’ll try to explain to the limit of language barrier (I sometimes am not very good at explaining things since English is not my native language).
Attachments
monkey_section.blend (558 KB)