DAG tutorial.

Discussion in '3D Modeling' started by Shiningted, Jul 19, 2021.

Remove all ads!
Tags:
  1. Shiningted

    Shiningted I want my goat back Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,651
    Likes Received:
    350
    So I tried to post a tutorial on my blog and found its been bought out by Google and wants a Google ID to open, with no chance to use my original credentials :oops: oy...

    Anyways, here is a simple tutorial on doing some basic DAG stuff - or 'clipping', if you prefer - using WorldEd. Much like my previous tutorial on creating and meshing new models, this is not anything I particularly discovered and is very rudimentary, more for me to look at myself since I only do this sort of stuff every couple of years and generally have to re-learn from scratch.


    So what is a DAG? I believe it stands for 'Depth Art Geometry' and can be thought of as what we do to the background maps to give them depth, that is, to interact with our 3d models (players, monsters, chests etc) as though they are fully fledged 3d environs and not the stitched collection of JPGs we know them to be.

    Here's an example I just made for IWD:
    Blog 1.png
    So you will observe an open door, clipping Lydda's form nicely. The door is of course a 3d model, animated to open and close, and the PC is of course a 3d model. They interact accordingly - the one at the front is drawn, the one at the back is clipped and if they don't block each other, they can go right through each other.

    BUT - you will notice the column in front of both, clips both. So what is that? Isn't that one of our painted JPGs? How is it clipping a pair of 3d models - and precisely, at that?


    This is where DAGs come in.

    So, to get a clear idea of what they look like, consider the picture below. Can you guess what room it is?

    Blog 2.png
    If you said, “Jinnerth the tailor’s room”, I’ll allow it. (The correct answer, of course, is Frank’s house).

    That wireframe image represents the 3d model that overlays (underlays?) the ground jpgs. It is a genuine 3d model, and using the various white dots you can see (I’ll explain how in a minute) you can rotate it along all 3 axes, or stretch it to suit.


    Where does it come from? These files are found in the data/art/clipping folder.

    “But Ted, you sexy modding behemoth, I don’t have a data/art/clipping folder in my Co8 installs? Nor even in the dodgy third party ones like 0rion or Temple+ I keep installed for laughs!”

    True, but why were you worrying about these lesser mods, when you can find THE WHOLE ToEE clipping install in KotB?
    Blog 3.png
    The reason all this is in KotB I will get to at the end – it’s important – but for now, you can get clipping data there, or (and I recommend this) you can extract ToEE1.dat and work from that. If you just do a mod over the Co8 one, or a ToEE mod in general, it should draw the necessary clipping from this dat. Otherwise – again, I will deal with that at the end.

    For now, you might be asking, “what good are models of rooms I am never going to use?” Good question, and yes, while you can rotate and stretch those models to size, you can’t
    clip or crop them – you use them all or nothing. What good is that?

    Very little! But luckily, when we peruse the clipping folder, as well as the various buildings of Hommlet (and everywhere else), where everything has been done and saved as one file, we find a few maps where all the individual models have been saved, well, individually. I recommend the Welcome Wench ones, (Map-3-InnCellar, Map-3-InnFirst and Map-3-InnSecond) and the traders’ barn (Map-4-TradersBarn). Popping the first of these, we see:

    Blog 4.png
    As well as very specific (and thus, not very useful) models like the stairs, we see various models of chairs, boxes, pillars and kegs that can be turned, stretched, rotated, resized and other synonyms of turned and stretched. Let’s start with a simple pillar.
    Blog 5.png

    So, open up WorldEd and look for this:

    Blog 6.1.png
    So that’s the
    Environment tab, and we want the button under the tree that looks like 3 sharks swimming in a line (or something from a weather map). No idea what that image represents, and please don’t tell me in the comments, I don’t care. For us, it’s the DAGs. The eagle-eyed will notice an identical button underneath – this does much the same thing, but accesses SKMs. If you know what that means, you can figure it out – otherwise, I have never used it (presumably it allows access to models like the weapons, armour, doors and other models in the game besides the clipping stuff).

    Once you have pressed the DAG button, go down to ‘select’ and click that. It will bring up a browsing menu, a la Windows Explorer. These clipping buttons are the only ones in WorldEd that do that, that I can think of. Navigate to your (extracted!) ToEE1.dat, and choose data/art/clip/Map-3-InnCellar (or whatever you want), and, for the sake of this exercise, choose the pillar. The drop-down menu you can see will subsequently allow you to access models already called upon – again, more on this later.

    O – one more thing. Make sure that all the clipping is visible! Go to the View tab at the top left of WorldEd and select Clipping, then tick every box. (What the different boxes do, is either self-evident – Handles turns on and off the white control dots, for instance – or can be ascertained by experiment. For a n00b, turn them all on).
    Blog 6.3.png
    Now, with the DAG button depressed (cheer up, little DAG button!) and a DAG selected in the Select box, just click on the screen and your DAG will appear! Click again, and another will appear – you have to change to the pointer button (top left of button pad) to manipulate it, while the red ‘no go’ sign next to that will delete as usual.

    This image should hopefully show what those white control dots will do.
    Blog 6.2.png
    To use them, click on the relevant dot then drag the button until the desired effect is reached. So, as per the pic:

    The right-most dot, clicked and dragged, will stretch this particular model sideways (do this several times to really make it fat).

    The left-most dot, clicked and dragged, will rotate the model around a vertical centre-point (like a stripper around a pole – and I genuinely wish I could come up with a better analogy than that, but I can’t right at this moment. Let’s be tolerant of our hard-working entertainers).

    The top-most dot, clicked and dragged, will stretch the model upwards, into the z axis – or, if you drag it down far enough (or often enough), will first shorten the model to nothing, then extend it below the z axis, should you want to for some reason. This is one of the only consistent effects: this dot always lengthens along the z axis, it seems.

    The bottom-most dot, clicked and dragged, will rotate the model around a horizontal centre-point (can’t really say if it’s the x or y axis). Not very useful for this model.

    The middle dot, clicked and dragged, will physically drag the model around (also consistent for every model). And finally the dot at 11:45 from there, which you can’t even see in a lot of the examples, I can’t even get to work for this one. So there. In other models (long ones like walls) it is, as expected, a way of rotating the model around the third access (x, y & z).

    Essentially, though, you have to actually play with these to get a feel for what they do: not least because the results I just described are for a vertical model like this pillar. Some horizontal models work much the same way – I also did a bed, (see next pic), and got identical results even down to the one that didn’t work, likewise with a box (the latter is great for filling in walls).
    Blog 6.25.png
    Note that sometimes the rotation, like the second bed example, goes over the dot when you drag, and then you can’t use that dot any more unless you resize the model in some other way to expose it! This can be really get-your-hands-dirty stuff, resizing things away from other models then trying to juggle them into place, for instance.

    Now - other (primarily) horizontal models, like beams and walls I tried, can have a very different result: a testament, no doubt, to my lack of fundamental knowledge of 3d modelling. I am just describing what to do to get a good result when modding with WorldEd. And let me stress – this is not Blender or Paint3d or something: this is a simple tool for manipulating models in a 3d environ that will only ever be viewed by one specific camera angle, so its uses are limited indeed.

    BUT – we are modders. We are used to working with such restrictions, bending them to our wills, sidestepping them where necessary, and creating wonders.

    What are the actual uses for this? Well, for starters, lets look at another one of those columns in IWD. By taking our simple square pillar model, stretching it out horizontally, and then again stretching it vertically – voila! We can easily create a 3d clipping model for the column.
    Blog 7.png
    So now, your character model will grey out when you run across the column, giving the appearance of being behind it.
     
    Last edited: Jul 19, 2021
    anatoliy likes this.
  2. Shiningted

    Shiningted I want my goat back Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,651
    Likes Received:
    350
    DAGs Part 2

    “But how is that different from using sector visibility blocking?” you might ask. Well, in most cases, it isn’t. It can be a bit more precise – it can clip a model (or half a model) cleanly (see next pic), in ways SVBing doesn’t, but it’s rarely worth the effort.
    Blog 7.1.png
    The main value is in things like where we started: clipping a door model, so that when it opens behind a pillar, it stays behind the pillar, it doesn’t swing open through or over it. In fact, door models like this are about the only reason I add clipping, personally. Because it can take a LOT of work. For instance, those doors in Easthaven that you open to get at the portal icons, those took Allyx and I a ridiculous amount of effort to get just right. For myself, since there was not likely to be a doorframe in ToEE exactly the right shape, it often meant endless stretching and rotating, then doubling up (or tripling up) on door-frame models, and pixel-perfect moving of both those and the doors themselves around, so that they worked both open and shut. And I am still not satisfied with a lot of them!
    Blog 9.jpg
    But that’s modding – if you want to create a quality product, which of course a TC has to be, then you have to go that extra yard. And in these cases, it means doing things not because they are necessary, but because their
    absence would be felt: without them, it would be clear that you are dealing with a mod and not a top-tier product. It reminds me of those dancers at the Oscars during musical numbers, whom you would only remember if they stuffed up and fell over. Sometimes you have to do things that no-one is even going to notice, so their lack is not felt.

    One last look at how we might have to do this doubling up: at the top of the tutorial I commented (or tooted my own horn) about how precise the clipping for the column was. This didn’t just involve a pillar, but also a circular model for the top. So let’s see: in WorldEd it looks like this:
    Blog 8.png
    Ignore the green line, that is for SVB stuff. And you can see that there is a second set of handles (dots) for the second model. Deleting the pillar, we see this was actually a keg! And in this case, I did rotate it around a few different axes to get the circular element in the way I wanted. Here is the finished ‘product’ next to a newly spawned ‘original’ to the left – it had to be resized then rotated quite a bit.
    Blog 8.1.png
    Again, ignore the red and yellow areas, they are the actual blocking (parts of the map you can’t move through). Maybe I should have taken this moment to use a shield model via the SKM button: there was some reason I didn’t, I forget what.

    So, that’s a basic example of clipping. I could talk about it for hours, bizarre thing that it is – more to the point, could talk about the extraordinary effort the modellers of ToEE put into making all this, because the detail of Frank’s house is there for every part of ToEE: every upstairs loft with nothing in it, every inch of the vignettes you get kicked out of without exploring. An unbelievable amount of effort for something that in so many cases has no impact on the game! This is (strategically) a 2d game, after all – there is no meaningful z axis involvement! No enemies that can fly out of reach, no depths to plumb, no levitate spells.

    Enough, or I’ll get carried away. Let’s get back to using (or not using) the files in ToEE1.dat.

    “What if I want to use my own files from Blender? Or not use the ToEE dats at all?” Anatoliy’s recent adventures in creating modules with their own dats – something modders have dreamt of since the beginning, and props to Temple+ for making it happen – now put these questions on the table.

    Firstly, if you want to make your own 3 models, go for it. Leksey made some tools, Sitra recently added one, Darkstorm has described some of the theory, and of course XVicious’ stuff also comes to mind. It’s all in the 3d modelling part of the forum. I’ve never done any such things (my few attempts at 3d modelling for 3d printing were not successful) so I won’t say anything about it. I struggle to imagine an effort-reward scenario where it is worth it, but if you have something truly spectacular that you want to do justice to, as I said, go for it.

    But let’s say you just want to draw on the existing models in the dats, but maybe convert the module to stand alone (with its own dats) later – well, you have to include anything you are drawing on in your own module, so that means your own data/art/clip folders. Really, you can put them anywhere as long as you always draw on them from the same place. So, you could have a single clip folder in art (or probably not even in art, since you can browse for it, but data/art/clip is clearly the place it is meant to be) and just have all the models you want to draw on there, or divide by map as the game currently does. I originally started adding those clipping files to KotB for places like the Lizardman swamp (based on the Moathouse map of course) and the Hermit Northern Woods, which of course uses the TN vignette map in the middle (and I placed everything so that it all lined up – easier than it might sound). In fact, a main reason I used such maps, or the CG flet map in the Spider Woods, was so people could run behind pillars and tree trunks and such and actually get to enjoy some of the amazing 3d artwork that someone at Troika spent heaven knows how long to do. Keep in mind, also, that all this was initially done without WorldEd – the Demo, which had most of those maps, was made purely with ToEEWB.

    Anyway, the rest of the ToEE clipping folders in KotB – which look to be all of them – were added by Gaear, who really took map making to the next level (as we all saw with Verbobonc). Not just the quality of the art-work, but incorporating all this clipping to give that factory-finish level of excellence to our mod. Just take a look at the amount of detail he did on the Outer Bailey map:
    Blog 10.jpg
    I wouldn’t have done that! But when I am running around the Outer Bailey testing this or that, I always notice it. (I nuked the detail lvl on this to keep the img file small, btw).

    So, the nitty gritty – if you can stick your DAGs anywhere, how does the game know where to look? Well, when you add a DAG (when you go to navigate to the dat and click ‘select’ in WorldEd), and then when you later click save on the map, WorldEd updates the clipping files: that’s the clipping.cgf and clipping.cif files in the modules / ToEE / maps / YourMap folder (not data / art / clip). So our example of lvl 2 of Kresselack’s tomb in IWD, where I have placed pillars and kegs and yes, a box or two, has the following in clipping.cfg:
    Blog 11.png
    I don’t know what the gibberish toward the end of the file is, but I will say, those models referenced (beams and walls and such) are the models I rotated with that mysterious handle that did nothing for the pillar and box. Also, how clipping.cfg interacts with clipping.cif, I also don’t understand – its all gibberish to me. But at least you can see that you need to add a data / art / clip / map-3-inncellar folder to your mod, if you aren’t going to assume use of ToEE1.dat. Using the HexEditor you can of course change this to something else of the same length, if you so desire: data / art / clip / AR3502_ Kressel2 would do it, and stick your files in that folder.

    So there you go. There should be enough to have you incorporating simple beams, boxes, walls and such into your games, to make that painted background really look like a 3d environ for the PCs.
     
    Last edited: Jul 19, 2021
    Allyx and anatoliy like this.
  3. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    5,001
    Likes Received:
    250
    I've often thought about going through all the dag files in ToEE and copying the useful ones (doors, tables, barrels, chairs, door frames pillars etc.) into a separate folder to make them easier to find without having to resort to trial and error. Too many of those dag files are "1 file for an entire map" for my liking.
     
Our Host!