Gamestudio Links
Zorro Links
Newest Posts
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (EternallyCurious, AndrewAMD, TipmyPip, Quad), 889 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Shadows / Render Stencil and Saving/Loading levels #460344
06/26/16 18:56
06/26/16 18:56
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline OP
User
Dooley  Offline OP
User

Joined: May 2005
Posts: 868
Chicago, IL
I have experienced different problems with my shadows after saving/loading levels. I could not find anything in the manual about this particular aspect of using shadows.

Has anyone encountered this? Is there any set of guidelines to follow with regard to shadows in a game_load, game_save situation?

Re: Shadows / Render Stencil and Saving/Loading levels [Re: Dooley] #460346
06/26/16 20:14
06/26/16 20:14

M
Malice
Unregistered
Malice
Unregistered
M



What are the shadow types shadow_stencil =?? and the 'problems' like.

I don't have a off the top answer.. sorry

With PSSM shadow_stencil =8; there maybe some issue -> just looking at the manual.
http://www.conitec.net/beta/shadows_c.htm
Quote:
--PSSM shadows must be deactivated before changing the video resolution or video mode, or when loading a level or changing the level size. Activate them again one frame afterwards.

Quote:
--On the other hand, PSSM shadows require careful adjustment of the shadow bias (pssm_fbias, see below) and the camera clip_far value to the level size and type. Wrong values can cause artefacts such as "surface acne" or displaced shadows.

--The light source is the sun, as set up in the level map or in the script (sun_angle).

--Only objects that cast PSSM shadows can receive PSSM shadows. For this reason, the SHADOW flag should be set for level geometry and terrain.

--PSSM shadows must be deactivated before changing the video resolution or video mode, or when loading a level or changing the level size. Activate them again one frame afterwards.

--They should be deactivated when the player enters an indoor area (otherwise, everything indoor would be in shadow).

--Before activating PSSM shadows, set shadow_stencil at 8, and set camera.clip_near as high and camera.clip_far as low as possible. Make sure that level_ent.max_x and level_ent.min_x reflects the final level size.



Also Try doing game save in flag list one by one. Not SV_ALL. Just start with one flag and add the next like
Code:
game_save("info",0,SV_INFO+SV_STRINGS+SV_BMAPS);


The will help find a problem type to look deeper into

Last edited by Malice; 06/26/16 20:34.
Re: Shadows / Render Stencil and Saving/Loading levels [Re: ] #460348
06/27/16 14:09
06/27/16 14:09
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
Btw:
I cant recommend to use those functions (game_save/load). I know it sucks but its better to write your own save/load functions.

Greets


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: Shadows / Render Stencil and Saving/Loading levels [Re: rayp] #460358
06/27/16 21:25
06/27/16 21:25
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline OP
User
Dooley  Offline OP
User

Joined: May 2005
Posts: 868
Chicago, IL
Thanks,
I actually did write my own save/load function which saves generated levels to a text file. Then it rebuilds the levels from the data in the file. However, there is one main level which I'm still using game_save/load, which seems too complex to do like that ... Maybe that's the answer.

Re: Shadows / Render Stencil and Saving/Loading levels [Re: Dooley] #460360
06/27/16 23:57
06/27/16 23:57
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline OP
User
Dooley  Offline OP
User

Joined: May 2005
Posts: 868
Chicago, IL
I am using A7 - stencil_shadows set to 2 - Z-Fail Stencil Shadows

They need to be set before level_load.

This is what I call before loading, or reloading my levels:

Quote:

shadow_stencil = 2; // activate z-fail accelerated stencil shadows
stencil_blur(1); // activate blurred shadows
mat_shadow.alpha = shadow_alpha;
shadow_range = 10;


Right now, to avoid shadow artifacts coming back to the spaceship level, which does not use stancil shadows, I call:

Quote:

ssView.material = NULL;
camera.stage = NULL;
shadow_stencil = -1; // deactivate z-fail accelerated stencil shadows
stencil_blur(0); // deactivate blurred shadows
mat_shadow.alpha = 0;
shadow_range = 0;


Going back to the ship uses a game_load function, but landing on the planet uses my own reloading function.

Right now, if I land on a planet, then return to the ship, everything is fine. However, if I return to the planet again, there appears to be two versions of the stencil_shadows. One is blurred and one is not, and they are at slightly different angles, as if there are two light sources casting shadows. Also, there are self shadows cast of objects that are not even assigned the "shadow" flag.

To make things more interesting, if I leave the game, and then come back and reload the planet, the shadows work fine.

Re: Shadows / Render Stencil and Saving/Loading levels [Re: Dooley] #460370
06/28/16 09:59
06/28/16 09:59
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Originally Posted By: Dooley

To make things more interesting, if I leave the game, and then come back and reload the planet, the shadows work fine.
, perhaps it is some bug with level load and game_load and stencil shadows? (might be something specific to A7)

Also alternative would be skipping stencil shadows and take a shadow shader from this forum. E.g. from Slin or such.

Re: Shadows / Render Stencil and Saving/Loading levels [Re: Reconnoiter] #460371
06/28/16 10:46
06/28/16 10:46
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
Quote:
However, there is one main level which I'm still using game_save/load

Just wanted to mention again: Dont use those functions, they just wont work correct. Many users ( including me ) faced that problem ( in some kind of variation ).:D
I just tryed again to use those functions in my ZombieFPS project, bug-hell broke loose grin

Anyway...
Try with this game_save - flag
Code:
-SV_VIEWS

Does it help? Often solves shader/shadow props.

U checked out Malice's post yes?
Cause he mentioned to use some flags and gave usefull tips.

Btw: Std. 3dgs stencil shadows are slow like hell.
Performance tip: Use
Code:
shadow_lod

and let the LOD models of your entity cast the shadows.


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: Shadows / Render Stencil and Saving/Loading levels [Re: rayp] #460382
06/28/16 18:03
06/28/16 18:03
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline OP
User
Dooley  Offline OP
User

Joined: May 2005
Posts: 868
Chicago, IL
Thanks for all the help guys.

I'm going to write the save/load function myself again. There are some other issues popping up which I need to fix, and they are all pointing my in the direction of writing my own save/load function.

I am okay with the A7 shadows for now (assuming I can fix this problem), but I will look at other options in my next phase of development. They do use LOD-1 by default (as opposed to LOD-0), but you can set them to different LOD levels if you need to.

@Malice - It sounds like you are referring to the A8 engine/manual. Sorry, I should have mentioned it was A7 in my original post.

Re: Shadows / Render Stencil and Saving/Loading levels [Re: Dooley] #460390
06/28/16 22:33
06/28/16 22:33

M
Malice
Unregistered
Malice
Unregistered
M



Quote:
@Malice - It sounds like you are referring to the A8 engine/manual. Sorry, I should have mentioned it was A7 in my original post.


Indeed was...! I've got nothing for the last gen. However my game_save with flags advice is relevant all the way back to A5.

A game save/load system isn't to hard . It's just a (load) level_load and a for_loop to 'adjust' the world. (Save) it's just a for_loop to record(in a form you choose) states for things, and only what you'd like to save.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | 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