Aug 30, 2008

Hug a Developer :)

Posted by rravuri

Aug 17, 2008

Windows 7

Posted by rravuri

image Check this out "Engineering Windows 7" blog ... this reminds of the start of the longhorn blogs... and this is the 3rd time I am seeing the words "open and honest" in articles on Windows 7 :)

Aug 13, 2008

C# 3.0 for Linux

Posted by rravuri

This is awesome Mono implements the complete C# 3.0 spec with full support for LINQ

Add to that have a Parallel LINQ bits too...

Aug 12, 2008

ShaderEffect Templates & Build Tasks

Posted by rravuri

Checkout the ShaderEffect Build Tasks as part of WPF Futures release...

http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=14962

D3DImage

Posted by rravuri

With .NET 3.5 SP1 RTM we get a new class called D3DImage this allows for Direct3D surface to act as a Image

Checkput some of the samples that I found so far..


With the RTM of .NET 3.5 SP1 , we can now create hardware accelerated layer blending effects in WPF like those available in Image Editing tools & Photoshop & GIMP

some of the common blending modes are

Darken, Darker Colors preferred.
darken

sampler2D input : register(s0);
sampler2D tex1 : register(s1);

float4 main(float2 uv : TEXCOORD) : COLOR
{
float4 clr1;
clr1= tex2D(tex1, uv.xy);

float4 Color;
Color= tex2D( input , uv.xy);

if (Color.r>clr1.r) Color.r=clr1.r;
if (Color.g>clr1.g) Color.g=clr1.g;
if (Color.b>clr1.b) Color.b=clr1.b;

return Color;
}

Lighten, Lighter Colors preferred.
Lighten

sampler2D input : register(s0);
sampler2D tex1 : register(s1);


float4 main(float2 uv : TEXCOORD) : COLOR
{
float4 clr1;
clr1= tex2D(tex1, uv.xy);

float4 Color;
Color= tex2D( input , uv.xy);

if (Color.r<clr1.r) Color.r=clr1.r;
if (Color.g<clr1.g) Color.g=clr1.g;
if (Color.b<clr1.b) Color.b=clr1.b;

return Color;
}

Difference, Simple Arithmetic difference on color components.
Difference

sampler2D input : register(s0);
sampler2D tex1 : register(s1);

float4 main(float2 uv : TEXCOORD) : COLOR
{
float4 clr1;
clr1= tex2D(tex1, uv.xy);

float4 Color;
Color= tex2D( input , uv.xy);

Color.r=clr1.r - Color.r;
Color.g=clr1.g - Color.g;
Color.b=clr1.b - Color.b;

return Color;
}

Multiply, Simple Arithmetic Multiplication on color components.
Multiply

sampler2D input : register(s0);
sampler2D tex1 : register(s1);
float4 main(float2 uv : TEXCOORD) : COLOR
{
float4 clr1;
clr1= tex2D(tex1, uv.xy);

float4 Color;
Color= tex2D( input , uv.xy);

Color.r=clr1.r * Color.r;
Color.g=clr1.g * Color.g;
Color.b=clr1.b * Color.b;

return Color;
}

NegationDifference, opposite or negative of difference
NegationDifference

sampler2D input : register(s0);
sampler2D tex1 : register(s1);

float4 main(float2 uv : TEXCOORD) : COLOR
{
float4 clr1;
clr1= tex2D(tex1, uv.xy);

float4 Color;
Color= tex2D( input , uv.xy);

Color.r=1-(1-clr1.r - Color.r);
Color.g=1-(1-clr1.g - Color.g);
Color.b=1-(1-clr1.b - Color.b);

return Color;
}

Overlay Hardlight, Combination of Multiply for darer colors and NegationDifference for Lighter colors.
overlayHard

sampler2D input : register(s0);
sampler2D tex1 : register(s1);

float4 main(float2 uv : TEXCOORD) : COLOR
{
float4 clr1;
clr1= tex2D(tex1, uv.xy);

float4 Color;
Color= tex2D( input , uv.xy);
if (Color.r<0.5)
Color.r=clr1.r * Color.r;
else
Color.r=1-((1-Color.r)*(1-clr1.r));

if (Color.g<0.5)
Color.g=clr1.g * Color.g;
else
Color.g=1-((1-Color.g)*(1-clr1.g));

if (Color.b<0.5)
Color.b=clr1.b * Color.b;
else
Color.b=1-((1-Color.b)*(1-clr1.b));

return Color;
}

Overlay SoftLight, Variation on Overlay for Lighter colors.
overlaysoft

sampler2D input : register(s0);
sampler2D tex1 : register(s1);
float4 main(float2 uv : TEXCOORD) : COLOR
{
float c=0;
float4 clr1;
clr1= tex2D(tex1, uv.xy);

float4 Color;
Color= tex2D( input , uv.xy);
c=clr1.r * Color.r;
Color.r=c+Color.r*(1-((1-Color.r)*(1-clr1.r)-c));

c=clr1.g * Color.g;
Color.g=c+Color.g*(1-((1-Color.g)*(1-clr1.g)-c));

c=clr1.b * Color.b;
Color.b=c+Color.b*(1-((1-Color.b)*(1-clr1.b)-c));

return Color;
}

Exclusion
Exclusion

sampler2D input : register(s0);
sampler2D tex1 : register(s1);

float4 main(float2 uv : TEXCOORD) : COLOR
{
float4 clr1;
clr1= tex2D(tex1, uv.xy);

float4 Color;
Color= tex2D( input , uv.xy);

Color.r+=clr1.r-clr1.r * Color.r;
Color.g+=clr1.g-clr1.g * Color.g;
Color.b+=clr1.b-clr1.b * Color.b;

return Color;
}



Download ShaderPad and play with these effects..


kick it on DotNetKicks.com

With .NET 3.5 RTM release today, I see that there are following new properties added to the ShaderEffect class.

for setting the register index that contains the size of the image to which the effect is being applied to. documentation on web is complete with examples on this.

  • int DdxUvDdyUvRegisterIndex

For specifying the boundaries of the effect, this can be used to create glow like effects when so that the platform knows that the effect can determine output color outside the bounds of the UIElement. No Samples in the documentation.

  • double PaddingBottom
  • double PaddingLeft
  • double PaddingRight
  • double PaddingTop
  • ShaderRenderMode property on PixelShader

I shall be adding support for these in the ShaderPad shortly.

splogox ShaderPad is a application like XamlPad / LinqPad , it is meant to server as WPF ShaderEffect Workbench. The ShaderEffect is a PixelShader based Effect that an be applied to any UIElement in WPF. This feature is available only in WPF 3.5 SP1

ShaderPad_release080811_sc1

This release also includes the ability to animate the input variables that are passed to the ShaderEffect. This is a quick and dirty release :) , so expect some instability...

In next release will add the ability to load effects from a common location on web, and save to web, this allow people to more freely share their effects.


Pre Requisites
.NET 3.5 SP1 : Download.
Direct X SDK : Download June 2008.

Download Download the Releases and source code at CodePlex.

Lookout for Effects releases soon....

Update: Example Blending Effects here


kick it on DotNetKicks.com

Jul 25, 2008

Wave Reflection Effect New Video

Posted by rravuri

Added a new video to shows that this effect is not just a image effect . Original Post

WPF 3.5 SP1 (Beta) introduces the ability to apply Pixel Shader effects to any UIElement, these will executed by GPU by compatible cards. Greg Schechter's blog is an excellent place to start learning about these features.

Shader Effects have long been used in rendering pipeline, to create great special effects. And nowadays are used by almost every game engine to enhance the visual aspects of the game play.

Another good tutorial and Check out the HLSLTester code , it is helpful in creating new effects here. I have used the Shader code from this page and added some dynamic properties to create the following effect.

WaveReflectionEffect

Download the full code for this demo from here.

Download the compiled effect.


kick it on DotNetKicks.com

Jul 20, 2008

'The Dark Knight'

Posted by rravuri

The Dark Knight Yesterday night I got to watch "The Dark Knight" and I loved it, the best part was Heath Ledger's portrayal of the Joker character.and off course the bat-pod I felt the batman character could have been portrayed a little bit more 'darker'. The dialog of the movie ...

"I'm not a monster. I'm just ahead of the curve." :)

The Dark KnightThe Dark Knight
More complete review here...

Jul 17, 2008

Windows Experience Index after SP1

Posted by rravuri

After installing Windows Vista SP1 the windows experience index shot up from 3.8 to 5.1 :) hmm..

7162008_94912 PM

Jul 15, 2008

Test Post with Windows Live Writer

Posted by rravuri

This is a test post using Windows Live Writer


livewriter

Jul 13, 2008

Future of C# & C# 4.0

Posted by rravuri

Good discussion on Channel 9 on the future of C# and some rational behind features that might make it in C# 4.0 .(We'll see what those features are at PDC )
"Concurrency features by far are game changing aspects.." - Andres

C# 4.0: Meet the Design Team

Jul 10, 2008

Won a Windows Mobile!

Posted by rravuri



Won a BlackJack II at World Microsoft Partner Conference .

Now I have to Load Windows Mobile 6.1 on it and may be pre-beta versions of Silverlight Mobile :)

Update to SilverCarrom

Posted by rravuri

Fixed the Resize Bug, check out the latest version

Jul 9, 2008

Update to SilverCarrom

Posted by rravuri

Had to roll back the previous version as I had a Resizing Bug..

Jul 5, 2008

Update to SilverCarrom

Posted by rravuri

Minor update v1.1 to SilverCarrom

  • Increase the MaxFrameRate to 120 , this make the physics more accurate
  • Implemented ReSize Handlers to scale the Game fit the current Browser Size.

Jul 4, 2008

Getting the Required FPS in Silverlight

Posted by rravuri

One the first code for any game will be setup a game loop. Here are some of the posts on how to achieve this in Silverlight applications:
Creating a Game Loop - Silverlight Games 101
Tip of the Day #5: Timers and the Main Game Loop - Mike Snows Silverlight Blog
Silverlight-Speed Loop

You can see that there are two ways, one using the DispatchTimer and one using Storyboard. However I found that "The DispatcherTimer is a lower resolution timer than the timer behind the Storyboard class, which causes loss in fidelity. Additionally, the Storyboard execution is more stable across the different supported OSs and Browsers. I'll put together a sample to show the comparision." as stated in post Procedural Animation in Silverlight 2 | Adam Kinney, Continuum Explorer

So for my game I started using the empty storyboard method. But then I noticed that I getting only 60-62 FPS (frames per second) even when doing zero computations. This was causing some edge conditions manifest in collision detection like the objects passing through each other. One way to get rid of these was to increase the number of steps by increasing the FPS which I found can be by setting the EnableFrameRateCounter property to 120 in my case.
More Silverlight performance tips here.

kick it on DotNetKicks.com

My first Silverlight Game

Posted by rravuri

SilverCarrom is My first Silverlight Game.

Carrom is a game that I played a lot in my childhood in India. I guess anyone from India in my age group must have played it sometime or other.Carrom is game similar to the game of Pool. Here instead of spherical balls we have small coin shaped objects.
For more information on Carrom visit www.carrom.org . Visit http://www.ehow.com/how_2124269_play-carrom.html for more information on ho to play this game.

This code uses the Farseer Physics Engine that was developed by Jeff Weber of Farseer Games.

Here are some of the To do items that I intend to work on when i have time...
  • Implement scoring
  • MultiPlayer ( Player Vs Computer & Player Vs Player )
  • Physics Engine Bugs
  • Game Varitions
  • Help / Options


Here is the screen shot of v1.0 , I intend to upload the entire code soon.
Screenshot