Evelyn GameDev

I started learning Unity and became a full-time indie developer within a year and a half

[Stable Diffusion / free] How to use generated images for game development with Google Colaboratory

Stable Diffusion shocked the world when it was released free of charge, allowing AI to generate very high quality illustrations and photos at tremendous speed.

Technology is changing the world.

It is easy to imagine that these trends will not stop at image generation, but will expand to audio, video, and 3D models.

As a test, I also ran Stable Diffusion to generate an image. Here are some of the results

Inside a futuristic space shuttle
Robot Girl

Isn't this fantastic technology?

We should incorporate this technology into games and apps.

There are paid services for image generation with AI, such as Midjourney and DreamStudio, but they are paid services.

In this article, I will show you how to run Stable Diffusion on Google Colaboratory so that you can use this technology for free.

For more technical details on Stable Diffusion, this article is a good reference for those interested.

Sign up for Hugging Face

You need an authentication token to run Stable Diffusion, so first create your account at Hugging Face.

Fill in the required fields to proceed with the creation of your account.

Sign UP

Display the mailer you normally use to verify your email address.

Confirm your email address

Then, go to the Settings section from your account.

Settings

Go to Settings > Access Token and click the New Token button.

Furthermore, click on the Generate Token button and the token is ready.

Toke page

Visit CompVis/stable-diffusion-v1-4 page to agree to the Terms of Use and access the repository.

HuggingFace is now ready.

Run Stable Diffusion for free with Google Colaboratory

Next, let's prepare for Stable Diffusion.

Stable Diffusion requires python and a GPU to run, but Google Colaboratory allows you to use Stable Diffusion even if your PC has low specs.

Visit Google Colaboratory Link above to create a duplicate on your Google Drive.

Paste the token created by HuggingFace.

pastee access token

Run it to complete the setup. Then allow access to Google Drive.

Run

Visit your Google Drive MyDrive and create a folder named googleColab.

Create a folder

If you want to change the name of the output folder to any name, modify the following part of the Python code.

drive_path = "/content/gdrive/MyDrive/googleColab/"

Change the prompt_text in the block below to a string of your choice and execute.

Generate images

Wait a few minutes and the image will be generated as shown below, and the image file will be saved to Google Drive as well.

Generated images

Now you have successfully generated an image with Stable Diffusion.

Now, let's generate images all over the place!

Tips for generating quality images

After running Stable Diffusion many times, the images' quality may not be that high.

In such a case, let's check what kind of prompts can be used to generate high-quality images.

You can search for images on the Lexica website and examine the Prompt that generated them.

I encourage you to use AI image generation for your activities.

Conclusion

Run Stable Diffusion on Google Colaboratory for free and use it in your game development!

How was it?

It's great to harness the power of the GPU for free with Google Colaboratory.

Please let me know if you use this article to release a game or app that uses images generated by Stable Diffusion.

I wish you the best of luck with your project.

My Products
VRM Posing DesktopMore DetailVRM Posing Desktop
Vrm Posing MobileMore DetailVRM Posing Mobile
Humanoid Static PosesMore DetailHumanoid Static Poses
No Coding Easy LocalizationMore DetailNo Coding Easy Localization