• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Igor Kokarev

[DX9] Blur with variable radius

7 posts in this topic

Please advice blur with variable radius with good quality for entire screen.

 

I've read advice to use separated gaussian blur x, y axis. However all examples were for certain fixed radius. How to implement variable radius?

 

Also it's important to avoid moire artefacts for animated objects inside blurred scene. We tried downsampling + spline and it gave moire defects.

 

 

0

Share this post


Link to post
Share on other sites

How dynamic are the variable radius ? Is it on a per pixel level or per game session (depending only on the visual settings ? ).

Here are some tips:

1. If you really have a dynamic setup, try to save different gaussian distributions in a texture and sample the texture.

2. If the setup change not very often, try to generate the shader coder just before uploading it. This way you avoid recalculation of the gaussian distribution and you have a fix range, which avoids dynamic for-loops (better performance on older hardware).

 

Edit:

3. You can use pre-processor directive to choose between a fix set of precoded configurations.

Edited by Ashaman73
0

Share this post


Link to post
Share on other sites

As above, can you give some more information on what you're doing?

 

I did a DOF blur effect with a variable width Gaussian blur per pixel for this scene, by first implementing a regular two-pass Gaussian blur shader, and then simply scaling my texture coordinate offsets per pixel. I think that shader is using 5 samples per pixel in each direction.

0

Share this post


Link to post
Share on other sites

Thanks for your responses!

 

I need to apply a dynamic blur to photography for multimedia application in realtime. Blur radius will change in every frame smoothly. Radius will be between 0 and around 150.

 

Hodgman,

I see very nice blur on your screenshot. My congratulations! Regrettably I need variable blur adjustable by user (templates).

Edited by SirIgor
0

Share this post


Link to post
Share on other sites

Using traditional techniques, you would either want to recompile hundreds of different blur shaders for those different radii, as they'll all need different numbers of samples and different weights, or you'd have to use a loop in the shader to dynamically choose the number of weights.
 
Those traditional blur techniques are not very efficient at such large radii though.
A better technique would be to look into Summed Area Tables (SAT), e.g. http://www.nvidia.com/docs/IO/8227/GDC2003_SummedAreaTables.pdf
Or look in to using compute shaders to implement the typical gaussian blur.

Edited by Hodgman
1

Share this post


Link to post
Share on other sites

We afraid that Summed Area Tables on PS 2.0 will not work fast enough.

 

Computable shaders is a good idea, but it require DX11 or Cuda.

0

Share this post


Link to post
Share on other sites

Update: The problem is solved. Thanks.

 

We're trying to implement 2-pass Gaussian blur on HSL2.0. Here is a code of shader for horizontal blur. Pixelwidth is a radius. This shader doesn't work, the result looks as without the shader, please can you help?

sampler s0: register(s0);

float1 pixelwidth: register(c0);

float PixelKernel[13] =
{
-6,
-5,
-4,
-3,
-2,
-1,
0,
1,
2,
3,
4,
5,
6,
};

static const float BlurWeights[13] =
{
0.002216,
0.008764,
0.026995,
0.064759,
0.120985,
0.176033,
0.199471,
0.176033,
0.120985,
0.064759,
0.026995,
0.008764,
0.002216,
};

float1 Clip(float1 arg): float1
{
if (arg<0) arg=0;
if (arg>1) arg=1;
return arg;
}

float4 main_ps(float2 tex: TEXCOORD0):COLOR
{
float4 cl=(0,0,0,0);
float2 coord=tex;
for (int i=0; i<13; i++){
coord.x=Clip(tex.x+PixelKernel[i]*pixelwidth);
cl+=tex2D(s0, coord)*BlurWeights[i];
}
return cl;
}
Edited by SirIgor
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0