My habit of developing P5 on FXHASH (randomSeed & save)
written by CHOUCHIAWEI
How can I make sure that my genart tokens on fxhash always look the same?
Usually, we use random values to create different visuals, but on fxhash, each token gets a unique hash value when it's created, which acts as a fixed seed every time you run the program. So it's like each token has its own ID that the program uses to generate the same visuals every time you open it.
In p5, you can set a randomSeed() / noiseSeed() to make sure that even if you use random(), the generated values will always be the same when you run the program. Without this feature, each token could produce different results every time you open it.
At the beginning Setup, I will do the following:
_r = fxrand();
_hash = fxhash;
print("fxrand(0,1) : ");
print(_r);
print("fxhash(string) : ");
print(_hash);
//random noise setup
seed = _r * 10000;
randomSeed(seed);
noiseSeed(seed);
If I want to check a specific screen, I would adjust it like this.
//_r = fxrand();
//_hash = fxhash;
//demo: check for both mobile and desktop no difference between each other
_r = 0.7078199288807809;
_hash = "ooGYcY2ve1TXjer42LKodNHzabUfYpkeVR5dGQYkgie85ZaJBoc";
print("fxrand(0,1) : ");
print(_r);
print("fxhash(string) : ");
print(_hash);
//random noise setup
seed = _r * 10000;
randomSeed(seed);
noiseSeed(seed);
By using this method, you can also tweak specific screen details during development to see how they affect the visuals. For example, you can adjust the colors, stroke size, camera position, or the chance of triggering certain conditions.
It's also useful for testing how your program works on different devices and mobile phones, to see if the same seed produces the same results. If not, you can check if you're using random() after the seed or avoid using Math.random().
Expressing "I feel" may seem intuitive, but it still holds important meaning in the creative process. However, creativity cannot solely rely on intuition, and it is helpful to modify details through recording and editing visuals.
In my case, the artwork name, program version, and seed will be preserved in the screenshot file name. This helps you obtain more information from the screen and facilitates future management.
In p5, the save() function can be used to save the screen. This feature is usually provided upon completion of many works, allowing collectors to download images for viewing or printing. But it can also be used frequently in the creation process to compare screen differences, even having different screen flavors during different development phases. If version management is well done, past parameters can be reactivated as a form of diversity.
let _r,_hash;
let workName = "HelloWrold";
function fxsetup() {
_r = fxrand();
_hash = fxhash;
print("fxrand(0,1) : ");
print(_r);
print("fxhash(string) : ");
print(_hash);
//random noise setup
seed = _r * 10000;
randomSeed(seed);
noiseSeed(seed);
}
function keyPressed() {
if (key == 'S' || key == 's') {
save(_r+"-"+_hash+"-"+workName + ".png");
}
}
Usually, after a basic framework and a fixed number of drawing steps, I begin using the save() function in my code. However, it's actually better to start saving your work earlier, even just by getting into the habit of taking screenshots.
By saving your work along the way, you can create process gifs that offer better visual appeal and a sense of immersion. Seeing the step-by-step progress of your work allows viewers to appreciate the effort and dedication you've put into your creation.
I personally use this website(https://ezgif.com/maker) to make gifs. My tips are to keep image size consistent and to slightly increase the time for the final completed frame to allow viewers more time to appreciate it.
"Mood board" is a very practical concept tool that can help us break away from efficiency and logic and return to the direction of creativity. I would recommend using the software "Pureref" to create your mood board so that you can easily collect images of things you like. The process of collecting is actually a microcosm of creation, and you will be attracted by various elements that attract you, or you will come up with a way to present the image. It is recommended that you set a comfortable time limit so that your ideas can be fully consolidated within that time.
Although our final output is mainly visual, the work can provide a certain atmosphere. I also collect articles, animated plots, and music with similar moods as help in focusing on the atmosphere of the work.
Thanks for reading. That's all for this sharing. I hope it has been helpful to you. If you have any questions or need corrections, feel free to contact my Twitter.
This sharing was the result of a discussion with Caddy, so thank you to Caddy.