Jump to content

  • Log In with Google      Sign In   
  • Create Account


Naruto-kun

Member Since 15 Oct 2012
Offline Last Active Apr 06 2014 08:38 AM
-----

Posts I've Made

In Topic: BlendState in an Effect

06 April 2014 - 01:11 AM

Here is how I load the texture.

D3DX11_IMAGE_LOAD_INFO rtd;
		ZeroMemory(&rtd, sizeof(rtd));
		rtd.Width = 1024;
		rtd.Height = 1024;
		rtd.MipLevels = 1;
		rtd.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
		rtd.Usage = D3D11_USAGE_DEFAULT;
		rtd.BindFlags = D3D11_BIND_SHADER_RESOURCE;
		rtd.CpuAccessFlags = D3DX11_DEFAULT;
		rtd.MiscFlags = D3DX11_DEFAULT;
		rtd.Depth = D3DX11_DEFAULT;
		rtd.FirstMipLevel = D3DX11_DEFAULT;
		rtd.Filter = D3DX11_DEFAULT;
		rtd.MipFilter = D3DX11_DEFAULT;
		rtd.pSrcInfo = NULL;
		HRSRC Srsrc = FindResource(modinst, MAKEINTRESOURCE(200), MAKEINTRESOURCE(10));
		//DWORD temp = GetLastError();
		HGLOBAL Simg = LoadResource(modinst, Srsrc);

		DWORD size = SizeofResource(modinst, Srsrc);
		void* buf= LockResource(Simg);
		hr = D3DX11CreateShaderResourceViewFromMemory(dev, buf, size, &rtd, NULL, &srv, NULL);

In Topic: BlendState in an Effect

05 April 2014 - 01:20 PM

Thanks. Figured it would be that way. However for some reason, the alpha component in my texture is not being respected. The texture is a 32bit BMP. All areas that are transparent have an alpha of 0.

 

Here is what the pixel shader looks like

float4 PS( PS_INPUT input ) : SV_Target
{ 
	float4 color = Map.Sample(linearSampler, input.t);
	color.a = color.a*input.opacity;
	return color;      
}

input.opacity is a little extra that I use to change transparency even further when I need to.

 

Any ideas?


In Topic: Geometry shaders

26 March 2014 - 11:51 AM

I was thinking I could handle that with constant variables initialized in shader instead of on the CPU.


In Topic: Geometry shaders

24 March 2014 - 11:37 AM

struct VS_Output
{  
    float4 Pos : SV_POSITION;              
    float2 Tex : TEXCOORD0;
};

VS_Output VS(uint id : SV_VertexID)
{
    VS_Output Output;
    Output.Tex = float2((id << 1) & 2, id & 2);
    Output.Pos = float4(Output.Tex * float2(2,-2) + float2(-1,1), 0, 1);
    return Output;
}

In Topic: sprites and slices

24 March 2014 - 05:55 AM

So...any ideas on how to merge them into a single volume?


PARTNERS