-
-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UPBGE: Implement infinite planar maps and refactor cube maps.
Infinite planar reflection and refraction is a technique inspired from the martinsh's works. This technique consists to render the scene with the same projection matrix as the scene camera but with a position and an orientation different allowing to render the part wanted for the reflection or the refraction. To accept the planar map, the system rendering the cube maps needed to be refactored. Indeed the system was too detailed and no general to the cube maps and the planar map. This new system work with a base class, the texture renderer. This texture renderer contains some faces to render, these faces are containing a frame buffer attached to the texture using the planar or cube map. Upon the texture renderer, two specialization exists, the cube map KX_CubeMap and KX_PlanarMap, theirs goal is to defines the faces and to modify the camera used for the render. Two categories of texture renderer can be defined, the viewport independents and the viewport dependents. Cube maps are viewport independents because they use their own camera projection, position and rotation, but it is no the case for planar maps. The planar map need to access the setting to create the projection matrix as the current camera rendering the scene, also they need the camera position and orientation. These two categories are stored into KX_TextureRendererMananegr (as KX_CubeMapManager previously) under the list m_renderers[2] accessed with the index VIEWPORT_DEPENDENT and VIEWPORT_INDEPENDENT. Finally two call to render the texture renderers is made in the frame render, one before render all the scenes for the independents and other per scene for the dependents. One of the goal of the specialization of cube maps and planar maps was to define the proper setting for the camera doing the render. To do so, two virtual function were defined: SetupCamera and SetupCameraFace. The first function define the settings shared between all the faces to render (e.g for cube maps the camera position). The second function define the setting unique per faces. After setup the camera settings shared per face, the projection matrix is computed or/and get thanks to the fnction GetProjection, this function take arguments for the viewport dependent renderer as the current scene camera the viewport and area dimension. The attributes shared between the KX_CubeMap and the KX_PlanarMap are exposed into the base python proxy KX_TextureRenderer, only KX_PlanarMap use an extra attribute called "normal" for the mirror normal. In the UI some changes were made. To define a planar map the user have to set the mapping to "Plane" instead of "Cube" in an environment map under "Realtime". As the planar map have to be rendered differently to make refraction a menu is exposed to choose reflection or refraction. In GLSL, only a function to read the planar map texture according to the viewport is added, it is named mtex_image_refl.
- Loading branch information
1 parent
935feda
commit acdbcc2
Showing
37 changed files
with
1,626 additions
and
877 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.