Sign in to follow this  

DX11 An Invalid parameter was passed to the returning function?

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

Hi, Am trying to follow
http://www.braynzarsoft.net/index.php?p=D3D11BD
This tutorial but I keep getting
An Invalid parameter was passed to the returning function.
When my code try to run
hr = D3d11Device->CreateVertexShader(VSBuffer->GetBufferPointer(), VSBuffer->GetBufferSize(), NULL, &VS);
I get a error message saying that An Invalid parameter was passed to the returning function and am not sure why :(
Thank you if you could explain it to me I also copy pasted my code in here if it was needed


[CODE]
#include <Windows.h>
#include <d3d11.h>
#include <D3DX11.h>
#include <D3DX10.h>
#include <xnamath.h>
#include <DxErr.h>
#pragma comment(lib, "DXErr.lib")
#pragma comment(lib, "d3d11.lib")
#pragma comment(lib, "d3dx11.lib")
#pragma comment(lib, "d3dx10.lib")
bool InitializeWindow(HINSTANCE hInstance,int showWnd,int windowWidth, int windowHeight,bool windowed);
int messageLoop();
LRESULT CALLBACK WndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam);

HRESULT hr;
HWND hWnd = NULL;
const int windowWidth = 800;
const int windowHeight = 600;
//3DirectX
bool InitDirect3D11App(HINSTANCE hInstance);
void ReleaseObjects();
bool InitScene();
void UpdateScene();
void DrawScene();

IDXGISwapChain* SwapChain;
ID3D11Device* D3d11Device;
ID3D11DeviceContext* D3d11DevCon;
ID3D11RenderTargetView* renderTargetView;
ID3D11Buffer* TriangleVertBuffer;
ID3D11VertexShader* VS;
ID3D11PixelShader* PS;
ID3D10Blob* VSBuffer;
ID3D10Blob* PSBuffer;
ID3D11InputLayout* VertLayout;
struct Vertex //Overloaded Vertex Structure
{
Vertex(){}
Vertex(float x, float y, float z)
: pos(x,y,z){}
XMFLOAT3 pos;
};
D3D11_INPUT_ELEMENT_DESC layout[] =
{
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
};
UINT numElements = ARRAYSIZE(layout);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance,LPSTR lpCmnLine, int nShowCmd)
{
if(!InitializeWindow(hInstance,nShowCmd,windowWidth,windowHeight,true))
{
MessageBox(0,"Window Initilize Failed","Error",MB_OK);
return 0;
}
if(!InitDirect3D11App(hInstance))
{
MessageBox(0,"DirectX Init Failed","Error",MB_OK);
return 0;
}
if(!InitScene())
{
MessageBox(0,"Scene Init Failed","Error",MB_OK);
return 0;
}
messageLoop();
ReleaseObjects();
return 0;
}
int messageLoop()
{
MSG msg;
ZeroMemory(&msg,sizeof(MSG));
while(true)
{
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if(msg.message == WM_QUIT)
{
break;
}
TranslateMessage(&msg);
DispatchMessage(&msg);

}
else
{
UpdateScene();
DrawScene();
}
}
return (int) msg.wParam;
}
bool InitializeWindow(HINSTANCE hInstance,int showWnd,int windowWidth, int windowHeight,bool windowed)
{

LPCTSTR WndClassName = "FusionEmptyWindowClass";
LPCTSTR windowTitleBar = "Fusion Empty:Placement Phase";
WNDCLASSEX wc;

wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = NULL;
wc.cbWndExtra = NULL;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+2);
wc.lpszMenuName = NULL;
wc.lpszClassName = WndClassName;
wc.hIconSm = LoadIcon(NULL, IDI_WINLOGO);
if(!RegisterClassEx(&wc))
{
MessageBox(NULL,"Error Registering The Window Class","Error",MB_OK | MB_ICONERROR);
return 0;
}
hWnd = CreateWindowEx
(
NULL,
WndClassName,
windowTitleBar,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
windowWidth,
windowHeight,
NULL,
NULL,
hInstance,
NULL
);
if (!hWnd)
{
MessageBox(NULL, "Error creating window",
"Error", MB_OK | MB_ICONERROR);
return 0;
}
ShowWindow(hWnd,showWnd);
UpdateWindow(hWnd);
return true;
}
bool InitDirect3D11App(HINSTANCE hInstace)
{
//Buffer describer
DXGI_MODE_DESC BufferDesc;

ZeroMemory(&BufferDesc,sizeof(DXGI_MODE_DESC));
BufferDesc.Width = windowWidth;
BufferDesc.Height = windowHeight;
BufferDesc.RefreshRate.Numerator= 60;
BufferDesc.RefreshRate.Denominator= 1;
BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;


//Describe our SwapChain
DXGI_SWAP_CHAIN_DESC SwapChainDesc;

ZeroMemory(&SwapChainDesc,sizeof(DXGI_SWAP_CHAIN_DESC));

SwapChainDesc.BufferDesc = BufferDesc;
SwapChainDesc.SampleDesc.Count = 1;
SwapChainDesc.SampleDesc.Quality = 0;
SwapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
SwapChainDesc.BufferCount = 2;
SwapChainDesc.OutputWindow = hWnd;
SwapChainDesc.Windowed = true;
SwapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;

//Creating the SwapChain
hr = D3D11CreateDeviceAndSwapChain
(
NULL,
D3D_DRIVER_TYPE_HARDWARE,
NULL,NULL,NULL,NULL,
D3D11_SDK_VERSION,
&SwapChainDesc,
&SwapChain,
&D3d11Device,
NULL,
&D3d11DevCon
);
if(FAILED(hr))
{
MessageBox(NULL,DXGetErrorDescription(hr),TEXT("D3D11CreateDeviceAndSwapChain"),MB_OK);
return 0;

}
//BackBuffer Creating
ID3D11Texture2D* BackBuffer;
hr = SwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), (void**)&BackBuffer );
if(FAILED(hr))
{
MessageBox(NULL, DXGetErrorDescription(hr),TEXT("SwapChain->GetBuffer"), MB_OK);
return 0;
}
//Rendering Target
hr = D3d11Device->CreateRenderTargetView(BackBuffer,NULL,&renderTargetView);
BackBuffer->Release();
if(FAILED(hr))
{
MessageBox(NULL,DXGetErrorDescription(hr),TEXT("D3d11Device->CreateRenderTargetView"),MB_OK);
return 0;
}
//Targeting Render target
D3d11DevCon->OMSetRenderTargets( 1, &renderTargetView, NULL ); // <----------------- SET NOT GET!!!!!!
//Set the target
return true;

}
bool InitScene()
{

[size=5][u][b]//Compile Shaders from shader file 5 or 4 = VERSION
hr = D3DX11CompileFromFile("Effects.fx", 0, 0, "VS", "vs_5_0", 0, 0, 0, &VSBuffer, 0, 0);
if(FAILED(hr))
{
MessageBox(NULL,DXGetErrorDescription(hr),"D3DX11CompileFromFile",MB_OK);
}
hr = D3DX11CompileFromFile("Effects.fx", 0, 0, "PS", "ps_5_0", 0, 0, 0, &VSBuffer, 0, 0);
if(FAILED(hr))
{
MessageBox(NULL,DXGetErrorDescription(hr),"D3DX11CompileFromFile",MB_OK);
}[/b][/u][/size]

//Create the Shader Objects
//The problem
hr = D3d11Device->CreateVertexShader(VSBuffer->GetBufferPointer(), VSBuffer->GetBufferSize(), NULL, &VS);
if(FAILED(hr))
{
MessageBox(NULL,DXGetErrorDescription(hr),"D3d11Device->CreateVertexShader",MB_OK);
}
hr = D3d11Device->CreatePixelShader(PSBuffer->GetBufferPointer(), PSBuffer->GetBufferSize(), NULL, &PS);
if(FAILED(hr))
{
MessageBox(NULL,DXGetErrorDescription(hr),"D3d11Device->CreatePixelShader",MB_OK);
}
//Set Vertex and Pixel Shaders
D3d11DevCon->VSSetShader(VS, 0, 0);
D3d11DevCon->PSSetShader(PS, 0, 0);
//Create the vertex buffer
Vertex v[] =
{
Vertex( 0.0f, 0.5f, 0.5f ),
Vertex( 0.5f, -0.5f, 0.5f ),
Vertex( -0.5f, -0.5f, 0.5f ),
};
D3D11_BUFFER_DESC vertexBufferDesc;
ZeroMemory( &vertexBufferDesc, sizeof(vertexBufferDesc) );
vertexBufferDesc.Usage = D3D11_USAGE_DEFAULT;
vertexBufferDesc.ByteWidth = sizeof( Vertex ) * 3;
vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
vertexBufferDesc.CPUAccessFlags = 0;
vertexBufferDesc.MiscFlags = 0;
D3D11_SUBRESOURCE_DATA vertexBufferData;
ZeroMemory( &vertexBufferData, sizeof(vertexBufferData) );
vertexBufferData.pSysMem = v;
hr = D3d11Device->CreateBuffer( &vertexBufferDesc, &vertexBufferData, &TriangleVertBuffer);
//Set the vertex buffer
UINT stride = sizeof( Vertex );
UINT offset = 0;
D3d11DevCon->IASetVertexBuffers( 0, 1, &TriangleVertBuffer, &stride, &offset );
//Create the Input Layout
hr = D3d11Device->CreateInputLayout( layout, numElements, VSBuffer->GetBufferPointer(),
VSBuffer->GetBufferSize(), &VertLayout );
//Set the Input Layout
D3d11DevCon->IASetInputLayout( VertLayout );
//Set Primitive Topology
D3d11DevCon->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST );
//Create the Viewport
D3D11_VIEWPORT viewport;
ZeroMemory(&viewport, sizeof(D3D11_VIEWPORT));
viewport.TopLeftX = 0;
viewport.TopLeftY = 0;
viewport.Width = windowWidth;
viewport.Height = windowHeight;
//Set the Viewport
D3d11DevCon->RSSetViewports(1, &viewport);

return true;
}
void UpdateScene()
{

}
void DrawScene()
{
float bgColor[4] = {(0.0f, 0.0f, 0.0f, 0.0f)};
D3d11DevCon->ClearRenderTargetView(renderTargetView, bgColor);
D3d11DevCon->Draw( 3, 0 );
SwapChain->Present(0,0);
}
void ReleaseObjects()
{
//Window Release
SwapChain->Release();
D3d11Device->Release();
D3d11DevCon->Release();
//Rendering Release
TriangleVertBuffer->Release();
VS->Release();
PS->Release();
VSBuffer->Release();
PSBuffer->Release();
VertLayout->Release();

}
LRESULT CALLBACK WndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch(msg)
{
case WM_KEYDOWN:
{
if(wParam == VK_ESCAPE)
{
if(MessageBox(0,"Are you sure you want to Quit","Really", MB_YESNO | MB_ICONQUESTION) == IDYES)
{
DestroyWindow(hWnd);
}
}
return 0;
}
case WM_DESTROY:
{
PostQuitMessage(0);
return 0;

}
}
return DefWindowProc(hWnd,msg,wParam,lParam);
}
[/CODE]

Share this post


Link to post
Share on other sites
I've noticed it is possible to successfully compile a shader into object code (array of DWORDs) and still have CreateVertexShader() fail with INVALID_PARAMETER if the original shader had invalid numbers of instructions, samplers, constants, etc.

What does the shader you are submitting look like? Edited by Steve_Segreto

Share this post


Link to post
Share on other sites
Look like this :3

float4 VS(float4 inPos : POSITION) : SV_POSITION
{
return inPos;
}
float4 PS() : SV_TARGET
{
return float4(0.0f, 0.0f, 1.0f, 1.0f);
}

Share this post


Link to post
Share on other sites
Perhaps your hardware simply doesn't support shader model 5?

Create the D3D11 device with the debug layer enabled (D3D11_CREATE_DEVICE_DEBUG device flag). This should give you more insight as to what could be wrong. Edited by eppo

Share this post


Link to post
Share on other sites
I also tried version 4, but it gave me the same error and I tried both on my lappy and station computer, my laptop should support version 5, cause atleast that what google said >.<, But I will try the Debug flag tommorow,unable to do it at the moment :( Edited by Conny14156

Share this post


Link to post
Share on other sites
[quote name='eppo' timestamp='1354055062' post='5004704']
Perhaps your hardware simply doesn't support shader model 5?

Create the D3D11 device with the debug layer enabled (D3D11_CREATE_DEVICE_DEBUG device flag). This should give you more insight as to what could be wrong.
[/quote]
This may seems a stupid question but is this the correct way?
hr = D3D11CreateDeviceAndSwapChain
(
NULL,
D3D_DRIVER_TYPE_HARDWARE,
NULL,
D3D11_CREATE_DEVICE_DEBUG,
NULL,
NULL,
D3D11_SDK_VERSION,
&amp;SwapChainDesc,
&amp;SwapChain,
&amp;D3d11Device,
NULL,
&amp;D3d11DevCon
);

I get no "compiler error" when I do this but nothing else really changed o.o Edited by Conny14156

Share this post


Link to post
Share on other sites
I tested a few things today and it seems like D3d11Device->CreatePixelShader somehow is the source of my problem, am not sure why but if I remove this my compiler doesnt complains any more about the CreateVertexShader but something else. Is it possible that the PixelShader returns onto the vertex and thus creating the problem? or is it cause I have DxErr included? I notice that in the the tutorial source file he does not have it cause it looks cleaner that way, but is it also the cause of my error?

Share this post


Link to post
Share on other sites
When you compile your pixelshader you are providing a pointer to the Vertexbuffer rather than the Pixelbuffer.
[source lang="cpp"]hr = D3DX11CompileFromFile("Effects.fx", 0, 0, "PS", "ps_5_0", 0, 0, 0, &VSBuffer, 0, 0);[/source]
Should be:
[source lang="cpp"]hr = D3DX11CompileFromFile("Effects.fx", 0, 0, "PS", "ps_5_0", 0, 0, 0, &PSBuffer, 0, 0);[/source]

Share this post


Link to post
Share on other sites
[quote name='Stuntdk' timestamp='1354169683' post='5005204']
When you compile your pixelshader you are providing a pointer to the Vertexbuffer rather than the Pixelbuffer.
[source lang="cpp"]hr = D3DX11CompileFromFile("Effects.fx", 0, 0, "PS", "ps_5_0", 0, 0, 0, &amp;VSBuffer, 0, 0);[/source]
Should be:
[source lang="cpp"]hr = D3DX11CompileFromFile("Effects.fx", 0, 0, "PS", "ps_5_0", 0, 0, 0, &amp;PSBuffer, 0, 0);[/source]
[/quote]

Yeha I noticed that to early today, biggest fail ever :(. but thank you :3. Edited by Conny14156

Share this post


Link to post
Share on other sites

This topic is 1874 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Similar Content

    • By mister345
      Hi, can somebody please tell me in clear simple steps how to debug and step through an hlsl shader file?
      I already did Debug > Start Graphics Debugging > then captured some frames from Visual Studio and
      double clicked on the frame to open it, but no idea where to go from there.
       
      I've been searching for hours and there's no information on this, not even on the Microsoft Website!
      They say "open the  Graphics Pixel History window" but there is no such window!
      Then they say, in the "Pipeline Stages choose Start Debugging"  but the Start Debugging option is nowhere to be found in the whole interface.
      Also, how do I even open the hlsl file that I want to set a break point in from inside the Graphics Debugger?
       
      All I want to do is set a break point in a specific hlsl file, step thru it, and see the data, but this is so unbelievably complicated
      and Microsoft's instructions are horrible! Somebody please, please help.
       
       
       

    • By mister345
      I finally ported Rastertek's tutorial # 42 on soft shadows and blur shading. This tutorial has a ton of really useful effects and there's no working version anywhere online.
      Unfortunately it just draws a black screen. Not sure what's causing it. I'm guessing the camera or ortho matrix transforms are wrong, light directions, or maybe texture resources not being properly initialized.  I didnt change any of the variables though, only upgraded all types and functions DirectX3DVector3 to XMFLOAT3, and used DirectXTK for texture loading. If anyone is willing to take a look at what might be causing the black screen, maybe something pops out to you, let me know, thanks.
      https://github.com/mister51213/DX11Port_SoftShadows
       
      Also, for reference, here's tutorial #40 which has normal shadows but no blur, which I also ported, and it works perfectly.
      https://github.com/mister51213/DX11Port_ShadowMapping
       
    • By xhcao
      Is Direct3D 11 an api function like glMemoryBarrier in OpenGL? For example, if binds a texture to compute shader, compute shader writes some values to texture, then dispatchCompute, after that, read texture content to CPU side. I know, In OpenGL, we could call glMemoryBarrier before reading to assure that texture all content has been updated by compute shader.
      How to handle incoherent memory access in Direct3D 11? Thank you.
    • By _Engine_
      Atum engine is a newcomer in a row of game engines. Most game engines focus on render
      techniques in features list. The main task of Atum is to deliver the best toolset; that’s why,
      as I hope, Atum will be a good light weighted alternative to Unity for indie games. Atum already
      has fully workable editor that has an ability to play test edited scene. All system code has
      simple ideas behind them and focuses on easy to use functionality. That’s why code is minimized
      as much as possible.
      Currently the engine consists from:
      - Scene Editor with ability to play test edited scene;
      - Powerful system for binding properties into the editor;
      - Render system based on DX11 but created as multi API; so, adding support of another GAPI
        is planned;
      - Controls system based on aliases;
      - Font system based on stb_truetype.h;
      - Support of PhysX 3.0, there are samples in repo that use physics;
      - Network code which allows to create server/clinet; there is some code in repo which allows
        to create a simple network game
      I plan to use this engine in multiplayer game - so, I definitely will evolve the engine. Also
      I plan to add support for mobile devices. And of course, the main focus is to create a toolset
      that will ease games creation.
      Link to repo on source code is - https://github.com/ENgineE777/Atum
      Video of work process in track based editor can be at follow link: 
       
       

    • By mister345
      I made a spotlight that
      1. Projects 3d models onto a render target from each light POV to simulate shadows
      2. Cuts a circle out of the square of light that has been projected onto the render target
      as a result of the light frustum, then only lights up the pixels inside that circle 
      (except the shadowed parts of course), so you dont see the square edges of the projected frustum.
       
      After doing an if check to see if the dot product of light direction and light to vertex vector is greater than .95
      to get my initial cutoff, I then multiply the light intensity value inside the resulting circle by the same dot product value,
      which should range between .95 and 1.0.
       
      This should give the light inside that circle a falloff from 100% lit to 0% lit toward the edge of the circle. However,
      there is no falloff. It's just all equally lit inside the circle. Why on earth, I have no idea. If someone could take a gander
      and let me know, please help, thank you so much.
      float CalculateSpotLightIntensity(     float3 LightPos_VertexSpace,      float3 LightDirection_WS,      float3 SurfaceNormal_WS) {     //float3 lightToVertex = normalize(SurfacePosition - LightPos_VertexSpace);     float3 lightToVertex_WS = -LightPos_VertexSpace;          float dotProduct = saturate(dot(normalize(lightToVertex_WS), normalize(LightDirection_WS)));     // METALLIC EFFECT (deactivate for now)     float metalEffect = saturate(dot(SurfaceNormal_WS, normalize(LightPos_VertexSpace)));     if(dotProduct > .95 /*&& metalEffect > .55*/)     {         return saturate(dot(SurfaceNormal_WS, normalize(LightPos_VertexSpace)));         //return saturate(dot(SurfaceNormal_WS, normalize(LightPos_VertexSpace))) * dotProduct;         //return dotProduct;     }     else     {         return 0;     } } float4 LightPixelShader(PixelInputType input) : SV_TARGET {     float2 projectTexCoord;     float depthValue;     float lightDepthValue;     float4 textureColor;     // Set the bias value for fixing the floating point precision issues.     float bias = 0.001f;     // Set the default output color to the ambient light value for all pixels.     float4 lightColor = cb_ambientColor;     /////////////////// NORMAL MAPPING //////////////////     float4 bumpMap = shaderTextures[4].Sample(SampleType, input.tex);     // Expand the range of the normal value from (0, +1) to (-1, +1).     bumpMap = (bumpMap * 2.0f) - 1.0f;     // Change the COORDINATE BASIS of the normal into the space represented by basis vectors tangent, binormal, and normal!     float3 bumpNormal = normalize((bumpMap.x * input.tangent) + (bumpMap.y * input.binormal) + (bumpMap.z * input.normal));     //////////////// LIGHT LOOP ////////////////     for(int i = 0; i < NUM_LIGHTS; ++i)     {     // Calculate the projected texture coordinates.     projectTexCoord.x =  input.vertex_ProjLightSpace[i].x / input.vertex_ProjLightSpace[i].w / 2.0f + 0.5f;     projectTexCoord.y = -input.vertex_ProjLightSpace[i].y / input.vertex_ProjLightSpace[i].w / 2.0f + 0.5f;     if((saturate(projectTexCoord.x) == projectTexCoord.x) && (saturate(projectTexCoord.y) == projectTexCoord.y))     {         // Sample the shadow map depth value from the depth texture using the sampler at the projected texture coordinate location.         depthValue = shaderTextures[6 + i].Sample(SampleTypeClamp, projectTexCoord).r;         // Calculate the depth of the light.         lightDepthValue = input.vertex_ProjLightSpace[i].z / input.vertex_ProjLightSpace[i].w;         // Subtract the bias from the lightDepthValue.         lightDepthValue = lightDepthValue - bias;         float lightVisibility = shaderTextures[6 + i].SampleCmp(SampleTypeComp, projectTexCoord, lightDepthValue );         // Compare the depth of the shadow map value and the depth of the light to determine whether to shadow or to light this pixel.         // If the light is in front of the object then light the pixel, if not then shadow this pixel since an object (occluder) is casting a shadow on it.             if(lightDepthValue < depthValue)             {                 // Calculate the amount of light on this pixel.                 float lightIntensity = saturate(dot(bumpNormal, normalize(input.lightPos_LS[i])));                 if(lightIntensity > 0.0f)                 {                     // Determine the final diffuse color based on the diffuse color and the amount of light intensity.                     float spotLightIntensity = CalculateSpotLightIntensity(                         input.lightPos_LS[i], // NOTE - this is NOT NORMALIZED!!!                         cb_lights[i].lightDirection,                          bumpNormal/*input.normal*/);                     lightColor += cb_lights[i].diffuseColor*spotLightIntensity* .18f; // spotlight                     //lightColor += cb_lights[i].diffuseColor*lightIntensity* .2f; // square light                 }             }         }     }     // Saturate the final light color.     lightColor = saturate(lightColor);    // lightColor = saturate( CalculateNormalMapIntensity(input, lightColor, cb_lights[0].lightDirection));     // TEXTURE ANIMATION -  Sample pixel color from texture at this texture coordinate location.     input.tex.x += textureTranslation;     // BLENDING     float4 color1 = shaderTextures[0].Sample(SampleTypeWrap, input.tex);     float4 color2 = shaderTextures[1].Sample(SampleTypeWrap, input.tex);     float4 alphaValue = shaderTextures[3].Sample(SampleTypeWrap, input.tex);     textureColor = saturate((alphaValue * color1) + ((1.0f - alphaValue) * color2));     // Combine the light and texture color.     float4 finalColor = lightColor * textureColor;     /////// TRANSPARENCY /////////     //finalColor.a = 0.2f;     return finalColor; }  
      Light_vs.hlsl
      Light_ps.hlsl
  • Popular Now