Sign in to follow this  
piluve

DX12 High precision texture.

Recommended Posts

Hello!

 

I´ve been strugling for a while on how to load hight precision textures in DX12. Right now I´ve been using to load my textures "DirectX::CreateDDSTextureFromFile12". There is also the "TextureFromMemory" function but it only accepts 8bits data and I would like to upload a 16bit texture (to be used as a heightmap).

What could I do? Should I try to upload a buffer instead?

Share this post


Link to post
Share on other sites

Which library are you using that has the DDS loading functions? 

 

Most DDS loaders will use the format of the data of the DDS file when creating the texture. So if the DDS file contains 16-bit data, the resulting texture will use a 16-bit format. Does your heightmap DDS file have 16-bit data in it?

Share this post


Link to post
Share on other sites

Which library are you using that has the DDS loading functions? 

 

Most DDS loaders will use the format of the data of the DDS file when creating the texture. So if the DDS file contains 16-bit data, the resulting texture will use a 16-bit format. Does your heightmap DDS file have 16-bit data in it?

 

Hello!

I´m using the DDSTextureLoader (microsoft), I export the heightmap from world machine as a png, then I import it in Photoshop an export it as a DDS texture (using the Nvidia plugin) if I set the DDS to have 8bits it works but with 16  it doesnt, when I load the texture in the program, the function just crash.

Edited by piluve

Share this post


Link to post
Share on other sites

You're talking about the the one from DirectXTex that you can find here? It doesn't have a function called "CreateDDSTextureFromFile12". Perhaps you're using an older version? If so, it would be worth trying the latest to see if it still crashes. If it does still crash then I would share some details of the crash (where in the code is it crashing? What kind of exception is happening? etc.) so that we can help you debug it.

Share this post


Link to post
Share on other sites

Just an aside, if you are compressing your heightmaps to save on texture memory( bandwidth included ), then you may run into issues where compression artifacts may cause visual anomalies when you render the terrain using the texture samples. If you are not compressing the texture and just using the DDS format, then why not just use the PNG, since neither format is going to save you anything.

Share this post


Link to post
Share on other sites

If you are not compressing the texture and just using the DDS format, then why not just use the PNG, since neither format is going to save you anything.

 

Well, DDS is going to save you loading time..

Share this post


Link to post
Share on other sites

You're talking about the the one from DirectXTex that you can find here? It doesn't have a function called "CreateDDSTextureFromFile12". Perhaps you're using an older version? If so, it would be worth trying the latest to see if it still crashes. If it does still crash then I would share some details of the crash (where in the code is it crashing? What kind of exception is happening? etc.) so that we can help you debug it.

 

I guess I was using an older version of it. I found a way to make it work, I export the texture as a one channel floating point texture and it works (while giving a lot of precision).

 

See you!

Share this post


Link to post
Share on other sites

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  

  • Announcements

  • Forum Statistics

    • Total Topics
      628378
    • Total Posts
      2982334
  • Similar Content

    • By Vilem Otte
      So, I've been playing a bit with geometry shaders recently and I've found a very interesting bug, let me show you the code example:
      struct Vert2Geom { float4 mPosition : SV_POSITION; float2 mTexCoord : TEXCOORD0; float3 mNormal : TEXCOORD1; float4 mPositionWS : TEXCOORD2; }; struct Geom2Frag { float4 mPosition : SV_POSITION; nointerpolation float4 mAABB : AABB; float3 mNormal : TEXCOORD1; float2 mTexCoord : TEXCOORD0; nointerpolation uint mAxis : AXIS; float3 temp : TEXCOORD2; }; ... [maxvertexcount(3)] void GS(triangle Vert2Geom input[3], inout TriangleStream<Geom2Frag> output) { ... } So, as soon as I have this Geom2Frag structure - there is a crash, to be precise - the only message I get is:
      D3D12: Removing Device.
      Now, if Geom2Frag last attribute is just type of float2 (hence structure is 4 bytes shorter), there is no crash and everything works as should. I tried to look at limitations for Shader Model 5.1 profiles - and I either overlooked one for geometry shader outputs (which is more than possible - MSDN is confusing in many ways ... but 64 bytes limit seems way too low), or there is something iffy that shader compiler does for me.
      Any ideas why this might happen?
    • By VietNN
      Hi everyone, I am new to Dx12 and working on a game project.
      My game just crash at CreateShaderResourceView with no infomation output in debug log, just: 0xC0000005: Access violation reading location 0x000001F22EF2AFE8.
      my code at current:
      CreateShaderResourceView(m_texture, &desc, *cpuDescriptorHandle);
       - m_texture address is: 0x000001ea3c68c8a0
      - cpuDescriptorHandle address is 0x00000056d88fdd50
      - desc.Format, desc.ViewDimension, Texture2D.MostDetailedMip, Texture2D.MipLevels is initalized.
      The crash happens all times at that stage but not on same m_texture. As I noticed the violation reading location is always somewhere near m_texture address.
      I just declare a temp variable to check how many times CreateShaderResourceView already called, at that moment it is 17879 (means that I created 17879 succesfully), and CreateDescriptorHeap for cpuDescriptorHandle was called 4190, do I reach any limit?
      One more infomation, if I set miplevel of all texture when create to 1 it seem like there is no crash but game quality is bad. Do not sure if it relative or not.
      Anyone could give me some advise ?
    • By VietNN
      Hi all,
      The D3D12_SHADER_RESOURCE_VIEW_DESC has a member Shader4ComponentMapping but I don't really know what is it used for? As several example set its value to D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING. I also read the document on MSDN but still do not understand anything about it.
      https://msdn.microsoft.com/en-us/library/windows/desktop/dn903814(v=vs.85).aspx
      https://msdn.microsoft.com/en-us/library/windows/desktop/dn770406(v=vs.85).aspx
      Anyone could help me, thank you.
    • By DejayHextrix
      Hi, New here. 
      I need some help. My fiance and I like to play this mobile game online that goes by real time. Her and I are always working but when we have free time we like to play this game. We don't always got time throughout the day to Queue Buildings, troops, Upgrades....etc.... 
      I was told to look into DLL Injection and OpenGL/DirectX Hooking. Is this true? Is this what I need to learn? 
      How do I read the Android files, or modify the files, or get the in-game tags/variables for the game I want? 
      Any assistance on this would be most appreciated. I been everywhere and seems no one knows or is to lazy to help me out. It would be nice to have assistance for once. I don't know what I need to learn. 
      So links of topics I need to learn within the comment section would be SOOOOO.....Helpful. Anything to just get me started. 
      Thanks, 
      Dejay Hextrix 
    • By HD86
      As far as I know, the size of XMMATRIX must be 64 bytes, which is way too big to be returned by a function. However, DirectXMath functions do return this struct. I suppose this has something to do with the SIMD optimization. Should I return this huge struct from my own functions or should I pass it by a reference or pointer?
      This question will look silly to you if you know how SIMD works, but I don't.
  • Popular Now