Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Quad, M_D), 1,217 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Support for volume textures #348621
11/28/10 17:04
11/28/10 17:04
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline OP
Expert
Matt_Aufderheide  Offline OP
Expert
M

Joined: Oct 2003
Posts: 4,131
As far as I can tell there is no way to load a volume texture in A8...this would be nice. I can do it in a dll but it would be nice if there was a native function.


Sphere Engine--the premier A6 graphics plugin.
Re: Support for volume textures [Re: Matt_Aufderheide] #348634
11/28/10 20:15
11/28/10 20:15
Joined: Mar 2006
Posts: 2,252
Hummel Offline
Expert
Hummel  Offline
Expert

Joined: Mar 2006
Posts: 2,252
signed! ChrisB told me that he had done this before with DX funcs but I´m still to stupid to use those...

Re: Support for volume textures [Re: Hummel] #348639
11/28/10 21:01
11/28/10 21:01
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Signed. I'm sick of seeing white-papers that mention volume textures and never looking at them again.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Support for volume textures [Re: JibbSmart] #348644
11/28/10 21:23
11/28/10 21:23
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Please tell me one common application for volume textures, I am not TOO familiar with them.

I thought once that they can be quite attractive for storing several maps (diffuse, normal, specular, etc.) into one texture, but after I heared that mipmaps are done also on the layers (e.g. mip0 512x512x4 --> mip1 512x512x2), they were quite uninteresting for me. Isn't it so??

Thanks for your patience.

[EDIT] Or are there other ways to store several maps in one texture without losing layers on mip maps with volume textures??

Last edited by HeelX; 11/28/10 21:23.
Re: Support for volume textures [Re: HeelX] #348645
11/28/10 21:30
11/28/10 21:30
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
i know an interesting (but not very common) application for volume textures. you can load the frames of a video into a cube and then watch it from the other sides (for example left to right instead of the intended front to back). this leads to extremely interesting effects as it swaps the time and space axis of the video. laugh (i experimented with something like that many years ago but it wasn't realtime. with a volume texture you could easily make it realtime.)

Re: Support for volume textures [Re: ventilator] #348658
11/29/10 02:21
11/29/10 02:21
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline OP
Expert
Matt_Aufderheide  Offline OP
Expert
M

Joined: Oct 2003
Posts: 4,131
well, a common application is 3D noise. One can easily make a 3D noise volume texture of say, 64*64*64 and sample it using tex3D(3dsampler,position.xyz). Because you are sampling a 3D texture it is consistent across space and time.

3D noise is useful for things like volumetric fog, fractal terrain, planets, etc.

Currently I'm working a planet renderer in A8 using 3D noise to procedurally generate terrain on a sphere.




Sphere Engine--the premier A6 graphics plugin.
Re: Support for volume textures [Re: Matt_Aufderheide] #348683
11/29/10 13:59
11/29/10 13:59
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Ok, volume textures won't be hard to add and will be supported.

Re: Support for volume textures [Re: jcl] #357672
02/08/11 01:42
02/08/11 01:42
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Heyo, I don't like to bump stuff, especially when you've already said "yes", but I just haven't seen any mention of this on forecast or the beta page, and it's something I'm really itching for now that I use noise textures for explosion effects (and they'd be much more versatile with volume textures).

I know you guys have a project you're working on, but is there any chance you can think of an excuse to use volume textures in Dagobert? laugh

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Support for volume textures [Re: JibbSmart] #357697
02/08/11 12:24
02/08/11 12:24
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
Well, I don´t want to give jcl a reason to not implement it, but for now, you can go with something like this, Julz:

Code:
#ifndef shd_voltex_c
#define shd_voltex_c

#include <d3d9.h>

#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

// Creates a volume texture from the given filename
LPDIRECT3DVOLUMETEXTURE9 shd_voltex_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;
}

#endif



That creates the volume texture which then only has to be linked to a shader, like this for example:
Code:
// Material event assigning the texture to the shader
void shd_voltex_set()
{
	LPD3DXEFFECT A7_eff = (LPD3DXEFFECT)render_d3dxeffect;
	if(A7_eff != NULL)
	{
		A7_eff->SetTexture("voltex", (LPDIRECT3DVOLUMETEXTURE9)mtl.skill1); //"voltex" is the textures name within the shader, mtl.skill1 is missused as a pointer to the texture
	}
}

//Usage:
somematerial.event = shd_matevent_colorGrading; 
somematerial.flags |= ENABLE_VIEW; //for a pp effect, probably ENABLE_RENDER when applied to entities
somematerial.skill1 = (var)shd_voltex_create("yourvoltex.dds"); //creation of the volumetexture, returns LPDIRECT3DVOLUMETEXTURE9



I am not sure, but I think that it will automatically be destroyed by, when the engine destroys the directx interface or whatever thingy.

Re: Support for volume textures [Re: Slin] #357720
02/08/11 14:21
02/08/11 14:21
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Wow, Nils, thanks for that! I'll have a look into using it laugh

Jibb


Formerly known as JulzMighty.
I made KarBOOM!

Moderated by  aztec, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1