Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

FantasyVII

Member Since 13 Jul 2012
Offline Last Active May 13 2013 02:03 AM
-----

Topics I've Started

Shader Model 2.0 runs faster than 3.0 !

12 April 2013 - 06:41 PM

Hello everyone,

 

So I been making a pixel shader lighting system in XNA with SM 3.0. I was getting around 70FPS with 4 lights. However when I changed the SM version in the fx file from 3.0 to 2.0, I got around 120FPS !!! Why?

 

obviously I can't use SM 2.0 because it's very limited with the amount of arithmetic that I can do. But why is it that SM 2.0 faster than 3.0? You would think 3.0 would run much much faster !!

 

Also in SM 3.0 I can have an array size of 15 elements. I can use all 15 lights and I get 70FPS. If i use 1 light I get 70FPS so it doesn't really matter. However when I set the array to 16 elements in the fx file my FPS drops to 10FPS !! even if I only use 1 light. why is that?!

 

struct Light
{
	float2 Position;
	float4 Color;
	float Radius;
	float Intensity;
};

Light lights[15];

 

 


2D Deferred lighting in XNA

11 April 2013 - 05:34 AM

Hello everyone,

 

So I have been trying to learn HLSL and I think I got the hang of it. I found this awesome tutorial that show how to implement deferred lighting. and I think I understand it. However there is just one thing that I would like to know. How can I change the light shape from point light to cone shape like light?

 

1111fs.png

 

 

Here is a video of my implementation of deferred lighting.

http://www.youtube.com/watch?v=Fp8dCFCqACc

 

 

and here is the code

struct Light
{
	float2 position;
	float4 color;
	float power;
};

texture colortexture;

int numberOfLights;
Light lights[4];

float ambient;
float4 ambientColor;

float screenWidth;
float screenHeight;

sampler ColorMap = sampler_state
{
	Texture = <colortexture>;
};

float4 CalculateLight(Light light, float4 base, float3 pixelPosition)
{
	float2 direction = light.position - pixelPosition;
	float distance = 1 / length(light.position - pixelPosition) * light.power;
	float amount = max(dot(base, normalize(distance)), 0);
	
	return base * distance * light.color * ambient;
}

float4 Deferredlight(float2 texCoords : TEXCOORD0) : COLOR
{
	float4 base = tex2D(ColorMap, texCoords);

	float3 pixelPosition = float3(screenWidth * texCoords.x, screenHeight * texCoords.y, 0);
		
	float4 finalColor = (base * ambientColor * ambient);
	for(int i=0; numberOfLights; i++)
	{
		finalColor += CalculateLight(lights[i], base, pixelPosition);
	}
	
	return finalColor;
}

technique Deferred
{
	pass Pass1
	{
		PixelShader = compile ps_2_0 Deferredlight();
	}
}

I want to share my tower defense game with you

13 March 2013 - 07:20 AM

Hello everyone,

 

For the past six months I have been working on a multiplayer 2D tower defense in XNA and C#. And I just thought I would share my work with all of you.

 

If anyone is interested here is my website check it out.

www.vault16software.com

 

I try to post a dev video when I can.

 

 


Creating a map editor like Warcraft 3

30 January 2013 - 12:25 PM

Hello everyone,

 

I have created a 2D tile based map editor. It's perfect for me. I love it and it gets the job done. However I was watching this video and I didn't understand one thing. When the user place multiple tiles of the same type, how does the editor merge them into one? I just can't understand how to program this feature.

 

BTW I know that the map editor is in 3D.

 

http://youtu.be/dzS_qpHsQAc?t=5m

 

Can someone please explain how this works?

 

Thank you smile.png


MonoGame template is not showing up in VS 2012 in windows 7

05 December 2012 - 06:55 AM

Hello,

Today I uninstalled VS 2010 and installed VS 2012 ultimate and MonoGame 3.0 Beta in windows 7. I started VS 2012 and I tried to create new project. However I didn't see MonoGame template!! I went to "Documents\Visual Studio 2012\Templates\ProjectTemplates\Visual C#\" and I can see MonoGame folder there but in VS 2012 I can't see the template. Why?!

I search all over the internet and I can't find a single webpage about this problem. Anyone people help me.

PARTNERS