Skip to content

Commit dfa6c9e

Browse files
committed
added docs for 3d textures
1 parent 4dec0ba commit dfa6c9e

File tree

5 files changed

+69
-8
lines changed

5 files changed

+69
-8
lines changed

Docs/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Version 2.1 x64 Windows: [Download](https://github.com/kopaka1822/ImageViewer/ra
4040
* [lat-long cubemap conversion](#Lat-Long-Cubemap-Conversion)
4141
* [mipmap generation](mipmaps.md) (including box filter and lanczos)
4242
* [customisable filter](#Custom-HLSL-Compute-Shader-Filter) in HLSL
43-
* [3D textures](#3D-Textures)
43+
* [3D (volumetric) textures](#3D-Textures)
4444
* computations are done in linear color space
4545

4646
## View Modes

Docs/volumetric.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# 3D Textures
2+
3+
The image viewer support 3D textures from the dds and ktx file format. If you dont have 3D textures in the required format see [Creating 3D Textures](#Creating-3D-Textures).
4+
5+
## View Modes
6+
7+
After opening a 3D texture, they will be displayed in the "Volume" view (see status bar next to the eye icon). If you want to inspect only a single slice you can select the "Single" view and navigate through each slice with the "Silce Index" that can be set inside the "Images" tab on the right side.
8+
9+
The volume view provides the following display options:
10+
* Shading: Enables simple flat shading
11+
* Hide Internals (for Transparency): Hides the insides of transparent areas so that only the hull is visible
12+
* Alpha Is Coverage (for Transparency): When disabled, assumes that light loses colored instead of monochrome intensity when shinging through colored surfaces.
13+
* Slice: Configures the range of displayed slices (cuts through the volume)
14+
15+
### Issues with Linear Interpolation
16+
When enabling linear interpolation, a ray marching algorithm is used to determine the color. Possible Issues:
17+
* Dark/Invalid Outlines: Those outlines can appear if the color channel of the texture is not correctly configured for fully transparent voxels (alpha = 0). In this case, the color of those invalid voxels bleeds over to non transparent voxels because linear interpolation is used. To fix this issue, apply the "fix_alpha" filter in the "Filter" tab.
18+
19+
## Creating 3D Textures
20+
21+
If you dont have the tools to create 3D dds or ktx textures you can use the image viewer to create a 3D textures from multiple 2D textures:
22+
* Go to File->Import as Array/3D
23+
* Drag your 2D textures into the list box
24+
* Click "To Texture3D" to convert the seperate 2D textures into a merged 3D texture
25+
26+
Alternatively, you can convert a 2D texture array to a 3D texture via "Tools->Texture Array to Texture3D" after loading the texture array.
27+
28+
If you want to create a 3D texture programatically you can use [GLI](https://github.com/g-truc/gli) to create dds/ktx files. This is a minimal example on how to create and save 3d textures:
29+
30+
```c++
31+
#include <gli/gli.hpp>
32+
33+
int main() {
34+
// 3d texture with rgba 8 bit srgb format, 32x32x32 resolution and 1 mipmap
35+
gli::texture3d tex(gli::format::FORMAT_RGBA8_SRGB_PACK8, gli::extent3d(32, 32, 32), 1);
36+
37+
// raw access to pixels
38+
uint8_t* pixels = reinterpret_cast<uint8_t*>(tex.data());
39+
// set pixel at (0, 0, 0) to white (0xFFFFFFFF)
40+
tex.store({ 0, 0, 0 }, 0, 0xFFFFFFFF;);
41+
42+
gli::save_dds(tex, "volume.dds");
43+
return 0;
44+
}
45+
```

DxImageLoader/DxImageLoader.vcxproj

+9
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,15 @@
310310
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\help</DestinationFolders>
311311
</CopyFileToFolders>
312312
</ItemGroup>
313+
<ItemGroup>
314+
<CopyFileToFolders Include="..\Docs\volumetric.md">
315+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
316+
<FileType>Document</FileType>
317+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
318+
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\help</DestinationFolders>
319+
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\help</DestinationFolders>
320+
</CopyFileToFolders>
321+
</ItemGroup>
313322
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
314323
<ImportGroup Label="ExtensionTargets">
315324
</ImportGroup>

DxImageLoader/DxImageLoader.vcxproj.filters

+3-4
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,9 @@
180180
<CopyFileToFolders Include="..\Docs\img\mip_compare.png">
181181
<Filter>Docs\img</Filter>
182182
</CopyFileToFolders>
183-
</ItemGroup>
184-
<ItemGroup>
185-
<None Include="..\Docs\statistics.md">
183+
<CopyFileToFolders Include="..\Docs\statistics.md" />
184+
<CopyFileToFolders Include="..\Docs\volumetric.md">
186185
<Filter>Docs</Filter>
187-
</None>
186+
</CopyFileToFolders>
188187
</ItemGroup>
189188
</Project>

ImageViewer/Views/MenuBar.xaml

+11-3
Original file line numberDiff line numberDiff line change
@@ -404,19 +404,27 @@
404404
<system:String>help/filter_manual.md</system:String>
405405
</MenuItem.CommandParameter>
406406
</MenuItem>
407+
<MenuItem
408+
Header="Statistics"
409+
Command="{Binding HelpCommand}">
410+
<MenuItem.CommandParameter>
411+
<system:String>help/statistics.md</system:String>
412+
</MenuItem.CommandParameter>
413+
</MenuItem>
414+
415+
<Separator/>
407416
<MenuItem
408417
Header="Mipmaps"
409418
Command="{Binding HelpCommand}">
410419
<MenuItem.CommandParameter>
411420
<system:String>help/mipmaps.md</system:String>
412421
</MenuItem.CommandParameter>
413422
</MenuItem>
414-
<Separator/>
415423
<MenuItem
416-
Header="Statistics"
424+
Header="3D Textures"
417425
Command="{Binding HelpCommand}">
418426
<MenuItem.CommandParameter>
419-
<system:String>help/statistics.md</system:String>
427+
<system:String>help/volumetric.md</system:String>
420428
</MenuItem.CommandParameter>
421429
</MenuItem>
422430
</MenuItem>

0 commit comments

Comments
 (0)