HashLips / generative-art-opensource

Create generative art by using the canvas api and node js, feel free to contribute to this repo with new ideas.
MIT License
1.36k stars 695 forks source link

Issues with amount of variations #49

Open 3Ddesignbros opened 2 years ago

3Ddesignbros commented 2 years ago

So I'm having some issues. In a couple of my folders such as backgrounds, I have a good amount of different backgrounds with 15 just in backgrounds alone. I also have a few more folders with different items with similar amounts.

I struggled with the weight percentages... None are rarer than the other so I was going to put them all the same. However, in the video, he said not to do that so I put them all with like ".00" from each either. For example color one is 5.45, color 2 is 5.46, and so on making sure they added up to 100.

I did a test run and just did 10 editions. It pumped out 8 very quickly but then gets stuck and never returns anymore. When you look at the 8 it created they all are very close to the same using the same variations of the top couple backgrounds as well as the top couple other variant items.

Do I need to do this differently? Is this a limitation and should I just reduce my amount of variations?

Thanks for any help.

3Ddesignbros commented 2 years ago

I've let the script run for 5 hours now and I still only have 8 pictures created.

mixart commented 2 years ago

Did you update these values? It sounds like maybe you didn't change them. editionSize <- total number tiy want to create startEditionFrom <- start creating from this number endEditionAt <- end creating from this number

The last two above are only useful if you want to say create 100 now and another hundred next week, but keep the same uniqueness so you never get dupes.

if you just want to create 1000 now, change the editionsize to 1000, start from 0, end at 1000

3Ddesignbros commented 2 years ago

Thanks for the reply, I did update these. I just wanted to do a 10 test run so I changed. "start" to 0, End to 10, editionSize =10.

I really think its something to do with my weights for each different layer within my folders.

const races = { printers: { name:"printers", layers: [ { name: "Background", elements: [ { id: 0, name: "Blue", path:${dir}/printers/background/Blue.png, weight: 6.60, }, { id: 1, name: "Brown", path:${dir}/printers/background/Brown.png, weight: 6.61, }, { id: 2, name: "Dark Blue", path:${dir}/printers/background/Dark Blue.png, weight: 6.62, }, { id: 3, name: "Dark Green", path:${dir}/printers/background/Dark Green.png, weight: 6.63, }, { id: 4, name: "Dark Orange", path:${dir}/printers/background/Dark Orange.png, weight: 6.64,

That goes on 10 more times, I then have other folders that have equal or more layer options, so my weight numbers get very low.... The few images it does create all are very similar with blue background, as well as the layers also using a close variation to one another.

3Ddesignbros commented 2 years ago

not sure why it changed it horizontal, below is how lit looks in my vidusal studio

const races = { printers: { name:"printers", layers: [ { name: "Background", elements: [ { id: 0, name: "Blue", path: ${dir}/printers/background/Blue.png, weight: 6.60, }, { id: 1, name: "Brown", path: ${dir}/printers/background/Brown.png, weight: 6.61, }, { id: 2, name: "Dark Blue", path: ${dir}/printers/background/Dark Blue.png, weight: 6.62, }, { id: 3, name: "Dark Green", path: ${dir}/printers/background/Dark Green.png, weight: 6.63, }, { id: 4, name: "Dark Orange", path: ${dir}/printers/background/Dark Orange.png, weight: 6.64,

Devolvera commented 2 years ago

I has a very similar issue, where I'd have multiple background elements but only two would output. I changed the weights and they equally started outputting. Try changing your weights where the first element has a weight of 1, then the LAST element has a weight of 2, and then go backwards and add 1 to each weight, it would be something like:

elements: [ { id: 0, name: "Blue", path: ${dir}/printers/background/Blue.png, weight: 1, }, { id: 1, name: "Brown", path: ${dir}/printers/background/Brown.png, weight: 5, }, { id: 2, name: "Dark Blue", path: ${dir}/printers/background/Dark Blue.png, weight: 4, }, { id: 3, name: "Dark Green", path: ${dir}/printers/background/Dark Green.png, weight: 3, }, { id: 4, name: "Dark Orange", path: ${dir}/printers/background/Dark Orange.png, weight: 2,

3Ddesignbros commented 2 years ago

@Devolvera I was under the impression that they all had to add up to exactly 100 which is why I had the weird decimal numbers. Is this not the case?

Also isn't the one layer that ends being like a "6" or something going to come up 6 times as much as the one that is a "1"? Ideally I'd like them all to come up equally.

Devolvera commented 2 years ago

@3Ddesignbros yeah I thought so too. For me I noticed it was only grabbing the first and last elements in each layer, despite me having 10 elements in those layers. I fiddled with weights and that solution worked for me, using the weights as priority? Everything seems fine to me, but I ended up with 1k variations total so over time I think it will balance out.

3Ddesignbros commented 2 years ago

Thanks, @Devolvera another question for you.

I have 3 different what he calls "races" I have the first one in the config file and after doing your weights above it ran great. I'm trying to add the 2nd and 3rd. I tried coping with everything from the 1st race and just tweaking it as needed, however, when I try to run it I get the error about layers being undefined.

I tried checking his config file here in git hub but he also only has 1 listed probably because he doesn't want to show everyone everything lunar-landing is doing.

have you done this yet? any issues?. I'm assuming I'm doing the {} and[] wrong but I can't figure it out.

Devolvera commented 2 years ago

@3Ddesignbros I only used the single race to be honest, I didn't quite understand the use/need for multiple races

Kenzo-github commented 2 years ago

I has a very similar issue, where I'd have multiple background elements but only two would output. I changed the weights and they equally started outputting. Try changing your weights where the first element has a weight of 1, then the LAST element has a weight of 2, and then go backwards and add 1 to each weight, it would be something like:

elements: [ { id: 0, name: "Blue", path: ${dir}/printers/background/Blue.png, weight: 1, }, { id: 1, name: "Brown", path: ${dir}/printers/background/Brown.png, weight: 5, }, { id: 2, name: "Dark Blue", path: ${dir}/printers/background/Dark Blue.png, weight: 4, }, { id: 3, name: "Dark Green", path: ${dir}/printers/background/Dark Green.png, weight: 3, }, { id: 4, name: "Dark Orange", path: ${dir}/printers/background/Dark Orange.png, weight: 2,

Doesnt work :/

bgastaldo commented 2 years ago

Can't seem to get this to work. I can generate layers randomly, but I can only do a tiny amount before it starts looping over the same ones over and over again. I'm using the main branch and the rarities are like this

let rarityWeights = [ addRarity('supersilly', 0, editionSize), addRarity('silly', 1, editionSize), addRarity('normal', 2, editionSize) ];

I have been fiddling with the numbers but it keeps outputting the same layers and combos then loops over them instead of going through them all. Thanks for any help

muhamaddigdaya commented 2 years ago

He explains on https://www.youtube.com/watch?v=qmpuvGdI0w4 within minute " 12:55 " @bgastaldo @Kenzo-github

cryptopharma commented 2 years ago

have the same problem. i've done exactly what he's suggesting in that video link above - and i keep getting the top layer only. I think the problem is he's using so few layers so we see the randomness. but with 10 to 20 layers the values don't work so well. there has got to be another randomization program that would work with 20 layers... also if i set the top layer to 100 it chooses that 9 out of 10 times no matter how many layers im using....