History: SoC2012 Implementation of Off-Screen Particles
Preview of version: 40
- «
- »
Aim of the project:
Thanks to this project Ogre users will benefit in faster rendering of particle systems. Particles hidden behind solid objects will not be painted.
Low frequency particle systems will be enabled to be rendered with downsampled resolution without observable loss of quality (i.a. thanks to blur at center of effects and full resolution in the vicinity of solid objects edges). That will enable saving more computational power for improvement of particle system granularity (for example).
General Information:
Project covers implementation of "GPU gems 3. Chapter 23. High-Speed, Off-Screen Particles" from:
http://http.developer.nvidia.com/GPUGems3/gpugems3_ch23.html .
It is being realized during "Google Summer of Code 2012".
Student assigned to the project: Karol Badowski.
Promotor of the project: Assaf Raman.
Project repository is a fork of OGRE mercurial repository (revision 8d3b960cce3e), aviable at:
https://bitbucket.org/KarolBadowski/ogre-gsoc2012-offscreenparticles .
https://bitbucket.org/KarolBadowski/ogre-gsoc2012-offscreenparticles-tidyupcode (new fork)
Project discussion thread on official OGRE forum:
http://www.ogre3d.org/forums/viewtopic.php?f=13&t=69771 .
Project proposal on Google Summer of Code website:
http://www.google-melange.com/gsoc/proposal/review/google/gsoc2012/karolbadowski/1
Milestones:
preparation before implementation: - done
depth acquisition: - done
downsampled rendering: - done
render target merging & shaders: - done
mixed resolution rendering: - done
Tasks for each milestone:
1:
- requirements specification
- UML diagrams
- reading tutorials
- understanding documentation
2:
- two pass depth acquisition
- multi render target depth acquisition
- z-buffer depth acquisition
- alpha channel depth acquisition
- automatisation of depth acquisition technique choice
3:
- dowsampling with variable scale
- point sampling depth renderer
- maximum of depth samples renderer
4:
- alpha-blending
- binary depth test
- soft particles
5:
- edges detection
- stenciling
Initial proposition of classes diagram:
Short description:
OffScreenParticles: (perhaps could be a CompositorChain)
In the constructor, it transparently makes a choice of appropriate subclasses (for example subclass of DepthAcquisitioner with appropriate parameters).
It acquires input data, calls methods of following classes and propagates the output.
DepthAcquisitioner:
It would be comfrtable if choice of the subclass was automatic, transparent to the developer. Decision process will need to "ask" classes providing intel about Render System. It also could check whether Alpha channel is beeing used (semi-transparent solid objects).
Single-Pass:
-ZBuff_DepthAcquisitioner: Z-buffer
(provided in directX10)
-MRT_DepthAcquisitioner: Multiple Rendering Target
(if older than directX10 and we do not use MSAA - multisample AntiAliasing)
-Alpha_DepthAcquisitioner: depth saved in channel alfa
(if tranparency is not used and (we do not need MSAA or GPU series different than GeForce6 or GeForce7))
Two-Pass:
-TwoPass_DepthAcquisitioner: writing to single rendering target in extra pass
(if we do not use MRT, still have possibility of MSAA even in directx9, still have possibility to use alfa channel)
DepthDownsampler:
It is not obligatory when we use Two-Pass Depth Acquisitioner.
Provides fields and setters allowing to change these fields:
Especially scale of downsampling.
OffScreenRenderer:
Important abstract method: silhouette().
I will provide support at least for two overrides (suggested in the article), that use private methods:
-pointSamplingDepth(): creates halo
-maximumOfDepthSamples(): minor halo artifacts reduced after linear blending
RenderTargetMerger:
Class merges data from MRT, preparing final output.
Most important abstract method is concatenate().
Class should support the usage of some already implemented PixelShaders and their concatenations, user defined application-dependant PixelShaders.
Method alfaBlending() that uses zShade() abstract method.
I will provide the implementation of overrides for zShade(), using:
-binaryDepthTestShade():
-softParticlesShade():
ResolutionMixer:
It provides edge detection method...
-detectEdges(): provides Laplace or Sobel edge detection matrix filter
...and second pass of depth acquisition with full resolution
-stencileEdgesPerticularisation(): fraction of pixels repeat the process without downsampling
Used techniques
DEPTH ACQUISITION
TEXTURE DOWNSAMPLING (depth)
SELECTIVE RENDERING
OFF SCREEN RENDERING WITH DEPTH TEST (backbuffer)
MAXIMUM OF DEPTH DOWNSAMPLING (displayed difference between max and min value)
EDGES DETECTION
DEPTH TEST USING OFFSCREEN DEPTH MAP
COPING WITH DiractX / OpenGL transformations
HANDLING HALO EFFECTS (linear filter + DEPTH texture / MAXOFDEPTH texture)
Schedule:
"Off-Screen Particles" project timeline:
Before May 21 - Reading documentation of OGRE engine, especially particle systems
Before Jun 4 - communication with project supervisor about eventual difficulties or questions in understending of already implemented classes
Before Jun 16 - continuation of Ogre Tutorials, Exam session on one university
Jun 17 - analysing OGRE Example Applications in search of useful solutions
Jun 18-19 - creating bacic scene for presentation and future tests
Jun 20 - defining animation for scene to distribute particles, creating fumes particle system
Jun 21-25 - reading tutorials and articles on depth testing + OGRE tutorials, EXam session on second university, tutorials about CG, HLSL, OGRE tutorials about shaders
Jun 26 - Exam DNA sequentioning, starting attemts to write depth acquisition
Jun 27 - trying to implement depth acquisition, examining code of "soft particles" effect implementation by ahmedismaiel
Jun 28-29 - still trying to write depth acquisition, examining all forum topics about that.
Jun 30 - hosting family
July 1 - implementing passing achieved already depth texture between compositors in compositor Chain,
July 1-4 - eliminating bugs in code (difference of displaying depth of semi-transparent objects in DirectX3D and OpenGL), downsampling is based on SSAO example - does not inherit texture, analysing possibility of handling semi-transparent objects together with particles.
July 5-6 - using own SolidMaterialsBuffer, entities are given the material manually. Achieved concatenation of compositors into chain. Deciding that there are no other solutions to preserve colour material, than using listeners on application level. Passing mocked texture instead created from depth in R,G,B,A channels. Using Post filters in compositor chain, reading script tutorials. fuguring out how to use compositors selectively? - only for solid materials. Modification of particle materials
July 7 - Figured out difference in execution of material between DirectX9 and OpenGL. Passing depth from vertex to pixel shader instead of calculating in pixel shader. Then texture is passed to next compositor that displays it. Using PF_FLOAT32_R. for passing depth.
July 8 - Writing downsampling in compositor, editing view from prepared movies to show summary, universal shader for downsamplingfor rectangular downsample,debugging of downsampler
July 9 - writing application-level proof of concept basic version of off-screen particles, using backbuffer for depth testing. creting and displayin viewports with view of solid objects only, particles only, writing concatenation. Handling recognition of render targets (setting them to invisibility before rendering and visibility after, to avoid infinite mirrors.) screen target for downsampling, handling multiple miniscreens. rendering separate groups of objects with masks connected to viewports
July 10 - turned off antialiasing. Separated display of solid objects and particles in viewports, compare of depth of downsampled texture (done in backbuffer) and particles. contorling autoupdate level of render targets. Handling render targer in post/preRenderTargetListener, mocking setting of transparent colour.
July 11 - looking for solution to handle colour transparency differently.