• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Is it possible to create a perlin noise in Photoshop? [Edited by moderator for clarity]

Explorer ,
Nov 02, 2020 Nov 02, 2020

Copy link to clipboard

Copied

Hello,

First question, is it possible in Photoshop to create a perlin noise with a script with slider controls?  Please be advised that I am not asking for the clouds effect.

 

According to the code provided below, the script has to be executed through ES toolkit but I am not getting any results:

 

 

#target estoolkit
var win, windowResource;
 
windowResource = "palette {  \
    orientation: 'column', \
    alignChildren: ['fill', 'top'],  \
    preferredSize:[300, 130], \
    text: 'ScriptUI Window - palette',  \
    margins:15, \
    \
    sliderPanel: Panel { \
        orientation: 'row', \
        alignChildren: 'right', \
        margins:15, \
        text: ' PANEL ', \
        st: StaticText { text: 'Value:' }, \
        sl: Slider { minvalue: 1, maxvalue: 100, value: 30, size:[220,20] }, \
        te: EditText { text: '30', characters: 5, justify: 'left'} \
        } \
    \
    bottomGroup: Group{ \
        cd: Checkbox { text:'Checkbox value', value: true }, \
        cancelButton: Button { text: 'Cancel', properties:{name:'cancel'}, size: [120,24], alignment:['right', 'center'] }, \
        applyButton: Button { text: 'Apply', properties:{name:'ok'}, size: [120,24], alignment:['right', 'center'] }, \
    }\
}"
 
win = new Window(windowResource);
 
win.bottomGroup.cancelButton.onClick = function() {
  return win.close();
};
win.bottomGroup.applyButton.onClick = function() {
  return win.close();
};
 
win.show();

// Set Adobe Photoshop to use pixels and display no dialogs.
app.preferences.rulerUnits = Units.PIXELS;
app.displayDialogs = DialogModes.NO;

var doc = app.activeDocument;

// Get the document dimensions.
var documentWidthAsInteger = app.activeDocument.width.value ; 
var documentHeightAsInteger = app.activeDocument.height.value ;

var perm = new Array(512);
var gradP = new Array(512);

//6t^5-15t^4-10t^3
function fade(t) {
    return t*t*t*(t*(t*6-15)+10);
}

//interpolate between two values
function lerp(a, b, t) {
    return (1-t)*a + t*b;
}

dot2 = function(x, y) {
    return this.x*x + this.y*y;
  };

//generate perlin noise
function perlin(x, y) {
	var X = Math.floor(x);
    var Y = Math.floor(y);

    x = x - X;
    y = y - Y;

    X = X & 255;
    Y = Y & 255;

    var n00 = gradP[X+perm[y]].dot2(x,y);
    var n01 = gradP[X+perm[y+1]].dot2(x,y-1);
    var n10 = gradP[X+1+perm[y]].dot2(x-1,y);
    var n11 = gradP[X+1+perm[y+1]].dot2(x-1,y-1);

    var u = fade(x);

    return lerp(
        lerp(n00, n10, u),
        lerp(n01, n11, u),
        fade(y));
}

function generateNoise() {
    for (var x=0; x<documentWidthAsInteger; x++) {
        for (var y = 0; y < documentHeightAsInteger.length; y++) {
            var value = Math.abs(perlin(x/100, y/100));
            value *= 256;
        };
    }
}

 

Can someone provide me with an answer on how to create a perlin noise with a random seed slider according to the example above as a second question only if first applies?

 

Thank you

TOPICS
Actions and scripting

Views

7.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Explorer ,
Nov 02, 2020 Nov 02, 2020

Copy link to clipboard

Copied

My deep excuses about the subject as I didn't realize it was already filled partially. The question has to be "Is it possible to create perlin noise in Photoshop". I kindly ask moderators to change the subject for me to the provided because I don't know how to edit my question. Thank you and my appologies

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 02, 2020 Nov 02, 2020

Copy link to clipboard

Copied

The script appears to be a work in progress:

 

perlin-gui.png

 

I presume that the slider offers more control of "scale" or another attribute than Filter > Render > Clouds or Difference Clouds?

 

Google turned up this script, which appears to be the source:

 

https://github.com/aidan-bauer/Photoshop-Perlin-Noise

 

https://feedback.photoshop.com/conversations/photoshop/photoshop-improve-fractal-noise-filters-rende...

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 02, 2020 Nov 02, 2020

Copy link to clipboard

Copied

Yes you are correct about the source, but is it possible generate a perlin noise out of zero in Photoshop?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 02, 2020 Nov 02, 2020

Copy link to clipboard

Copied

If anything could do it with a ready made plugin, then Filter Forge would be my best guess.  Are you just trying to produce random monochome fractal noise or specifically a landscape effect?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 03, 2020 Nov 03, 2020

Copy link to clipboard

Copied

LATEST

In my last question I should have asked is it possible to generate a perlin noise with a script in Photoshop. I am just trying to figure out how to create a perlin noise generator script if possible, as the generation process of the script in my original question is good, but the implementation in Photoshop is somehow unfinished, and besides everything there is a lack of documentation to Photoshop scripting. I would need help on that matter if possible.

 

Thank you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines