Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


michaelmk86

Member Since 14 Feb 2012
Offline Last Active Aug 08 2013 06:16 PM

Posts I've Made

In Topic: [SharpDX]Loading Multiple Images into a Texture Array

28 May 2013 - 12:11 PM

The simplest way i can think of is this

 

ID3D11ShaderResourceView*  textures[10];

for(int i=0; i<10; i++)
   D3DX11CreateShaderResourceViewFromFile(device, fileName[i], NULL, NULL, &textures[i], NULL);

ID3D11DeviceContext* deviceContext;

deviceContext->PSSetShaderResources(0, 10, textures);

not sure if this is what you are asking.


In Topic: reuse 3d primitives

22 May 2013 - 04:10 AM

I successfully drew a 50x50 area one cube high. FPS is at a whopping 11 -.- so I obviously did something very wrong lol

2500 draw calls and 11fps looks reasonable if you have a very weak and old cpu.

 

just to give you an idea, if you have a good cpu you can make 40K draw calls with 60fps (but in DX11 not dx9)


In Topic: How to get multiple textures on a model in DX11?

21 May 2013 - 03:51 PM

something weird that i notice

struct VertexInputType
{
    float4 position : POSITION;
    float2 tex : TEXCOORD0;
    float3 normal : NORMAL;
    uint material : BLENDINDICES;
    uint InstanceId : SV_InstanceID;
};

 

in this line in the VertexShader

 

output.material = input.material;

 

have around 10% performance impact, I mean all it dose is to pass the an int to the Pixel Shader wacko.png


In Topic: How to get multiple textures on a model in DX11?

21 May 2013 - 02:32 PM

it works now.

 

with the "uint material : BLENDINDICES;" as input in the vertex shader

 

thanks


In Topic: How to get multiple textures on a model in DX11?

21 May 2013 - 07:40 AM

Otherwise you need an index per-vertex telling you which texture to use in the pixel shader. You can add a uint to the input and output of your vertex shader. Your vertex buffer will need to specify the integer index of the texture for each vertex. The vertex shader will just pass the integer through to the pixel shader. Then change your Texture2D to an array like Texture2D mTexture[3] : register(t0); and call mTexture[input.index].Sample().

that is exactly what I need, but can you give a bit more info on how to make this input to the shader?

 

//currently have this
struct VertexInputType
{
    float4 position : POSITION;
    float2 tex : TEXCOORD0;
    float3 normal : NORMAL;
    uint material; // what i need to put here? 
    uint InstanceId : SV_InstanceID;
};

PARTNERS