Welcome to WSL!

Make yourself at home, but before posting, please may I ask you to read the following topics.


Posting 101
Server space, screenshots, and you

Thank you!

PS. please pretty please:


Image

ReGrain - Automatically regrain your comps!  [SUBMITTED]

Moderator: SecondMan

User avatar
Millolab
Fusionista
Posts: 502
Joined: Wed Oct 24, 2018 6:26 am
Been thanked: 61 times
Contact:

ReGrain - Automatically regrain your comps!

#1

Post by Millolab » Fri Mar 20, 2020 6:50 am

Hello Friends!

time is something I have in abundance in this lockdown days.
I'm glad to share this (I hope) useful macro I created.

This is ReGrain, it will help you regrain your comps with few effort.

Image

here the UI

Image

And here you can find a quick tutorial to see how it works!



Cheers!

Emilio.
com.Millolab.ReGrain.zip
You do not have the required permissions to view the files attached to this post.

User avatar
eliottgaumont
Posts: 28
Joined: Fri Aug 24, 2018 12:33 am

Re: ReGrain - Automatically regrain your comps!

#2

Post by eliottgaumont » Fri Mar 20, 2020 10:37 am

Excellent, can you share the tutorial with friends?

User avatar
Millolab
Fusionista
Posts: 502
Joined: Wed Oct 24, 2018 6:26 am
Been thanked: 61 times
Contact:

Re: ReGrain - Automatically regrain your comps!

#3

Post by Millolab » Fri Mar 20, 2020 10:45 am

eliottgaumont wrote:
Fri Mar 20, 2020 10:37 am
Excellent, can you share the tutorial with friends?
what do you mean?

User avatar
Millolab
Fusionista
Posts: 502
Joined: Wed Oct 24, 2018 6:26 am
Been thanked: 61 times
Contact:

Re: ReGrain - Automatically regrain your comps!

#4

Post by Millolab » Sat Mar 21, 2020 9:55 am

I had an idea and made an update.
I know this has not yet submitted... but still.

Here the new UI.

Image

the workflow is the same, but you have more precise control of your grain.

Cheers!

:cheers: :cheers:
com.Millolab.ReGrain.zip
You do not have the required permissions to view the files attached to this post.

User avatar
Millolab
Fusionista
Posts: 502
Joined: Wed Oct 24, 2018 6:26 am
Been thanked: 61 times
Contact:

Re: ReGrain - Automatically regrain your comps!

#5

Post by Millolab » Sun Mar 22, 2020 7:12 am

com.Millolab.ml_ReGrain.zip
You do not have the required permissions to view the files attached to this post.

User avatar
SecondMan
Site Admin
Posts: 4456
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 27
Location: Vancouver, Canada
Been thanked: 109 times
Contact:

Re: ReGrain - Automatically regrain your comps!

#6

Post by SecondMan » Sun Mar 22, 2020 9:58 am

And submitted! Thanks for sharing! :cheer:

User avatar
jcouritas
Posts: 9
Joined: Tue Apr 30, 2019 3:16 pm

ReGrain - Automatically regrain your comps!

#7

Post by jcouritas » Thu Apr 09, 2020 9:30 am

Hello Back for the noise Voronoi pattern here is the Blink Script.

Code: Select all

set cut_paste_input [stack 0]
version 11.3 v4
push $cut_paste_input
BlinkScript {
 kernelSourceFile C:/Users/fab/Downloads/voronoi.blink
 recompileCount 91
 ProgramGroup 1
 KernelDescription "2 \"VoroNoise\" iterate pixelWise c117be128a07c11b6d82fd34148d66b3bcac41976ec9c2082affe38e890c2c0f 2 \"src\" Read Point \"dst\" Write Point 6 \"Frequency\" Float 1 AABIQg== \"Seed\" Int 1 AAAAAA== \"aspect ratio\" Float 1 AACAPw== \"width\" Int 1 AAAAAA== \"height\" Int 1 AAAAAA== \"Randomness\" Float 1 AAAAPw== 6 \"frequency\" 1 1 \"seed\" 1 1 \"aspect_ratio\" 1 1 \"width\" 1 1 \"height\" 1 1 \"randomness\" 1 1 0"
 kernelSource "// Voronoi.blink\n// A test implementation of libNoise's Voronoi generator using Blink\n// Ivan Busquets - August 2013\n// Modified for DasGrain by Fabian Holtz - April 2019\n\n#define X_NOISE_GEN  1619\n#define Y_NOISE_GEN  31337\n#define Z_NOISE_GEN  6971\n#define SEED_NOISE_GEN  1013\n#define SQRT_3 1.73205081\n\ninline int IntValueNoise3D (int x, int y, int z, int seed)\n\{\n  // All constants are primes and must remain prime in order for this noise\n  // function to work correctly.\n  int n = (\n      X_NOISE_GEN    * x\n    + Y_NOISE_GEN    * y\n    + Z_NOISE_GEN    * z\n    + SEED_NOISE_GEN * seed)\n    & 0x7fffffff;\n  n = (n >> 13) ^ n;\n  return (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff;\n\}\n\ninline float ValueNoise3D (int x, int y, int z, int seed)\n\{\n  return 1.0 - ((float)IntValueNoise3D (x, y, z, seed) / 1073741824.0);\n\}\n\nkernel VoroNoise : ImageComputationKernel<ePixelWise>\n\{\n  Image<eRead> src;\n  Image<eWrite, eAccessPoint> dst;\n\nparam:\n  float frequency;\n  int seed;\n  float aspect_ratio;\n  int width;\n  int height;\n  float randomness;\n\n\n  void define() \{\n    defineParam(frequency, \"Frequency\", 50.0f);\n    defineParam(aspect_ratio, \"aspect ratio\", 1.0f);\n    defineParam(seed, \"Seed\", 0);\n    defineParam(randomness, \"Randomness\", 0.5f);\n  \}\n\n\n\n\n  void process(int2 pos) \{\n   float x = pos.x * aspect_ratio * frequency / width;\n   float y = pos.y * frequency / width;\n   int xInt = (x > 0.0) ? x : x - 1;\n   int yInt = (y > 0.0) ? y : y - 1;\n\n\n    float minDist = 2147483647.0;\n    float xCandidate = 0;\n    float yCandidate = 0;\n\n    float dist;\n\nfor (int yCur = yInt - 2; yCur <= yInt + 2; yCur++) \{\n      for (int xCur = xInt - 2; xCur <= xInt + 2; xCur++) \{\n\n        // Calculate the position and distance to the seed point inside of\n        // this unit cube. Limited by the randomness value\n        float xPos = xCur + (ValueNoise3D (xCur, yCur, 0, seed    ) + 1 ) * randomness + (1-randomness) - 1;\n        float yPos = yCur + (ValueNoise3D (xCur, yCur, 0, seed + 1) + 1 ) * randomness + (1-randomness) - 1;\n\n        float xDist = xPos - x;\n        float yDist = yPos - y;\n\n        dist = pow(xDist, 2) + pow(yDist, 2);\n        if (dist < minDist) \{\n          // This seed point is closer to any others found so far, so record\n          // this seed point.\n          minDist = dist;\n          xCandidate = xPos;\n          yCandidate = yPos;\n\t\}\n    \}\n\}\n\n    SampleType(dst) sample(0.0f);\n\n    sample.x = xCandidate / aspect_ratio / frequency;\n    sample.y = yCandidate / height * width / frequency;\n    sample.z = 0;\n\n    dst() = sample;\n\}\n\};"
 rebuild ""
 VoroNoise_Frequency {{width/parent.cell_size}}
 VoroNoise_Seed {{"(x+(parent.parent.stereo==2 ? \[lsearch \[value root.views] \[view]] / 2 : 0))*5"}}
 "VoroNoise_aspect ratio" {{pixel_aspect}}
 VoroNoise_width {{width}}
 VoroNoise_height {{height}}
 rebuild_finalise ""
 name VoroNoise
 selected true
 xpos 620
 ypos -520
}

User avatar
thibaud
Fusioneer
Posts: 193
Joined: Thu Sep 04, 2014 1:23 am
Been thanked: 6 times
Contact:

Re: ReGrain - Automatically regrain your comps!

#8

Post by thibaud » Thu Apr 09, 2020 9:52 am

'Refernece' Frame ?

User avatar
Millolab
Fusionista
Posts: 502
Joined: Wed Oct 24, 2018 6:26 am
Been thanked: 61 times
Contact:

Re: ReGrain - Automatically regrain your comps!

#9

Post by Millolab » Thu Apr 09, 2020 10:26 am

thibaud wrote:
Thu Apr 09, 2020 9:52 am
'Refernece' Frame ?
Nice catch! :)

User avatar
SecondMan
Site Admin
Posts: 4456
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 27
Location: Vancouver, Canada
Been thanked: 109 times
Contact:

Re: ReGrain - Automatically regrain your comps!

#10

Post by SecondMan » Fri Apr 10, 2020 4:30 pm

@jcouritas - please have a quick read of viewtopic.php?p=2250#p2250 - especially the bit about sharing code snippets (adjusted your post). Thanks!

User avatar
Millolab
Fusionista
Posts: 502
Joined: Wed Oct 24, 2018 6:26 am
Been thanked: 61 times
Contact:

Re: ReGrain - Automatically regrain your comps!

#11

Post by Millolab » Mon Apr 27, 2020 11:47 am

Here a little bug fix + typo correction!

v1.2!
com.Millolab.ml_ReGrain.zip
You do not have the required permissions to view the files attached to this post.

User avatar
SecondMan
Site Admin
Posts: 4456
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 27
Location: Vancouver, Canada
Been thanked: 109 times
Contact:

Re: ReGrain - Automatically regrain your comps!

#12

Post by SecondMan » Mon Apr 27, 2020 3:46 pm

And submitted! Thanks for the update! :cheer:

User avatar
Millolab
Fusionista
Posts: 502
Joined: Wed Oct 24, 2018 6:26 am
Been thanked: 61 times
Contact:

Re: ReGrain - Automatically regrain your comps!  [SUBMITTED]

#13

Post by Millolab » Fri May 22, 2020 10:30 am

Again, some minor bug fixing!

Cheers!
com.Millolab.ml_ReGrain.zip
You do not have the required permissions to view the files attached to this post.

User avatar
SecondMan
Site Admin
Posts: 4456
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 27
Location: Vancouver, Canada
Been thanked: 109 times
Contact:

Re: ReGrain - Automatically regrain your comps!

#14

Post by SecondMan » Fri May 22, 2020 1:00 pm

And submitted! Thanks for the update :cheer: