Hook to transmit 3D normals to DDraw

A Forum dedicated to the Suggestion, Creation and Editing of XWA Dynamic Link Library Files

Moderators: Darksaber, General_Trageton, Forceflow, JeremyaFr, DTM

Post Reply

Hook to transmit 3D normals to DDraw

JeremyaFr
Lieutenant Commander
XWAU Member
Posts: 1796
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Mon Jan 06, 2020 7:14 pm

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

User avatar
Trevor
Cadet 1st Class
Posts: 228
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Tue Jan 07, 2020 1:10 am

Oh wow, I assume this is only of use to Blues ddraw and has no effect on your default one?

Trev

blue_max
Lieutenant JG
XWAU Member
Posts: 561
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Tue Jan 07, 2020 5:21 am

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.
You do not have the required permissions to view the files attached to this post.

Rookie_One1
Lieutenant Commander
Rebel Alliance
Posts: 1398
Joined: Thu Feb 26, 2004 12:01 am

Post by Rookie_One1 » 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
Rookie One, is that you?? - Ru Merleen, Rebel Spy at Imdaar Alpha
Current Holder of the Frying Pan of Death

User avatar
ual002
Lieutenant JG
Galactic Empire
Posts: 529
Joined: Wed Sep 24, 2008 2:23 am

Post by ual002 » Tue Jan 07, 2020 2:13 pm

If we can figure out a way to tie new lighting effects to the .TIE mission light sources, I think we would be set.
For the glory of his majesty Emperor Palpatine! Image Image Image Image

JeremyaFr
Lieutenant Commander
XWAU Member
Posts: 1796
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Tue Jan 07, 2020 5:29 pm

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 ;
};

blue_max
Lieutenant JG
XWAU Member
Posts: 561
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Tue Jan 07, 2020 7:16 pm

Thanks Jeremy! Quick question: s_V0x0782840 looks like the local light count, would you know if that's correct?

JeremyaFr
Lieutenant Commander
XWAU Member
Posts: 1796
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Tue Jan 07, 2020 7:26 pm

That's correct.

User avatar
Trevor
Cadet 1st Class
Posts: 228
Joined: Thu Dec 04, 2014 7:11 pm

Post by Trevor » Tue Jan 07, 2020 11:31 pm

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

Tuskin
Ensign
Posts: 293
Joined: Sat Aug 13, 2005 11:01 pm

Post by Tuskin » Wed Jan 08, 2020 12:11 am

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.

User avatar
ual002
Lieutenant JG
Galactic Empire
Posts: 529
Joined: Wed Sep 24, 2008 2:23 am

Post by ual002 » Wed Jan 08, 2020 12:36 am

Well, this definitely has more depth, that's for sure.
For the glory of his majesty Emperor Palpatine! Image Image Image Image

Post Reply