Documentation / Node reference / tex nodes

tex/GenerativeImage

Makes a picture from a text prompt, or edits images as a prompt says, through a hosted image API.

Files

Press generate to send the request. Nothing is ever sent by a cook, only by the button, and each picture costs the provider's credits (about two cents at MEDIUM quality on OpenAI). With nothing connected, the prompt alone becomes a picture. Connect an image to the first input and it is edited instead: a photo of a face can become the same person as a werewolf, a statue or an old man. The first input is the main image, whose framing and face are kept. The second input is optional: a reference the prompt can use however it says, such as "in the style of the second image". The second input cannot be used alone. The inputs are read when you press generate, so changing them sends nothing until the next press. To edit a photo a visitor gives with a control panel's photo buttons, wire a tex/Image into the first input: the app names that tex/Image as where photo 1 goes, and it shows grey until a photo arrives.

The result is an ordinary texture, so it can go anywhere a texture goes. Point a geo/GenerativeModel's image1 at this node to turn the edited picture into a 3D model: photo, then edit, then model. Look at the picture first, and press generate again here until you like it, before spending a model.

If the picture feeds a model that is printed or left untextured, ask for changes of SHAPE, not of colour. Ears, horns, a muzzle, sunken cheeks or scars come through in the model; green skin does not. The provider refuses pictures its safety system judges too violent or explicit, such as torn flesh or exposed bone, and says so on the node.

The node is a container. Until the first picture it shows black. A picture that lands is shown by a tex/Image inside it, named image_generativeResult and wired into a tex/Output, and kept as generative/<fingerprint>.png (the tex/Image's path says where). A second press with nothing changed shows it again instead of spending credits. While a new one is being made, the previous one stays on show, and the new one goes into the same tex/Image. You can work on the picture inside: a filter placed between the tex/Image and the tex/Output stays when the next picture lands. A tex/Image renamed or deleted inside is made again by the next picture.

On a native build the provider is called with your own API key. Press apiKey to save it, or press generate and you will be asked for it; it is kept on this computer only (~/.config/polygon/keys/<provider>), never in the scene.

In a browser the request goes to Polygon's own server, which holds the keys, and the picture comes back as a URL. The page uploads the input images itself: a tex/Image (a visitor's photo or a picture from the scene's assets) or another tex/GenerativeImage's picture. Other tex nodes cannot be sent from a browser.

Parameters

Name Type What it does
provider UInt8 OPENAI Which hosted API makes the picture. On native it uses your own key for that provider: see apiKey.
prompt String What to make, or with an image connected, what to change in it. Say "the second image" to use the reference on the second input. For a picture that becomes a printed or untextured model, describe changes of shape rather than colour.
quality UInt8 LOW · MEDIUM · HIGH · XHIGH How much the provider should spend on the picture, in OpenAI's own names. Higher rungs cost more and take longer; MEDIUM is about two cents a picture.
aspect UInt8 SQUARE · PORTRAIT · LANDSCAPE The shape of the picture: SQUARE, PORTRAIT (taller than wide, for a face) or LANDSCAPE.
generate Button Send the request. Costs the provider's credits and takes seconds to a minute. Disabled while a picture is being made.
apiKey Button Save your API key for the provider, or replace or remove the saved one. The key is kept on this computer only, never in the scene, and a saved key is never shown again.
_resultFingerprint String Bookkeeping, hidden: the fingerprint of the request whose picture this node holds, which is what makes a second identical press free.

See also

This page is generated from the engine, so it describes the release you can download. The same text is in the editor's Help panel next to the node itself.