It is currently 08 Aug 2022, 06:36
   
Text Size

MTG.Design Vector-Based Rendering Engine

by Nate and Snacko

Moderators: Snacko, CCGHQ Admins

MTG.Design Vector-Based Rendering Engine

Postby proud » 24 Feb 2022, 06:53

MTG.Design Vector-Based Rendering Engine

Hi everyone!

A brief bit of history.

I started MTG.Design back in 2014. (“ancestral” is my other handle.) I was looking for a 300 dpi source, and was happy to see ahkren had been working on HQ Cardgen, and had everything I needed. (I owe you a debt of gratitude! I would love to send you something — get in touch with me.) But within a year or two, ahkren became busy, and HQ Cardgen no longer had a maintainer. I was a de facto steward, but wasn’t familiar with the rendering portion, as I had developed my own text renderer.

Fast forward a few more years. Other options have become available, but I tired of pushing pixels and fussing over destructive and tedious image editing. I ended up deciding a fully vector-drawn approach (with exception to background textures) was going to be the very best option. When I didn’t find the right artist to take this on, I self-taught myself SVG, acquainted myself with Affinity Designer and Inkscape, and here we are today.

The next-gen MTG.Design renderer.

Attached are some samples.

https://github.com/MTG-Design/resources

Resources are split into individual components, the recipes how how to build the cards, and the PHP and LaTeX rendering files. Components include items such as accents, backgrounds, boxes, borders, and shadows. Recipes indicate which components to use, what effects to apply, and where to place them on a card. Rendering files composite the graphics with LaTeX text.

Currently, the components and recipes are included.

Some rendering support has been enabled, but it is unfinished.

Requirements

  • PHP 8.1 or newer
  • XeLaTeX, with several packages installed
  • Inkscape, in order to save SVGs to a differnet format (like PNG or PDF)
How to use

build.php builds the .ini recipe files into SVG or PNG images. (To export to PNG, inkscape is recommended for proper SVG export. (Not all graphics applications fully implement the SVG 1.1 specification.)

When cards are built, they will save to /cards by default.

render.php renders the text using XeLaTeX. You must install it on your system if you want to render text on cards.

Code: Select all
usage: render.php <format> <path>

Formats:
  -l   LackeyBot JSON format
  -m   MTGJSON JSON format
  -n   Start rendering at card number
  -s   Scryfall JSON format
When cards are rendered, they will save to /output by default.

(Fonts are not in this repository; it is up to the user to source their font files. I’ll add support for substitute fonts.)

The following LaTeX packages are required:

Code: Select all
  textpos
  calc
  xcolor
  fontspec
  lmodern
  hyphenat
  enumitem
  graphicx
  setspace
/frames includes the .ini recipes for how to draw the card, and where. /typesetting includes the text .ini recipes for how to set the type, and where to place it.

You can add new types of cards by creating a new recipe file. (Guidance and help on how to write recipe files will be added in the future.)

Contribute

MTG.Design is being actively worked on, with frames being uploaded only when they are considered ready. If you have components or recipes to add, please file a pull request and they will be reviewed.

You can donate to MTG.Design using Patreon.

About

MTG.Design was created using the MIT license by ancestral of Spellshapers, LLC.

Images in /background, /title, /typeline and /stamp may contain trademarks and be copyright of Wizards of the Coast, LLC, a subsidiary of Hasbro, Inc.

MTG.Design is not affiliated with, endorsed, sponsored, or specifically approved by Wizards of the Coast LLC.
Attachments
WU Planeswalker.png
WU Planeswalker
regular_creature_legendary_R_RG.png
RG Hybrid Legendary Creature Rare
3 Blue Ox.svg.txt
Blue Ox token
(162.57 KiB) Downloaded 167 times
1 Goat.svg.txt
Goat token
(329.28 KiB) Downloaded 173 times
aka ancestral, mproud
MTG.Design
proud
 
Posts: 68
Joined: 21 Apr 2010, 10:50
Has thanked: 6 times
Been thanked: 23 times

Re: MTG.Design Vector-Based Rendering Engine

Postby Huggybaby » 03 Jul 2022, 01:33

How did I miss this post?

Thanks proud!
User avatar
Huggybaby
Administrator
 
Posts: 3172
Joined: 15 Jan 2006, 19:44
Location: Finally out of Atlanta
Has thanked: 671 times
Been thanked: 583 times


Return to HQ Card Generator

Who is online

Users browsing this forum: No registered users and 1 guest


Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 10 minutes)
Most users ever online was 1922 on 07 Jun 2021, 06:01

Users browsing this forum: No registered users and 1 guest

Login Form