Box mapping with procedural texture

I noticed that “Texture image” node has box projection option which allows mapping 2D texture to 3D object. My problem is that I don’t know how to achieve similar solution when using procedural texture (e.g. noise texture). I guess that procedural textures are essentially 3D textures so it is possible to map them to 3D object directly - that is why box option is not provided for such textures as it is for image textures. Despite that there are some situations when box mapping of 2D noise texture to 3D object would be desirable. My question is: what is the best method of achieving such effect? Is it possible to do it just by appropriate node configuration?

Thanks.

Procedural texture example


Thanks for reply. I know how to achieve such basic setup. My problem is I don’t know how to do box mapping. The example you provided doesn’t use box mapping I guess.

Ok, I will try to give an example to better explain my issue. So I created procedural texture and applied it on cube by using standard object coordinates. In viewport you can side face of the cube:



You can see that texture consists of black sport lengthened in top-bottom direction. This is cool - I would like all faces of the cube to show such pattern. But, if you look at top face of the same cube (in same configuration) you will see:


So it contains many dot-like black shapes. I understand it is expected result - noise texture is 3D texture mapped directly to the object by using object coordinates so it is where these dot-like shapes on top face come from. Nonetheless, I would like to get the same pattern on all faces, so top face contains long spots as well, not dots. What is the simplest way of achieving that? I guess that box mapping is the way to go, but I cannot see such option for noise and other procedural textures.

I am attaching the blend file.

Attachments

proctex-problem.blend (501 KB)

One more thing - I would like to avoid using UV mapping as it introduces additional work in case of more complicated objects.

What are you trying to achieve? Box mapping is meant to allow a 2d texture to function like a 3d texture. You can use the “real thing” with procedurals, so there is no need.

glukoz is trying a noise pattern scaled as x=6 y=6.
However this is a 2d approach of a texture. The generated noise procedural is a 3d texture. The xyz coordinates are the xyz object space. He’s trying for a x=6 z=1 distorted 2d image box mapped like.

@michalis question: I would like to get the same scaled pattern on all faces - I think I’ve already explained it clearly in my previous post.

I guess the way to go should be as follows:

  • create scaled 3D procedural texture
  • extrude 2D procedural texture from 3D texture from previous point, so new generated 2D texture contains desired lengthened shapes
  • apply this new 2D texture to object using box mapping - this way all faces of the cube should be coloured by the same scaled pattern.

I think it is so simple idea so it should be possible to achieve such effect by appropriate node setup - but how to do that? :slight_smile:

OK, gluloz
here’s a workaround.
On the cube, UV unwrap it (edit mode), reset, and use ctrl+P to pack the six faces.
In cycles texture coordinates as UV
mapping (point) as scale x=6 y=1 z=1 vector to noise texture combo to diffuse.
You see, having a UV set mapping works in 2d coordinates.

If you try to render (bake) a procedural texture on a plane by example, and handle it as an image texture, it won’t work.
Because it won’t be seamless.

Thanks for your reply. As I said earlier - I would like to avoid UV mapping as it is uncomfortable when dealing with more complicated objects. That is why I opt for using object coordinates with box mapping. I guess that such method may introduce visible seams on object but I think I can live with that.

There is an old blended box mapping node group available here:

http://mango.blender.org/production/blended_box/

You would have to input 3 copies of your entire procedural texture chain, each one scaled on the correct set of axes.

The amount of blending is set by color ramp nodes inside the group. The whole thing is very cumbersome to work with, but might be the basis of a solution that works for you.

Wonderful - I succeeded to achieve desired effect using the method you provided. Thanks a lot! And you are right - this method is very cumbersome. I think it would be desirable to add box mapping option for procedural textures in some new version of Blender, what do you think? :slight_smile:

Sadly there is no option like that after 4 years… Any new workaround about it?

I’m using this approach.
Search for triplanar mapping, although the one I derived mine from is based on a sixplanar blended boxmapping thing I found on blendswap.

Looks superb but somehow hard to understand for me (Your link), could You please provide a .blend?

Sincerely, Jan

I useful to anyone, I stumbled on the same problems and found workarounds :

  • If you want a simple “box mapping” on any object, create a cube, then on the material of your object use a TextureCoordinate node set to “Object”, and select the created cube. Hide the created cube from viewport and render. Weird to add a hidden cube for that, but it works.

  • There is also another solution : On your object, go to mesh properties and you’ll find a tab called “Texture Space”. Uncheck “Auto Texture Space”, and then you can manipulate the texture scale on each axis or all together, without touching the material or doing UV mapping.

No. All you’re doing is manipulating the 3D parallel mapping. Box mapping is mapping XY coordinates to all three planes (XY, XZ, YZ), and choosing the one that is closes to its normal (or blend between them). Using the built-in brick texture, which is 2D, a working box mapping you gives you bricks from all directions.

@CarlG Thanks for your reply. My workaround works with noise but doesn’t work with a brick texture indeed, I assume it’s because the noise is 3D. And so these are not good methods.

I found a solution here : Box mapping for procedural brick texture in cycles

I’m beginning in Blender and might miss some things, but it’s weird to have to put that much effort for doing triplanar or box mapping.

Box mapping/triplanar mapping isn’t really that much work, because once you have the node group, you can reuse it anywhere you want.

But yeah, it is kind of a weakness of Blender that it isn’t built in-- or rather, isn’t built in in the right way (shouldn’t really be attached to texture nodes itself, should instead be a kind of mapping node.)

And there are still issues. If you’re using normals to map, you can’t use what you’ve mapped to set normals, meaning you can’t plug a triplanar projection into displacement-- have to bake to image first. In my mind, a good solution to that would be a output from, say, a geometry node that provided original, smooth-shaded normals, in order to avoid the dependency issues. (We already have original flat-shaded normals, via the true normal output.)

Probably not possible. I don’t think box mapping with blend is done simply by mangling the coordinates, that would cause distortions in the coordinates and there are none. Box mapping without blend masking by sharp normals (as in the example above) is possible.

Boxmapping with blend need a mapping way to manipulate coordinates, and a blended way to mix the results. I’ve attached an example based on 6 sided triplanar mapping converted into 3 sided triplanar mapping. Although this is more complex that I would be able to come up with myself.

I’m using brick texture since it is 2D. But bricks isn’t what you’d typically use blended for.
Also, if you have several signal channels, you’d have to do this for all channels since it’s not only working on the coordinates.
Blended Box Mapping.blend (886.0 KB)