Jump to content
  • Advertisement
Sign in to follow this  
Dethtoll

Volume texture interpolation, HLSL, and efficiency

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

I'm fairly new to DirectX and HLSL, and I have a question about volume textures. I'm working on an image composition project that requires weighted sums of 16 (or potentially more) equally-sized floating-point textures. My program would be cleaner and more flexible if I had control over the number of textures instead of simply creating 16+ samplers that differ only by their texture. Only a single mipmap texture is required per texture. My idea is to pack all the textures into a single volume texture, which would be sampled at integer depth values. This leads to my main question: + Are volume textures less efficient than standard 2D textures if they're sampled at integer depths? In other words, if I sample the volume at integer depth n, will the textures at depth n-1 and n+1 still be sampled? Maybe more clearly: Can I point sample the depth and still filter the height and width bilinearly?

Share this post


Link to post
Share on other sites
Advertisement
Alright, looks like I was confused about a few things there. The depth value of texture volumes has a range of [0,1], so I can't sample at integer depths anyways.

Is there any way to have a set of textures in HLSL without creating a sampler for each? It just seems messy to have to manually create n samplers, and it would be nice to be able to iterate over the textures in a for loop rather than repeating code.

Would it be possible to use the tex2Dlod intrinsic for this purpose? Is it even possible to create mipmap levels with the same dimensions as the original image?

Thanks in advance.

Share this post


Link to post
Share on other sites
Is it necessary to even create a volume texture? What about just arranging them in a 4x4 pattern on a single flat texture, and using texture coordinate offsets to do the sub-indexing?

Of course, you could break the process down into binding/sampling, say, 4 textures at a time and using an intermediate texture result. Or 1 at a time, for that matter. All depends on exactly what you're doing.

Share this post


Link to post
Share on other sites
That's actually what I ended up doing. I just packed them into a single texture, with a 1-pixel extended border around each for correct bilinear filtering.

Not sure why I was so eager to jump into 3 dimensions...

Share this post


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

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!