Page 1 of 1

Hook to transmit 3D normals to DDraw

Posted: Mon Jan 06, 2020 7:14 pm
by JeremyaFr
Hello,
Here is a new hook.

This hook transmits vertex normals to DDraw via the specular component.

The w part of the specular component is set to 1.0f.
The xyz parts contains the normal:
0.0 means -1.0
0.5 means 0.0
1.0 means 1.0

Download link:
xwa_hook_normals.zip

Re: Hook to transmit 3D normals to DDraw

Posted: Tue Jan 07, 2020 1:10 am
by Trevor
Oh wow, I assume this is only of use to Blues ddraw and has no effect on your default one?

Trev

Re: Hook to transmit 3D normals to DDraw

Posted: Tue Jan 07, 2020 5:21 am
by blue_max
That is correct, Trevor. Jeremy -- being the genius that he is -- figured out a way to send smooth normal data down to ddraw in a way that won't disrupt any other version of ddraw. I'm currently adding support for specular shading using this hook, here's a preview:
specular-1.jpg
specular-2.jpg
This information will allow me to implement true normal mapping, replace XWA's shading system and a few other things. In short: there's going to be more eye candy in our near future thanks to Jeremy.

Re: Hook to transmit 3D normals to DDraw

Posted: Tue Jan 07, 2020 2:01 pm
by Rookie_One1
Seriously, with all that we are getting, next versions of XWAUP and DSUCP will look better than most newer games(including what EA did with star wars :p ) :D

Re: Hook to transmit 3D normals to DDraw

Posted: Tue Jan 07, 2020 2:13 pm
by ual002
If we can figure out a way to tie new lighting effects to the .TIE mission light sources, I think we would be set.

Re: Hook to transmit 3D normals to DDraw

Posted: Tue Jan 07, 2020 5:29 pm
by JeremyaFr
Global lights are stored in

Code: Select all

// V0x00782848
dword s_XwaGlobalLightsCount;

// V0x007D4FA0
Array<XwaGlobalLight,8> s_XwaGlobalLights;

// S0x07D4FA0
struct XwaGlobalLight
{
/* 0x0000 */ int PositionX ;
/* 0x0004 */ int PositionY ;
/* 0x0008 */ int PositionZ ;
/* 0x000C */ float DirectionX ;
/* 0x0010 */ float DirectionY ;
/* 0x0014 */ float DirectionZ ;
/* 0x0018 */ float Intensity ;
/* 0x001C */ float XwaGlobalLight_m1C ;
/* 0x0020 */ float ColorR ;
/* 0x0024 */ float ColorB ;
/* 0x0028 */ float ColorG ;
/* 0x002C */ float BlendStartIntensity ;
/* 0x0030 */ float BlendStartColor1C ;
/* 0x0034 */ float BlendStartColorR ;
/* 0x0038 */ float BlendStartColorB ;
/* 0x003C */ float BlendStartColorG ;
/* 0x0040 */ float BlendEndIntensity ;
/* 0x0044 */ float BlendEndColor1C ;
/* 0x0048 */ float BlendEndColorR ;
/* 0x004C */ float BlendEndColorB ;
/* 0x0050 */ float BlendEndColorG ;
};
Local lights are stored in

Code: Select all

// V0x00782840
dword s_V0x0782840;

// V0x007FA360
Array<S0x07FA360,128> s_V0x07FA360;

// S0x07FA360
struct S0x07FA360
{
/* 0x0000 */ int PositionX ;
/* 0x0004 */ int PositionY ;
/* 0x0008 */ int PositionZ ;
/* 0x0F0C */ byte unk0C [12];
/* 0x0018 */ float Distance ;
/* 0x001C */ dword Intensity ;
/* 0x0020 */ float ColorA ;
/* 0x0024 */ float ColorR ;
/* 0x0028 */ float ColorB ;
/* 0x002C */ float ColorG ;
};

Re: Hook to transmit 3D normals to DDraw

Posted: Tue Jan 07, 2020 7:16 pm
by blue_max
Thanks Jeremy! Quick question: s_V0x0782840 looks like the local light count, would you know if that's correct?

Re: Hook to transmit 3D normals to DDraw

Posted: Tue Jan 07, 2020 7:26 pm
by JeremyaFr
That's correct.

Re: Hook to transmit 3D normals to DDraw

Posted: Tue Jan 07, 2020 11:31 pm
by Trevor
YAY glass finally looks shiny again (was only shiny in software mode oddly in d3d6)

Agreed, next update is going to be really awsome. :)

Trev

Re: Hook to transmit 3D normals to DDraw

Posted: Wed Jan 08, 2020 12:11 am
by Tuskin
Rookie_One1 wrote:
Tue Jan 07, 2020 2:01 pm
Seriously, with all that we are getting, next versions of XWAUP and DSUCP will look better than most newer games(including what EA did with star wars :p ) :D
Eh, I doubt that.

Re: Hook to transmit 3D normals to DDraw

Posted: Wed Jan 08, 2020 12:36 am
by ual002
Well, this definitely has more depth, that's for sure.