MHDoom finished

Discuss anything not covered by any of the other categories.
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: MHDoom finished

Post by revelator »

Hmm checked out if at all possible to add bfg's GLSL backend and it is.

There are a few things that will be a problem though.

It uses some new types from idlib so we probably have to use the idlib from BFG.
matrixes are GLSL shaders now so huge rewrite incomming.
draw_common.cpp is now tr_backend_draw.cpp and other types now also have other names or are in different pkaces.
a few functions have been removed like glasswarp and diffuse cubemaps.

the good things.

material.cpp is pretty much still the same as vanilla just modified to use the GLSL find shader function and it has megatextures removed ( was newer used anyway "old version").
treb's shadowmapping, might even be possible to use his depth code to implement real SSAO.

still it will take time and im not sure if im up to the task without help.
Productivity is a state of mind.
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: MHDoom finished

Post by revelator »

Tbh im planning on using the working shaders from sikkmod like HDR/Bloom LUT (possibly lensflares and sunshafts also) and adding it to venoms menu,
as an update to Doom3 (maybe put it under an advanced setting in the video menu ?).
Could allways add SSAO setiings later when the bugs with it have been fixed :) .

With a little help from someone at Doom3world i fixed the bug with starting a new game with different skill levels not working so that part is ok,
still todo would be coercing venoms menu to overwrite old savegames (it cant atm you have to create new save) and fixing an old bug where the id logo would refuse to fade out after the id logo video.
besides these small buggers its a rather nice upgrade of the old Doom3 menu :).

I would like to ask sikkpin for permission but since doom3world is down i hope he stills visits here.
Productivity is a state of mind.
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: MHDoom finished

Post by revelator »

Tried finding good shot of the weird shadow bug and this is the best so far look closely

Image

notice the rail is casting a semitransparent white shadow ? i pointed my crosshair at it :(
Productivity is a state of mind.
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: MHDoom finished

Post by toneddu2000 »

I cannot understand which object is producing shadow. What do you mean for "rail"? The rusty curved pipe?
Meadow Fun!! - my first commercial game, made with FTEQW game engine
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: MHDoom finished

Post by revelator »

The handrail or banister right in my crosshair :) sorry forgot the name earlier im not from UK ;)

if you look down at the floor on that pic you can see a white shadow from it.
Productivity is a state of mind.
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: MHDoom finished

Post by revelator »

Image

marked it ;)
Productivity is a state of mind.
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: MHDoom finished

Post by toneddu2000 »

ak ok thanks now I've seen it. It's even weirder, because the handrail which could cast the shadow is too far from the shadow itself! :shock:
Are you sure it's not related to the material which the object is composed of? I mean, some material script which has some effect that could cause that bug?
Meadow Fun!! - my first commercial game, made with FTEQW game engine
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: MHDoom finished

Post by revelator »

it seems to be a mix of things for instance sikkpins interaction shader allmost newer causes this but it does happen occasionally, also it only sems to happen in certain areas so im starting to suspect
a fault in a map or brushmodel, maybe a bug in the tools used (dmap i think ?)
strangely enough the function Doom3 uses for shadow occlusion lies in the dmap compiler code and it seems to be from a dev at nvidia Oo atleast thats what the comment says.

hmm just checked and its not in dmap but it is from nvidia

// this is the code from Cass at nvidia, it is more precise, but slower
return R_CalcIntersectionScissor( lightDef, entityDef, tr.viewDef );

hmm gonna try and see what it does :) need to set r_useInteractionScissors to -2 before it uses the nvidia scissors.
Productivity is a state of mind.
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: MHDoom finished

Post by revelator »

Heh ok this cvar was rather interresting at -2 it shows the casted shadows as colored lines at -1 it uses the nvidia scissors (which crash the game btw ouch) at 1 it just uses normal scissors and at 2 it uses portal scissors as well. Strangely enough at the debug setting -2 it uses the nvidia code only like at -1 and does not crash there hmm ?!?.
Productivity is a state of mind.
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: MHDoom finished

Post by revelator »

Gonna share this might be usefull for other modders.

put these in sys_public.h

Code: Select all

// Revelator: If we're not using GNU C, elide __attribute__
#ifndef __GNUC__
#define  __attribute__(x)				/* NOTHING */
#endif
#define id_attribute(x)					__attribute__(x)

// Revelator: workaround for msvc's missing __attribute__((packed))
// only used in snd_local.h which will need some rewriting.
#ifdef _MSC_VER
#  define PACKED(type) \
	__pragma(pack(push, 1)) type __pragma(pack(pop))
#elif defined(__GNUC__)
#  define PACKED(type) \
	id_attribute((packed)) type
#endif
in snd_local.h get rid of the pragma(pack) and pragma(pop) macros.

now change the structs to look like this.

Code: Select all

PACKED(
struct pcmwaveformat_s
{
	waveformat_t	wf;
	word			wBitsPerSample;
});
instead of

Code: Select all

struct pcmwaveformat_s
{
	waveformat_t	wf;
	word			wBitsPerSample;
}PACKED;
this also works for linux ;)
Productivity is a state of mind.
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: MHDoom finished

Post by revelator »

went a bit further with the above heres the final version

Code: Select all

// Revelator: workaround for msvc's missing __attribute__( ( packed ) )
// only used in snd_local.h which will need some rewriting.
#ifdef _MSC_VER
#  define PACKED( __type__ ) \
	__pragma( pack( push, 1 ) ) struct __type__ __pragma( pack( pop ) )
#elif defined(__GNUC__)
#  define PACKED( __type__ ) \
	id_attribute( ( packed ) ) struct __type__
#endif
and the structs that use it

Code: Select all

/*
===================================================================================

	General extended waveform format structure.
	Use this for all NON PCM formats.

===================================================================================
*/

PACKED( waveformatex_s
{
	word    wFormatTag;        /* format type */
	word    nChannels;         /* number of channels (i.e. mono, stereo...) */
	dword   nSamplesPerSec;    /* sample rate */
	dword   nAvgBytesPerSec;   /* for buffer estimation */
	word    nBlockAlign;       /* block size of data */
	word    wBitsPerSample;    /* Number of bits per sample of mono data */
	word    cbSize;            /* The count in bytes of the size of
                                    extra information (after cbSize) */
} );

typedef waveformatex_s waveformatex_t;

/* OLD general waveform format structure (information common to all formats) */
PACKED( waveformat_s
{
	word    wFormatTag;        /* format type */
	word    nChannels;         /* number of channels (i.e. mono, stereo, etc.) */
	dword   nSamplesPerSec;    /* sample rate */
	dword   nAvgBytesPerSec;   /* for buffer estimation */
	word    nBlockAlign;       /* block size of data */
} );

typedef waveformat_s waveformat_t;

/* flags for wFormatTag field of WAVEFORMAT */
enum
{
	WAVE_FORMAT_TAG_PCM		= 1,
	WAVE_FORMAT_TAG_OGG		= 2
};

/* specific waveform format structure for PCM data */
PACKED( pcmwaveformat_s
{
	waveformat_t	wf;
	word			wBitsPerSample;
} );

typedef pcmwaveformat_s pcmwaveformat_t;

#ifndef mmioFOURCC
#define mmioFOURCC(ch0, ch1, ch2, ch3)				\
		((dword) (byte) (ch0) | ((dword) (byte) (ch1) << 8) |	\
		((dword) (byte) (ch2) << 16) | ((dword) (byte) (ch3) << 24))
#endif

#define fourcc_riff     mmioFOURCC('R', 'I', 'F', 'F')

PACKED( waveformatextensible_s
{
	waveformatex_t    Format;
	union
	{
		word wValidBitsPerSample;       /* bits of precision  */
		word wSamplesPerBlock;          /* valid if wBitsPerSample==0*/
		word wReserved;                 /* If neither applies, set to zero*/
	} Samples;
	dword           dwChannelMask;      /* which channels are */
	/* present in stream  */
	int            SubFormat;
} );

typedef waveformatextensible_s waveformatextensible_t;

typedef dword fourcc;

/* RIFF chunk information data structure */
PACKED( mminfo_s
{
	fourcc			ckid;           /* chunk ID */
	dword			cksize;         /* chunk size */
	fourcc			fccType;        /* form type or list type */
	dword			dwDataOffset;   /* offset of data portion of chunk */
} );

typedef mminfo_s mminfo_t;
Works beautifully :)
Productivity is a state of mind.
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: MHDoom finished

Post by revelator »

Seems i finally nailed the shadow bug, was a bad C++ reinterpret_cast<evil>(666) grrrr.

if not sure stay the hell away from using it unless a static or const_cast cant do it. dynamic_cast is rather seldomly used fortunatly and thank god for that.
const_cast are used for throwing away the const incase you need it recast to a non cont type ( messy stuff this ).
static_cast mostly works like a C style cast.

damn thing took me 24 hours to hunt down :( newer making that mistake again i swear.
Productivity is a state of mind.
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: MHDoom finished

Post by toneddu2000 »

cool man! I wish I had your skills! :)
Meadow Fun!! - my first commercial game, made with FTEQW game engine
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: MHDoom finished

Post by revelator »

If i was truely skillfull i would have avoided a bug like that in the first place ;) but thanks for the nice words :)

btw could anyone test if doom3 crashes for them if using r_useinteractionscissors -1 or -2 ? it does not happen at once so let it run a while.
these values are mostly for debugging scissors but i find it kinda odd that they cause crashes.
Productivity is a state of mind.
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Re: MHDoom finished

Post by revelator »

Hmm debugging it turned out that a NULL pointer is passed to the interaction from somewhere in the frustum code when using the nvidia scissors,
could'nt get much more than that out of it :S but it has to be local in tr_shadowbounds.cpp since id's scissors dont seem to cause this.
Productivity is a state of mind.
Post Reply