All Projects → acdemiralp → Fg

acdemiralp / Fg

Licence: mit
Rendering abstraction which describes a frame as a directed acyclic graph of render tasks and resources.

Programming Languages

cpp17
186 projects

Projects that are alternatives of or similar to Fg

Easy3d
A lightweight, easy-to-use, and efficient C++ library for processing and rendering 3D data
Stars: ✭ 383 (-1.79%)
Mutual labels:  graph, rendering
UniRate
Unity plugin to easily manage the application frame rate and rendering interval. Preventing battery power consumption and device heat, especially on mobile platforms.
Stars: ✭ 26 (-93.33%)
Mutual labels:  rendering, frame
Sourcecred
a social algorithm for computing cred
Stars: ✭ 345 (-11.54%)
Mutual labels:  graph
Touchdesigner shared
TouchDesigner toxes and small projects
Stars: ✭ 385 (-1.28%)
Mutual labels:  rendering
Tinyraytracer
A brief computer graphics / rendering course
Stars: ✭ 3,971 (+918.21%)
Mutual labels:  rendering
Communities
Library of community detection algorithms and visualization tools
Stars: ✭ 348 (-10.77%)
Mutual labels:  graph
Androidplot
Charts and plots for Android
Stars: ✭ 381 (-2.31%)
Mutual labels:  graph
Scala typeclassopedia
Abstractions and constructions from math (Category theory, Abstract algebra) implementations in Scala, minimal description, links to good explanations, links to implementations in other FP languages: Haskell, Idris, Purescript, non FP too: Java, C++ and to formalizations in proof assistants: Coq (UniMath, HoTT book), Cubical Agda.
Stars: ✭ 338 (-13.33%)
Mutual labels:  abstraction
Tev
High dynamic range (HDR) image comparison tool for graphics people. With an emphasis on OpenEXR images.
Stars: ✭ 384 (-1.54%)
Mutual labels:  rendering
Graphology
A robust & multipurpose Graph object for JavaScript & TypeScript.
Stars: ✭ 377 (-3.33%)
Mutual labels:  graph
React Slate
Write interactive CLI apps with React
Stars: ✭ 385 (-1.28%)
Mutual labels:  rendering
Ncine
A cross-platform 2D game engine
Stars: ✭ 372 (-4.62%)
Mutual labels:  rendering
React Mindmap
React component for MindNode maps
Stars: ✭ 357 (-8.46%)
Mutual labels:  rendering
Awesome Knowledge Graph
A curated list of Knowledge Graph related learning materials, databases, tools and other resources
Stars: ✭ 382 (-2.05%)
Mutual labels:  graph
Rdf
RDF.rb is a pure-Ruby library for working with Resource Description Framework (RDF) data.
Stars: ✭ 353 (-9.49%)
Mutual labels:  graph
Java Algorithms Implementation
Algorithms and Data Structures implemented in Java
Stars: ✭ 3,927 (+906.92%)
Mutual labels:  graph
Graphosaurus
3D graph viewer powered by WebGL (three.js)
Stars: ✭ 340 (-12.82%)
Mutual labels:  graph
Algorithms
Minimal examples of data structures and algorithms in Python
Stars: ✭ 20,123 (+5059.74%)
Mutual labels:  graph
Samples
Sample projects using Material, Graph, and Algorithm.
Stars: ✭ 386 (-1.03%)
Mutual labels:  graph
Vizceral
WebGL visualization for displaying animated traffic graphs
Stars: ✭ 3,871 (+892.56%)
Mutual labels:  graph

What is a framegraph?

A rendering abstraction which describes a frame as a directed acyclic graph of render tasks and resources. Based on the Game Developers Conference (GDC) presentation by Yuriy O’Donnell.

What is a render task?

A compute or graphics task to be performed as part of a rendering pipeline.

What is a resource?

Data created, read or written by a render task. Alternates between two states; virtual and real. While virtual, the resource is not instantiated but contains the necessary information to do so. While real, the resource is instantiated and ready for use. A transient resource is owned, realized and virtualized by the framegraph. A retained resource is always real and is imported into the framegraph.

Usage

First, create descriptions for your rendering resources (e.g. buffers, textures) and declare them as framegraph resources.

struct buffer_description
{
  std::size_t size;
};
struct texture_description
{
  std::size_t                levels;
  GLenum                     format;
  std::array<std::size_t, 3> size  ;
};

using buffer_resource     = fg::resource<buffer_description , gl::buffer    >;
using texture_1d_resource = fg::resource<texture_description, gl::texture_1d>;
using texture_2d_resource = fg::resource<texture_description, gl::texture_2d>;
using texture_3d_resource = fg::resource<texture_description, gl::texture_3d>;

Then, specialize fg::realize<description_type, actual_type> for each declared resource. This function takes in a resource description and returns an actual resource.

namespace fg
{
template<>
std::unique_ptr<gl::buffer>     realize(const buffer_description&  description)
{
  auto actual = std::make_unique<gl::buffer>(); 
  actual->set_size(static_cast<GLsizeiptr>(description.size));
  return actual;
}
template<>
std::unique_ptr<gl::texture_2d> realize(const texture_description& description)
{
  auto actual = std::make_unique<gl::texture_2d>();
  actual->set_storage(
    description.levels , 
    description.format , 
    description.size[0], 
    description.size[1]);
  return actual;
}
}

You are now ready to create a framegraph and add your render tasks / retained resources to it.

fg::framegraph framegraph;

gl::texture_2d backbuffer;
auto retained_resource = framegraph.add_retained_resource(
  "Backbuffer", 
  texture_description(), 
  &backbuffer);

struct render_task_data
{
  texture_2d_resource* input1;
  texture_2d_resource* input2;
  texture_2d_resource* input3;
  texture_2d_resource* output;
};
auto render_task = framegraph.add_render_task<render_task_data>(
  "Render Task",
  [&] (render_task_data& data, fg::render_task_builder& builder)
  {
    data.input1 = builder.create<texture_2d_resource>("Texture 1", texture_description());
    data.input2 = builder.create<texture_2d_resource>("Texture 2", texture_description());
    data.input3 = builder.create<texture_2d_resource>("Texture 3", texture_description());
    data.output = builder.write <texture_2d_resource>(retained_resource);
  },
  [=] (const render_task_data& data)
  {
    auto actual1 = data.input1->actual();
    auto actual2 = data.input2->actual();
    auto actual3 = data.input3->actual();
    auto actual4 = data.output->actual();
    // Perform actual rendering. You may load resources from CPU by capturing them.
  });

auto& data = render_task->data();

Once all render tasks and resources are added, call framegraph.compile(). Then, framegraph.execute() in each update. It is also possible to export to GraphViz for debugging / visualization via framegraph.export_graphviz(filename):

alt text

alt text

Next Steps

  • Asynchronous render tasks (+ resource / aliasing barriers).
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].