Clipping

Discussion in 'TemplePlus' started by DarkStorm, Sep 9, 2009.

Remove all ads!
  1. Ranth

    Ranth Established Member

    Joined:
    Jan 26, 2008
    Messages:
    829
    Likes Received:
    0
    Storm,

    Once you complete your engine, what exactly will we be able to do beyond what we can do now? I am a layman when it comes to engines so excuse my ignorance.
     
  2. DarkStorm

    DarkStorm Established Member

    Joined:
    Oct 2, 2003
    Messages:
    514
    Likes Received:
    3
    Well part of my motivation is improving my Direct3d and C# skills.

    The other part would be to implement the Pathfinder core rules instead of d&d ;-)

    And in addition: The goal would be several times better performance, no more CTD's and no hardcore slowdowns without any apparent reason.

    In principle I'm doing this for the fun though, and I think some of the harder parts are already done (getting the coordinate system down...).

    Cu,
    Storm

    ps: If the actual game mechanics don't get far, the project still could be used as a WYSIWYG World Editor for static objects, mobiles and other stuff.
     
  3. DarkStorm

    DarkStorm Established Member

    Joined:
    Oct 2, 2003
    Messages:
    514
    Likes Received:
    3
    Hey-Ho,

    I figured out the remaining unknowns in the DAG file format through some painful reverse engineering. They indeed define a bounding box for the clipping geometry. The Bounding Box is in screen coordinates (x,y instead of x,y,z).

    I hope the following illustration helps:
    [​IMG]

    The idea is this: The geometry is positioned in the world to match the background art. The bounding box needs a different center, since it's square (which is idiotic by the way, but lots of stuff in the original ToEE engine is). So an x and y offset are subtracted from geometry position and a z-offset is added. The resulting point is then transformed into screen space (x,y coordinates). This is the Bounding Box Center described above. After that you just draw a square centered on that point and you get the depth geometry bounding box.

    I didn't test this in the original game yet, but I checked if the theory adds up by actually drawing the bounding box for the depth art in my engine using the above theory and it works out. The bounding box tightly encloses the displayed geometry.

    I'll update the file format description above to match my discovery.
    This also concludes the DAG file format. There are no unknowns left.

    Cu,
    Storm
     
  4. Ranth

    Ranth Established Member

    Joined:
    Jan 26, 2008
    Messages:
    829
    Likes Received:
    0
    Bounding Box:
    "It's used by the game to determine whether the geometry is visible in relation to the camera position"

    This leads me to ask one big question. Since you seem to understand how the models work, can we rotate the camera? Or make it zoom-able?

    Trokia's next game would have had a rotatable camera. There was a link to a video of it here: http://www.co8.org/forum/showthread.php?p=66029#post66029 but it apparently is broken.

    It would be amazing if we could make ToEE 3d. Granted, all of the models would need to be re textured, and there would be 1,000 other problems, but it would be amazing.

    EDIT: It seems the link works on my 2nd try.
     
  5. DarkStorm

    DarkStorm Established Member

    Joined:
    Oct 2, 2003
    Messages:
    514
    Likes Received:
    3
    Rotation: In relation to the clipping geometry and models? Certainly.
    But you would have to throw away the background map and texturing all that stuff is *really really* a lot of work. Also the clipping geometry has holes in the back for some objects since they didn't bother to model the houses from behind ;-)

    Zooming: Not really an issue. I'll implement that in my engine I think. I can't make the original game zoom however. Too many issues ;-)
     
  6. DarkStorm

    DarkStorm Established Member

    Joined:
    Oct 2, 2003
    Messages:
    514
    Likes Received:
    3
    To keep this on topic:

    Is anyone reading this capable of creating (or at least modifying/using parts of the original) clipping geometry? I'd be willing to help you with an exporting plugin for blender (in case you want to modify the original clipping stuff) or a clipping geometry placement tool in case you want to place existing DAG's on your map.

    Please get in touch!

    Cu,
    Storm
     
  7. Ranth

    Ranth Established Member

    Joined:
    Jan 26, 2008
    Messages:
    829
    Likes Received:
    0
    I''m actually shocked they modeled anything in the game. I thought they just made it similiar to how we create maps. We have a background image and we can make certain areas (houses, barrels, chairs) unable to walk over.

    I don't really understand how modeled objects benefit ToEE.
     
  8. DarkStorm

    DarkStorm Established Member

    Joined:
    Oct 2, 2003
    Messages:
    514
    Likes Received:
    3
    The sector-overlay you use for blocking/non blocking is not accurate enough if you use 3d models for foliage and other scenery objects.

    And don't forget: They had the models anyway because they used them to render the background. So why not use them for clipping ingame? It would've been faster to just render the depth-information once and then use the pre-rendered depth information... But i guess they didn't think that far ;-)

    But to further explain why such geometry is required: The best examples are doors that are inside frames. The frame is part of the background map and thus would always be behind the door. That would look unnatural. If you render the 3d-model of the frame into the depth-buffer (without actually *displaying* the model), the door seems to be correctly covered by the frame. If you don't know anything about the Z-Buffer/Depth-Buffer i keep talking about, Wikipedia has an explanation.

    Cu,
    Storm
     
    Last edited: Sep 11, 2009
  9. Ranth

    Ranth Established Member

    Joined:
    Jan 26, 2008
    Messages:
    829
    Likes Received:
    0
    Ah ok. The door explanation made a lot of sense. Thanks.
     
  10. Shiningted

    Shiningted I want my goat back Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,655
    Likes Received:
    352
    Hey, thats the example I used in post 10, does no-one listen? :rant:

    Back on topic: this is certainly something I would like to use, but I know nowt of 3d geometry :sadblinky Also, I don't have any 3d software. Am I right in thinking Blender is free? (I heard that somewhere).

    On the upside, I dare say I can get all the original 3d efforts that underlie the new maps in ToEE, so thats something :)
     
  11. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    Blender is free & opensource. I've tried mucking about with it in the past, unfortunately I have 0 artistic talent :Being_a_s
    Courtesy link: www.blender.org
     
  12. DarkStorm

    DarkStorm Established Member

    Joined:
    Oct 2, 2003
    Messages:
    514
    Likes Received:
    3
    Hi,

    Well... To be honest I am completely incapable of 3d modelling... But as you say, the original ToEE has a lot of clipping art and the CIF files allow you to rotate/scale/position that freely. The only thing I possibly could do with blender would be to split the original clipping art into smaller files for better reuse.

    Cu,
    Storm
     
  13. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    I think he meant that we can use it to extend and re-render existing maps using those models.

    One obvious use is re-rendering Verbobonc in daylight - the current daytime Verbobonc map was created by photoshopping the night-time map from the NG vignette. It's not totally horrible, but you can't deny it looks odd. With the model + texturing, we'll be able to recreate the map, render it with lighting suitable for daytime, and maybe even extend it within the rendering software (rather than photoshopping it).
     
  14. BigLittleBoy

    BigLittleBoy Member

    Joined:
    May 20, 2008
    Messages:
    60
    Likes Received:
    0
    Hi everyone.

    If you need someone to create or modify meshes, you can count on me.
    My only problem is lack of expertise with blender. I have some minor experience, but usually i use 3ds max. Nevertheless i want to help and if i have to master blender in process, i will do it, no problem.

    @DarkStorm. You are making a kind of small revolution here, but i guess you know this anyway.
     
    Last edited: Sep 12, 2009
  15. DarkStorm

    DarkStorm Established Member

    Joined:
    Oct 2, 2003
    Messages:
    514
    Likes Received:
    3
    Well once you import the stuff into blender, you could use the blender export facilities to export to a 3ds compatible format i think.

    Cu,
    Storm
     
Our Host!