Skip to content

DanTrz/Godot-PlanarReflector-CPP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

icons_reflection Godot C++ Planar Reflection System

Godot Engine License: MIT Version

A high-performance planar reflection system for Godot 4.4+ designed specifically for 3D pixel art games, but can be used in any game.

Reflection Demo

✨ Features

🎯 Core Functionality

  • Real-time planar reflections with geometric accuracy
  • Very performant written in C++ via GDExtensions
  • Pixel art optimized - Works perfectly with SubViewport downscaling
  • Dual rendering system - Separate game and editor modes
  • Layer-based filtering - Control what objects appear in reflections
  • Custom environments - Independent lighting for reflected scenes
  • **Version 1.0.1 brings Compositor Effect to hide/mask objects intersecting with PlanarReflector (like underwater objects).
  • **C++ version Binaries available for MacOS, Windows and Linux. (GDScript version also included, but required adding Script to a MeshInstance3D manually)

🎮 Reflection & Performance Features

  • Camera mode detection - Automatic perspective/orthographic handling
  • Reflection offset system - Fine-tune reflection positioning
  • LOD (Level of Detail) - Distance-based performance optimization
  • Update frequency control - Balance quality vs performance
  • Movement threshold detection - Only update when camera moves
  • Configurable reflection layers - You can define what Visibility Layers get reflection
  • Cached calculations - Minimize redundant computations

🚀 Installation

Method 1: Manual Installation

  1. Download the latest release code from Github
  2. Just copy the entire addons/ folder to your Godot res:// folder.
  3. If you already have a addons/ folder, all you need is to paste the PlanarReflectorCpp/ folder in there
  4. Enable the plugin in the Godot settings -> You might need to reload your project
  5. You can download/Clone the entire Git Repo that comes with a DemoScene to see the base configuration applied

Method 2: AssetLib (WiP - coming soon)

🎮 General usage:

  1. Add the PlanarReflectorCpp node to your scene
  2. Add a PlanarMesh to it
  3. Add the provided BaseMaterial and BaseShader to it (see: addons/PlanarReflectorCpp/SupportFiles/)
  4. Make sure your objects are set the the Visibility Layer that matches the "Reflection layer" in the PlanarReflector
  5. Add custom enviroment (ideally without BG or BG COlor) and configure the PlanarReflector exported properties.
  6. Check that your lights are also in the correct layer and that your Main Camera is assigned (and the Camera CullMasks match the layers)
  7. Run your game
  8. To see reflections working in the editor, make sure you enable the plugin and "click" in the 3D scene, selecting the planar node in the scene (will refresh it)

🔧 Technical Constraints

  • Planar surfaces only - Works best with flat surfaces
  • **Hide objects intersecting with Planar Reflector is EXPERIMENTAL (Alpha stage) working with Compositor Effects. This means you can now hide underwater objects, for example. When available, I will update to the new solution explained here:#1
  • Requires Plugin enabled for editor - To see reflections in the Editor the plugin must be active

Full CPP Code here: https://github.com/DanTrz/PlanarReflector-GDExtension-FullCPPProject

About

Godot-PlanarReflector-CPP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors