Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (NewbieZorro, TipmyPip, 1 invisible), 19,045 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Shadows & performace #12123
03/19/03 04:57
03/19/03 04:57
Joined: Jan 2003
Posts: 710
T
Templar Offline OP
Developer
Templar  Offline OP
Developer
T

Joined: Jan 2003
Posts: 710
Hi guys,

i would like to ask you a question and i would also apreciate any comment on this by Conitec.

Most of my entities use dynamic shadows (.shadow = on). Unfortunately i found out that i wanted my shadows not to be transparent (otherwise i get sorting errors over other transparent sprites - dirt patches on ground etc.). Because (according to a reply from conitec) there is no way at this time to disable shadow transparency I thought i would make my own shadows in the same way they're created by the shadow flag (the entity made flat and unlit) but not transparent. Trying that i came across some interesting issues.

As I wrote above (if get it right) the shadows are in fact copied entites. Knowing that i was wondering - do these "shadow entities" eat up the same amount of system resources as the original entity (i guess that their texture is shared) ?

I'm asking this because i found out, that when i have two of my characters in an active camera view (they're about 1000 & 2000 polys) and i turn one's shadow off, i get about 4 fps increase on a slower machines (800 Mhz or so) which makes nearly 10 fps for both of them . Now that isn't much and the machines are much stronger than that nowadays (although i think that A5 due to it's BSP and other features - ?unlike A6? - is intended to perform well exactly on such machines) but what if there were 10 such entities instead of 2 even on a stronger PC? Wouldn't get say 20 FPS or more "wasted" just on calculating the shadows?

So am I right in thinking that these fake shadows take up almost the same amount of system power as the original entity does?

If it is so (hope it isn't though), it would only seem logical for the shadow to be created from a low (as low as you can get [Smile] poly proxy instead...

Can any of you guys (or Conitec) confirm this?

Thanks for reading it so far and not complaining about my english ;-)

T.

Re: Shadows & performace #12124
03/21/03 00:36
03/21/03 00:36
Joined: Mar 2003
Posts: 78
Germany
T
TheMatrix Offline
Junior Member
TheMatrix  Offline
Junior Member
T

Joined: Mar 2003
Posts: 78
Germany
I think you're not completely right...
YES, the shadows are a copy of the model but
NO, they don't consume the same amount of mem,
as far as I know, because they're not models but sprites that look like the original model [Eek!]
But I don't know that for sure. I only experienced that the decrease in perfomance is not that high so... just keep your shadow-flags
set. Because if thee's anyone out there who thinks he can play a new game with his p2 350 and an 8mb graphics card... [Big Grin] [Big Grin] [Big Grin]


Nur ein Mensch.
-Nur ein Agent *wegpust*

(MATRIX)
Re: Shadows & performace #12125
03/21/03 05:00
03/21/03 05:00
Joined: Jul 2000
Posts: 8,973
Bay Area
Doug Offline
Senior Expert
Doug  Offline
Senior Expert

Joined: Jul 2000
Posts: 8,973
Bay Area
Lots of shadows can reduce performace. The best solution is to allow your users to turn shadows on and off as they like.


Conitec's Free Resources:
User Magazine || Docs and Tutorials || WIKI
Re: Shadows & performace #12126
03/21/03 05:31
03/21/03 05:31

A
Anonymous
Unregistered
Anonymous
Unregistered
A



Shadows don't consume any memory. But the shadow flag can almost double the rendering time for a model, unless you used LOD. LOD can remarkably speed up the shadow rendering.

Re: Shadows & performace #12127
03/22/03 01:54
03/22/03 01:54

A
Anonymous
Unregistered
Anonymous
Unregistered
A



I think that the sdynamic shadows that A5 uses are made of vertices (they look like that). The shadows in, say, C&C: Renegade are sprites, coz u can see the pixels (and the dynamic shadows in Doom3 are awesome [Smile] ).

Re: Shadows & performace #12128
03/22/03 08:37
03/22/03 08:37

A
Anonymous
Unregistered
Anonymous
Unregistered
A



This gives me an idea...
I could make very dynamic shadows that cast from local dynamic lights and cast around irregular geometry (e.g. on the floor and walls) simply from a little wdl.

First I would make a copy of the player model, but color it completely black. This would be my shadow. I would then make a script to trace() a ray from the light source, and continue through a vertex of player model to hit on some level geometry. Then I would use vec_to_mesh() to move the corresponding shadow vertex to that spot that was hit. I would perform this for every vertex in the model. The result would be very slow, but impressive (I believe)

Re: Shadows & performace #12129
03/22/03 16:59
03/22/03 16:59
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
big mike: great idea!

i did a test script -> the shadow does also bend around edges this way and it's fast enough! i will post screenshots...

Re: Shadows & performace #12130
03/22/03 18:46
03/22/03 18:46
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
 -

 -
transparency doesn't look good...

 -
a bend that goes through geometry... it does only bend well on simple walls (and on terrains i could imagine).

conclusion: this method can't substitute stencil shadows! [Smile]

Re: Shadows & performace #12131
03/22/03 19:50
03/22/03 19:50
Joined: Dec 2000
Posts: 4,608
mk_1 Offline

Expert
mk_1  Offline

Expert

Joined: Dec 2000
Posts: 4,608
Really nice...where's the code? [Big Grin]
Uhm.. you said trace linked with every vertex? What if my model uses 3443 faces (around 3500 Vertices)? Would this kill the performance? (I need two of those cpu killer models)


Follow me on twitter
Re: Shadows & performace #12132
03/23/03 08:07
03/23/03 08:07
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
code:
action shadow
{
var pos[3];
var lightpos[3];
var lightdir[3];

my.passable=on;
my.unlit=on;
my.ambient=-100;
//my.transparent=on;
//my.alpha=75;

lightpos.x=0;
lightpos.y=0;
lightpos.z=0;

var numverts;
numverts=ent_vertices(my);

while(1)
{
vec_set(my.x,p_player.x);

var i=0;
while(i<numverts)
{
vec_for_vertex(pos,p_player,i);

trace_mode=ignore_models;

vec_set(lightdir,pos);
vec_sub(lightdir,lightpos);
vec_normalize(lightdir,100000);

trace(pos,lightdir);

vec_set(temp,target);
vec_normalize(normal,1); //shadow offset to avoid z-fighting
vec_add(temp,normal);
vec_sub(temp,my.x); //vec_to_mesh needs relative coords to my.x

vec_to_mesh(temp,my,i);

i+=1;
}
wait(1);
}
}

ent_create(shadowmdl,my.x,shadow);

you have to call ent_create to create the shadow.

shadowmdl can not be the same file as the model that should cast the shadow. this is another disadvantage. you have to make a copy with a different filename.

this was just an experiment. i don't think it's really useable or that it can be improved to be useable...

my model has 1200 faces and i didn't notice a slowdown.


Moderated by  HeelX, Spirit 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1