4

I would like to know if it's possible to get something periodic only through the parameters of the musgrave node with cycles.

sorry if my question isn't clear, here is an example of what I'm doing: https://i.stack.imgur.com/Se6uq.png

the brick texture node is periodic, I mean f(0)=f(2*pi) while the Musgrave texture gives something with a discontinuity. Honestly I don't think it's possible to solve this problem trough musgrave node in general case, because I guess it uses a pseudo random generator and when you code a such thing you search to avoid periodicity.

David
  • 49,291
  • 38
  • 159
  • 317
  • 1
    Images as to what you mean by periodic in this context would help. – Ray Mairlot Nov 06 '14 at 17:55
  • What are you meaning by periodic? – BlendingJake Nov 06 '14 at 18:27
  • musgrave at x must be equal at x+L for any x value and for one L given. – The Unholy Metal Machine Nov 06 '14 at 18:38
  • What part of the musgrave? If it is the output then you should be able to use a math node set to add. Then add musgrave and L. – BlendingJake Nov 06 '14 at 19:03
  • @bob-Masterofblackmagic Add some more specifics to the question, an image of what you want or whatever you have tried would also be useful. – iKlsR Nov 06 '14 at 20:59
  • Actually the brick isn't periodic, you can simply test more to prove that. It's true that precedural textures can be seamless. However, "seamless" doesn't 100% mean "tileable", or f(0)=f(2*pi) as you described. Besides, you were using Radical gradient. For a tileable image texture, fine, feel free to use it. But obviously it will not work for prcedurals in most case. – Leon Cheung Nov 07 '14 at 04:40
  • @LeonCheung (sorry for the deal I was busy all the last days...) I said the brick are periodics because I consider the result not the settings, the reason is quite obvious, f(0) and f(2pi) fall in the mortar. – The Unholy Metal Machine Nov 12 '14 at 22:58

1 Answers1

8

The reason for the 'join' in the resultant texture is due to the discontinuities (edges) in the mapping into texture space and the solution is to change your mapping to join the edges to make the musgrave continuous. In order to visualise this, consider how the polar coordinates are currently being mapped into texture space.

The polar mapping can be considered as having the following marked boundaries (ABCD) :

radial

In 'texture space' the marked boundaries map to the edges of a square (or rectangular) region as follows :

plane

Note how the point A in the radial texture maps to the edge A in texture space - effectively compressing the texture down to a point in the centre. Edge B is stretched around the circumference while C and D are at the discontinuity of the texture and correspond to opposite edges of the plane in texture space.

The discontinuity is caused by edges C and D not corresponding to the same region in texture space. Therefore, the solution is to change the mapping to wrap those edges around so that they do coincide - ie, change the mapping in texture space to a cylinder rather than a plane :

cylinder

Now, crosing the C-D boundary in polar coordinates does not produce a discontinuity since the C-D boundary in texture space correspond to the same region.

To achieve this was can use the following nodes :

planar to cylindrical nodes

This takes the output from the Radial texture (which varies from 0.0 to 1.0 as the coordinate moves around the centre) and converts it to Y/Z coordinates around the circumference of the cylinder in texture space shown in the above diagram. Note that since 0.0 and 1.0 map to the same location the mapping becomes cyclic, thereby hiding the join.

To make this more versatile we can add in two offsets - one to offset along the axis of the cylinder (to allow the texture to be animated into/out-of the centre) and one to offset the 'rotation' - and one to adjust the radius of the cylinder, controlling the density of the texure around the centre point to produce the following material :

full material

One limitation of using a Gradient texture is that the output is always between the range 0.0 and 1.0 - beyond a certain distance the output does not change. To address this we can simply replace the Gradient with maths nodes to calculate the distance directly (ie, sqrt(x^2 + y^2)).

full material with proper distance

This can produce the following result :

animated

Blend file included

Rich Sedman
  • 44,721
  • 2
  • 105
  • 222