Jump to content
  • Advertisement
Sign in to follow this  
Yashwinder

Grayscale Image Transitions Using SlimDX

This topic is 2556 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

I am making an image slide show. Till now I have done transitions using the matrix transformation but now I am trying to make transitions using some gray scale background image.
Can any body please give me an idea how can i perform that or can post some code to give me an idea.

Thanks

Share this post


Link to post
Share on other sites
Advertisement
Use a pixel shader for this. You can use some of the shaders in this library to get you started.. they just require that you add the technique to the shader but that's about it. Granted, this is for WPF.. but the concepts are going to be similar in that you have to load the shader, load two textures (texture0, texture1), set the two texture sampler registers to use those textures for the effect, and then set a register for "progress" that is a simple float between 0 and 1 to represent how much the transition has progressed.. then just render out all the passes.

I've actually done this in SlimDX, but my code is a little elaborate to post here.

http://wpffx.codeplex.com/

Here's a list of transitions they have available:
BandedSwirl, Blings, Blood, CircleReveal, CircleStretch, CircularBlur, CloudReveral, Cloudy, Crumble, Dissolve, DropFade, Fade, LeastBright, LineReveal, MostBright, PixelateIn, PixelateOut, Pixelate, RadialBlur, RadialWiggle, RandomCircleReveal, Ripple, Rotate, Saturate, Shrink, SlideIn, SmoothSwirl, Swirl, Water, Wave.

Share this post


Link to post
Share on other sites

Can you please post a little bit of the main working code. I will be grateful to you


Are you familiar with HLSL and how to set that up on the CPU side? If not, it's too much to go into in a thread post. If you do know how- then obtaining your greyscale would be easy:

Color.rgb = (Color.r+Color.g+Color.b)/3.0f;

Share this post


Link to post
Share on other sites
I have learned to code for HLSL but i dont know how to use it in slimdx code for rendering an image file by the help of a texture and sprite to create various effects. can you please post a small code for just giving a hint, so that I can proceed further. I will be grateful to you.

Share this post


Link to post
Share on other sites

[quote name='Yash14' timestamp='1307459102' post='4820537']
Can you please post a little bit of the main working code. I will be grateful to you


Are you familiar with HLSL and how to set that up on the CPU side? If not, it's too much to go into in a thread post. If you do know how- then obtaining your greyscale would be easy:

Color.rgb = (Color.r+Color.g+Color.b)/3.0f;
[/quote]

A better formula to use would be:

[font="Courier New"]Color.rgb = (Color.r * 0.299f + Color.g * 0.587f + Color.b * 0.114f);[/font]

The reason is that in terms of luminance (which is what the grayscale value is a representation of), the three colour primaries are not equally weighted. Use of those coefficients is fairly standard in image processing.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!