how to load texture file
dwlcj opened this issue · comments
how to load HDR Environment mapping(.hdr texture file) for VisRTX HDRILight.
how to load texture file for VisRTX Material.
Hey, thanks for reaching out!
VisRTX itself does not include any image file loading code, you'll need a separate library for that. The OptiX Advanced Samples include HDR loading code for example.
Once you have the raw pixel data loaded, you can use VisRTX::Context::CreateTexture(const Vec2ui& size, TextureFormat format, const void* src)
(or VisRTX::Texture::SetPixels
later on).
For the HDR image you'll likely want the RGBA32F
or RGB32F
texture format using floats per channel.
Also note that there is nothing to be done for MDL materials with hardcoded texture paths (something like texture_2d("path/to/image.jpg")
; these textures are loaded automatically by the MDL SDK.
I should probably add a small sample showing resource loading, including an MDL material from disk. The current samples only use in-memory MDL source, but it's easily possible to load an MDL file from disk, e.g., from vMaterials, something like this:
const char** modulePaths = { "path/to/vMaterials" };
CreateMDLMaterial("::Category::MaterialName", nullptr, 0, 1 /*numModulePaths*/, modulePaths);
Hope that helps!
Tim
Thanks, Tim.