Author Topic: Tile Magic  (Read 854 times)

Legacy_Zwerkules

  • Hero Member
  • *****
  • Posts: 1997
  • Karma: +0/-0
Tile Magic
« Reply #45 on: December 17, 2012, 07:11:27 pm »


               Henesua, this is a very good idea. I always thought it would be nice if turning on animloops could be scripted. Using your idea we could simulate that.
I haven't used tile magic yet. From what I've read here I think that the tile vfx overlays the original tile. It doesn't replace it. Is that right?
So the basic tile would have the ground and a tree without foliage and the tiles used for the tile magic would have the foliage, fruits and emitters, but not the ground and the tree?
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Tile Magic
« Reply #46 on: December 17, 2012, 08:03:13 pm »


               I think you have it right, Zwerkules.

Some clarification:
Tile Magic is a term that has been used to describe using a tile model as a VFX. The VFX itself is not applied to the tile but to an invisible placeable (typically spawned at a position which enables the VFX to overlay a specific tile).

I have seen that the following features work with these VFX:
Danglymesh
Lights
Animesh

There may be more features but I haven't exhaustively explored this. Also Lights behave in interesting ways. I've noticed that some lights activate when a PC enters the VFX tile. They also seem to partially activate at a distance.

And lets not forget the VFX render differently than other objects. I believe they are not obscurred by Fog, and they appear to disappear at a certain distance from the PC.

One more thing:
since the VFX is being applied to an invisible placeable its position can be adjusted by adjusting the placeable. I think it is best to set the Z height for the VFX to 0.0. That way the builder doesn't have to adjust via scripting the height at which the placeable is spawned. The placeable can get its height from the WOK mesh of the tile it is sitting on which should put the VFX at the exact height required.

Alternatively if a VFX is made for a specific tileset, the affects could keep the same origin as the tile they are intended to overlay. But if a tileset has a raise-lower feature, we'll still have to adjust the VFX height for that.

I suppose there are a few ways to tackle the height problem, and we'll have to put our heads together to come up with the best method.
               
               

               


                     Modifié par henesua, 17 décembre 2012 - 11:53 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Tile Magic
« Reply #47 on: December 18, 2012, 12:10:59 am »


               I was thinking. VFX do have some drawbacks with the way that they render.
BUT I believe that some of these drawbacks do not happen with placeables. Placeables are rendered before fog yes? So they are obscured by it whereas VFX are not. Why not do the "animloop" replacements as placeables that we can create in the same manner as most tile magic is. It will overlay a tile, but it will look better in the way it renders because it will be a placeable.

Last minute thought. '<img'> I do not believe it will change the art asset.

Likewise to take advantage of VFX's order in the rendering cycle, glowing animloop elements could be done as VFX. Fireflies in a tree, or the standard horror element of glowing eyes from a swarm of small animals in a tree. Could also work for magical flowers that bloom and glow at night.

Anyway... more ideas.
               
               

               


                     Modifié par henesua, 18 décembre 2012 - 12:32 .
                     
                  


            

Legacy_NowAndZen

  • Newbie
  • *
  • Posts: 25
  • Karma: +0/-0
Tile Magic
« Reply #48 on: December 19, 2012, 01:13:25 am »


               Can Tilemagic only draw from the stock tilesets, or could it create bits from, say, Six's WildWoods or the expanded Project Q tilesets?
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Tile Magic
« Reply #49 on: December 19, 2012, 01:58:08 am »


               

NowAndZen wrote...
Can Tilemagic only draw from the stock tilesets, or could it create bits from, say, Six's WildWoods or the expanded Project Q tilesets?


Standard Tilemagic draws upon rows in visualeffects.2da to use as VFX. Vanilla NWN (NWN without HAKs) has a number of rows in visualeffects.2da which use some tiles from the stock tilesets as VFX. If you are searching through the 2da search for "SCENE" and you'll find a number of these rows. Sunjammer found them all and included the row numbers as constants with descriptive labels in his tilemagic include.

You can add additional tiles to visualeffects.2da. I have used a number of tiles from tilesets like Wildwoods and the various Project Q expansions. I've even taken tiles out of a tileset and removed unwanted elements from the tile, then saved it as a renamed copy. I've got a VFX now for just the flowers in the meadow tile from Six's wildwoods, lilypads from Rosenkranz's Immersive Swamp, a couple spectral trees from Six's spectral woods, just the water planes from several tilesets etc...

As I've mentioned above, I've explored all of this further and have decided that placeables are in many instances superior to VFX as a means to implement "TileMagc". Traditionally its been VFX, but a placeable version of a tile which also lacks a PWK can work as well. In this case you'd need to create a custom script which spawns the placeable in just the right position, rather than use the vanilla tilemagic include and functions which spawns an invisible placeable in the center of a tile and applies a VFX to it.

At this point I think the VFX type of TileMagic would be best used with magical animations that synch with a given tile. For example lets say we have a ruined tower feature in a tileset. And on full moons an intact version of the tower rises in a ghostly mist on the spot. So you'd have a shimmery, silvery glowing tower overlaying the ruin, and this could be spawned with a tilemagic affect. Or a similar thing could be done with complicated light sources, and similar VFX animations on a tile. Since you can't turn animations in a tile on or off, spawning the animation as a VFX would work well.
               
               

               


                     Modifié par henesua, 19 décembre 2012 - 02:35 .
                     
                  


            

Legacy_WebShaman

  • Hero Member
  • *****
  • Posts: 1390
  • Karma: +0/-0
Tile Magic
« Reply #50 on: December 20, 2012, 12:51:17 pm »


               Awesome sauce!  This community never fails to amaze me, even after all these years...
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Tile Magic
« Reply #51 on: December 22, 2012, 03:05:48 pm »


               Another aspect of tilemagic that we have not gotten into is WOK modification.

See OTR's video and the discussion that followed it.

I am leaning more and more toward using placeables for tilemagic, and then recalled that discussion about PWKs and WOKs. I suspect that sing a placeable in this fashion could allow a PC to walk across a bridge, that can also be walked under. Could be cool eh?
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Tile Magic
« Reply #52 on: December 22, 2012, 06:08:28 pm »


               Are there issues with using a model with a Tile classification as a Placeable?

I am tempted to include the WOK with each of the tiles I modify and add to placeables.2da

[edit]
It appears to work just fine. I am unable to discern any issue with this.
'Posted

The monster is standing on a placeable version of a barrows tile which was plopped down in the Fort tileset. I located the placeable in the center of the tile.

More tests to follow.
               
               

               


                     Modifié par henesua, 22 décembre 2012 - 06:55 .
                     
                  


            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
Tile Magic
« Reply #53 on: December 22, 2012, 07:58:58 pm »


               

henesua wrote...

Are there issues with using a model with a Tile classification as a Placeable?

IIRC, Adam Miller once reported there were problems using more than 10-15 placeables set as tile classification.  Only time I've ever heard of any issues though, and things may have changed for the better since then.  As to overlaying a placeable WOK onto of a tile WOK, you might want to make sure that there are no issues with, for instance, dropped objects disappearing.  This may only occur when the placeable's WOK is +/- 10-25cm different than the WOK it's overlaying, but it was something I came across with a placeable WOK tower I made.  There may also be other unintended consequences.

I like the idea of doing away with visible geometry altogether on a tileset, but each riff on the idea seems to have its own can of worms to deal with.
               
               

               


                     Modifié par OldTimeRadio, 22 décembre 2012 - 08:00 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Tile Magic
« Reply #54 on: December 22, 2012, 09:53:03 pm »


               After more playtesting...
'Posted
Note how the footstep type reflects a water material although the placeable tile is dirt. The tileset tile underneath the placeable tile had a walkable pool. The placeable tile mounded up over the pool thus placing the player at a higher elevation.

I have not found any problems related to number of tile placeables. I filled up an 8x8 area (the typical size I use) with these and had no problems with them: 64 placeables each with a Tile designation.

Other findings:
  • placeable must be set to static, for the placeable's WOK to modify the tile's WOK. I suspect that a placeable must be in place when the module is loading as well, but have not tested this yet with dynamically changing placeable tiles.
  • placeable must be oriented in same X and Y coordinates as the center of the tile. For tcovering the bottom left tile this means the placeable must be set at x 5 and y 5. If the placeable overlaps an adjent tile, when a player character enters that tile there is a hiccup, the chracter is jettisoned up in the Z access, appearing to walk in space, then after a moment returns to the tile.
  • placeable's z coordinate can be anything you want, but this looks jarring when it is a visible distance such as 2 units (meters?) above the ground plane of the adjacent tile.
  • many aspects of the tile's WOK are unchanged by the placeable WOK. Footsteps do not change. Obstructions do not change and thus pathfinding does not change. I imagine visibility does not change either.
  • Items seem to rest on the Placeable WOK and on the Tile WOK. I'm not sure how this works. Can a WOK be applied to any mesh? Meaning can you have multiple WOKs per tile model? I was able to place a great sword on the modified ground (the placeable tile), and on an adjacent table which was part of the tile model.

               
               

               


                     Modifié par henesua, 22 décembre 2012 - 11:11 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Tile Magic
« Reply #55 on: December 22, 2012, 10:29:16 pm »


               Some more screenshots which may be misleading but are interesting.

renderaabb 0 (normal render)
'Posted

renderaabb 1 (wok render)
'Posted

When rendering the WOK mesh, only the placeable's WOK is visible.  This may be merely a quirk of the renderaabb command since I have already found that the only aspect of the placeable WOK that takes precedence is the Z height.
               
               

               


                     Modifié par henesua, 22 décembre 2012 - 10:31 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Tile Magic
« Reply #56 on: December 22, 2012, 11:55:39 pm »


               One major misconception I have been implying, and which I wish to now correct. The WOK file is unnecessary to get the behavior described above.

You do not need to include the WOK file with the MDL for the Z heights to work. I have tried this with a WOK and without and the behavior is the same. I believe the MDL file contains the information for Z Height in the aabb node.

Example:
node aabb Plane05
  parent plctile_dirt01
  position 0.0 0.0 0.01
  orientation 1.0 0.0 0.0 0.0
  wirecolor 0.0 1.0 0.0
  multimaterial 99
    Walkmesh - Dirt 
    Walkmesh - Obscuring
    Walkmesh - Grass
    Walkmesh - Stone
    Walkmesh - Wood
    Walkmesh - Water
    Walkmesh - Nonwalk
    Walkmesh - Transparent
    Walkmesh - Carpet
    Walkmesh - Metal
    Walkmesh - Puddles
    Walkmesh - Swamp
    Walkmesh - Mud
    Walkmesh - Leaves
    Walkmesh - Lava
    Walkmesh - Pit
    Walkmesh - Deep Water
    Walkmesh - Door
    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL
    Walkmesh - Unassigned
  ambient 0.415686 0.384314 0.254902
  diffuse 0.415686 0.384314 0.254902
  specular 0.0 0.0 0.0
  shininess 10.0
  bitmap Walkmesh - Dirt
  verts ..........
........
endnode

Next thing to try is to manipulate that node and see what happens.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Tile Magic
« Reply #57 on: December 23, 2012, 01:27:57 am »


                I am stumped.

The file pasted below when used as a static placeable does not not render the cursor click when a player clicks within the tile. I can't figure out why. I have not encountered this with any other tile.

#MAXMODEL ASCII
# tdg07_e20_01
filedependency Unknown
newmodel plctile_stone08
setsupermodel plctile_stone08 null
classification TILE
#MAXGEOM ASCII
beginmodelgeom plctile_stone08
node dummy plctile_stone08
 parent NULL
endnode
node aabb rectangle998
 parent plctile_stone08
 position 0 0 0.01
 orientation 0 0 0 0
 wirecolor 0.521569 0.521569 0.521569
 ambient 0.2 0.2 0.2
 diffuse 0.8 0.8 0.8
 specular 0 0 0
 shininess 1
 bitmap NULL
 verts 4
   -5 -5 0
   5 -5 0
   5 5 0
   -5 5 0
 faces 2
   0 1 2 1 0 0 0 7
   3 0 2 1 0 0 0 7
 aabb     -5 -5 0 5 5 0 -1
   -5 -5 0 5 5 0 1
   -5 -5 0 5 5 0 0
endnode
node trimesh plane427
 parent plctile_stone08
 position 0 0 0.01
 orientation 0 0 0 0
 wirecolor 0.109804 0.34902 0.694118
 tilefade 0
 scale 1  
 render 1
 Shadow 0
 beaming 0  
 inheritcolor 0
 rotatetexture 0
 alpha 1.0
 transparencyhint 0
 selfillumcolor 0.0 0.0 0.0  
 ambient 1 1 1
 Diffuse 1 1 1
 Specular 0 0 0
 shininess 1
 center 0.0 0.0 1.0  
 bitmap brownwall05  
 verts 25
   -5 -2.5 0
   -5 -5 0
   -2.5 -2.5 0
   -2.5 -5 0
   0 -2.5 0
   0 -5 0
   2.5 -2.5 0
   2.5 -5 0
   5 -2.5 0
   5 -5 0
   -5 0 0
   -2.5 0 0
   0 0 0
   2.5 0 0
   5 0 0
   -5 2.5 0
   -2.5 2.5 0
   0 2.5 0
   2.5 2.5 0
   5 2.5 0
   -5 5 0
   -2.5 5 0
   0 5 0
   2.5 5 0
   5 5 0
 faces 32
   0 1 2 1 0 1 2 1
   3 2 1 1 3 2 1 1
   2 3 4 1 2 3 4 1
   5 4 3 1 5 4 3 1
   4 5 6 1 4 5 6 1
   7 6 5 1 7 6 5 1
   6 7 8 1 6 7 8 1
   9 8 7 1 9 8 7 1
   10 0 11 1 10 0 11 1
   2 11 0 1 2 11 0 1
   11 2 12 1 11 2 12 1
   4 12 2 1 4 12 2 1
   12 4 13 1 12 4 13 1
   6 13 4 1 6 13 4 1
   13 6 14 1 13 6 14 1
   8 14 6 1 8 14 6 1
   15 10 16 1 15 10 16 1
   11 16 10 1 11 16 10 1
   16 11 17 1 16 11 17 1
   12 17 11 1 12 17 11 1
   17 12 18 1 17 12 18 1
   13 18 12 1 13 18 12 1
   18 13 19 1 18 13 19 1
   14 19 13 1 14 19 13 1
   20 15 21 1 20 15 21 1
   16 21 15 1 16 21 15 1
   21 16 22 1 21 16 22 1
   17 22 16 1 17 22 16 1
   22 17 23 1 22 17 23 1
   18 23 17 1 18 23 17 1
   23 18 24 1 23 18 24 1
   19 24 18 1 19 24 18 1
 tverts 25
   0 0.501953 0
   0 0.00195313 0
   0.5 0.501953 0
   0.5 0.00195313 0
   1 0.501953 0
   1 0.00195313 0
   1.49805 0.501953 0
   1.49805 0.00195313 0
   1.99805 0.501953 0
   1.99805 0.00195313 0
   0 1 0
   0.5 1 0
   1 1 0
   1.49805 1 0
   1.99805 1 0
   0 1.5 0
   0.5 1.5 0
   1 1.5 0
   1.49805 1.5 0
   1.99805 1.5 0
   0 2 0
   0.5 2 0
   1 2 0
   1.49805 2 0
   1.99805 2 0
endnode
endmodelgeom plctile_stone08
donemodel plctile_stone08
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Tile Magic
« Reply #58 on: December 23, 2012, 05:58:57 am »


               I figured out the problem with the cursors, and learned one more thing that a placeable tile's aabb mesh influences.

By changing
    faces 2
    0 1 2 1 0 0 0 7
    3 0 2 1 0 0 0 7
to
    faces 2
    0 1 2 1 0 0 0 1
    3 0 2 1 0 0 0 1

i enabled the mesh to register a crosshairs when a PC clicks on it.

And no that is not what I've been doing all day. The answer came to me out of the blue while doing something else. I should try that more often.
               
               

               


                     Modifié par henesua, 23 décembre 2012 - 06:01 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Tile Magic
« Reply #59 on: December 23, 2012, 06:25:46 am »


               I just reworked the fog plane from the steam works tileset so that it appears similar to radiation fog on a very cold and yet dry day. That thin fog layer that forms just a few inches above the ground and fades away.

Anyway, I made some adjustments to the emitter so that it inherits color similar to how the mist placeable works, it seems to inherit its color from the area's Ambient light. How does one make it inherit color from the area's fog color?