Titan Dogs - Rendering

in 1UP2 years ago (edited)

thumbnail.jpg

Hello everyone,

This week end I've been working on automating the rendering process for the creation of the Titan dogs NFTs.

This includes the following steps:

  • Creating a JSON file of 10,000 unique Titan Dogs.
  • Verify rarity of attributes.
  • Render each element of the JSON list into Photoshop.
  • Save as PNG file in dedicated folder.

Lots to do right? But very exciting tasks! And we're getting to the end of the NFT generation phase.


So, as planned, I started with the JSON creation.
I first created a smaller file with a list of all attributes and their corresponding rarity.
I completed it with my design rules in mind.

Those rules being:

  • Only one pattern possible per titan.
  • Only one base color possible per titan.

I originally wanted the background to be one of the main colors currently applied but changed my mind along the way.

With this set of attributes I then looped through them, taking into account the rarity. I made sure to shuffle the created titans after each attribute was added for a better mix.

image.png

After a successful attempt with 100 titans, it was time to generate the 10,000 unique variations! And then...

Crash!

Turns out my computer is not built to make loops 10,000 times. Who would have thought. I opted for another method, 10 loops of 1,000 titans. I added color randomness along the way so no tokens are the same.

I added them all into one file to loop through it in the next phase.

I checked rarity by counting the number of titans which feature the same color on all parts. I could verify that the randomness I added did not mess up with the overall color rarity.

Generation.JPG

Now came the time to take that list of titans and script commands for Photoshop in order to hide/show corresponding layers.

I faced trouble on my very first task: hiding all layers.

I had originally create a series of loops that would trickle down the Photoshop DOM (document object model, basically the document structure) hiding layers as they go. But this script would take at least 5 minutes to complete. Sometimes I even ended the whole process thinking it had crashed.

I simply could not spend so much time hiding all layers, because I would have to do it 10,000 time for the renders down the line.

To resolve this I ended up using something called "Action reference" instead of cycling through the layers. With this method I was able to gather all Ids of all layers, select one after the other, then set the visibility to false. Not sure why this technique was so much faster but it worked. I could move on to showing the correct layers now.

This part took less time, but I did do some tweaking by the end as some groups and layers in Photoshop had slightly different name or position. It only works if all attributes share the same layer structure.

Below you can see the first attempt that didn't render the dog, nor the colors...

Render1.JPG

And finally, the magic happened (After debugging...)

The very first Titan Dog rendered automatically! You can see one arm with not pattern to test out the asynchronous pattern generation.

Render2.JPG

Then I just added a save to PNG file. Easy!

Render3.JPG

With that out of the way, I launched the render from the 10,000 titan list. And then...

Crash!

Again.

Remember, the machine does not like looping through an object of 10,000 items.
So I tricked it again, made 10 JSON files of 1,000 titans and looped through each one of them. Here we go!

Render4.JPG

Rendering in progress!

Little hiccup, the rendering time... I can see from the creation date that it takes 2 minutes to render a single image. That means 10,000 images would take... 333,3 hours... or 13.875 days.

Two weeks to render it all. Arg. Frustrating!

I'm leaving the computer on as I don't see any other way but I'll try to think of an alternative in the mean time.

Just writing this article I'm over 50 Titan dogs!


image.png

EDIT:
Quick update. I revised my code and the Photoshop layers to use only "Action reference" and I'm up to 10 titans generated per minute! I could be finished in 16 hours...

I'm never using Photoshop DOM again! ;-D

image.png


So what is next?

I'll work next on creating the website with the "candy machine" that mints a random Titan.
I'll also plan the road map and the marketing strategy to bring more people over.
I'm still trying to come up with the right price tag for those NFTs. I'll spend some time looking at other project to get inspired.

Anyway, this was two fun days. Can't wait for the render to complete. It's like waiting for the Christmas presents!

On that note, Happy Holidays everyone.
Thanks for passing by,

See you on the otherside,

Jrej

PS: My favorite so far!

image.png

Sort:  

Art and code, I would love to get into something like this to explore generative art, especially if javascript can be used in some way. Question is, where do you start?

Good question.

I started with the art myself, trying to come with layer combinaisons that always look great together. For the code I initially envisioned adding elements to a canvas according to a JSON file but doing it in Photoshop allowed more control art-wise.

I believe in many Adobe software you can simply import a js file as a script.
image.png

You can then start the file with the following lines to access the Photoshop DOM. The first line is a small dependency I found online for JSON compatibility. Another thing to note is that it's ES5 Javascript so no arrow functions, let variables, includes methods, etc...

image.png

You have lots of ressources online for that but feel free to ask if you have any question.

I took the classes of Andrei Neagoie to learn how to code. I saw he just released an NFT creation special. He always has great courses but it's a monthly membership.

That’s very helpful thanks. Just a spare time thing at the moment, so hopefully will get a chance to explore it.

Me gustaría entender mas eso de la creación de los NFT's, excelente trabajo y de igual forma felices fiestas.

Thanks for the comment. I'll be sure to share my next steps in the development. Glad you enjoyed so far!

Turns out my computer is not built to make loops 10,000 times

Ooooooops XD

Two weeks to render it all. Arg. Frustrating!

Average when doing 3d which is why there are render farms x_x

in fairness that's usually animations though I have had some stills with ridiculous lighting that takes days

Your favourite looks awesome, and can't go wrong with that corgi expression, that and the chihuahua one I think are my favourite pilots XD

Nice work getting it all together :D

Thanks ryivhnn.

I'm actually going over the code again to improve the render speed. It should not take as long as a 3D render. I'll try using the Action reference I mentioned in the blog to set aside all layer ids I should show. I can also avoid hiding all layers but simply the ones I just used.

I'm too impatient to wait two weeks!

Quick update. I'm up to 10 per minute with only "action reference"!
I could be finished in 16 hours...
I'm never using Photoshop DOM again. ;-)

image.png

Art and coding is a nice combination. I can see this would be challenging. Are you checking them all? The results look good anyway.

!PIZZA !LUV !LOLZ

Yes I'm watching frequently the computer as they render. It's fun seeing the different variations.
I also plan on checking rarity more thoroughly before the final mint, to see if any tweaking is need.

Why did the astronaut throw away his vegetarian burger?
He wanted something *meteor*.

@jrej, I sent you an $LOLZ on behalf of @steevc
Use the !LOL or !LOLZ command to share a joke and an $LOLZ. (1/1)

PIZZA!

PIZZA Holders sent $PIZZA tips in this post's comments:
@steevc(2/6) tipped @jrej (x1)

Learn more at https://hive.pizza.

1UP-devider-comment.pngYou've got 1UP'ed and earned ONEUP! When you use the #nft or #oneup tag, your post will appear on www.1up.zone, your NFT and PlayToEarn blockchain gaming community. Learn more on Discord.

These are super cool! Amazing artwork. Good job 👍

Thanks a lot @thealbytross and welcome to Hive.
Glad you enjoyed the artwork. That was a lot of fun to do.
I hadn't used real ink for illustrations in a while, but there's something about it that digital can't beat. ;-)

Thanks @jrej . Wow, yeah looks like it was fun - @basilmarples check these guys out. Definitely worth following. Really looking forward to when these get released!

cheers albo. Looks awesome. I'll be following closely... :)

Thanks @basilmarples I'm deploying the NFTs on the Solana devnet as we speak. Once that is working, I'll be ready to carry on. I'll share the project road map soon. ;-)

awesome! looking forward to it : )
merry xmas