Box mapping with procedural texture

Does box mapping blend? A box mapped Suzanne has clear borders. But if so, I didn’t realize that.

I hadn’t looked at previous node demos, just assumed they were valid. Here’s my node group box mapping, which divides the texture space into three volumes and swizzles coordinates on the basis of in which volume texture coordinates lie. Doesn’t rely on normals, because box mapping is based on position, not normals:

This doesn’t do any blending/blurring, beyond texture filtering, but the texture filtering ought to be valid.

This isn’t a great way to texture Suzanne, but that’s because box mapping isn’t a great way to texture Suzanne.

Edit: May have been wrong about some of that (I tend to just UV map everything.) Node group linked overemphasizes front facing, but that can be fixed. Maybe it does use normal rather than position. I’ll experiment some more.

If you set the texture to box mapping (only image textures has this, that’s the issue), the blend parameter shows up. UV map everything? That’s ok for texture and texture painting (if you have the time for it), but you won’t be getting smooth results from 2D procedurals.

Try the file I attached above. Since it’s pretty complex, it’s going to impact render times. However, you could probably bake it out to a regular UV mapped image using whatever UV layout you see fit.

Yes, there are 3D generators (even 4D now). But some patterns are too hard or even impossible to create in 3D as they are 2D features. Most of my setups involve 2D only, and in some cases also involve blended box mapping using images, or the procedure above if I need greater control, maybe on conjunction with a noised texture mixer (hides repeats for dense repetitions). I can setup an example that does both if interested.

Well, I use some generated/object, when I don’t feel like mixing over seams. (But those can be represented by a UV map anyways, just do a pair of orthogonal project from view, mappings that can give much more intuitive, artistic control than trying to perturb natural coords with math alone. UV maps don’t have to have any seams.) A box mapping won’t give you smooth procedurals either, no more than it will give smooth image textures across Suzanne. There are discontinuities (unless you’re texturing a box, in which case, UV also works fine.)

I’ve done a six-plane mix-by-normals before. That’s how I know you can’t use it for displacement output, learned the hard way :slight_smile:

I think box-mapping via node-group can be done-- maybe not identically to Blender’s algorithm, but quite possibly, better. I’m going to keep on experimenting. I’m not sure that Blender’s box-mapping blends, but if it does, it does it only faintly, and you can do that by mixing output from multiple texture lookups, just like it looks like your three-way brick is doing.

Edit: Ooops! I was wearing blinders. I didn’t realize the “blend” was a slider. Does look just like mixing from multiple samples.

Box mapping looks to ignore custom normals, from modifiers or displacement output, so I think it is using position in texture space, not normal.

Edit2: Box mapping with blending in nodes, via mixing between multiple texture lookups. Compared with box blending via image texture node on right. Not exactly the same-- box map in texture lookup seems per-vertex then interpolated, not per-sample, but per-sample is better anyways. Can’t say I have the “curve” of the blend the same-- I almost certainly do not, I just used a power node to scale the weights of the texture lookups. Whole node setup is pretty messy, sorry, I’ve been experimenting a lot.