As far as i know you can't simply use BMAP* the traditional way to load volume textures.
Here's how i do it:

Code:
STRING* sc_deferredLighting_sBRDFLUT = "shadec/tex/sc_deferredLighting_LUT.dds";
LPDIRECT3DVOLUMETEXTURE9* sc_deferredLighting_texBRDFLUT;

LPDIRECT3DVOLUMETEXTURE9 sc_volumeTexture_create(STRING *filename)
{
	LPDIRECT3DVOLUMETEXTURE9 temptex;
	HRESULT res = D3DXCreateVolumeTextureFromFile((LPDIRECT3DDEVICE9)pd3ddev, _chr(filename), &temptex);
	if(res != S_OK)
	{
		printf("error: %x", res);
		return NULL;
	}
	return temptex;
}

//create brdf LUT
if(!sc_deferredLighting_texBRDFLUT) sc_deferredLighting_texBRDFLUT = sc_volumeTexture_create(sc_deferredLighting_sBRDFLUT);

//In your material event
LPD3DXEFFECT pEffect = (LPD3DXEFFECT)render_d3dxeffect;
pEffect->SetTexture("texBRDFLut", sc_deferredLighting_texBRDFLUT); //assign volumetric brdf lut



I think you can also directly set it to BMAP.d3dtex once you loaded it using sc_volumeTexture_create() but i'm not sure.

The texcoords for fetching the volume slide are in range 0-1. In order to fetch a slide from a volume texture with a depth of 32 you can fetch that by x/32.
Also, if i remember correctly, you always have to use a power of 2 for your volume depth. Volume textures with 3,5,6,7,9,etc slides won't work. I may be wrong on this, but something in my mind tells me it was this way when i used volume textures with gamestudio.

Hope this helps! laugh

[edit] Here's the missing stuff
Code:
// Original code by Nils Daumann | www.slindev.com
// http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=357697&Main=42496#Post357697

#undef INTERFACE
#define INTERFACE IDirect3DTexture9

DECLARE_INTERFACE_(IDirect3DVolumeTexture9, IDirect3DBaseTexture9)
{
    /*** IUnknown methods ***/
    STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE;
    STDMETHOD_(ULONG,AddRef)(THIS) PURE;
    STDMETHOD_(ULONG,Release)(THIS) PURE;

    /*** IDirect3DBaseTexture9 methods ***/
    STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE;
    STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE;
    STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE;
    STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE;
    STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE;
    STDMETHOD_(DWORD, GetPriority)(THIS) PURE;
    STDMETHOD_(void, PreLoad)(THIS) PURE;
    STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE;
    STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE;
    STDMETHOD_(DWORD, GetLOD)(THIS) PURE;
    STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE;
    STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE;
    STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE;
    STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE;
    STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DSURFACE_DESC *pDesc) PURE;
    STDMETHOD(GetSurfaceLevel)(THIS_ UINT Level,void** ppSurfaceLevel) PURE;//IDirect3DSurface9
    STDMETHOD(LockRect)(THIS_ UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE;
    STDMETHOD(UnlockRect)(THIS_ UINT Level) PURE;
    STDMETHOD(AddDirtyRect)(THIS_ CONST RECT* pDirtyRect) PURE;
};

MY_DECLARE_INTERFACE(IDirect3DVolumeTexture9)
typedef IDirect3DVolumeTexture9 *LPDIRECT3DVOLUMETEXTURE9;

HRESULT WINAPI
    D3DXCreateVolumeTextureFromFileA(
        LPDIRECT3DDEVICE9         pDevice,
        LPCSTR                    pSrcFile,
        LPDIRECT3DVOLUMETEXTURE9* ppVolumeTexture);

#define D3DXCreateVolumeTextureFromFile D3DXCreateVolumeTextureFromFileA


Last edited by BoH_Havoc; 04/14/13 11:08.

Shade-C EVO Lite-C Shader Framework