You must be logged in to post messages.
Please login or register

Modding and Scripting
Moderated by Yeebaagooon, TAG

Hop to:    
Welcome! You are not logged in. Please Login or Register.4 replies
Age of Mythology Heaven » Forums » Modding and Scripting » Guide: How to create your own skybox
Bottom
Topic Subject:Guide: How to create your own skybox
Yeebaagooon
EXCO Emeritus
posted 27 April 2019 08:06 PM EDT (US)         


Welcome, mortals! Like me you have probably been staring up at the heavens at some point in a secluded area away from light pollution, pondering the mysteries of existence when a single brilliant thought enters your mind - this sky would look great in AoM!

Today I take a tentative step into the realm of modding to bring you this guide. Long the realm of the intellectuals, mortals have tried to compile complex code only to have it return an unfathomable error as the ghosts of the modding gods of old laugh at their syntax error. Dare I say that this guide is fairly straight forward?

So to make a sky you'll need a few tools to help you.

Requirements:
1) - Sky pack by Stephen Caines. Currently this is the only extension sky pack I know of, from the legend himself. We'll be using some of his files as bases to copy/paste our own skies over to. It's also a very neat sky pack. We could create our own skies by extracting the AoM files but this is simpler.
2) - AOMEd by the omnipotent Ykkrosh. Duh. This is a modding guide.
3) - A hex editor. I recommend HxD, it's free and looks nice. Notepad++ is also an option here.
4) - An image editor that can save 24-bit .bmp files. Paint is good.




What makes a sky?
So we need to understand a few basic things before we set about creating our own skies. First of all, to make a new sky you will need three elements:
  • An edit to the skies.xml file in the data folder to include your new sky.
  • A .brg model so your sky can render.
  • Textures for your sky.

    I created a few images as a test to see how AoM puts skies together. It's messy.

    So what's this? I know that AoM uses eight texture files to compose a sky as evident by the eight .ddt texture files that you will have downloaded for each skybox. I set about creating very basic .ddt texture files to see how they fit together. Each file is 256x256 in size.
    The first reaslisation is that AoM will flip your images horizontally and vertically, so your image will be back to front and upside down! This means if you wanted a cityscape sky and compiled it without remembering the above, your buildings would point down which is fairly useless. You must remember to flip your images if your sky will have any orientation - simply rotating will make it a mirror image.

    After I had got my head round this, I found out how AoM puts a skybox together. This is a really important point so gets its own big image!


    IMPORTANT REFERENCE IMAGE

    Behold.


    This image is your reference, it is how a skybox is put together. We can see that a total skybox has an area of 1024x512 before it repeats. The letters in each box represent the filename that corresponds to that section of the skybox.
    So for example, if we make a large skybox picture the file that will be in the top left corner will be named skyboxtester_RT.


    Let's make a basic sky:
    I mean really basic. This part of the guide will walk through how to actually make a sky.
    We won't be making anything fancy - far from it. This sky will just feature one 256x256 image that repeats.

    Step 1: Choose your image and save it as a 256x256 24-bit .bmp file. Let's use my avatar. REMEMBER TO FLIP THE IMAGE HORIZONTALLY AND VERTICALLY.

    Step 2: Name your sky and create the filename. Let's call this one SkyYeebaa.

    Step 3: Name all your files as per the reference image. You can right click and save as on the image to your right, it is in 24-bit .bmp format and the correct size.
    You should have eight copies of the same bitmap file named as follows:
    -SkyboxYeebaa_RT
    -SkyboxYeebaa_RF
    -SkyboxYeebaa_LF
    -SkyboxYeebaa_BK
    -SkyboxYeebaa_RT2
    -SkyboxYeebaa_RF2
    -SkyboxYeebaa_LF2
    -SkyboxYeebaa_BK2

    Step 4: We must now convert our files to .ddt format so AoM can read them. Open up AoMED and choose direct file conversion. Convert each of your .bmp files to .ddt files selecting the Paletted (16 bit), no alpha [2] option.

    Step 5: Place all of our .ddt files in the textures folder.
    C:\Program Files (x86)\Microsoft Games\Age of Mythology\Textures

    Step 6: We need to let AoM know that a new sky has arrived. Go into the data folder and open skies.xml
    C:\Program Files (x86)\Microsoft Games\Age of Mythology\data
    It details all your skies in an obvious way and can be edited with notepad. Add the line: <sky>SkyYeebaa</sky>
    Save the new file.

    Step 7: Convert skies.xml with AoMED to skies.xmb so the game can read it.

    Step 8: We now need to create a model file which will load up our sky. Models have the extension .brg.
    Open the models folder.
    C:\Program Files (x86)\Microsoft Games\Age of Mythology\Models
    Load up one of Stephen's sky files in your hex editor. Let's open SkyCloud1.brg.

    Scroll most of the way to the bottom, and you'll find this line.

    This is where the model file loads your textures. However care is needed as we are at the part most likely to go wrong.
    The file size of the .brg file cannot change otherwise your sky will not render. This means that we must keep the character limit and thus the file size exactly the same.
    Find the search menu on HxD and then open up 'Replace'.

    Input 'Cloud1' and replace all instances of it with 'Yeebaa', if the file replaces eight instances you know you've done it. Sometimes a warning will pop up if you are about to change the file size. Select NO and try again!
    Check the file thoroughly now to make sure the suffixes correspond to your saved files. You will see in the above image SKyBoxCloud1_FR does not match the reference image. Change FR to RF. Do the same for FR2.
    THE FILESIZE MUST NOT CHANGE.

    Hopefully now in the hex editor you will have SkyboxYeebaa_RT and eight other entries corresponding to our list above in step 3.

    Save the file as SkyYeebaa.brg.
    If you're having trouble with this step - case sensitive is important as well.

    Step 9:
    Open up AoM, use the render sky trigger and enter SkyYeebaa, test your scenario with a suitable camera track and it should look something like this:



    Let's make a better sky:
    Not possible, perfection has already been achieved.
    OK fine something a bit more technical.

    Let's go for a starry sky. Now I don't want there to be sharp image edges such as you saw above with SkyYeebaa, so this means our sky must be flipped.

    IMPORTANT REFERENCE IMAGE

    Behold. It's so important we need to see it again.


    Steps 1-3:
    If we're going to make a square image that tessellates, the largest the final image can be is 512x512 because we can't use three vertical boxes. So we have to use four 256x256 images to make a square of 512x512.
    We do this by finding a starry sky image (left), and crop it to 256x256. Orientation doesn't matter too much here. AoM will flip this image vertically and horizontally but we don't care because you won't notice must difference.

    Now let's save the image on the left as SkyboxStarry_RT.
    So this image becomes to topmost leftmost image in our skybox. Moving along to the right we next hit RF. In order to make this image tessellate we must flip RT horizontally, that way the right border of RT will merge with the left border of RF.

    Now we move down a row. The original RT image flipped in the vertical plane will become RT2.
    RT flipped horizontally and vertically will be RF2.

    We should now have four image files that form a perfect 512x512 square which is seamless and will repeat without rough edges when stacked next to each other.
    But a skybox requires eight boxes, so we simply copy over:
    RT is also LF
    RF is also BK
    RT2 is also LF2
    RF2 is also BK2

    That way we have made a skybox of the required eight images.

    Steps 4-9:
    As above. This should be easier now you've done it already.



    Let's make a picture sky:
    This would be challenging to start out with, if you came straight to this section I recommend you read and do the above two sections to become familiar with the process.
    As you've already made two skies this one should be a breeze!

    I want to use one of my photos of the aurora. This image will not tessellate, so I find the photo I want and crop is to 1024x512.
    Orientation matters here so I flip my photo in both the horizontal and vertical plains so that when AoM does this, the image is restored to normal orientation.
    Next I have to split my image up into eight 256x256 squares and name them. Let's overlay the IMPORTANT REFERENCE IMAGE. The keen eyed amongst you will see the top row is the '2' row - this is just because of the high camera angle I use in my map. If you could zoom out there would be the start of another picture underneath.


    Perfect.


    I then crop each section and name appropriately, as per above. I compile the skybox going through steps 4-9 above.



    What's the best sky?
    From a scenario perspective I don't really want to be hunting the perfect camera angle and building my eyecandy around that, I want the sky to slot in with my scenario.
    The tessellating sky is the best way to do this.

    You will see in the example of the starry sky above we only utilised 512x512 of the 1024x512 available to us.
    If we want to create the largest tessellating sky possible, the image we will need to flip must be 512x256.
    On to google image I go, and soon enough I find a sexy lightning image. I crop this down to 512x256 and flip it as below:


    Looks hawt.


    Working through steps 1-9 and in less than 10 minutes I have myself this beauty, SkyThundr:



    Have fun creating your own skies! Please direct questions to this thread and I look forward to seeing pictures of your creations! If you want to try and figure out how to get round the character limit, MythicRuler has done so, but I couldn't figure out how to apply his work to this guide sadly. Stephen's skyboxes do feature work of varying characters - so perhaps a better modder than I will be able to write an addendum on how to change the character limit.

    Post sky pictures!

    ______________________________________ Yeebaagooon ______________________________________
    ____________________ AoMH Seraph ____________________
    "I saw the picture and became immediately worried about Yeeb seducing and buying out Zen" - Shanks13
    "Yeebaagooon had never seen a more handsome man in all his life. He couldn't control himself, He needed to act. Gripping the mirror in his strong arms he kissed the figure before him..." - Out Reach
    AoMH: Unfinished Scenarios|Singleplayer: Codename Ripto 5.0|Multiplayer: Minigames X 4.7|CSC 7
    Ex Seraphs Dictator, Spore Heaven Seraph

    [This message has been edited by Yeebaagooon (edited 04-27-2019 @ 08:56 PM).]

  • AuthorReplies:
    Venlesh
    Mortal
    (id: The Elva_Rokk)
    posted 28 April 2019 09:59 AM EDT (US)     1 / 4       
    Oh hell yeah. LOME 5 has a ton of new skyboxes. I've been making these bad boys for years.




    Current Projects:
    Legends of Middle-Earth 5.0 Check out LoME's first video showcase!
    Legend of Zelda V1.1 Modpackpack Released! Have a nice day.
    Yeebaagooon
    EXCO Emeritus
    posted 28 April 2019 11:49 PM EDT (US)     2 / 4       
    Sweet! Did you figure out how to get round the character limit?

    ______________________________________ Yeebaagooon ______________________________________
    ____________________ AoMH Seraph ____________________
    "I saw the picture and became immediately worried about Yeeb seducing and buying out Zen" - Shanks13
    "Yeebaagooon had never seen a more handsome man in all his life. He couldn't control himself, He needed to act. Gripping the mirror in his strong arms he kissed the figure before him..." - Out Reach
    AoMH: Unfinished Scenarios|Singleplayer: Codename Ripto 5.0|Multiplayer: Minigames X 4.7|CSC 7
    Ex Seraphs Dictator, Spore Heaven Seraph
    MrEmjeR
    Mortal
    (id: EmjeR)
    posted 04 May 2019 11:27 AM EDT (US)     3 / 4       
    I love this guide! tenouttaten

    >> www.EmjeR.com <<

    Mods - EmjeR's eyecandy pack :: Improved Greeks look :: Ghengis Khan - Mods
    Programs - BCTool Attachpoint Editor :: BCTool :: Words - Programs
    Games - 0 AD :: Stronhold 2 :: BfME 2 - Games
    !! Proud member of WildFire Games !!
    nottud
    Mortal
    posted 05 May 2019 11:05 AM EDT (US)     4 / 4       
    I can't see Sky Boxes as they don't appear when I run the game in 4k. ;(
    You must be logged in to post messages.
    Please login or register

    Hop to:    

    Age of Mythology Heaven | HeavenGames