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
Grayscale Image Transitions Using SlimDX
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.
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.
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;
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.
[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.
How can I use my HLSL .fx File in my slimDx code
Check out the "Loading, Compiling and Creating Shaders" section...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement