Jump to content

[Tutorial] Setting Up EVE Cube Maps (24MB .dds 4 Texture Maps)


Recommended Posts

Tutorial: Setting Up EVE Cube Maps

In this tutorial we will be looking at how to take advantage of EVE's Cube Map system to layer up to 4 textures onto a single cube map to reduce file size within mod distributions.

This method will be outlining the process of taking 4 Equirectangular Cloud Maps, converting them to a single image by putting them into the Red, Green, Blue and Alpha channels, converting it to a Cube Map and setting it up for use in-game with EVE.

***Please Note: All the images below are clickable thumbnails to 1080p images***

----

1. Source your Cloud Map (or whatever you want to use) images from wherever. Google Images, NASA, your own creations etc. and ensure that they are all sized correctly in an Equirectangular format; as what has always previously been used in EVE & KSP i.e. Width = 2 x Height. You can use up to 4 image maps at this stage. Below, I have shown a 8192px x 4096px cloud map that has a transparent background.

iPm3hpFl.png

2. Your images will need to be converted to Greyscale, flat images where the light portions will be the clouds and the dark portions of your image will be the transparent parts in game on your cloud layer i.e. the opacity of the pixel scales with brightness.

LRye64rl.png

Therefore, at this stage just edit your cloud map to have a black background with your cloud map layer over the top.

3. Do this for all 4 of your textures and save them as .bmp. For ease of use, I'd recommend naming them something simple like red.bmp, green.bmp, blue.bmp and alpha.bmp or 1.bmp, 2.bmp etc.

4. Open your Equirectangular to Cube Map conversion software, I recommend CubeTheSphere or Hugin (I will be using CubeTheSphere in this tutorial), and load in and convert your images to Cube Maps. In CubeTheSphere open your Equirectangular .bmp image and then select the individual cube face image size to be 2048px x 2048px under the Options toolbar. This will result in the output Cube Map to roughly equate to the same resolution as the 8k Equirectangular image.

oJVQAiAl.png

5. Extract all the faces of the Cube Map to give you your 6 individual images being the Front, Back, Left, Right, Top and Bottom sides of the map. Do this for all of your 4 cloud maps. This may take some time as your computer is rendering out the images for each face of the cube. Be patient.

F7fMAqal.png

6. Now you need to rename the faces to correlate with EVE's naming conventions. In EVE the following sides of the Cube are given as X Positive, X Negative, Y Positive, Y Negative, Z Positive and Z Negative. Seeing as we will finally be outputting the textures for KSP in .dds format, we will need to name the sides of the faces upside down as .dds flips the image vertically when saving.

For ease of use, use the following guide to help you rename the files:

  • Xp : Right
  • Xn : Left
  • Yp : Bottom
  • Yn : Top
  • Zp : Front
  • Zn : Back

So you should end up with something like the following list of files for each of your cloud maps:

  • redXp.bmp (Right Image)
  • redXn.bmp (Left Image)
  • redYp.bmp (Bottom Image)
  • redYn.bmp (Top Image)
  • redZp.bmp (Front Image)
  • redZn.bmp (Back Image)

rtdrWCyl.png

7. Once you have your cube maps for all your 4 cloud map textures, go back into Photoshop and load the first 3 X-Positive face images. i.e. redXp.bmp, greenXp.bmp & blueXp.bmp

8. Convert each of the images to Greyscale. Confirm to 'Discard' when asked.

dcAqLmll.png

9. Ensure that each of the images is flattened.

ig3CC9Ml.png

10. Navigate to the Channels panel and select the 'Merge Channels' button from the drop down menu.

J0F0chEl.png

11. The Merge Channels menu should pop up where you can select the RGB option from the drop down menu, select the 'RGB' option and 3 channels and click 'OK'.

LvYCMk6l.png

12. In the next menu select the appropriate image for each of the corresponding colour channels. Click 'OK' to merge the images into one image.

XkSvlPEl.png

13. As a result you will end up with something similar to what is shown below. By toggling the visibility of each of the colour channels you can see you individual textures appear on their separated colour channels.

dJ0XCVrl.png

14. To add the 4th cloud map, cube map face texture to the image, we will be putting it into the Alpha Channel. To do this, in the Channels panel click 'Create New Channel' to add another channel to the image. This will by default apply a solid black mask to this channel which will act as the alpha channel.

Vagw6I6l.png

15. Open up the 4th appropriate cube map face in Photoshop (in this examples case the alphaXp.bmp), convert it to Greyscale as before and select all the image and cut/copy it.

ArI3yK3l.png

16. In the Channels panel with the new Alpha channel selected as the Active Channel, paste the image into this channel. You should see it appear similarly to what is shown below when only the Alpha channel is toggled visible.

jFCOu01l.png

17. At this stage, toggle the RGB channels on and the Alpha channel off and save the resulting texture as a DXT5 .dds texture. I have shown my nVidia dds configs below during the saving process. When saving the .dds texture, make sure to name them '******Xp.dds' for ease of use later i.e. cloudsXp.dds

KSbkR8tl.png

18. Repeat steps 7 through 17 another 5 times for each side of the Cube Map and you should end up with 6 .dds textures with your 4 cloud maps appearing on the 4 separate channels named:

  • ********Xp.dds
  • ********Xn.dds
  • ********Yp.dds
  • ********Yn.dds
  • ********Zp.dds
  • ********Zn.dds

These are the final textures that will be used in-game. Copy them to your Textures directory inside your mod directory.

19. EVE requires a separate config to know how to handle cube maps. This file can be located anywhere in your mod directory but must be named 'textures.cfg. I always recommend the use of the EVE GUI to edit the configs as no syntax or parameter errors can be made but for this demonstration I will be listing the config structure below as I assume the knowledge and familiarity with EVE's GUI.

The Textures config can be found in the TextureConfig panel in the GUI. In this config, you will be required to list the following information:

Cube Map = True and paths to each of the cube map faces. i.e.

EVE_TEXTURE_CONFIG
{
	OBJECT
    {
        name = Mod/Textures/imageName
        isCubeMap = True
        texXn = Mod/Textures/imageNameXn
        texYn = Mod/Textures/imageNameYn
        texZn = Mod/Textures/imageNameZn
        texXp = Mod/Textures/imageNameXp
        texYp = Mod/Textures/imageNameYp
        texZp = Mod/Textures/imageNameZp
    }
}

SyUMDB3l.png

20. Once EVE knows to recognise the 6 images as a Cube Map, you can navigate to your Celestial Body's Cloud Manager in the CloudManager Panel in the GUI and add a cloud layer. You can name this layer whatever you wish and input your specific settings for altitude, speed etc.

21. Toggle the MainTex option and input the path to your texture; this will be as specified in the Texture Config section i.e. Mod/Textures/imageName

22. Change the RGBA setting by default to AlphaCubeMap. If done correctly up until this stage, the image path should be displaying as white text.

Ky4tQjYl.png

23. Scroll down the GUI and toggle the 'layer2D' option so that it renders the cloud texture as a graphic in ScaledSpace/PQS.

ql6C71xl.png

24. At this stage you can hit Save and Apply and EVE should now render, by default, the cloud map you specified to be in the Alpha channel of your Cube Map.

3eKfSUfl.png

If following my instructions above with regards to the alignment of the cube faces using CubeTheSphere it should be aligned correctly. If using other software or this is not the case, you may need to play around with the sides of which your textures are appearing on the Cube Map.

25. To change the rendering of the cloud map to that of the Red, Green or Blue channels, cycle through the 'alphaMask' option to switch between your 4 cloud map textures.

lYoldW2l.png

vCJuzObl.png

5lKIb7Al.png

26. At this stage you should be finished and able to choose between 4 different cloud maps by using only 6 cube map textures. Hooray! From here you can go back into your cloud layers and edit the parameters of them to how you wish to configure your EVE Cloud Layer to appear.

----

For reference, if you were to use 4 separate 8k DXT5 .dds textures for the 4 cloud maps, the resultant total file size would be 170MB. By combining these 4 maps into a single 2k DXT5 .dds Cube Map the resultant total file size is only 24MB... more than a 700% saving!

Imgur Album of the above Tutorial Images for your reference:

A big thank you and shout out to @rbray89 for making all of this possible with EVE and the continous support that he has given when we badger him with questions. EVE Forum link:

I hope that you found this helpful and will be an aid in your endeavour to create better and more efficient visual packs for EVE. If you have any queries, feel free to ask by pinging me with an @Poodmund tag in this thread.

Link to comment
Share on other sites

I was ignoring the real use of the alpha chanel here, so many thanks!. With my cubes, in well compressed .png there is not so much difference in memory terms, but still this is a much much better system. Now I have room for an extra HD cloud layer, using a little less memory than before.

Simply perfect: huge thanks to @rbray89 for this system and to @Poodmund for this excellent tutorial.

Updating to this right now!

Link to comment
Share on other sites

Let it be known also that you do not have to utilise all 3 or 4 channels, you could merge just 2 images into a 3 channel RGB image and leave one of the channels blank... but that kind of defeats the purpose/gain of this technique. I am glad you guys can follow the process because I can't wait to see what you can pull off with it. :D

Edited by Poodmund
Link to comment
Share on other sites

Also, there is another cube-map system to be introduced soon as well if you'd rather use that. 2 Textures for a single planet. One texture for the + and one for the - of XYZ stored in the RGB channels. MUCH less complicated in my opinion. The bigger benefit here is that with 2 textures I can reduce the number of samplers in the shader so it will help performance out a decent bit.

Cloud particles will also just use a single texture going forward (xyz == RGB).

Link to comment
Share on other sites

@rbray89 KSP/EVE uses the mipmaps here? I mean: worth it to generate the mipmaps to lighten the memory usage? (I've seen the option in the EVE gui too, generates EVE the mipmaps for the dds if it is not present in the texture?)

Link to comment
Share on other sites

5 minutes ago, Proot said:

@rbray89 KSP/EVE uses the mipmaps here? I mean: worth it to generate the mipmaps to lighten the memory usage? (I've seen the option in the EVE gui too, generates EVE the mipmaps for the dds if it is not present in the texture?)

Yes, the mipmaps are used in all instances.

Link to comment
Share on other sites

13 minutes ago, rbray89 said:

Cloud particles will also just use a single texture going forward (xyz == RGB).

Will this have a benefit performance wise with Volumetrics or will it still be invoking the same amount of samplers as 3 separate?

Link to comment
Share on other sites

33 minutes ago, Poodmund said:

Will this have a benefit performance wise with Volumetrics or will it still be invoking the same amount of samplers as 3 separate?

Unfortunately it still has to sample the texture 3 times, but I won't have to do other expensive operations to blend them, so it will be a tiny bit better.

Link to comment
Share on other sites

  • 2 months later...
  • 4 months later...
  • 5 months later...
  • 3 years later...
This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...