Portal rendering / culling module for Godot
Go to file
2019-10-19 17:01:22 +01:00
images Add files via upload 2019-09-23 11:27:57 +01:00
config.py Add files via upload 2019-09-11 08:09:36 +01:00
INSTRUCTIONS.md Update INSTRUCTIONS.md 2019-09-23 14:51:55 +01:00
lbitfield_dynamic.cpp Dynamic objects now working 2019-09-13 19:15:25 +01:00
lbitfield_dynamic.h Dynamic objects now working 2019-09-13 19:15:25 +01:00
lbound.cpp More debugging support 2019-09-18 11:04:02 +01:00
lbound.h More debugging support 2019-09-18 11:04:02 +01:00
ldebug.cpp Preliminary lighting support 2019-10-09 11:33:19 +01:00
ldebug.h Preliminary lighting support 2019-10-09 11:33:19 +01:00
ldob.cpp Preliminary lighting support 2019-10-09 11:33:19 +01:00
ldob.h Preliminary lighting support 2019-10-09 11:33:19 +01:00
LICENSE Initial commit 2019-09-11 08:04:27 +01:00
lplanes_pool.cpp Improved pool 2019-09-25 07:48:35 +01:00
lplanes_pool.h Improved pool 2019-09-25 07:48:35 +01:00
lportal_all.cpp More debugging support 2019-09-18 11:04:02 +01:00
lportal.cpp Preliminary lighting support 2019-10-09 11:33:19 +01:00
lportal.h Preliminary lighting support 2019-10-09 11:33:19 +01:00
LPortalTutorial.zip Add files via upload 2019-09-18 12:27:01 +01:00
lroom_converter.cpp Preliminary lighting support 2019-10-09 11:33:19 +01:00
lroom_converter.h Preliminary lighting support 2019-10-09 11:33:19 +01:00
lroom_manager.cpp Preliminary lighting support 2019-10-09 11:33:19 +01:00
lroom_manager.h Preliminary lighting support 2019-10-09 11:33:19 +01:00
lroom.cpp Preliminary lighting support 2019-10-09 11:33:19 +01:00
lroom.h Preliminary lighting support 2019-10-09 11:33:19 +01:00
lvector.h DOB visibility culling added 2019-09-16 14:23:10 +01:00
README.md Update README.md 2019-10-19 17:01:22 +01:00
register_types.cpp Refactor LRooms and LPortals to no longer be part of scene graph 2019-09-15 15:39:01 +01:00
register_types.h Add files via upload 2019-09-11 08:09:36 +01:00
SCsub Optional convex hull bound for rooms 2019-09-17 14:30:31 +01:00
TUTORIAL.md Update TUTORIAL.md 2019-09-18 13:28:31 +01:00

godot-lportal

Portal rendering module for Godot 3.2
Work in progress

plane_lines

Although not yet released, I am trying to make sure that committed versions are runnable (especially stable branch), so if you want to test out the system, simply follow the installation instructions. Note that the function definitions are still subject to change, but any rooms you build should be compatible with later versions.

Video of initial testing:
https://www.youtube.com/watch?v=xF_3Fe2HRdk
https://www.youtube.com/watch?v=NmlWkkhGoJA

Feel free to leave suggestions / feature requests on the issue tracker, especially regarding ease of use.

Current status

I am currently working on the lightmapping workflow. While this isn't strictly speaking a core part of LPortal, many users will want to use baked lighting with the system because it will offer the best performance, particularly on mobile.

The current Godot standard workflow for lightmapping needs a bit of work, and I wanted to improve it for LPortal. The Godot standard workflow is based around creating a lightmap per object, and the uv mapping (via xatlas) can produce dodgy results sometimes. Instead I've tried to create a more streamlined and optimal lightmapping workflow for use with LPortal.

For rendering efficiency on older hardware I decided to have several (or all) objects share the same lightmap. I have at long last managed to get this working. The system currently merges together all the static objects in each room to form one mesh. The user will have two options:

  1. UV map the merged mesh within Godot using the inbuilt xatlas system, and lightmap using Godot's BakedLightmap node. This should be a fast workflow, suitable for low budget games / testing.
  2. For higher production quality, LPortal can export the merged mesh as an .obj file, where it can be loaded into blender or your modelling package of choice, uv unwrapped, and lightmapped.

This allows far more extensive and accurate lighting, and ambient occlusion etc than would be possible within Godot. The uv mapped mesh can be re-exported from blender as an .obj ready for reloading by LPortal.

In both workflows, LPortal will disassemble the lightmapped UV mapped mesh back to the original geometry and objects with their original materials. This was not easy to get working! :)

Roadmap

  • Auto conversion of named room spatials and portal mesh instances to LRoom and LPortal DONE
  • Auto creation of mirror portals DONE
  • Recursive determine visibility DONE
  • Prevent memory allocations (use pools for plane vectors) DONE
  • Add support for objects moving between rooms - cameras, players, physics etc - DONE
  • Refactor code, moving LRooms and LPortals outside scene graph DONE
  • Cleanup code, Optimize DONE
  • Handle special cases (multiple portals views into room etc) DONE
  • Optimize non-moving statics DONE
  • Optional convex hull bound for rooms DONE
  • Add debug graphical view of portal planes DONE
  • Add debug graphical view of room bounds DONE
  • Dealing with shadows from objects outside of view PARTIALLY DONE
  • Building baked lightmap workflow ONGOING
  • Bug fixing / testing ONGOING
  • Shadow caster optimization
  • Closable portals
  • PVS (primary and secondary)

Instructions

See INSTRUCTIONS.md and TUTORIAL.md

Installation

You will need to compile Godot from source (for now). See: http://docs.godotengine.org/en/3.0/development/compiling/index.html

Once the engine is compiling okay on your system, to add the module:

  • Create a folder inside godot/modules called 'lportal'
  • Clone / download this repository as a zip file and place the files in the lportal folder
  • Compile the engine as normal, it should automatically pick up the lportal module
  • Note that to export to other platforms you will also have to compile export templates for those platforms

You will know the installation was successful when you see a new Node type 'LRoomManager' in the Godot IDE.