Latest Posts

Topic: Developing in-game graphics - for dummies

feh
Avatar
Topic Opener
Joined: 2021-04-19, 10:26
Posts: 8
Ranking
Pry about Widelands
Posted at: 2021-06-23, 22:51

So I did some modelling in blender and am now wondering what the next steps are to get the art in game. The outdated Blenderperspective -page was not overly helpful. As a noob in blender, I don't know if my perplexity about some parts there (e.g. "...AO enabled and high sampling rate, and on KEY render type (not SKY)" stems from my lack of blender knowledge or different blender versions.


This topic is intended to gather the requirements for graphics to get in game. Also maybe the current active graphic developers could share their different workflows from blender model to in-game graphic, what program/version you use, what you do manually, which scripts you use (and where to find them),... So those keen on providing graphics for the game have something to start off of.

Blender general

  • It is recommended (but not mandatory) to use the blender templates as they at least still provide the correct light direction and camera position. They also have a Python 2 script that was used to generate the original graphic output but the script is most likely broken on anything later than blender version 2.76b (definitely broken on blender 2.92).
  • pack all materials and textures you used into the .blend file.
  • When creating construction steps for a building (usually how many steps?) keep in mind that widelands first draws the last completed phase and then a portion of the current phase on top of it. Here's what it looks like when it goes wrong.
  • Question: There's some weird instruction concerning shadows on the BlenderPerspective page: render two pictures, one without shadows, one with shadows only, resize them individually and ultimately copy the pic over the shadow pic. Does anyone do that? Why?
  • Player Colors again use the broken Python script. How can you do it manually?
  • tbc

Blender output properties

@current active graphic developers: What are your settings?

  • Dimensions: BlenderPerspective recommends around 640x480
  • file format: .png, RGBA, color depth 8 or 16?, Compression ?

Resizing

To get the blender output to the right in game size I take it you crop all empty space and resize e.g. with GIMP (with interpolation turned off) to the right dimensions. Now I found on the BlenderPerspective page that menu pictures are 24x24. Wares use the same size as queue_empty picture (which is in px?) and on-map pictures are resized to their appropriate size. face-wink.png Which is quite helpful.
→ As a first reference point, maybe someone can provide some example sizes e.g. workers are usually px high, buildings range from _ to _ px,… are there any size restrictions?
Once the correct size is found, mipmaps should be provided for better game performance at different zoom levels. Those are 100%, 200%, 400% and 50%.

Animations

tba
spritesheets are used to save disk space. There's a Java tool in graphics/tools/ for that, maybe someone can dumb it down for those (me) that never used java?


Corrections, comments, additions - please face-smile.png


Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 2057
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2021-06-24, 10:32

So here's the advice from the only active graphic developer who uses Blender face-wink.png

I mostly ignore that page and the weird settings it suggests, and I do not use the python scripts. My workflow is like this:

  • Design the modal. Use a whitish texture for areas that will be playercoloured.

  • Render the model at a very high resolution (usually 800×800; for large buildings 1600×1600; for very small units 400×400 is enough. The renders should be at least 4× as tall as the in-game resolution). As render directory choose graphics/tribes/amazons/buildings/productionsites/charcoal_kiln/working/Renders####.png.

  • Make all textures shadeless and fully black; except the playercolour texture(s) which become shadeless and pure white.

  • Render this again at the same resolution as before. The output location for these images should be the pc/ subdirectory of the previous set (i.e. graphics/tribes/amazons/buildings/productionsites/charcoal_kiln/working/pc/Renders####.png).

  • Open a terminal, cd to graphics/tools. Run

java SpriteSheetGenerator -i ../graphics/tribes/amazons/buildings/productionsites/charcoal_kiln/working -o <PATH/TO/OUTPUT/DIRECTORY> -a <ANIMATION_NAME> -c <DESIRED_NUMBER_OF_SPRITESHEET_COLUMNS> -s <SCALE_FACTOR> -m <FRAME_ID_FOR_MENU_ICON>

This generates the spritesheets for the animation with all scales and playercolour masks in the specified directory, with the specified number of columns, by scaling the animation down to the given factor, and generates, if you specified -m, a menu icon from the given frame. You can use java SpriteSheetGenerator --help for a list of all options or java SpriteSheetGenerator --gui for a graphical interface in case this is more convenient.

Hope this helps, feel free to ask if anything's unclear face-smile.png


Top Quote
DragonAtma
Avatar
Joined: 2014-09-14, 01:54
Posts: 351
Ranking
Tribe Member
Posted at: 2021-06-30, 02:33

My advice? Use povray, not blender. :Þ

Seriously, though, they're both fine; it's just that I only know povray and, therefore, cannot help with blender.


Top Quote