SlideShare uma empresa Scribd logo
1 de 31
Baixar para ler offline
High-Speed, Off-Screen Particle
             GPU gems 3




                  OZ
      http://ozlael.egloos.com/
Large particle system
●   mushroom cloud, smoke, fire, explosio
    n ...
●
    Many polygons
●
    Fill rate
●
    Frame rate
Motivation
●   Off-screen Render Target
●   Fraction of the Frame Buffer size
Low-Resolution
●   Image of smoke and fog have only low fr
    equencies
●   Small number of samples without loss of
    visual quality
●
    Bad to high frequencies
Off-Screen Rendering
●   Particles are rendered to an Off-Screen.
●   Not require a same size of Frame Buffer.
●   Not require a particular ratio of size.
●   Trade-off
Off-Screen Depth Testing
●   Requires Depth buffer
●   Occlude the particles against opaque
●   Depth testing
●   Off-screen RT size
Off-Screen Depth Testing
●   1. Render all solid objects(a)
●   2. Downsample the resulting Depth Buffer
●   3. Render the particles to Off-screen RT,
    testing against the small depth buffer(b)
●   4. Composite the particle RT back onto t
    he main Frame Buffer(c)
Off-Screen Depth Testing




   Show how the depth test creates a silhuette of the solid objects
Acquiring Depth
●   MRT
    - All targets must have equal bit depths
    - not compatible with MSAA
●   Single RT in a separate pass
●   Alpha channel of an RGBA target
    - Use RGBA16 cause precision problem
    - Memory footprint
    - Can’t MSAA on GeForce 7
Acquiring Depth
●   DirectX 10
    - Directx access
    - Shader Resource View
Our Engine
●   Deferred Render System
●   G-Buffer Depth
Point Sampling Depth
●   Depth test will occlude the particle
●   Make halo


         Low Res.

         High Res.
Point Sampling Depth
Maximum of Depth Samples
●   Sample a spread of four depth values fro
    m the full-resolution depth
●   Take the maximum one.
●   Four samples fully cover the high-res.
●   Shrinking the object silhouettes
Depth Testing and Soft Particles
 ●   The Depth Test Implemented in the PS

float4 particlePS(VS_OUT vIn): COLOR
{
  float myDepth = vIn.depth;
  float sceneDepth = tex2D(depthSampler, vIn.screenUV).x;
  if (myDepth > sceneDepth)
    discard;
  // Compute color, etc.
  ...
}
Depth Testing and Soft Particles
●   Access to Depth, useful to Soft Particle
●   saturate(( Z object - Z particle) * scale)
Depth Testing and Soft Particles
 ●   Soft Particles Are better than

float4 particlePS(VS_OUT vIn): COLOR
{
  float myDepth = vIn.depth;
  float sceneDepth = tex2D(depthSampler, vIn.screenUV).x;
  float zFade = saturate(scale * (myDepth - sceneDepth));
  // Compute (r,g,b,a), etc.
  ...
  return float4(r,g,b, a * zFade);
}
Alpha Blending
Alpha Blending
●   Store everything except Frame-buffer d
●   d term : multiplied by the inverse of every
    alpha value blended.
Alpha Blending
●   s term : If the target is initialized to zero,
    conventional alpha-blend equation
Alpha Blending States
●   AlphaBlendEnable = true;
●   SrcBlend = SrcAlpha;
●   DestBlend = InvSrcAlpha;
●   SeparateAlphaBlendEnable = true;
●   SrcBlendAlpha = Zero;
●   DestBlendAlpha = InvSrcAlpha;
Additive Blending
●   Common to additively blend particles
●   Not be possible to combine both in a sin
    gle Off-screen RT
Mixed -Resolution Rendering
●   Still blocky
Blocky Problem
●   Edges can be fixed with Edge detection.
●   Standard Sobel filter
Sobel Mask
Composing with Stenciling
●   Edge-detection selects pixels blocky
●   Rendering the particles at the full Frame-
    buffer resolution only where edges occur.
Avoid Stencil Writes,
  Creating a Mask
Avoid Stencil Writes,
             Creating a Mask
   ●   Stencil buffer mask areas of FrameBuffer
float4 composePS(VS_OUT2 vIn): COLOR {
float4 edge = tex2D(edgesSampler, vIn.UV0.xy);
if (edge.r == 0.0)
{
  float4 col = tex2D(particlesRTSampler, vIn.UV1.xy);
  return rgba;
}
else
{
  // Where we have an edge, abort to cause no stencil write.
 discard;
}
}
Result
Result




         Image from : technology.blurst.com/
Result
This Ignore blocky problem

Mais conteúdo relacionado

Destaque (18)

latest slide
latest slidelatest slide
latest slide
 
Artificial intelligence prelims - answers
Artificial intelligence   prelims - answersArtificial intelligence   prelims - answers
Artificial intelligence prelims - answers
 
latest slide
latest slidelatest slide
latest slide
 
Semiología respiratoria imágenes
Semiología respiratoria imágenesSemiología respiratoria imágenes
Semiología respiratoria imágenes
 
Syllabus: 8th grade science
Syllabus: 8th grade scienceSyllabus: 8th grade science
Syllabus: 8th grade science
 
Youtube: ver, partilhar, carregar
Youtube: ver, partilhar, carregarYoutube: ver, partilhar, carregar
Youtube: ver, partilhar, carregar
 
Sw203 Lab4
Sw203 Lab4Sw203 Lab4
Sw203 Lab4
 
Krzyzanowski Photography - Food Portfolio
Krzyzanowski Photography - Food PortfolioKrzyzanowski Photography - Food Portfolio
Krzyzanowski Photography - Food Portfolio
 
Greenthan
GreenthanGreenthan
Greenthan
 
Enviroment Eco cars
Enviroment Eco carsEnviroment Eco cars
Enviroment Eco cars
 
Folio1
Folio1Folio1
Folio1
 
Rain Garden
Rain GardenRain Garden
Rain Garden
 
Cloud computing
Cloud computingCloud computing
Cloud computing
 
scout
scoutscout
scout
 
before upload
before uploadbefore upload
before upload
 
No Panic workshop
No Panic workshopNo Panic workshop
No Panic workshop
 
Instrumentos
InstrumentosInstrumentos
Instrumentos
 
first pitch
first pitchfirst pitch
first pitch
 

Semelhante a Offscreenparticle

Smedberg niklas bringing_aaa_graphics
Smedberg niklas bringing_aaa_graphicsSmedberg niklas bringing_aaa_graphics
Smedberg niklas bringing_aaa_graphics
changehee lee
 
Crysis Next-Gen Effects (GDC 2008)
Crysis Next-Gen Effects (GDC 2008)Crysis Next-Gen Effects (GDC 2008)
Crysis Next-Gen Effects (GDC 2008)
Tiago Sousa
 
Z Buffer Optimizations
Z Buffer OptimizationsZ Buffer Optimizations
Z Buffer Optimizations
pjcozzi
 
Visible surface detection in computer graphic
Visible surface detection in computer graphicVisible surface detection in computer graphic
Visible surface detection in computer graphic
anku2266
 
NVIDIA effects GDC09
NVIDIA effects GDC09NVIDIA effects GDC09
NVIDIA effects GDC09
IGDA_London
 
Shaders in Unity by Zoel
Shaders in Unity by ZoelShaders in Unity by Zoel
Shaders in Unity by Zoel
Agate Studio
 

Semelhante a Offscreenparticle (20)

Real-time Shadowing Techniques: Shadow Volumes
Real-time Shadowing Techniques: Shadow VolumesReal-time Shadowing Techniques: Shadow Volumes
Real-time Shadowing Techniques: Shadow Volumes
 
Advancements in-tiled-rendering
Advancements in-tiled-renderingAdvancements in-tiled-rendering
Advancements in-tiled-rendering
 
GDC 2012: Advanced Procedural Rendering in DX11
GDC 2012: Advanced Procedural Rendering in DX11GDC 2012: Advanced Procedural Rendering in DX11
GDC 2012: Advanced Procedural Rendering in DX11
 
Screen Space Reflections in The Surge
Screen Space Reflections in The SurgeScreen Space Reflections in The Surge
Screen Space Reflections in The Surge
 
Smedberg niklas bringing_aaa_graphics
Smedberg niklas bringing_aaa_graphicsSmedberg niklas bringing_aaa_graphics
Smedberg niklas bringing_aaa_graphics
 
Crysis Next-Gen Effects (GDC 2008)
Crysis Next-Gen Effects (GDC 2008)Crysis Next-Gen Effects (GDC 2008)
Crysis Next-Gen Effects (GDC 2008)
 
OpenGL for 2015
OpenGL for 2015OpenGL for 2015
OpenGL for 2015
 
Checkerboard Rendering in Dark Souls: Remastered by QLOC
Checkerboard Rendering in Dark Souls: Remastered by QLOCCheckerboard Rendering in Dark Souls: Remastered by QLOC
Checkerboard Rendering in Dark Souls: Remastered by QLOC
 
Foveated Ray Tracing for VR on Multiple GPUs
Foveated Ray Tracing for VR on Multiple GPUsFoveated Ray Tracing for VR on Multiple GPUs
Foveated Ray Tracing for VR on Multiple GPUs
 
Rendering Tech of Space Marine
Rendering Tech of Space MarineRendering Tech of Space Marine
Rendering Tech of Space Marine
 
Secrets of CryENGINE 3 Graphics Technology
Secrets of CryENGINE 3 Graphics TechnologySecrets of CryENGINE 3 Graphics Technology
Secrets of CryENGINE 3 Graphics Technology
 
iOS Visual F/X Using GLSL
iOS Visual F/X Using GLSLiOS Visual F/X Using GLSL
iOS Visual F/X Using GLSL
 
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
4K Checkerboard in Battlefield 1 and Mass Effect Andromeda
 
Z Buffer Optimizations
Z Buffer OptimizationsZ Buffer Optimizations
Z Buffer Optimizations
 
Massive Point Light Soft Shadows
Massive Point Light Soft ShadowsMassive Point Light Soft Shadows
Massive Point Light Soft Shadows
 
Visible surface detection in computer graphic
Visible surface detection in computer graphicVisible surface detection in computer graphic
Visible surface detection in computer graphic
 
[Unite Seoul 2020] Mobile Graphics Best Practices for Artists
[Unite Seoul 2020] Mobile Graphics Best Practices for Artists[Unite Seoul 2020] Mobile Graphics Best Practices for Artists
[Unite Seoul 2020] Mobile Graphics Best Practices for Artists
 
NVIDIA effects GDC09
NVIDIA effects GDC09NVIDIA effects GDC09
NVIDIA effects GDC09
 
Shaders in Unity by Zoel
Shaders in Unity by ZoelShaders in Unity by Zoel
Shaders in Unity by Zoel
 
Taking Killzone Shadow Fall Image Quality Into The Next Generation
Taking Killzone Shadow Fall Image Quality Into The Next GenerationTaking Killzone Shadow Fall Image Quality Into The Next Generation
Taking Killzone Shadow Fall Image Quality Into The Next Generation
 

Mais de ozlael ozlael

Introduce coco2dx with cookingstar
Introduce coco2dx with cookingstarIntroduce coco2dx with cookingstar
Introduce coco2dx with cookingstar
ozlael ozlael
 
Deferred rendering case study
Deferred rendering case studyDeferred rendering case study
Deferred rendering case study
ozlael ozlael
 
Kgc make stereo game on pc
Kgc make stereo game on pcKgc make stereo game on pc
Kgc make stereo game on pc
ozlael ozlael
 
Hable uncharted2(siggraph%202010%20 advanced%20realtime%20rendering%20course)
Hable uncharted2(siggraph%202010%20 advanced%20realtime%20rendering%20course)Hable uncharted2(siggraph%202010%20 advanced%20realtime%20rendering%20course)
Hable uncharted2(siggraph%202010%20 advanced%20realtime%20rendering%20course)
ozlael ozlael
 

Mais de ozlael ozlael (20)

Unity & VR (Unity Roadshow 2016)
Unity & VR (Unity Roadshow 2016)Unity & VR (Unity Roadshow 2016)
Unity & VR (Unity Roadshow 2016)
 
뭣이 중헌디? 성능 프로파일링도 모름서 - 유니티 성능 프로파일링 가이드 (IGC16)
뭣이 중헌디? 성능 프로파일링도 모름서 - 유니티 성능 프로파일링 가이드 (IGC16)뭣이 중헌디? 성능 프로파일링도 모름서 - 유니티 성능 프로파일링 가이드 (IGC16)
뭣이 중헌디? 성능 프로파일링도 모름서 - 유니티 성능 프로파일링 가이드 (IGC16)
 
Optimizing mobile applications - Ian Dundore, Mark Harkness
Optimizing mobile applications - Ian Dundore, Mark HarknessOptimizing mobile applications - Ian Dundore, Mark Harkness
Optimizing mobile applications - Ian Dundore, Mark Harkness
 
그래픽 최적화로 가...가버렷! (부제: 배치! 배칭을 보자!) , Batch! Let's take a look at Batching! -...
그래픽 최적화로 가...가버렷! (부제: 배치! 배칭을 보자!) , Batch! Let's take a look at Batching! -...그래픽 최적화로 가...가버렷! (부제: 배치! 배칭을 보자!) , Batch! Let's take a look at Batching! -...
그래픽 최적화로 가...가버렷! (부제: 배치! 배칭을 보자!) , Batch! Let's take a look at Batching! -...
 
유니티 그래픽 최적화, 어디까지 해봤니 (Optimizing Unity Graphics) Unite Seoul Ver.
유니티 그래픽 최적화, 어디까지 해봤니 (Optimizing Unity Graphics) Unite Seoul Ver.유니티 그래픽 최적화, 어디까지 해봤니 (Optimizing Unity Graphics) Unite Seoul Ver.
유니티 그래픽 최적화, 어디까지 해봤니 (Optimizing Unity Graphics) Unite Seoul Ver.
 
유니티 그래픽 최적화, 어디까지 해봤니 (Optimizing Unity Graphics) NDC15 Ver.
유니티 그래픽 최적화, 어디까지 해봤니 (Optimizing Unity Graphics) NDC15 Ver.유니티 그래픽 최적화, 어디까지 해봤니 (Optimizing Unity Graphics) NDC15 Ver.
유니티 그래픽 최적화, 어디까지 해봤니 (Optimizing Unity Graphics) NDC15 Ver.
 
Infinity Blade and beyond
Infinity Blade and beyondInfinity Blade and beyond
Infinity Blade and beyond
 
스티브잡스처럼 프레젠테이션하기
스티브잡스처럼 프레젠테이션하기스티브잡스처럼 프레젠테이션하기
스티브잡스처럼 프레젠테이션하기
 
유니티의 라이팅이 안 이쁘다구요? (A to Z of Lighting)
유니티의 라이팅이 안 이쁘다구요? (A to Z of Lighting)유니티의 라이팅이 안 이쁘다구요? (A to Z of Lighting)
유니티의 라이팅이 안 이쁘다구요? (A to Z of Lighting)
 
Introduce coco2dx with cookingstar
Introduce coco2dx with cookingstarIntroduce coco2dx with cookingstar
Introduce coco2dx with cookingstar
 
Deferred rendering case study
Deferred rendering case studyDeferred rendering case study
Deferred rendering case study
 
Kgc make stereo game on pc
Kgc make stereo game on pcKgc make stereo game on pc
Kgc make stereo game on pc
 
mssao presentation
mssao presentationmssao presentation
mssao presentation
 
Modern gpu optimize blog
Modern gpu optimize blogModern gpu optimize blog
Modern gpu optimize blog
 
Modern gpu optimize
Modern gpu optimizeModern gpu optimize
Modern gpu optimize
 
Bickerstaff benson making3d games on the playstation3
Bickerstaff benson making3d games on the playstation3Bickerstaff benson making3d games on the playstation3
Bickerstaff benson making3d games on the playstation3
 
DOF Depth of Field
DOF Depth of FieldDOF Depth of Field
DOF Depth of Field
 
Hable uncharted2(siggraph%202010%20 advanced%20realtime%20rendering%20course)
Hable uncharted2(siggraph%202010%20 advanced%20realtime%20rendering%20course)Hable uncharted2(siggraph%202010%20 advanced%20realtime%20rendering%20course)
Hable uncharted2(siggraph%202010%20 advanced%20realtime%20rendering%20course)
 
Deferred rendering in_leadwerks_engine[1]
Deferred rendering in_leadwerks_engine[1]Deferred rendering in_leadwerks_engine[1]
Deferred rendering in_leadwerks_engine[1]
 
Deferred shading
Deferred shadingDeferred shading
Deferred shading
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Offscreenparticle

  • 1. High-Speed, Off-Screen Particle GPU gems 3 OZ http://ozlael.egloos.com/
  • 2. Large particle system ● mushroom cloud, smoke, fire, explosio n ... ● Many polygons ● Fill rate ● Frame rate
  • 3. Motivation ● Off-screen Render Target ● Fraction of the Frame Buffer size
  • 4. Low-Resolution ● Image of smoke and fog have only low fr equencies ● Small number of samples without loss of visual quality ● Bad to high frequencies
  • 5. Off-Screen Rendering ● Particles are rendered to an Off-Screen. ● Not require a same size of Frame Buffer. ● Not require a particular ratio of size. ● Trade-off
  • 6. Off-Screen Depth Testing ● Requires Depth buffer ● Occlude the particles against opaque ● Depth testing ● Off-screen RT size
  • 7. Off-Screen Depth Testing ● 1. Render all solid objects(a) ● 2. Downsample the resulting Depth Buffer ● 3. Render the particles to Off-screen RT, testing against the small depth buffer(b) ● 4. Composite the particle RT back onto t he main Frame Buffer(c)
  • 8. Off-Screen Depth Testing Show how the depth test creates a silhuette of the solid objects
  • 9. Acquiring Depth ● MRT - All targets must have equal bit depths - not compatible with MSAA ● Single RT in a separate pass ● Alpha channel of an RGBA target - Use RGBA16 cause precision problem - Memory footprint - Can’t MSAA on GeForce 7
  • 10. Acquiring Depth ● DirectX 10 - Directx access - Shader Resource View
  • 11. Our Engine ● Deferred Render System ● G-Buffer Depth
  • 12. Point Sampling Depth ● Depth test will occlude the particle ● Make halo Low Res. High Res.
  • 14. Maximum of Depth Samples ● Sample a spread of four depth values fro m the full-resolution depth ● Take the maximum one. ● Four samples fully cover the high-res. ● Shrinking the object silhouettes
  • 15. Depth Testing and Soft Particles ● The Depth Test Implemented in the PS float4 particlePS(VS_OUT vIn): COLOR { float myDepth = vIn.depth; float sceneDepth = tex2D(depthSampler, vIn.screenUV).x; if (myDepth > sceneDepth) discard; // Compute color, etc. ... }
  • 16. Depth Testing and Soft Particles ● Access to Depth, useful to Soft Particle ● saturate(( Z object - Z particle) * scale)
  • 17. Depth Testing and Soft Particles ● Soft Particles Are better than float4 particlePS(VS_OUT vIn): COLOR { float myDepth = vIn.depth; float sceneDepth = tex2D(depthSampler, vIn.screenUV).x; float zFade = saturate(scale * (myDepth - sceneDepth)); // Compute (r,g,b,a), etc. ... return float4(r,g,b, a * zFade); }
  • 19. Alpha Blending ● Store everything except Frame-buffer d ● d term : multiplied by the inverse of every alpha value blended.
  • 20. Alpha Blending ● s term : If the target is initialized to zero, conventional alpha-blend equation
  • 21. Alpha Blending States ● AlphaBlendEnable = true; ● SrcBlend = SrcAlpha; ● DestBlend = InvSrcAlpha; ● SeparateAlphaBlendEnable = true; ● SrcBlendAlpha = Zero; ● DestBlendAlpha = InvSrcAlpha;
  • 22. Additive Blending ● Common to additively blend particles ● Not be possible to combine both in a sin gle Off-screen RT
  • 24. Blocky Problem ● Edges can be fixed with Edge detection. ● Standard Sobel filter
  • 26. Composing with Stenciling ● Edge-detection selects pixels blocky ● Rendering the particles at the full Frame- buffer resolution only where edges occur.
  • 27. Avoid Stencil Writes, Creating a Mask
  • 28. Avoid Stencil Writes, Creating a Mask ● Stencil buffer mask areas of FrameBuffer float4 composePS(VS_OUT2 vIn): COLOR { float4 edge = tex2D(edgesSampler, vIn.UV0.xy); if (edge.r == 0.0) { float4 col = tex2D(particlesRTSampler, vIn.UV1.xy); return rgba; } else { // Where we have an edge, abort to cause no stencil write. discard; } }
  • 30. Result Image from : technology.blurst.com/