Quantcast

Jump to content

» «
Photo

StaticShadow limit

8 replies to this topic
ThirteenAG
  • ThirteenAG

    Foot Soldier

  • Feroci Racing
  • Joined: 29 Dec 2008
  • None

#1

Posted 17 January 2014 - 10:22 AM Edited by ThirteenAG, 17 January 2014 - 10:23 AM.

In a continuation of my corona limit topic, i'm wondering if it's possible to increase the amount of particle shadows, which are usually shown under lampposts:
a225803c8444e761f19ff8c6459c0074.jpg 07a3a75402e900937f5342e84b2f0be6.jpg

Here's what i know(SA):
0x6FD411 - contains alpha value
0x6FD3A6 - contains draw distance
0x6FD42C - call for CShadows::StoreStaticShadow(0x70BA00) to create shadows under lampposts.

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci Racing
  • Joined: 19 Aug 2006
  • Unknown

#2

Posted 17 January 2014 - 11:29 AM Edited by Wesser, 17 January 2014 - 11:44 AM.

It would be pretty easy. By a quick look, 0x00C4A030 is the base address of the array containing the 48 static shadows which take 64 bytes each. There are just few dependencies.

You could have asked me directly. Should I prepare the code once again? :p

ThirteenAG
  • ThirteenAG

    Foot Soldier

  • Feroci Racing
  • Joined: 29 Dec 2008
  • None

#3

Posted 17 January 2014 - 12:15 PM

You could have asked me directly.

Well, i think a separate topic may be useful for someone else some day, and i'm kinda expected your response :)

Should I prepare the code once again? :p

Would be great, maybe i'll be able to do something similar to project 2dfx with it later :)

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci Racing
  • Joined: 19 Aug 2006
  • Unknown

#4

Posted 17 January 2014 - 12:24 PM Edited by Wesser, 17 January 2014 - 05:46 PM.

Yes, I agree with your first sentence.

It won't take that much. Stay tuned. :^:

//Edit: Here it is.

ThirteenAG
  • ThirteenAG

    Foot Soldier

  • Feroci Racing
  • Joined: 29 Dec 2008
  • None

#5

Posted 17 January 2014 - 06:35 PM

Thanks Wesser, you nailed it again! :cookie:  :cookie:  :cookie:


Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci Racing
  • Joined: 19 Aug 2006
  • Unknown

#6

Posted 02 June 2014 - 01:53 PM Edited by Wesser, 02 June 2014 - 01:54 PM.

There was a bug in the previous static shadows limit adjuster which got already fixed (sorry for being too late):
 

Finally, I fixed the missing vertices bug.

The game stores the vertices of static shadows into CShadows::aPolyBunches (0x00C40DF0, an array of 360 CPolyBunch elements, each one can handle up to 7 vertices at a time) in order to keep them in memory for reducing the performance hit. The hack consists in making the pre-allocated linked list given above limitless. Redownload the plug-in from here.

You can store your own static shadows by hooking the function call of CShadows__UpdateStaticShadows and injecting yours at 0x53E0BE:

#include "stdafx.h"
#include "hook.h"

using namespace Hook;

struct RwTexture;

class CEntity;
class CVector
{
  public:
	float x, y, z;
};

enum SShadType
{
	SSHADT_NONE,
	SSHADT_DEFAULT,		// SSHAD_RM_COLORONLY (shad_car, shad_ped, shad_heli, shad_bike, shad_rcbaron, bloodpool_64, wincrack_32, lamp_shad_64)
	SSHADT_INTENSIVE,	// SSHAD_RM_OVERLAP (shad_exp, headlight, headlight1, handman)
	SSHADT_NEGATIVE,	// SSHAD_RM_INVCOLOR
	SSHADT4,			// SSHAD_RM_COLORONLY
	SSHADT5,			// SSHAD_RM_COLORONLY
	SSHADT6,			// SSHAD_RM_COLORONLY
	SSHADT8 = 8			// SSHAD_RM_COLORONLY
};

enum SShadRenderMode
{
	SSHAD_RM_NONE,		// Shadow type: <0, 0, >8.
	SSHAD_RM_COLORONLY, // Shadow type: 1, 4, 5, 6, 8. The texture alpha is present if the alpha channel is set.
	SSHAD_RM_OVERLAP,	// Shadow type: 2. Any shadow alpha greater than 0 does not make any difference.
	SSHAD_RM_INVCOLOR	// Shadow type: 3. Same tip above goes here.
};

void (__cdecl *const CShadows__UpdateStaticShadows)() = (decltype(CShadows__UpdateStaticShadows))0x707F40;
bool (__cdecl *const CShadows__StoreStaticShadow)(unsigned int id, unsigned char type, RwTexture *particle, CVector *pos, float x1, float y1, float x2, float y2, short alpha, unsigned char red, unsigned char green, unsigned char blue, float, float, float drawdist, bool lifetime, float updist) = (decltype(CShadows__StoreStaticShadow))0x70BA00;

void StoreCustomStaticShadows()
{
	CVector pos;

	pos.x = 0.0f;
	pos.y = 0.0f;
	pos.z = 0.0f;

	CShadows__StoreStaticShadow(1024, SSHADT_INTENSIVE, *(RwTexture **)0xC403F4, &pos, 8.0f, 0.0f, 0.0f, -8.0f, 128, 255, 192, 0, 15.0f, 1.0f, 40.0f, false, 0.0f);
	CShadows__UpdateStaticShadows();
}

BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
{
	if(dwReason == DLL_PROCESS_ATTACH)
	{
		RedirectOffset(0x53E0BF, StoreCustomStaticShadows);
	}
	return TRUE;
}
The following explanation will help you understanding the size coordinates:
[1.0f,  0.0f,  0.0f, -1.0f]

 1
+-+
|x||-1|
+-+

[1.0f, -1.0f,  0.0f, -1.0f] [1.0f,  1.0f,  0.0f, -1.0f]

+                             +
|\                           /|
+x+                         +x+
 \|                         |/
  +                         +

[1.0f,  0.0f,  1.0f, -1.0f] [1.0f,  0.0f, -1.0f, -1.0f]

+-+                           +-+
 \x\                         /x/
  +-+                       +-+

[1.0f, -1.0f, -1.0f, -1.0f] [1.0f,  1.0f,  1.0f, -1.0f]

  +                           +
 / \                         / \
+ x +                       + x +
 \ /                         \ /
  +                           +
For those unnamed arguments, you can copy the values of my test configuration.

  • ThirteenAG, _DK and TJGM like this

_DK
  • _DK

    gta3 cleo

  • Feroci Racing
  • Joined: 12 Apr 2009
  • None

#7

Posted 02 June 2014 - 02:16 PM

The 'position' thingy, was explained here:
http://modsforgta.uc...3-16-1333570000
  • Wesser likes this

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci Racing
  • Joined: 19 Aug 2006
  • Unknown

#8

Posted 02 June 2014 - 02:31 PM

Yep, just like 2D stuff. That explanation was just an overview of how these values affect the shadows orientation, TG didn't really need to play with them for Project 2DFX. :p

SilverRST
  • SilverRST

    Gangsta

  • Members
  • Joined: 25 Mar 2013
  • None

#9

Posted 03 June 2014 - 09:01 PM Edited by SilverRST, 03 June 2014 - 09:01 PM.

Well, I thouight this was an old topic but fortunately not :p

I'm having a sh*tty problem, namely this mod is not working:

http://www.gtagarage...ow.php?id=24363

I also downloaded the shadows limit asi and yet it still won't work. There is no corona shadow at all.

I tried using the old effects and still no luck. I am using the V1.0 GTA SA.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users