Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 5 6 [7] 8 9 ... 23

Author Topic: [PRINT_MODE:SHADER]  (Read 86440 times)

Mike Mayday

  • Bay Watcher
  • gfx whr
    • View Profile
    • Goblinart
Re: [PRINT_MODE:SHADER]
« Reply #90 on: February 09, 2012, 09:25:59 am »

*crowds cheering*

*girls fainting*

*mayday wipes a single tear of joy from his right eye*
Logged
<3

lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
Re: [PRINT_MODE:SHADER]
« Reply #91 on: February 12, 2012, 11:36:33 am »

This turns out to become a full-graphics implementation. Sorry about that.

Rendering:

The rendering engine is a primitive blitter implementation in GLSL.
It has one defined operation: given two tile textures, starting alpha and
ending alpha, it blits first texture with its alpha, then second texture
with its alpha.

Inputs to the blitter comprise:
  • a texture album containing all needed textures of uniform size
  • blitter "program", a 3D texture, width and height correspond to the tile type, while depth corresponds to the current frame number
  • screen data represented as several layers of tile types.
  • current frame number

Screen data consists, provisionally, of the following layers, each to be blitted on top of previous.
  • rock: floors, walls, ramps; both natural and constructed
  • rock: veins and gem clusters
  • grass, moss, farms, vegetation
  • other constructions: doors, tables, workshop components, traps, etc
  • items: which to draw, one per tile
  • contaminants
  • creatures
  • magma/water levels
  • mist, dust, smoke, miasma
  • designations and zones: piles, zones, burrows, mining/construction/wet|warm stone indicators

Graphic data is defined in the following format, which is intentionally raws-like.
Example definition

Code: [Select]

[TILE_PAGE:pagename]
    [FILE:page/name.png]
    [TILE_DIM:16:16]
    [PAGE_DIM:16:16]
    [DEF:cactus:10,6]
    [DEF:cheap_ore:132]
    [DEF:cheap_gem:168]
    [DEF:best_ore:9,12]
    [DEF:cage:1,3]

[MAT:DEFAULT]
    [WALL:SOLID]
[CEL:pagename:8,3]
    [WALL:ROUGH]
[CEL:pagename:8,3]
    [WALL:ROUGH:NS]
[CEL:pagename:11,13]

[MAT:GOLD]
    [VEIN]
[BLIT:best_ore]
[BLEND:FFD700]
[KEY:24]
[BLIT:best_ore]
[BLEND:AF8700]
[KEY:48]
    [CAGE]
[BLIT:cage]
[BLEND:FFD700FF]
[KEY:24]
[BLIT:cage]
[GLOW:FFD70080]
[KEY:48]

[MAT:SILTY_CLAY]
    [DEFAULT]
[BLEND:FBEC5D]


The above code defines first a texture set, quite like the existing creature graphics do.

One distinction is definition of aliases with DEF tag, and tile addressing by both tile number and tile coordinates.

MAT:DEFAULT definition provides a default mapping between various tiles and the texture set.
WALL:SOLID defines not-yet-mined tile, while WALL:ROUGH defines a wall not smoothed, in a end-tile position.
WALL:ROUGH:NS defines a 'vertical' wall, that is, one that goes from north to south. NSEW in place of it will define a wall cross.

MAT:GOLD defines a vein, and a cage. Vein is the symbol drawn on top of base rock tile. Cage is an item.
As defined, both will glow - alternate between bright and dim gold color with the period of 2 seconds.
Here, operations to draw a tile are interspersed with KEY tag which can be read as 'key frame at frame number such and such'.
Animation is fixed to 12  FPS. Total length of an animation is to be limited by 128 frames which is about 10 seconds.

MAT:SILTY_CLAY definition just says - take corresponding tile from MAT:DEFAULT def and apply color with the BLEND operation.
This is roughly the same thing the game does already.

In fact, BLEND is just a BLIT of solid-color texture, thus they are the same to the blitter. GLOW is the same as BLEND, but transitions to and from a GLOW cel are smoothed by linearly changing alpha from previous BLEND value to the GLOW value, and then to the next BLEND value. When loading graphics, those definitions are compiled into blitter input code for all 128 frames.

BLEND is first applied to the BLIT source, then the resulting image is blended on top of previous layer respecting resulting per-pixel alpha.

There will be distinct tile indices - that is, tags undeneath the MAT tag - for all items/item classes present in the game, with variants for rotating and stopped axles, windmills and such, busy vs idle workshops, passabe/forbidden doors, siege engines and whatever we'll come up with.

One caveat is that this would be quite videoram-hungry. However, with budget video cards having upwards of 512MB on board and more than enough gpu power nowadays, this won't be a problem. For those that don't fancy fancy graphics, classic renderers, including ncurses, will stay available.

Discuss.

Mike Mayday

  • Bay Watcher
  • gfx whr
    • View Profile
    • Goblinart
Re: [PRINT_MODE:SHADER]
« Reply #92 on: February 12, 2012, 02:26:43 pm »

I can't. I'm speechless. And terrified.
Logged
<3

Ironhand

  • Bay Watcher
  • the llama is laughing
    • View Profile
Re: [PRINT_MODE:SHADER]
« Reply #93 on: February 12, 2012, 04:29:42 pm »

Holy crap.
Logged

lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
Re: [PRINT_MODE:SHADER]
« Reply #94 on: February 12, 2012, 06:47:39 pm »

Now can someone please explain what do those double wall directions in fact mean:

dfhack/library/TileTypes.cpp:
Code: [Select]
       { "smooth stone wall RD2", WALL, STONE, VAR_1, TILE_SMOOTH, "--SS--E-" },
        { "smooth stone wall R2D", WALL, STONE, VAR_1, TILE_SMOOTH, "--S---EE" },
        { "smooth stone wall R2U", WALL, STONE, VAR_1, TILE_SMOOTH, "N-----EE" },
        { "smooth stone wall RU2", WALL, STONE, VAR_1, TILE_SMOOTH, "NN----E-" },
        { "smooth stone wall L2U", WALL, STONE, VAR_1, TILE_SMOOTH, "N---WW--" },
        { "smooth stone wall LU2", WALL, STONE, VAR_1, TILE_SMOOTH, "NN--W---" },
        { "smooth stone wall L2D", WALL, STONE, VAR_1, TILE_SMOOTH, "--S-WW--" },
        { "smooth stone wall LD2", WALL, STONE, VAR_1, TILE_SMOOTH, "--SSW---" },
        { "smooth stone wall LRUD", WALL, STONE, VAR_1, TILE_SMOOTH, "N-S-W-E-" },
        { "smooth stone wall RUD", WALL, STONE, VAR_1, TILE_SMOOTH, "N-S---E-" },
        { "smooth stone wall LRD", WALL, STONE, VAR_1, TILE_SMOOTH, "--S-W-E-" },
        { "smooth stone wall LRU", WALL, STONE, VAR_1, TILE_SMOOTH, "N---W-E-" },
        { "smooth stone wall LUD", WALL, STONE, VAR_1, TILE_SMOOTH, "N-S-W---" },
        { "smooth stone wall RD", WALL, STONE, VAR_1, TILE_SMOOTH, "--S---E-" },
        { "smooth stone wall RU", WALL, STONE, VAR_1, TILE_SMOOTH, "N-----E-" },
        { "smooth stone wall LU", WALL, STONE, VAR_1, TILE_SMOOTH, "N---W---" },
        { "smooth stone wall LD", WALL, STONE, VAR_1, TILE_SMOOTH, "--S-W---" },
        { "smooth stone wall UD", WALL, STONE, VAR_1, TILE_SMOOTH, "N-S-----" },
        { "smooth stone wall LR", WALL, STONE, VAR_1, TILE_SMOOTH, "----W-E-" },

?

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: [PRINT_MODE:SHADER]
« Reply #95 on: February 12, 2012, 10:45:20 pm »

each wall tile can be connected two any out of four directions.

{ "smooth stone wall LRUD", WALL, STONE, VAR_1, TILE_SMOOTH, "N-S-W-E-" }, for example, is a + shaped wall.
Logged

lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
Re: [PRINT_MODE:SHADER]
« Reply #96 on: February 13, 2012, 04:35:39 am »

each wall tile can be connected two any out of four directions.

{ "smooth stone wall LRUD", WALL, STONE, VAR_1, TILE_SMOOTH, "N-S-W-E-" }, for example, is a + shaped wall.

This I understood. But what does mean double-N in
Code: [Select]
        { "smooth stone wall RU2", WALL, STONE, VAR_1, TILE_SMOOTH, "NN----E-" },

Knight Otu

  • Bay Watcher
  • ☺4[
    • View Profile
Re: [PRINT_MODE:SHADER]
« Reply #97 on: February 13, 2012, 05:39:15 am »

Walls are sometimes represented as ╖╕╜╛╙╘╒╓ at their end. Presumably the NN distinguishes the two-line end and the single-line end in some fashion. Given the other wall types, the doubled direction probably is the single-line end. Maybe Baughn knows more, though.
Logged
Direforged Original
Random Raw Scripts - Randomly generated Beasts , Vermin, Hags, Vampires, and Civilizations
Castle Otu

lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
Re: [PRINT_MODE:SHADER]
« Reply #98 on: February 14, 2012, 11:44:01 am »

Thanks Otu.

Now in the meanwhile we've got a new release. I have backported truetype changes to work with 31.25. Unfortunately, there can't be a single binary for both just and only because some keybinding ids were inserted/deleted to/from a middle of an enum.

In any case, enjoy:
3401
3125


If it complains about CXX ABI or something like that, rename included libstdc++.so.6.oneiric to libstdc++.so.6 (in libs/ directory)

SalmonGod

  • Bay Watcher
  • Nyarrr
    • View Profile
Re: [PRINT_MODE:SHADER]
« Reply #99 on: February 14, 2012, 12:34:37 pm »

I just stumbled on this and am perplexed.  I get on a very basic level what this is supposed to do... I think... does it really provide much of a performance boost?... enough to think about setting up a linux install?
Logged
In the land of twilight, under the moon
We dance for the idiots
As the end will come so soon
In the land of twilight

Maybe people should love for the sake of loving, and not with all of these optimization conditions.

lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
Re: [PRINT_MODE:SHADER]
« Reply #100 on: February 14, 2012, 01:51:34 pm »

does it really provide much of a performance boost?

It is noticeable, on maximum zoom-out and when loading game - PRINT_MODE:STANDARD is quite slow when uploading textures. However, it does not significantly raise your FPS (as opposed to GPFS and overall interface smoothness). 

It would be interesting to compare STANDARD and SHADER on low-power machines, like mid-tier laptops. Unfortunately I don't have one.


 

Mike Mayday

  • Bay Watcher
  • gfx whr
    • View Profile
    • Goblinart
Re: [PRINT_MODE:SHADER]
« Reply #101 on: February 14, 2012, 03:40:36 pm »

Wow! So... all the mentioned features are already implemented??
Logged
<3

lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
Re: [PRINT_MODE:SHADER]
« Reply #102 on: February 14, 2012, 05:12:33 pm »

Wow! So... all the mentioned features are already implemented??

I'm not that omnipotent yet.

Greendogo

  • Bay Watcher
    • View Profile
Re: [PRINT_MODE:SHADER]
« Reply #103 on: February 14, 2012, 06:09:04 pm »

What's this talk of tile aliases?
Logged
Sail - The end reminds me of a goblin choking a kobold.  No ponies, sorry.

lxnt

  • Bay Watcher
    • View Profile
    • pm:full_graphics
Re: [PRINT_MODE:SHADER]
« Reply #104 on: February 14, 2012, 06:45:24 pm »

What's this talk of tile aliases?

What I posted above is a preliminary format for full-graphic tilesets, which is to be discussed and improved while I write renderer backend.
Pages: 1 ... 5 6 [7] 8 9 ... 23