Page 1 of 2 12 LastLast
Results 1 to 20 of 24
  1. #1

    Extending the Voronoi texture node in Cycles

    Hi,

    I think the voronoi node in Cycles is rather limited and extending it via OSL is rather slow (because only available on CPU). I therefore coded up a patch for the node tha tworks on the GPU as well as the CPU and implements most functionality available in the BI node.

    example F2 - F1 texture:

    f2f1.png

    Details (and source code) on my blog, let me know what you think. Is this useful enough to let me try and get it included in the source?
    Last edited by varkenvarken; 05-Jul-16 at 09:36.
    Check out my new add-on, Ortho, or the other ones on my Blender Market store.
    There you will also find my e-books 'Creating Add-ons for Blender', 'Open Shading Language for Blender' and the new 'Blender Add-on Cookbook'.
    Main blog: http://blenderthings.blogspot.com



  2. #2
    Member
    Join Date
    Sep 2012
    Posts
    2,989
    Ohoho... that would be very nice addition
    can't test & don't know how to build win-x64 flavor (am on 7)
    if anyone will make it, gladly will take it for a spin, show why is needed and good for



  3. #3
    Member SynaGl0w's Avatar
    Join Date
    Oct 2008
    Location
    L1 Cache
    Posts
    556
    Much appreciated!!! This is one of the reasons why they need to implement some type of loop construct for cycles SVM. Way back I experimented with implementing voronoi just using regular nodes but unfortunately I ran out SVM stack space. Because voronoi requires loops, you have to unroll each iteration. The best I could do was 2 dimensions and that used about 183 - 210 of the 255 stack limit. Third dimension was out of the question. Also annoying is the fact that stack usage seems somewhat random when dealing with more complex node layouts, hence the bounce between 183 and 210.

    Without the ability to express loops for the SVM, cycles procedural texturing is very very limited. Stuff that is even trivial in GLSL can't be done in Cycles.
    One nerd to rule them all, One nerd to write them. One nerd to compile them all, And in the linker bind them.
    Sketchbook | Sanctuary Rising | Piles'N'Tiles



  4. #4
    Member Ace Dragon's Avatar
    Join Date
    Feb 2006
    Location
    Wichita Kansas (USA)
    Posts
    28,687
    I would also like to see a detail parameter as well (so it more closely matches the noise and musgrave textures in functionality).

    A good argument for committing this patch would be that the new patterns you can generate have very little overlap, if any with what you can do with the other texture nodes.
    Sweet Dragon dreams, lovely Dragon kisses, gorgeous Dragon hugs. How sweet would life be to romp with Dragons, teasing you with their fire and you being in their games, perhaps they can even turn you into one as well.
    Adventures in Cycles; My official sketchbook



  5. #5
    Submitted it today (T45797)
    Added the Chebyshev metric as well. Let's see how it gets along with the reviewers :-)

    @SynaGl0w: a loop construct would be useful but also a pain to implement in svm. Maybe there isn't much of a technical barrier but the lack of (architectural) documentation is. It is certainly interesting though and I will study it some more, but my personal interest at this point is to be able to implement more basic patterns and noise sources (think hexagon and gabor noise respectively) to enable texture creators to get their hands on more basic building blocks without having to resort to CPU only OSL nodes.

    @Ace Dragon: I am not sure what you mean my 'detail' in the context of a voronoi (cell based) pattern. These patterns are not recursive so there is no adding more octaves or whatever like in fbm and the like. The generalized minkowski metric might be what you are looking for?

    @everyone: if there are patterns/textures or nodes that you think are missing in Cycles (either compared to what is available in BI or in general) I am happy to have a look at it and see if it is feasible to implement them and get them committed. Note shaders though (atleast not at the moment, because those are different beasts altogether and I am not sure I am up to that at this point :-)
    Check out my new add-on, Ortho, or the other ones on my Blender Market store.
    There you will also find my e-books 'Creating Add-ons for Blender', 'Open Shading Language for Blender' and the new 'Blender Add-on Cookbook'.
    Main blog: http://blenderthings.blogspot.com



  6. #6
    Member SynaGl0w's Avatar
    Join Date
    Oct 2008
    Location
    L1 Cache
    Posts
    556
    Very nice! Any thoughts on doing this: http://www.iquilezles.org/www/articl...ronoilines.htm

    Personally I think the best kind of stuff to implement as dedicated nodes is anything that would otherwise use up too much svm stack space if created with the current selection of nodes: Anything that requires loops/iterations, etc.

    There are a few crazy procedural patterns on the first page of my sketchbook that were a bit nuts to do with nodes. Hexagons can be done much simpler than using the n-gon node group like I did, but I wanted the extra outputs/texture spaces/ids/distances/etc. If you want to look at them I'll post the node versions I did. I have a custom build that displays svm stack usage in the node editor for the current shader that I could run some node implementations through to see which ones are most stack expensive. I need to go find the diff I used for it =/.

    A dedicated fast noise texture would be awesome, similar to the countless GLSL ones or the random source used inside of the advanced noise nodes we already have such as voronoi. 3D coords go in: unfiltered, pure noise comes out.

    Not sure if possible, but for existing noise types a seamless toggle would be awesome, so that internal sampling of texture coordinates wraps around, so as to allow the creation of procedural seamless materials.
    One nerd to rule them all, One nerd to write them. One nerd to compile them all, And in the linker bind them.
    Sketchbook | Sanctuary Rising | Piles'N'Tiles



  7. #7
    this looks like bevel node from substance
    3:00
    https://vimeo.com/122940573
    dont know if this type of workflow is possible in cycles, or whats missing in node editor



  8. #8
    @SynaGl0w: interesting link, I'll have a look at it
    Check out my new add-on, Ortho, or the other ones on my Blender Market store.
    There you will also find my e-books 'Creating Add-ons for Blender', 'Open Shading Language for Blender' and the new 'Blender Add-on Cookbook'.
    Main blog: http://blenderthings.blogspot.com



  9. #9
    @pachupp: most of it is feasible already I guess, but bevel nodes and slope blur need the either the neighbourhood or derivatives of a pixel, something we might explicitely calculate for some patterns but I don't a general bevel node is feasible in Cycles svm (it is in OSL and als in the compositor because the latter can access neighbouring pixels).
    Check out my new add-on, Ortho, or the other ones on my Blender Market store.
    There you will also find my e-books 'Creating Add-ons for Blender', 'Open Shading Language for Blender' and the new 'Blender Add-on Cookbook'.
    Main blog: http://blenderthings.blogspot.com



  10. #10
    Made a first step in creating a completely new hexagon texture for cycles. It's fairly feature complete but I don't want to spend too much time on it before I get feedback on my previous patch (for the Voronoi extension)

    gpuhexagon.png
    Last edited by varkenvarken; 05-Jul-16 at 09:33.
    Check out my new add-on, Ortho, or the other ones on my Blender Market store.
    There you will also find my e-books 'Creating Add-ons for Blender', 'Open Shading Language for Blender' and the new 'Blender Add-on Cookbook'.
    Main blog: http://blenderthings.blogspot.com



  11. #11
    you can get similar result (bevel from voronoi with bunch of cycles nodes), will show you tomorow how

    regards



  12. #12
    @pachupp: i am certainly interested
    Check out my new add-on, Ortho, or the other ones on my Blender Market store.
    There you will also find my e-books 'Creating Add-ons for Blender', 'Open Shading Language for Blender' and the new 'Blender Add-on Cookbook'.
    Main blog: http://blenderthings.blogspot.com



  13. #13
    hi, yesterday by happy accident i get interesting effect similiar to beveled voronoi but ist totaly fake

    regards



  14. #14
    That is indeed quite interesting! I like the straightlined edges, which with all the continuous noises are hard to get. This could be very useful for camouflage or maybe cityscapes in the distance. Thanks!
    Check out my new add-on, Ortho, or the other ones on my Blender Market store.
    There you will also find my e-books 'Creating Add-ons for Blender', 'Open Shading Language for Blender' and the new 'Blender Add-on Cookbook'.
    Main blog: http://blenderthings.blogspot.com



  15. #15
    Member Monio's Avatar
    Join Date
    Nov 2012
    Location
    Warsaw | Poland
    Posts
    168
    Maaaaaan. I waited for this voronoi options for years!. You are my hero!

    I got some ideas for procedural textures improvements (based on math, not noob wishes). Are you planing working on Cycles more or those nodes was all you wanted?

    Smooth voronoi would be super nice.
    http://iquilezles.org/www/articles/s...othvoronoi.htm



  16. #16
    @Monio: I'll certainly work on it some more but whether I publish it depends on whether it gets accepted. Most interesting stuff can be done equally well in OSL though (albeit slower) so I come across some interesting stuff I might implement it in OSL first. Because the Blender devs are a bit reluctant to accept new nodes because of the work the are putting into splitting the kernel and because my node patch didn't fit the output pattern of the other texture/pattern nodes, I made a simpler VoronoiCrackle node that produces just F2 - F1 (and the color) so it has just two outputs. I'll make that one available as soon as I have created the patch file.

    PS> that smooth voronoi seems real easy to implement
    Check out my new add-on, Ortho, or the other ones on my Blender Market store.
    There you will also find my e-books 'Creating Add-ons for Blender', 'Open Shading Language for Blender' and the new 'Blender Add-on Cookbook'.
    Main blog: http://blenderthings.blogspot.com



  17. #17
    Member Monio's Avatar
    Join Date
    Nov 2012
    Location
    Warsaw | Poland
    Posts
    168
    Yeah, I read that on Patch page. If I recall correctly nobody is working on CUDA Kernel split right now (or they didn't committing). Who knows when they do it? Somewhere in 2016? Maybe 2017?

    "The best is the enemy of the good"

    Imho Voronoi Cracle should be in Cycles since implementation of current Voronoi. We have "magic" texture but doesn't have one of most usefull procedurals. Essential stuff for someone who work on procedural shaders/textures. Your code will be beneficial to hundreds of people.
    Last edited by Monio; 18-Aug-15 at 14:00.



  18. #18
    Member SynaGl0w's Avatar
    Join Date
    Oct 2008
    Location
    L1 Cache
    Posts
    556
    If they want to keep the output standard with the others you could always just add your distances to an enum in the node options just like the distance types. That way all the voronoi stuff is still in the same node, and the outputs of the node remain unchanged. So in one menu you have your distances (F1, F2, F2-F1, F3, Crackle, etc.) and in the other menu you have the distance types (euclidean, manhattan, chebychev, etc.)

    Mockup:
    voronoi_node_mockup.png

    Just a suggestion to keep the voronoi node with the same outputs we have now, but the addition of internal node options. The default value of said options would of course produces the same output as the node does now, ensuring nobody has their materials broken. You would think that would be satisfactory to the patch reviewers.
    One nerd to rule them all, One nerd to write them. One nerd to compile them all, And in the linker bind them.
    Sketchbook | Sanctuary Rising | Piles'N'Tiles



  19. #19
    Member Monio's Avatar
    Join Date
    Nov 2012
    Location
    Warsaw | Poland
    Posts
    168
    SynaGl0w solution is great. Simple and elegant. Best thing is we can still scroll trough all options without need for adding new node to graph.



  20. #20
    @SynaGl0w: that is an excellent suggestion. Let's see if I can squeeze that one in :-)
    Check out my new add-on, Ortho, or the other ones on my Blender Market store.
    There you will also find my e-books 'Creating Add-ons for Blender', 'Open Shading Language for Blender' and the new 'Blender Add-on Cookbook'.
    Main blog: http://blenderthings.blogspot.com



Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •