Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. 3D Textures support on all backends?
Forum Updated to NodeBB v4.3 + New Features

3D Textures support on all backends?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 138 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • febiodeveloperF Offline
    febiodeveloperF Offline
    febiodeveloper
    wrote last edited by
    #1

    Hello,

    I'm developing a 3D image volume renderer using the RHI framework. I'm using Qt 6.9.3. Using the OpenGL backend, everything is fine: the 3D image is visible and the shader performs as expected.
    Unfortunately, on any of the other backends (Vulkan, D3D, Metal), the image is not visible. The shader seems to work, except that it samples always returns vec4(0,0,0,0) (so nothing is shown on the screen). This makes me think that the image is not uploaded correctly, but I don't know what the problem could be. This is my upload code:

    	const uint8_t* base = data.data();
    
    	QRhiTextureUploadDescription desc;
    	std::vector<QRhiTextureUploadEntry> entries(slices);
    	for (int z = 0; z < slices; ++z) {
    
    		const uint8_t* slicePtr = base + qint64(z) * (sliceSize);
    		QRhiTextureSubresourceUploadDescription subRes = { slicePtr, (quint32) sliceSize };
    		entries[z] = { z, 0, subRes };
    	}
    	desc.setEntries(entries.begin(), entries.end());
    
    	u->uploadTexture(texture.get(), desc);
    
    

    The data is an std::vector<uint8_t> that holds the image data. My main test image is a 100x100x100 8-bit grayscale image. I'm using the QRhiTexture::Format::R8 format. I've verified that all the relevant features (R8, ThreeDimensionalTexture) are supported on the other backends, so I'm quite puzzled why it only works for OpenGL.
    I would appreciate it if anyone can provide some insight.
    Thanks in advance!

    1 Reply Last reply
    1
    • J Offline
      J Offline
      Jonas Karlsson
      wrote last edited by
      #2

      First I'd suggest trying a more recent version of Qt and if that does not help then post the full code here or make a small reproducer to narrow down the issue.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SiennaBloom
        Banned
        wrote last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • febiodeveloperF Offline
          febiodeveloperF Offline
          febiodeveloper
          wrote last edited by
          #4

          Sorry took me a while to get back to this. I found the error and it turns out I did not use consistent uniform bindings between my vertex and fragment shader, you know, one of those ID-10-T errors :). Interestingly, OpenGL didn't seem to care and worked fine regardless.
          Anyways, the volume rendering is now working on all backends.

          1 Reply Last reply
          3
          • febiodeveloperF febiodeveloper has marked this topic as solved

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved