read

During March, 2014, I developed a HTML5 renderer for the CryEngine game engine based on the Awesomium page renderer capable of using shared GPU<->CPU texture buffers to show realtime views of web-pages on surfaces in the 3D engine. As the web pages are rendered to a texture, the game engine can easily project the view onto anything, including cloth simulations, lights projected onto 3D geometry, curved surfaces, and even water textures.

GitHub Source

Implementation

Every frame the renderer checks to see if Awesomium has a new frame to render. If so, it copies the image into the GPU memory texture space, and assigns the texture to the CryEngine material specified by the developer, replacing existing texture data. This allows for live updating of the texture every frame, and real-time views on anything renderable in the CryEngine.

FlowNode Interaction

Using flow nodes, a developer can create a HTML5 view like so:

FlowNodes are great for rapid prototyping of new game elements.

C++ Interaction

The system is also accessable through the C++ interface:

AwesomiumPlugin::IAwesomiumPlugin plugin = PluginManager::safeGetPluginConcreteInterface<IPluginAwesomium*>( "Awesomium" );
AwesomiumPlugin::CAwesomiumSystem sys = plugin->GetSystem();

//Make a view
AwesomiumPlugin::CAwesomiumView* view = sys->CreateView( width, height, "Entity Name", "Full Material Path" );

//Go to YouTube
view->GetView()->LoadURL( WebURL( WSLit( "http://youtube.com/" ) ) );

//Refresh
view->GetView()->Reload(false);

The result? Live YouTube videos on surfaces in the engine, complete with sound and all JavaScript interactions:

Blog Logo

Christian Stewart


Published

comments powered by Disqus
Image

Christian Stewart

Also known as Quantum and Paralin.

Back to Overview