Page MenuHome

Shading: Add Seamless option to the Voronoi texture.
Needs ReviewPublic

Authored by Omar Emara (OmarSquircleArt) on Mon, Oct 28, 8:16 PM.
Tags
None
Tokens
"Love" token, awarded by kilbeeu."Love" token, awarded by BennyG."Love" token, awarded by monio."Like" token, awarded by Frozen_Death_Knight."Love" token, awarded by aidyburrows3d."Love" token, awarded by amonpaike."Love" token, awarded by charlie."Love" token, awarded by franMarz."Like" token, awarded by EAW."Love" token, awarded by kioku."Love" token, awarded by dgsantana."Love" token, awarded by xrg."Love" token, awarded by ThinkingPolygons.

Details

Summary

The seamless option, if enabled, will make the texture seamless at unit
boundaries and reapet beyond such boundaries. The scale of the texture
in this case represents the number of cells before the texture starts
repeating.

I only did an EEVEE implementation for now, I will do Cycles once
the patch is reviewed to conserve effort.

Diff Detail

Repository
rB Blender
Branch
voronoi-tilling (branched from master)
Build Status
Buildable 5469
Build 5469: arc lint + arc unit

Event Timeline

Think this is a useful thing to have.

The only thing which is annoying is to have this seamless check everywhere. How important is it to have non-seamless mode? Is it just for compatibility (or is there actual usecase when it's preferred) ?

@Sergey Sharybin (sergey) Not sure if it would be a good idea to get rid of the non-seamless mode. To demonstrate, one might use the voronoi texture to create a cobblestone floor, in which case, the user don't want the texture to repeat, if the non-seamless mode didn't exist, the user will have to use a sufficiently large scale to make sure the texture is unique, which might not be intuitive for everyone.

I guess if we wanted to compromise, we can make sure the texture is seamless along unit coordinates but unique anywhere else. It should be easy to do, but not sure if it would be a good idea. I could make a test and see how it looks.

@Sergey Sharybin (sergey) The following texture implements the compromise I described. The texture is seamless only at unit boundaries. I think it is acceptable, I can't make any patterns, which is very good. What do you think?

@Bartosz Moniewski (monio) Raised some concerns that a single checkbox isn't enough, proposing that we should have four integer inputs, each corresponding to the number of cells before the texture tile in a certain axis. This allows the creation of non-square seamless textures and provides more independent controls.

To do so, the node will have four extra inputs, or two if we implement integer vectors or use float vectors directly. The implementation itself should be very simple. It is just a matter if whether we should do it.

Let me know what you think.

Non-uniform scaling is necessary to achieve directionality of a texture or compensate stretched mapping (cylinders).

With current infinite noises we just add mapping node and set scale but this won't work for authoring tillable textures. Anything in scale fields that isn't an integer will break tilling, scale can't be fine tuned. Event with integers, using mapping node will introduce tiling within texture itself.

My suggestion:
At the top of the node we add new enum param with "Infinite", "Tileable" and "Tileable Non-Uniform" options.
"Infinite" - regular float input for Scale like now.
"Tileable" - float Scale is hidden and one int Scale param is displayed.
"Tileable Non-Uniform" - there are separate int params for each axis. Number depends on Dimensions of a texture.

Regarding pattern repeating only on borders. @Omar Emara (OmarSquircleArt), are you sure this don't have discontinuities on borders? From math point of view you would need to repeat 4x4 cells on borders for non-smooth variant and 6x6 with smooth one (basically radius of search kernel in every direction). Pretty sure this will introduce repeating patterns. I don't know how your code works but I assume this will also introduce pattern flickering while changing scale which is really bad for animated shaders. We should leave infinite noise variant as it is IMHO.

If we are going to allow per-axis scales, then I think we should just remove the uniform variant, no need to introduce even more special cases. For the compromise I described, a search kernel of 3x3 only dictates that we repeat a single cell, so it is not really bad. Similarly, a 5x5 search kernel only dictates that we repeat only two cells. For scaling, flickering only happens if you animate the scale of the texture, not the texture coordinates, so we didn't really lose any ability.

I don't mind doing what you described. But lets just see what the developers think first.

I'm also in agreement with Bartosz, if those extra options can also appear when switching to seamless i'd be all for it as some directionality would be excellent for other cases.

Here's a standard non-stretched tiling lava texture using the seamless checkbox option so far...

Here there's a camera looking straight down with a plane tiling twice in x and y. In this example i've only used voronoi but definitely would have been useful to have the standard noise seamless too! (But that's another story) :)

Alright, since everybody seems to be in agreement that per-axis control is essential, I will update the patch to reflect that. Thanks for the feedback!

kb (kilbeeu) added a subscriber: kb (kilbeeu).