• Advertisement

Archived

This topic is now archived and is closed to further replies.

HLSL or CG Blur code? How?

This topic is 5358 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I''m trying to do a number of effects such as glow, bloom, Depth of Field etc. with HLSL. All these effects require a fast blur. I looked at a number of papers from ATI and nVidia however I still am confused about the concept and do not really understand what they mean about the sampling kernel, or more precisely I don''t know how to (by what amount)offset the TEXCOORDS for the Pixel shader. I would GREATLY appreciate if anyone could show me a simple way to apply Blur (any type such as Box filter etc.) to a texture with either HLSL (preferred) or Cg. THANKS!

Share this post


Link to post
Share on other sites
Advertisement
The screen space u interval is 1/(horizontal resolution).
Similarly, v interval is 1/(vertical resolution).
For example, the pixel immediately to 'right' can be addressed as [u+uInterval,v].

[edited by - Nik02 on August 16, 2003 5:34:32 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
or... always render your scene to a texture, and keep the texture between frames, blend the current frame with it, and repeat... it shows motion blurs fairly well, and isn''t that slow.

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
or... always render your scene to a texture, and keep the texture between frames, blend the current frame with it, and repeat... it shows motion blurs fairly well, and isn''t that slow.



This method looks nice. Won''t the effect look different based on the current frame rate though? 100fps would look diff from 20fps as in the 100fps would have shorter trails. and the 20fps would look weird? Well anyways I''m gona try it to see!





Share this post


Link to post
Share on other sites
You really shouldn''t use previous frames for motion blur... motion blur is usually never rendered with more than 180 degrees shutter angle... that''s 50% of the frame time. If you use one previous frame you''ll get more than 100% of the frame time, or >360 degress shutter angle.

To do proper motion blur you must render more frames than you display, and blend them together. There''s really no way around it, if you want it to look right, and thus should probably only be an option in the program so the user can enable it if the frame rate is high enough to make it useful.

This can be done with multisample masking, for example, or by rendering to a texture.

Share this post


Link to post
Share on other sites

  • Advertisement