Jump to content
  • Advertisement
Sign in to follow this  
kolarz3

DX11 DirectX 11 mipmaps implementation

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

Helo guys, I try to turn on opacity texture. In close model look good, but in the distance I see artifacts. Maybe mipmaps help ? I try to turn on this mipmap but I dont known that this work ? This is clip on yt : 

.

D3DX11_IMAGE_LOAD_INFO info;
//ZeroMemory( &info, sizeof(info) );
info.BindFlags= D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
info.MiscFlags=D3D11_RESOURCE_MISC_GENERATE_MIPS;
info.MipLevels=D3DX11_DEFAULT ;

D3DX11CreateShaderResourceViewFromFile( d3d11Device,sw,&info, NULL, &texture, NULL );//diffuse
D3DX11CreateShaderResourceViewFromFile( d3d11Device,sw,&info, NULL, &texture2, NULL );/opacity

D3D11_SAMPLER_DESC sampDesc;
ZeroMemory( &sampDesc, sizeof(sampDesc) );
sampDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
sampDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
sampDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
sampDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
sampDesc.MinLOD = 0;
sampDesc.MaxLOD = D3D11_FLOAT32_MAX;
d3d11Device->CreateSamplerState( &sampDesc, &CubesTexSamplerState );//sampler state of textures

//This call per frame
d3d11DevCon->GenerateMips(texture);
d3d11DevCon->GenerateMips(texture2);

//PS fragment
if(opacity.Sample( ObjSamplerState, input.UVcord ).x>=0.5)psOut.Color=diffuse.Sample( ObjSamplerState, input.UVcord );
else clip(psOut.Color.a-1.1);

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!