Skip to content

A cross-platform GPU-accelerated CEF-based (Chromium Embedded Framework) WebView Extension for Godot 4

License

Notifications You must be signed in to change notification settings

dsh0416/godot-cef

Header

Godot CEF

A high-performance Chromium Embedded Framework (CEF) integration for Godot Engine 4.5+, written in Rust. Render web content directly inside your Godot games and applications with full support for modern web standards, JavaScript, HTML5, and CSS3.

GitHub Actions Workflow Status GitHub Actions Workflow Status GitHub Release Godot Asset Library GitHub Issues GitHub Pull Requests

Features

  • Web Rendering in Godot — Display any web content as a texture using the CefTexture node (extends TextureRect)
  • Accelerated Off-Screen Rendering — GPU-accelerated rendering using platform-native graphics APIs for maximum performance
  • Software Rendering Fallback — Automatic fallback to CPU-based rendering when accelerated rendering is unavailable
  • Dynamic Scaling — Automatic handling of DPI changes and window resizing
  • Multi-Process Architecture — Proper CEF subprocess handling for stability and consistency
  • Remote Debugging — Built-in Chrome DevTools support
  • Typed IPC (CBOR) — Send/receive typed primitives, arrays, and binary buffers (Variant / JS values) without manual JSON serialization
  • Listener-based JS Bridge — Multi-subscriber IPC listeners via addListener/removeListener/hasListener
  • No-Panic Runtime Policy — Panics in crate runtime code are treated as bugs and blocked by lint/CI policy

Screenshots

GitHub rendered in Godot Web content as 3D texture
GitHub page rendered with full interactivity Web content integrated into 3D scenes
WebGPU Samples WebGL Aquarium
WebGPU demos running natively WebGL Aquarium at ~120 FPS with 10,000 fish

Quick Start

Installation

Download the latest pre-built binaries from the Releases page, extract the addon to your Godot project's addons/ folder, and you're ready to go!

Note

During export/package builds, Godot may convert some imported assets into other formats. If your frontend is built with Vite and needs specific source files to remain as-is, you can use vite-plugin-godot-keep-import to keep imports for selected file types.

Basic Usage

extends Control

func _ready():
    var cef_texture = CefTexture.new()
    cef_texture.url = "https://example.com"
    cef_texture.enable_accelerated_osr = true  # Enable GPU acceleration
    add_child(cef_texture)

Example with Signals

extends Node2D

@onready var browser = $CefTexture

func _ready():
    # Set initial URL
    browser.url = "https://example.com"

    # Connect to signals
    browser.load_finished.connect(_on_page_loaded)
    browser.ipc_message.connect(_on_message_received)

func _on_page_loaded(url: String, status: int):
    print("Page loaded: ", url)

    # Execute JavaScript
    browser.eval("document.body.style.backgroundColor = '#f0f0f0'")

func _on_message_received(message: String):
    print("Received from web: ", message)

Documentation

For comprehensive API documentation, examples, and guides, visit the full documentation.

Resource Description
API Reference Complete CefTexture API documentation
Properties Node properties and configuration
Methods Browser control and JavaScript execution
Signals Events and notifications
IME Support International text input

Platform Support

Platform DirectX 12 Metal Vulkan Software Rendering
Windows ✅ (Note 1) n.a. ✅ (Note 2)
macOS n.a. [#4]
Linux n.a. n.a. ✅ (Note 2)
Platform Notes
  1. Windows DirectX 12: Requires at least Godot 4.6 beta 2. Godot 4.5.1 contains a bug where RenderingDevice.get_driver_resource on DirectX 12 textures always returns 0.

  2. Vulkan Backends: See #4 for details. On Windows and Linux, we use hooking to inject extensions for GPU-accelerated rendering (x86_64 only). This is a workaround until godotengine/godot-proposals#13969 is resolved.

  3. Software Rendering: On platforms where accelerated rendering is not yet implemented, the extension automatically falls back to software rendering using CPU-based frame buffers.

Limitations

Media Codec Support

The prebuilt CEF binaries do not include proprietary codecs (H.264, AAC, MP3) due to licensing restrictions in the Chromium/CEF stack. This is an upstream limitation that cannot be addressed within this project.

Codec Type Supported (Royalty-Free) Not Supported (Proprietary)
Video VP8, VP9, AV1, Theora H.264/AVC, H.265/HEVC
Audio Opus, Vorbis, FLAC, WAV, PCM MP3, AAC
Container WebM, Ogg, WAV MP4 (with H.264/AAC)
Using Royalty-Free Alternatives

For best compatibility, encode your media using these royalty-free formats:

Recommended for video: WebM container with VP9 or AV1 video and Opus audio

# Convert video to WebM (VP9 + Opus)
ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 30 -b:v 0 -c:a libopus -b:a 128k output.webm

# Convert video to WebM (AV1 + Opus) - better compression, slower encoding
ffmpeg -i input.mp4 -c:v libaom-av1 -crf 30 -c:a libopus -b:a 128k output.webm

Recommended for audio: Opus in WebM/Ogg container

# Convert audio to Opus
ffmpeg -i input.mp3 -c:a libopus -b:a 128k output.ogg

These formats offer comparable or better quality than proprietary alternatives and work out of the box.

Building CEF with Proprietary Codecs (Advanced)

If you require H.264/AAC/MP3 support, you must build CEF from source with proprietary codec flags enabled:

proprietary_codecs=true
ffmpeg_branding=Chrome

Important considerations:

  • Building CEF requires ~100GB disk space and several hours
  • H.264 licensing may apply depending on distribution scale
  • FFmpeg licensing terms (LGPL/GPL) must be followed
  • You assume responsibility for codec licensing compliance

See the CEF build documentation for detailed instructions.

Building from Source

For detailed build instructions, see CONTRIBUTING.md.

Quick Build Steps

  1. Install prerequisites: Rust (nightly) and Godot 4.5+

  2. Install CEF binaries:

    cargo install export-cef-dir
    export-cef-dir --version "145.0.26" --force $HOME/.local/share/cef
    export CEF_PATH="$HOME/.local/share/cef"
  3. Build:

    cargo xtask bundle --release
  4. Copy to Godot project: Copy built artifacts from target/release/ to your project's addons/godot_cef/bin/<platform>/ folder.

See the addons/godot_cef/godot_cef.gdextension file for the complete list of required files per platform.

Validate Packaged Addon

You can validate bundled addon artifacts with:

cargo xtask validate --addon addons/godot_cef

No-Panic Policy

This project treats panics in crate runtime code as bugs. We do not use panic-based control flow.

  • Workspace lint policy denies panic!, unwrap(), expect(), todo!(), and unimplemented!().
  • cargo clippy --workspace --all-targets -- -D warnings is used as a CI gate.
  • Release builds use panic = "abort" to prevent unwind-based panic behavior in production artifacts.

If you find a runtime panic path, please open an issue or submit a fix.

Comparison with Similar Projects

Feature Godot CEF (this project) godot_wry gdcef
Browser Engine Chromium (CEF) Native OS webview (WRY) Chromium (CEF)
Implementation Rust Rust C++
Rendering Texture (OSR) Window overlay Texture (OSR)
GPU Acceleration ✅ Yes ✅ Yes ❌ Software only
3D Scene Support ✅ Yes ❌ No (always on top) ✅ Yes
HiDPI Aware ✅ Yes ✅ Yes ❌ No
Consistent Cross-Platform ✅ Same engine everywhere ❌ Different engines ✅ Same engine everywhere
JS ↔ GDScript IPC ✅ Yes ✅ Yes ✅ Yes
Godot Filesystem Access ✅ Yes (res://) ✅ Yes ❌ No
Project Export ✅ Yes ✅ Yes ❌ No
Headless CI Support ✅ Yes ❌ No ✅ Yes
Bundle Size Large (~100MB+) Small (uses OS webview) Large (~100MB+)
When to Use Each

Choose Godot CEF (this project) if you need:

  • GPU-accelerated web rendering for high performance
  • Smooth and high performance interactive UI
  • Web content as a texture in 3D scenes (e.g., in-game screens, VR/AR interfaces)
  • Consistent behavior across all platforms (same Chromium engine everywhere)
  • Modern Rust codebase with godot-rust

Choose godot_wry if you need:

  • Minimal bundle size (uses the OS's built-in webview)
  • Simple overlay UI that doesn't need to be part of the 3D scene
  • Lightweight integration without bundling a full browser

Choose gdcef if you need:

  • C++ codebase for a more mature CEF integration with more docs
  • Proven, mature implementation with longer history

Motivation

This project was created during development of Engram. While our first demo version benefited greatly from an interactive UI written in Vue.js using godot_wry, we encountered limitations with the wry-based approach. Since other implementations have long struggled with GPU-accelerated OSR, we decided to create our own solution.

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines on:

  • Setting up your development environment
  • Code style and testing requirements
  • Pull request process
  • Reporting issues

License

MIT License — Copyright 2025-2026 Delton Ding

See LICENSE for details.

Related Repositories

  • custom-unit-pxp: A set of packages for the custom pxp unit (px + var) that can be useful for game UI workflows.

Acknowledgments

Star History

Star History Chart

About

A cross-platform GPU-accelerated CEF-based (Chromium Embedded Framework) WebView Extension for Godot 4

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors