logo
Main

Forums

Downloads

Unreal-Netiquette

Donate for Oldunreal:
Donate

borderline

Links to our wiki:
Wiki

Walkthrough

Links

Tutorials

Unreal Reference

Usermaps

borderline

Contact us:
Submit News
Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) Issue #53. Visible shadows under invisible/translucent players (Read 1031 times)
Masterkent
Developer Team
Offline



Posts: 1040
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Issue #53. Visible shadows under invisible/translucent players
Mar 4th, 2018 at 12:40pm
Print Post  
When a player activates Invisibility or Cloaking Device, the casted shadow disappears only after changing player's location. As long as player's location remains the same, the shadow remains visible:



On the other hand, when the player becomes visible again, the disappeared shadow may not appear until the next location change too. These effects take place due to improper optimization:

Code
Select All
simulated event Tick( float Delta )
{
	local Actor HitActor;
	local Vector HitNormal,HitLocation, ShadowStart;

	if ( Owner==None || Owner.bDeleteMe )
	{
		Destroy();
		Return;
	}

	if ( OldOwnerLocation == Owner.Location )
		return;

	OldOwnerLocation = Owner.Location;

	DetachDecal();

	if ( Owner.Style==STY_Translucent || Owner.bHidden || Owner.DrawType==DT_None )
		return; 


Suggested resolution: define class Engine.ObjectShadow as indicated below:

Code
Select All
class ObjectShadow extends Decal
	Config(User)
	Abstract;

#exec TEXTURE IMPORT NAME=BlobShadow FILE=Textures\BlobShadow.pcx LODSET=2

var() config int ShadowDetailRes; // Must be a value in power of 2
var() config float ShadowScaling;
var transient vector OldOwnerLocation;
var transient bool bOptionalUpdate;
var ShadowBitMap PLShadow;

function AttachToSurface();

function Timer();

simulated event Tick( float Delta )
{
	local Actor HitActor;
	local Vector HitNormal,HitLocation, ShadowStart;

	if ( Owner==None || Owner.bDeleteMe )
	{
		Destroy();
		Return;
	}

	if (!class'GameInfo'.default.bCastShadow ||
		Owner.Style == STY_Translucent ||
		Owner.bHidden ||
		Owner.DrawType == DT_None)
	{
		DetachDecal();
		bOptionalUpdate = false;
		return;
	}

	if (bOptionalUpdate && OldOwnerLocation == Owner.Location)
		return;

	OldOwnerLocation = Owner.Location;
	bOptionalUpdate = true;
	DetachDecal();

	ShadowStart = Owner.Location;
	ShadowStart.Z-=(Owner.CollisionHeight-5);
	HitActor = Trace(HitLocation, HitNormal, ShadowStart - vect(0,0,500), ShadowStart, false);

	if (HitActor == none)
		return;

	if (class'GameInfo'.Default.bUseRealtimeShadow && PLShadow == none)
	{
		PLShadow = ShadowBitMap(Level.AllocateObj(Class'ShadowBitMap'));
		if( PLShadow==None )
			PLShadow = new(Outer)Class'ShadowBitMap';
		PLShadow.ProjectingActor = Owner;
		PLShadow.ProjectDirection = rot(16384,0,0);
		Texture = PLShadow;
		if( PLShadow.USize!=ShadowDetailRes || PLShadow.VSize!=ShadowDetailRes )
			PLShadow.SetShadowRes(ShadowDetailRes,ShadowDetailRes);
		PLShadow.Softness = GetShadowSoftness();
		PLShadow.StaticLevel = 0;
		Style = STY_AlphaBlend;
	}
	else if (!class'GameInfo'.Default.bUseRealtimeShadow && PLShadow != none)
	{
		PLShadow.ProjectingActor = none;
		Level.FreeObject(PLShadow);
		PLShadow = none;
		Texture = default.Texture;
		Style = default.Style;
	}

	if (PLShadow != none)
	{
		DrawScale = FMax(Owner.CollisionRadius,16.f)*(12.f/ShadowDetailRes);
		PLShadow.ShadowScale = 1.f/DrawScale;
		PLShadow.Gradience = Min(FMax(ShadowStart.Z-HitLocation.Z,0.f)/700.f*255+100,255);
	}
	else
		DrawScale = Owner.CollisionRadius/35.f*ShadowScaling*(1.f-FMax(ShadowStart.Z-HitLocation.Z,0.f)/500.f);

	SetLocation(HitLocation+HitNormal);
	SetRotation(rotator(HitNormal));
	AttachDecal(30, vect(1,0,0));
}
simulated function Destroyed()
{
	if( PLShadow!=None )
	{
		PLShadow.ProjectingActor = None;
		Level.FreeObject(PLShadow);
		PLShadow = None;
	}
	Super.Destroyed();
}
simulated static final function byte GetShadowSoftness()
{
	if( Default.ShadowDetailRes<=64 )
		return 0;
	switch( Default.ShadowDetailRes )
	{
	case 128:
		return 1;
	case 256:
		return 2;
	case 512:
		return 3;
	default:
		return 4;
	}
}

defaultproperties
{
	MultiDecalLevel=3
	Texture=Texture'BlobShadow'
	DrawScale=0.50
	ShadowScaling=1
	bAttachPanningSurfs=True
	ShadowDetailRes=128
} 


Note 1: the suggested implementation also allows to disable shadows on fly (useful when you need to get rid of a sudden performance hit in presence of too many shadows around).

Note 2: the corresponding ObjectShadow.uc already has been submitted (in the archive containing modified sources of UWindow & UMenu).
« Last Edit: Mar 4th, 2018 at 7:44pm by Masterkent »  
Back to top
 
IP Logged
 
Smirftsch
Forum Administrator
*****
Offline



Posts: 7683
Location: at home
Joined: Apr 30th, 1998
Gender: Male
Re: Issue #53. Visible shadows under invisible/translucent players
Reply #1 - Mar 5th, 2018 at 9:15am
Print Post  
yep, added as suggested Smiley
  

Sometimes you have to lose a fight to win the war.
Back to top
WWWICQ  
IP Logged
 
Red_Fist2
New Member
*
Offline


Oldunreal member

Posts: 16
Location: here
Joined: Dec 7th, 2008
Re: Issue #53. Visible shadows under invisible/translucent players
Reply #2 - Apr 3rd, 2018 at 5:35pm
Print Post  
What I been wanting fixed is seeing pawn shadows under water- waterzone.

It's a dead giveaway to shoot or see or know beforehand or from sniping range if enemies are in the water giving sort of a cheat, fix or add that would be a good thing.

Or maybe a way to stop shadows for certain pawns only.
  
Back to top
 
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 1040
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Issue #53. Visible shadows under invisible/translucent players
Reply #3 - Apr 4th, 2018 at 2:50pm
Print Post  
I don't see reasons why the behavior in water zones should be any different.

The distance between a pawn and its shadow probably can be considered as too high (taking into account the fact that the existing implementation does not draw shadows based on real light sources), which is easy to notice when the pawn is flying or swimming. We could reduce such a max distance equally for all zones.
  
Back to top
 
IP Logged
 
Red_Fist2
New Member
*
Offline


Oldunreal member

Posts: 16
Location: here
Joined: Dec 7th, 2008
Re: Issue #53. Visible shadows under invisible/translucent players
Reply #4 - Apr 4th, 2018 at 5:01pm
Print Post  
I don't know a fix, but the main idea is mainly for water from a gameplay aspect, in-that, you should not be able to know if mean critters are in the, pond, lake, if you decide to jump in, or kill them before you jump in, only because the shadow gives them away.

So if you have a choice of two paths, one land and the other water, you should not be able to kill things (under water) before you jump in.

It's been a strategy issue I have not liked for a long time. But you seem to have a good solution, but any underwater critter, or anything in the water the shadow gives unfair advantage to the game.
  
Back to top
 
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 1040
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Issue #53. Visible shadows under invisible/translucent players
Reply #5 - Apr 4th, 2018 at 5:23pm
Print Post  
Red_Fist2 wrote on Apr 4th, 2018 at 5:01pm:
I don't know a fix, but the main idea is mainly for water from a gameplay aspect, in-that, you should not be able to know if mean critters are in the, pond, lake, if you decide to jump in, or kill them before you jump in, only because the shadow gives them away.

Can you post any screenshot that would serve as a demonstration of your issue? I personally don't use pawn shadows other than for testing, so it's hard for me to judge about their appearance in general.

I found low-resolution real-time shadows barely visible and I hardly imagine how such shadows could be more noticeable than the corresponding pawns.
  
Back to top
 
IP Logged
 
Red_Fist2
New Member
*
Offline


Oldunreal member

Posts: 16
Location: here
Joined: Dec 7th, 2008
Re: Issue #53. Visible shadows under invisible/translucent players
Reply #6 - Apr 4th, 2018 at 8:30pm
Print Post  
This is a bad example since I could not find a good map, but imagine if you are in an outdoors map on a cliff using the sniper, with water that looks similar. You can clean up the whole thing before you jump in the lake, pool, pond.
But is a good example of how easy they are to see.


Ahhh poop, I don't see how to post a picture, I have no external link.

  
Back to top
 
IP Logged
 
Red_Fist2
New Member
*
Offline


Oldunreal member

Posts: 16
Location: here
Joined: Dec 7th, 2008
Re: Issue #53. Visible shadows under invisible/translucent players
Reply #7 - Apr 4th, 2018 at 9:31pm
Print Post  
Don't think this is for all water areas, they need to be translucent, and the lighting and how shallow , etc etc

But without the shadow or from far away, it would be much harder to know if the place has enemies.

I could not find a good outdoors map example, so this is just an arbitrary example.
  
Back to top
 
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 1040
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Issue #53. Visible shadows under invisible/translucent players
Reply #8 - Apr 5th, 2018 at 9:15am
Print Post  
Red_Fist2 wrote on Apr 4th, 2018 at 8:30pm:

Is that UT with oldskool?

In Unreal 227i, you can choose real-time shadows which don't look like big black circles.
  
Back to top
 
IP Logged
 
Red_Fist2
New Member
*
Offline


Oldunreal member

Posts: 16
Location: here
Joined: Dec 7th, 2008
Re: Issue #53. Visible shadows under invisible/translucent players
Reply #9 - Apr 5th, 2018 at 8:23pm
Print Post  
It's UT with oldskool
  
Back to top
 
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 1040
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Issue #53. Visible shadows under invisible/translucent players
Reply #10 - Apr 6th, 2018 at 11:44am
Print Post  
Issues with UT stuff are out of scope of this subforum. The following videos demonstrate how shadows from DevilFish look in UT with OldSkool and Unreal 227.

OldSkool shadows: https://www.youtube.com/watch?v=eITVREMD4ms
Unreal 227 shadows: https://www.youtube.com/watch?v=lQ5-c5GBMpY

[Note: changing shadow settings on fly may not work in 227i, you may need to reload the level to apply the modified settings]
  
Back to top
 
IP Logged
 
Red_Fist2
New Member
*
Offline


Oldunreal member

Posts: 16
Location: here
Joined: Dec 7th, 2008
Re: Issue #53. Visible shadows under invisible/translucent players
Reply #11 - Apr 6th, 2018 at 5:41pm
Print Post  
A little better, I say none, zero, mainly for water zones I guess.
  
Back to top
 
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 1040
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Issue #53. Visible shadows under invisible/translucent players
Reply #12 - Apr 6th, 2018 at 7:49pm
Print Post  
IMO, blob shadows are too big, they probably should be smaller. Since I don't use such shadows anyway, I didn't pay much attention to issues with their size. But now I looked at the code responsible for their scaling, and... it's hilarious :-)

Code
Select All
var() config float ShadowScaling;
....
DrawScale = Owner.CollisionRadius/35.f*ShadowScaling*(1.f-FMax(ShadowStart.Z-HitLocation.Z,0.f)/500.f); 


This is a configurable cheat integrated right into the game patch. Nice work :-)

Big circles are improperly rendered on corners and look ugly, but they can give a huge advantage in competitive game modes such as DM, so cheaters may be happy to exploit this "feature".
  
Back to top
 
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 1040
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Issue #53. Visible shadows under invisible/translucent players
Reply #13 - Apr 7th, 2018 at 2:09pm
Print Post  
At this moment I can suggest only two variants:

1. ObjectShadow.uc which features:
- ShadowScaling declared as editable non-config variable,
- limited distance between shadow and its owner,
- some fixes for changing the parameters of shadows on fly,
- small optimization for shadows which would be invisible due to non-positive DrawScale or maximal Gradience.

2. ObjectShadow.uc which features:
- preserved the original declaration of ShadowScaling [editable, config],
- using FMin(1.0, ShadowScaling) instead of raw ShadowScaling,
- some fixes for changing the parameters of shadows on fly,
- small optimization for shadows which would be invisible due to non-positive DrawScale or maximal Gradience.
  
Back to top
 
IP Logged
 
Masterkent
Developer Team
Offline



Posts: 1040
Location: Russia
Joined: Apr 5th, 2013
Gender: Male
Re: Issue #53. Visible shadows under invisible/translucent players
Reply #14 - Apr 12th, 2018 at 7:48pm
Print Post  
PawnShadowX and DecoShadowStatic also need fixing. Issue #53 has been extended to cover the set of issues with updating the casted shadows:

Issue #53. Issues with updating pawn and decoration shadows.
#53.1. Visible shadows under invisible/translucent players.
#53.2. Shadows can be used for cheating (spotting pawns behind walls).
#53.3. Shadows of static decorations disappear after loading a saved game.
#53.4. Shadows cannot be disabled on fly when this would be desirable (e.g. due to low framerate).
Discussion: http://www.oldunreal.com/cgi-bin/yabb2/YaBB.pl?num=1520167258
Category: -uscript
Severity: High [per 53.2]
Status: Ready

Prepared modifications for j_39 (appendix 2):

ObjectShadow.uc
DecoShadowStatic.uc
PawnShadowX.uc

  - The content of the Tick function was moved to new function UpdateShadow.

  - When the shadow resolution is changed, the implementation retraces the floor
    and updates the shadow.

  - When the traced actor is a mover, the implementation retraces the floor and
    updates the shadow on every tick (Trace function may return wrong actor when
    the mover is moving, so this method does not guarantee that shadows are
    always updated correctly).

  - DrawScale and ProjectorScale of blob shadows was reduced to be 2 times
    smaller than before.

  - Max distance between the actor and its shadow (when the shadow may be
    visible) is reduced to be more than 2 times smaller than before.

  - In Engine.ObjectShadow, added config bool variable bOptimizeTracing: when
    it's true, retracing the floor may be skipped when the location of the owner
    is not changed since the last tick; when it's false, retracing is done on
    every tick (then the shadow is guaranteed to be properly updated in presence
    of moving objects below the owner).

  - In Engine.ObjectShadow, added function UpdateAllShadows which is supposed to
    be used by UMenu code, so changing shadow-related settings via UMenu may
    take an immediate effect in the game.

  - In Engine.ObjectShadow, removed the config specifier from the declaration of
    variable ShadowScaling.

  - In Engine.PawnShadowX, removed unused variables ShadowDetailRes and
    ShadowScaling.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo