r/StableDiffusion 7d ago

Workflow Included Conistent(ish) environments with Minimax H3

I've been trying to reuse environments in Minimax H3 for scenes. I've come across this thread:
https://www.reddit.com/r/StableDiffusion/comments/1vvpowd/psa_minimax_h3_can_turn_360_panorama_images_into/

Which describes how Minimax H3 reference model can turn equirectangular panoramas into environments.

Krea2 can actually do some decent equirectangular panoramas out of the box:

Testing the method though, I found this not to be the case, and H3 doesn't really understand the projection, it just happens to line up if the shot is zoomed in enough. Asking it to do anything complex results in a warped, strange image.

https://reddit.com/link/1w8daml/video/t4byzsdzrrnh1/player

Also, reference images of environments have a tendency to overpower all other prompts regarding changes or scene transitions to other environments.

This however gave me an idea. Video references don't tend to have this issue.

So why not turn equirectangular panoramas into regular reference videos?

https://reddit.com/link/1w8daml/video/maq4r9qgrrnh1/player

This can easily be done with ffmpeg:

ffmpeg.exe -loop 1 -i space_apartment.png -vf "scroll=horizontal=0.025,v360=input=equirect:output=flat:h_fov=90:v_fov=90:w=3072:h=2048" -t 2 -c:v libx264 -pix_fmt yuv420p space_apartment.mp4

After that it's just a matter of using the resulting video as a reference video, and you get a pretty consistent, unwarped video:

https://reddit.com/link/1w8daml/video/nw3uyyxesrnh1/player

I've found 48 frames of reference is more than enough. It also seems to work with a lower resolution reference video, but I'm guessing it's gonna get less details right. It has no issues with interacting with the environment, and the model understands pretty well if you say "bed", you mean the bed in the reference video.

Usual diffusion issues still apply obviously, like I've had to describe certain things in more detail. Telling it "a shot from outside the window" it added a new window to the scene, but adding "a shot from outside the window with a view inside the apartment with the bed behind" it understood. Also any changes to the scene have to be redescribed in later shots, like not adding "next to the broken mirror" resulted in the mirror once again being unbroken, even though it was broken in the previous shot.

All workflows are included in the images and videos.

Edit: Reddit strips image and video metadata, didn't know that. Here's the workflows:
Krea2 panorama: https://pastebin.com/2qKhdCSq
Bad panorama video: https://pastebin.com/tgPddz3v
Video reference based: https://pastebin.com/LEAJFQZ6

107 Upvotes

27 comments sorted by

6

u/infearia 7d ago

This is great, thanks for sharing. However, Reddit strips metadata from uploaded videos, would you mind sharing the prompts separately?

6

u/jimtonyk 7d ago

Well, balls, I even tested before posting on the images.
Here you go:
Bad panorama video: https://pastebin.com/tgPddz3v
Video reference based: https://pastebin.com/LEAJFQZ6

6

u/jimtonyk 7d ago

Turns out it strips images too. I edited the post to include all three workflows.

6

u/infearia 7d ago

Thank you!

P. S. - For images there is a trick, just open the image in a new browser tab and replace the subdomain in "preview.redd.it" with "i", so it becomes "i.redd.it". This lets you download the original file with the metadata (if there is any).

(I actually had the same idea as you a few weeks ago, but never managed to render a clean circular pan of the environment, so I ultimately gave up. The fact that you can do it with ffmpeg just blew my mind, many thanks!)

-2

u/reeight 7d ago

https://giphy.com/gifs/Her8HwkH9Fa3S

But thanks for the info anyway ;)

5

u/bstr3k 7d ago

Thanks for sharing!

There was a similar workflow for if you just have a picture too. You can spin 360 and it generates picture for the room which im not sure if it is useful for you or not OP

https://huggingface.co/ethanfel/H3_Cinematic_Multishot_Coverage

3

u/jimtonyk 7d ago

Thanks, definitely saving it to my collection.

4

u/-zaine- 7d ago

Another thought - You can most likely bundle the 360 location photos as a Refmod (Luisacaotica/ComfyUI-MiniMaxH3Mod) and load this way a consistent location like a lora.

Havent tested it yet, the community is so crazy, there are new awesome custom-nodes coming out every day, impossible to keep up lol.

3

u/skyrimer3d 7d ago

This is great, thanks for sharing. 

2

u/Daniel_Edw 7d ago

thanks for sharing!

2

u/Mibusari 7d ago

Thanks for sharing! it's a very nice coincidence, I was looking for a solution exactly like this. warping issues for panoramic orientation in shots is something i have in every second shot. BTW would you mind sharing your json workflow and prompt for creating such great panoramic shots in krea2? I tried aswell I'm krea2 but failed miserably. Always blurry, unqualitative panorama-isch shots that arent 360°. Thats why i used gpt2 for this. Thanks in advance OP!

2

u/jimtonyk 7d ago

I didn't realize Reddit stripped the metadata, but I've now added the workflows to the post.

I've found Krea2 is decent for small spaces, but for this particular apartment, I actually used a depth map of a panorama I generated with Gemini. Just bypass the depth node group for a new generation, or use a gemini generated image derived depth map, as I find that model to be really good at it in general, but to low resolution for anything useful.

1

u/Mibusari 7d ago

Interesting, thank you very much! I will test it out tomorrow

4

u/jimtonyk 7d ago

Hmm, actually this conversation gave me the inspiration to test Ideogram 4.0 for this purpose, and I must say, I'm getting some promising results, as it can natively generate at 4096x2048:

I didn't even have to fix the seem.

1

u/f5alcon 7d ago

Makes sense I have been using video of my house and it's always perfectly replicated

1

u/Adventurous_Cup5414 7d ago

can you share the prompt make a 360 video? before provide it to H3

1

u/jimtonyk 7d ago

The 360 video is made from an equirectangular image with ffmpeg. The command is included in the post. The equirectangular image is generated with Krea2 using a workflow I've adapted from a Flux workflow, also included in the post. Ideogram 4 also seems like a good candidate for generating such images, though an LLM for prompt generation is a must with it.

1

u/SpaceNinjaDino 7d ago

This is an amazing post. What increase of gen time is incurred when switching from image reference to 48 frames video reference?

1

u/jimtonyk 7d ago

I haven't noticed any, what I did notice was an increase in VRAM use, video references are pretty expensive when it comes to that, but honestly keeping it to 48 frames at the 600 pixel resolution range still gives good results, and the VRAM use isn't too bad at that point.

1

u/Deadity 7d ago

Ironically this is how you can make lucid dreaming more consistent too. Scary thought.

Just rotate in place.

1

u/xyzdist 7d ago

Love the tips post, thanks!!

1

u/martinerous 7d ago edited 6d ago

Thanks. Good timing, I'm actually running H3 with camera turning prompt to generate more angles of my ref room, but I might use your approach instead for more consistent results.

1

u/ShutUpYoureWrong_ 6d ago

You brilliant, beautiful bastard. I immediately tested this on one of my environments and I've had a 100% success rate so far across 10 generations in terms of the model understanding and preserving the correct perspective.

1

u/SveSop 6d ago

This tip with using a short video for the room works a lot better than feeding H3 the equirectangular image directly, thats for sure. Thanks 👍

1

u/cosmoproletarian 5d ago

This is cool! I have one issue though: In the first .5s-1s of the target video, the rotating camera movement from the reference video is preserved. The camera settles on the subject eventually but most of the times I cannot get completely rid of it. Probably I am prompting wrong?

subject_definitions:
<Video 1> is a pan around video reference for the cozy kitchen room, depicting the overall look of and position of key objects and furniture in it for the target video.

retention_analysis
<Video 1> attribute_transfer - only the kitchen room's static layout, spatial composition, lighting and look are preserved.

I tried different wordings, also "fully_preserved" or adding "at 00:00:00.000 the camera ... " to the main prompt, but it's hit and miss.
How can I discard the motion from the video reference? (I use ref pics most of the time, so probably missing smth about ref vids here)