Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3D character generation DreamGaussian live rigging saved scenes etc. #17

Open
wants to merge 64 commits into
base: main
Choose a base branch
from

Conversation

liamzebedee
Copy link

@liamzebedee liamzebedee commented Mar 25, 2024

This contains the code to automatically create 3D characters while we are running the show. The character heads are generated by a custom AI pipeline written in Python, using SDXL and Dreamgaussian, live imported into the show at runtime and rigged to the "default guy" model.

This works through changing the show:

  • 3d scenes are generated in the background if an AI character is detected in the script
  • when a 3d character is detected, we run a separate "character voting" scene
  • we then play the scene

Lots of other cool features:

  • save and replay scenes from the filesystem - including dialogue, voice tracks, ai generated art (dimensions, characters)
  • entire history of the show is saved as we run the main loop
  • PlayScene now perfectly starts from the same place every time - resetting rick/morty to their positions, resetting camera angles, resetting the AI art/dimension controllers (rewritten)

images.

3d characters

A 3d donald trump generated at runtime:

image

Sam altman telling codebullet about AGI

Screenshot 2023-11-27 at 5 12 54 pm

Gordon Ramsey and Dutch guys:

Screenshot 2023-11-27 at 10 38 50 am

The new character voting chamber:

image

Live reaction bar:

Screenshot 2024-03-25 at 4 24 20 pm

The saved files and scenes written to disk:

Screenshot 2023-11-28 at 4 01 44 pm

new API's

// Loading scenes
var scene = RickAndMortyScene.ReadFromDir("scene-obama-ai");
await RunScene(scene);

// Saving scenes
var scene = await CreateScene(firstPrompt, "me", "banana", "me", usingVoiceActing);
await scene.WriteToDir();
// Run topic vote
TopicVoteResults voteResults = await RunTopicVote(nextSceneTask, 30f);
var scene = CreateScene(
    voteResults.topic,
    voteResults.author,
    voteResults.backupTopic,
    voteResults.backupAuthor,
    usingVoiceActing
);

// Run new character vote.
CharacterVoteResults voteRes = await RunCharacterVote(
    "barack obama",
    AIHeadRigger.GetGenerationsForCharacter("barack obama"),
    5000
);
// Hiding/showing different UI's
SetUI(topicVotingUI);
SetUI(charVotingUI);
SetUI(episodeStuffUI); // titles, subtitles, etc
SetUI(null); // show none

the 3d generation server (python)

  • generates 4x candidate images in parallel using SDXL, with prompt/antiprompt/reference image configured
  • feeds these 4x images to a dreamgaussian model, generating 4x 3d models in parallel
  • outputs .zip containing 3d model (.obj) and textures (.mtl, .png)
  • generation is run in the Replicate cloud
  • benchmarking:
    • using Replicate A40
    • model time - 120s (cold boot) + 30s (first run) + 120s (gen/inference) = 270s
    • first run goes for an extra 30s due to the model's cog container downloading some extra files
  • everything is based on the raw filesystem - no need to make it complex

Filesystem layout:

Screenshot 2023-11-05 at 4 08 28 pm

The boys:

Screen Shot 2023-10-23 at 6 21 14 pm

Reference of 2d SDXL to 3d DreamGaussian quality:

Screen Shot 2023-11-01 at 3 51 59 pm

CLI view:

Screenshot 2023-11-27 at 3 14 39 pm

add test case to generation server
* refactor WholeThingManager RunScene to be functional and with no global variables in the create/play scenes logic
* add load/save methods to rickandmorty scene
* create AIArt class which contains dimension/character details
* refactor AiArtDimensionController to accept AiDimension
* refactor AiArtCharacterController to accept AiCharacter
* refactor ReplicateAPI to return AIArt class
* log iterations
* testing topic selection locally - cycle through test topics list
- [x]  Refactor the voting process into separate functions
    - [x]  RunTopicVote
    - [x]  RunCharacterVote
    - [x]  Transition between scenes
    - [x]  Refactor UI
- [x]  Show voting scene w/ custom timeout
- [x]  Test the voting.
    - [x]  Run topic vote, render topics.
    - [x]  Run character vote, render characters.
- [x]  Properly reset the scene
    - [x]  Change the virtual cameras
    - [x]  Warp rick and morty to dimension
    - [x]  Do it all “sync” so we setup before
- [x]  Refactor the UI stuff for an episdoode (title, subtitle) into separate place
- [x]  Refactor the common UI elements (green shit) into a place
- [x]  Rewrite voting logic so it can count votes from youtube according to “Char:1234”
- [x]  Test “character voting”
    - [x]  Play the character voting chamber
    - [x]  Then count votes for that character
    - [x]  Then play the scene, and you can have the character be changed by the vote outcome
- [x]  Reset the location of character3d to the star wars cantina
- [x]  Add the youtube voting into the mix
- [x]  Refactor the head3d to be even more robust
- [x]  Copy-save all of the 3d assets to the scenes dir upon generation
- [x]  Save the character gen details once the scene is finished generating
- [x]  Refactor the camera angle generation into own function
- [x]  Reuse character if we have one
    - [x]  Load the characters from the scene files. Oops no we want the voted ones
    - [x]  Save the votes to a json file
    - [x]  Load votes from the json file, build dictionary of 3d characters
* save data into data-prod or data-test
* modify youtube chat to accept ratings

this includes commented code for different approaches:
- events
- async routine
- and eventually the working one, using coroutines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant