Create stunning AI-generated skybox assets within Unity for use as HDRIs in game dev and immersive projects.
- >= 2020.x.x
Package can be used standalone or optionally together with a Pusher websockets package. If installed the Pusher package will use websockets to listen for any changes in the Asset Generation Process on Runtime and make updates accordingly, which in return should improve performance for your games on Runtime.
Simplest way to install the package and it's optional Pusher dependency is to
open Packages/manifest.json file of your project with your favourite editor
and add the following in your dependencies (make sure to respect JSON commas):
{
"dependencies": {
"com.pusher.pusherwebsocketunity": "https://github.com/pusher/pusher-websocket-unity.git#upm",
"com.blockadelabs.sdk": "https://github.com/Blockade-Games/BlockadeLabs-SDK-Unity.git"
}
}or if you don't plan on using Pusher, you can just add the com.blockadelabs.sdk package.
Alternatively you can go to your Unity Project, to Window > Package Manager and install the packages using the
Add package from git URL... option.
If using Pusher make sure to use this URL (uses the UPM branch):
https://github.com/pusher/pusher-websocket-unity.git#upm
and for Blockade Labs SDK the default one will do the trick:
https://github.com/Blockade-Games/BlockadeLabs-SDK-Unity.git
If you are using OpenUPM-CLI, you can easily install the Pusher package using the command below:
openupm add com.pusher.pusherwebsocketunityand the Blockade Labs SDK with the following command:
openupm add com.blockadelabs.sdkFor known issues after installation check the section below.
After installing the Blockade Labs SDK you can go to Window > Package Manager and switch to Packages: In Project
tab to locate the package. On the Blockade Labs SDK package page there are samples that can be imported in your
Project. Samples contain some assets and two sample scenes to get you started (Imagine and Skybox Scene).
After importing the samples load one of the above mentioned sample scenes inside your project which should be located in
Assets/Samples/Blockade Labs SDK/x.x.x/Scenes folder.
On the sample scene you loaded there is game object named Pusher. If you don't plan on using Pusher you can delete it in order
to avoid any future The referenced script (PusherManager) on this Behaviour is missing! warnings.
If you plan on using Pusher on Runtime, add your Blockade Labs' API Secret Key in the designated field and that is it
for that object.
If you open the Skybox Scene sample, you will notice a game objects named Skybox Sphere. The Sphere has a Mesh Renderer component which uses a sample Skybox Material which in turn uses a shader of type Skybox/Panoramic.
A texture generated with this package is assigned to the shader. You can generate a new texture that will replace the existing one on the sphere
by following these steps.
- Select the Sphere object.
- Locate the
Blockade Imaginariumcomponent. - Add your Blockade Labs'
publicAPI key in the designated field first. - You'll notice that the object has an option
Assign to Materialticked. Leave it as it is. - Click the
Get Stylesbutton in theSkyboxsection. - Select the desired style.
- Fill the required fields (usually
prompt) marked with an asterisk (*), and update the remaining fields per your preference if needed. - Click the
Generate SkyboxButton. - In about 20-30 seconds your texture will be replaced with a new texture you just created, and a folder located in
Assets/Blockade Labs SDK Assetswill now hold your newly created sprite and texture. - In the
Scenetab of the Unity editor using theViewTool you can position yourself inside the sphere and check out the newly generated skybox.
If you open the Imagine Scene sample, you will notice 3 game objects for Character, Weapon and Environment. Also there is a disabled Cube object. You can interact with each of those objects in a similar fashion while in the Editor.
- Select the Character object for example.
- Locate the
Blockade Imaginariumcomponent. - Add your Blockade Labs'
publicAPI key in the designated field first. - You can leave the
Assign to sprite rendereroption ticked to assign your newly generated sprite to the current object. - Click the
Get Generatorsbutton in theImaginesection. - Fill the required fields (usually
prompt) marked with an asterisk (*), and update the remaining fields per your preference if needed. - Click the
GenerateButton. - In a few seconds your sprite renderer will be replaced with a new sprite you just created, and a folder located in
Assets/Blockade Labs SDK Assetswill now hold your newly created sprite and texture.
- Following a similar course of action as for the sprites above, you can also enable the cube object in the scene.
- The cube object has a Mesh Renderer and a sample Material assigned.
- Add the Api key as you would normally.
- You'll notice that the object has an option
Assign to Materialticked. Leave it as it is. - Following the same set of instructions as for the sprite, you can generate a texture that will now replace a material of the 3D object like the sample cube.
To be able to generate assets on Runtime you just need to follow these simple steps:
- Select the game object with the attached component of
Blockade Imaginarium. - Add your Blockade Labs'
publicAPI key in the designated field - Click on the
Enable GUIcheckbox for Imagines or on theEnable Skybox GUIcheckbox to display GUI for Skybox generation. - After you run the game a GUI will appear on top of your Game view.
- Use the GUI in the same manner as you would in the editor (
Get Generators > Enter Prompt > GenerateorGet Styles > Enter Prompt > Generate Skybox).
If you are using an optional Pusher package, after installation on 2021.x.x versions you might get an error saying:
Assembly 'Packages/com.pusher.pusherwebsocketunity/Packages/PusherClient.2.1.0/lib/net472/PusherClient.dll' will not be loaded due to errors: PusherClient references strong named Newtonsoft.Json Assembly references: 12.0.0.0 Found in project: 13.0.0.0.
To resolve the issue go to Edit > Project Settings > Player > Other Settings > Configuration > Assembly Version Validation and disable Version Validation.