ROB TOM ROE
  • Home
  • Blog
  • Projects
  • Virtex Edge
  • Contact
September 24, 2016 by rtroe

Vertices Engine Optimizations – Encapsulating Post Processors

Vertices Engine Optimizations – Encapsulating Post Processors
September 24, 2016 by rtroe
제목 없음
Crepuscular Rays, Depth of Field and Bloom Post Processors

Currently most of the Post Processors are handled loosely and internally by the vxRenderer class. This is great for keeping everything in one place, but it causes a lot of redundant information to be sent to the GPU each call. A perfect illustration of this is in this excerpt from the Edge Detection Post Processor code:

[gist https://gist.github.com/ea6b627f4d69ffb197fe2c2222717419/]

As you can see above, there’s a number of redundant calls to items which wouldn’t had changed from the last loop. A more efficient way would be to add these into get/set Properties and to manage the effects from within their own class.

[gist https://gist.github.com/fae303a3582dde7cfa09616d7b055f19/]

I could’ve put each of these get/set Properties within the vxRenderer class, but then that would only add lines of code to an already very full *.cs file and makes debugging any post processor issues even more complicated.

I decided a cleaner and better way to implement this would be to encapsulate each post processor into it’s own class which inherited from a base Post Processor class and Interface.

[gist https://gist.github.com/b1b94d7aef2131eae422454d8f2cd1eb/]

As you can see above from the interface, There’s a ‘SetResolution()‘ method which holds any and all code that’s required to update everytime the resolution changes. This makes updating Viewport bounds that are required for most post processors to be easily reset.

There’s also a ‘LoadContent()’ method which is essentially for setting up any code outside of the Constructor.

Finally is the ‘Apply()‘ method, where the magic happens. This is a generic method where the actual effect is applied to the scene.

Further to all of this, All of the Post Processors are added to an Effects list in the Renderer.  This makes any batch changes very easy to perform by simply just looping through the collection when needed and calling the required method.

jvdjp4n
Again, Crepuscular Rays, Bloom and Cartoon Edge Detection Post Processors

In the end, this creates for a very structured way in which to handle all of the post processing effects, allowing not only a more efficient rendering loop by lessening the amount of information sent to the GPU each loop, as well as minimizes on lines of code.

 

Related

Previous articleVertices Engine Optimizations - Camera Frustum CullingNext article Historic Source Code

2 comments

r4tch31 says:
September 27, 2016 at 10:26 am

Reblogged this on Virtex Edge Design.

Reply
virtexedge says:
September 4, 2017 at 9:52 am

Reblogged this on Virtex Edge Design.

Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

About The Blog

Nulla laoreet vestibulum turpis non finibus. Proin interdum a tortor sit amet mollis. Maecenas sollicitudin accumsan enim, ut aliquet risus.

Recent Posts

Game Jam – GatewaysApril 25, 2021
Game Jam – Frequency SyncJanuary 29, 2019
Shader Series – Screen Space ReflectionsJune 26, 2018

Categories

  • 3C – Capture Crop Create
  • 3D Laser Scanner
  • Arduino
  • Asia
  • Chrome Addins
  • Dev Blog
  • DIY
  • Game Jam
  • Metric Racer
  • MonoGame Tutorials
  • Music
  • OpenCascade
  • Programming
  • Quadcopter
  • Shader Series
  • Shaders Tutorials
  • Space Esc8bit
  • The Chaotic Workshop
  • Traveling
  • Tutorial
  • Tutorials
  • Uncategorized
  • Vertices Engine
  • Videos
  • Virtex Dev Blog
  • Virtex Edge Design

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Tags

3D 8-Bit AdMOb Ads android Animation Apollo Apollo 11 Audio Audio Puzzle C# Editor Electronics featured Game Dev Game Development Game Engine Gaming Github GLSL Graphics HLSL Japan Javascript Linux Mobile MonoGame NASA OpenGL Optimizations Programming Projects Screen Space Reflections Shaders Source Code SSR Terrain Editor tools Transparency Tutorial Vertices Virtex Edge Design WebGL wxWidgets XNA

Recent Posts

Game Jam – GatewaysApril 25, 2021
Game Jam – Frequency SyncJanuary 29, 2019
Shader Series – Screen Space ReflectionsJune 26, 2018

Categories

  • 3C – Capture Crop Create
  • 3D Laser Scanner
  • Arduino
  • Asia
  • Chrome Addins
  • Dev Blog
  • DIY
  • Game Jam
  • Metric Racer
  • MonoGame Tutorials
  • Music
  • OpenCascade
  • Programming
  • Quadcopter
  • Shader Series
  • Shaders Tutorials
  • Space Esc8bit
  • The Chaotic Workshop
  • Traveling
  • Tutorial
  • Tutorials
  • Uncategorized
  • Vertices Engine
  • Videos
  • Virtex Dev Blog
  • Virtex Edge Design

Tags

3D 8-Bit AdMOb Ads android Animation Apollo Apollo 11 Audio Audio Puzzle C# Editor Electronics featured Game Dev Game Development Game Engine Gaming Github GLSL Graphics HLSL Japan Javascript Linux Mobile MonoGame NASA OpenGL Optimizations Programming Projects Screen Space Reflections Shaders Source Code SSR Terrain Editor tools Transparency Tutorial Vertices Virtex Edge Design WebGL wxWidgets XNA
Rife Wordpress Theme. Proudly Built By Apollo13

ROB TOM ROE

I’m an Entrepreneur, Software Developer and Mechanical Engineering Grad. I started out working in the Energy and Nuclear safety sector as well as Aircraft Design, Repair and Stress analysis. In 2015 I started Virtex Edge Design , a software and game development company.

Recent Posts

Game Jam – GatewaysApril 25, 2021
Game Jam – Frequency SyncJanuary 29, 2019
Shader Series – Screen Space ReflectionsJune 26, 2018

Categories

  • 3C – Capture Crop Create
  • 3D Laser Scanner
  • Arduino
  • Asia
  • Chrome Addins
  • Dev Blog
  • DIY
  • Game Jam
  • Metric Racer
  • MonoGame Tutorials
  • Music
  • OpenCascade
  • Programming
  • Quadcopter
  • Shader Series
  • Shaders Tutorials
  • Space Esc8bit
  • The Chaotic Workshop
  • Traveling
  • Tutorial
  • Tutorials
  • Uncategorized
  • Vertices Engine
  • Videos
  • Virtex Dev Blog
  • Virtex Edge Design