Skip to content

Commit

Permalink
Add documentation about exporting SkyBoxes
Browse files Browse the repository at this point in the history
  • Loading branch information
sercero committed Apr 15, 2024
1 parent 56fe6c4 commit 2b53577
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- [Exporting Node Animations](#exporting-node-animations)
- [Exporting for Physics](#exporting-for-physics)
- [Exporting Vertex Colors](#exporting-vertex-colors)
- [Exporting SkyBoxes](#exporting-skyboxes)
- [Level of Detail (LOD)](#level-of-detail-lod)
- [Mesh Previewer](#mesh-previewer)
- [About](#about)
Expand Down Expand Up @@ -261,6 +262,13 @@ Check out the [Exporting for Physics](Physics.md) tutorial to see some technique
`blender2ogre` can import and export Vertex Colors, a way to assign colors to your mesh by vertex. It is also possible to asign alpha values to each vertex for transparency or other uses.
Check out the [Vertex Colors](VertexColors.md) tutorial to see how to create the Vertex Colors in Blender and how to export them.
### Exporting SkyBoxes
![skyboxes1.jpg](images/skyboxes/skyboxes1.jpg)
`blender2ogre` can generate SkyBoxes from HDRi Maps and export them in a format that can be used in OGRE, that is a Cube Map.
Check out the [SkyBoxes](SkyBoxes.md) tutorial to see how to create import the Environment Map in Blender and how to export it.
### Level of Detail (LOD)
Level of Detail or LOD is an optimization technique supported by OGRE, where meshes that are far away from the camera are replaced by meshes with lower vertex count.
Because you can get away with less detailed models when they are in the distance this optimizacion technique is very common, especially in games.
Expand Down
66 changes: 66 additions & 0 deletions SkyBoxes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@

# Exporting SkyBoxes

![skyboxes1.jpg](images/skyboxes/skyboxes1.jpg)

## Documentation:
- https://en.wikipedia.org/wiki/Skybox_(video_games)
- https://ogrecave.github.io/ogre/api/latest/class_ogre_1_1_scene_manager.html#a370c23fff9cc351b150632c707a46700
- https://docs.blender.org/manual/en/latest/render/lights/world.html

## Introduction
It is possible to export an HDRi map as a Cube Map that can be used in OGRE for SkyBoxes or environment maps.

## Setting the Environment Map in Blender
1) Go to `World Properties` Tab \
![skyboxes2.png](images/skyboxes/skyboxes2.png)

2) Then under "Surface", make sure that `Use Nodes` is checked. Surface should say "Background".

3) Then, where it says `Color` click on the white dot and a menu should appear to select the texture for the environment map. \
![skyboxes3.png](images/skyboxes/skyboxes3.png)

4) Open a Picture or select one from the Blender cache. \
![skyboxes4.png](images/skyboxes/skyboxes4.png)

5) Then select `File`->`Export`->`Ogre3D (.scene and .mesh)` \
![skyboxes5.png](images/skyboxes/skyboxes5.png)

6) In the `General` Settings, make sure to enable the option `Export SkyBox` and set the resolution to some power of 2 value (e.g.: 512, 1024, 2048, etc.). \
The higher the resolution the more time it will take for the exporting process. \
![skyboxes6.png](images/skyboxes/skyboxes6.png)

The exporter will create six images, one for each of the faces of the "SkyBox":
- front: "<texture_name>_fr.png"
- back: "<texture_name>_bk.png"
- right: "<texture_name>_rt.png"
- left: "<texture_name>_lf.png"
- top: "<texture_name>_up.png"
- bottom: "<texture_name>_dn.png"
\
![skyboxes7.png](images/skyboxes/skyboxes7.png)

And a material with the same name as the environment texture.

## Using the SkyBox in OGRE
To load the SkyBox in OGRE it can be done with the DotScene Plugin, where you can use the .scene exported by `blender2ogre`.
\
The exported scene has the following section:
```
...
<environment >
<colourBackground b="0.050876" g="0.050876" r="0.050876" />
<skyBox active="true" material="symmetrical_garden_02" />
</environment>
...
```

To use it in code you can do the following:
```
String material = "symmetrical_garden_02";
Real distance = 5000;
bool drawFirst = true;
bool active = true;
String groupName = "Scene";
mSceneMgr->setSkyBox(true, material, distance, drawFirst, rotation, groupName);
```
Binary file added images/skyboxes/skyboxes1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/skyboxes/skyboxes2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/skyboxes/skyboxes3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/skyboxes/skyboxes4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/skyboxes/skyboxes5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/skyboxes/skyboxes6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/skyboxes/skyboxes7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2b53577

Please sign in to comment.