RPGify LoRA
Link to download page on CivitAi
This LoRA attempts to replicate the visual style of video games, with a focus on Skyrim (for concepts), Elden Ring (backgrounds), and Baldur's Gate 3 (characters).
Effects can be combined or used separately.
Trigger words:
- Global: "rpg, heroic fantasy" (optional, enforces the style)
- Baldur's Gate 3: "bg3"
- Elden Ring: "eldenring"
- Skyrim: "skyrim"
Steps, Hires steps, CFG: doesn't matter
Checkpoints: works better with realistic checkpoints, especially DreamShaper, but is usable with all
Combining LoRAs: that's the main point, it is usable with character LoRAs and will teleport them to the corresponding universe. Anime characters can be used, you will need to emphasize the trigger words (see examples).
Technical data for the generation of this LoRA can be found at the bottom of this page.
Random pictures generated with RPGify
Technical aspect
Trained with OneTrainer on in-game screenshots:
- 299 pictures of Elden Ring
- 206 pictures of Baldur's Gate III
- 432 pictures of Skyrim
Steps
- Download images
- Resize them: I made a PHP script to resize images with a minimum size of 300 pixels and a maximum of 576, converts them to PNG format and adding a prefix for better classification.
See the Code - Download it
Dimensions are grouped by multiples of 8 to facilitate batch processing.
Will give a try with cropping too, as resizing can lead to severally low resolution.<?php
$dest_rep = 'to_crop/output/'; // Output directory
$basefiles = 'to_crop/input/'; // Input directory
$files = scandir($basefiles);
$count = 0;
$max_size = 576; // Max dimension
foreach($files AS $useless => $name)
{
if($name != '.' && $name != '..')
{
$source_file = $basefiles . $name;
$dest_file = $dest_rep . 'painting_romanticism_' . $count . '.png'; // Change 'painting_romanticism_' for the prefix you want
if(substr($name,-4) == '.png')
{
$img = @imagecreatefrompng($source_file);
}
elseif(substr($name,-4) == '.jpg' || substr($name,-5) == '.jpeg')
{
$img = imagecreatefromjpeg($source_file);
}
elseif(substr($name,-5) == '.webp')
{
$img = imagecreatefromwebp($source_file);
}
elseif(substr($name,-5) == '.avif')
{
$img = imagecreatefromavif($source_file);
}
$original_x = imagesx($img);
$original_y = imagesy($img);
// Optimal ratio
$ratio = ($original_x / $original_y) > 1 ? 169 : 916;
$new_x = floor($original_x / 8) * 8;
$new_y = floor($original_y / 8) * 8;
if($ratio == 169)
{
$true_ratio = $original_x / $original_y;
if($original_x > $max_size)
{
$ratio_crop = $original_x / $max_size;
$new_x = $max_size;
$new_y = round($original_y / $ratio_crop);
$new_y = floor($new_y / 8) * 8;
}
}
else
{
$true_ratio = $original_y / $original_x;
if($original_y > $max_size)
{
$ratio_crop = $original_y / $max_size;
$new_y = $max_size;
$new_x = round($original_x / $ratio_crop);
$new_x = floor($new_x / 8) * 8;
}
}
if($new_x > 300 && $new_y > 300)
{
$dst_file = imagecreatetruecolor($new_x, $new_y);
if(substr($name,-4) == '.png' || substr($name,-5) == '.webp')
{
imagecolortransparent($dst_file, imagecolorallocatealpha($dst_file, 0, 0, 0, 127));
imagealphablending($dst_file, false);
imagesavealpha($dst_file, true);
}
imagecopyresampled($dst_file, $img, 0, 0, 0, 0, $new_x, $new_y, $original_x, $original_y);
imagepng($dst_file, $dest_file);
}
}
}
?> - Automatic tagging with Kohya_SS, using WD14 and a treshold of 0.1 (0.4 for Elden Ring, as I want mainly the style), adding "rpg, heroic fantasy" + videogame trigger word at the beginning
- I Use OneTrainer for the training: download settings.