Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by M_D. 04/26/24 20:22
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 816 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
Double sided shader that works with PSSM #465743
05/11/17 00:03
05/11/17 00:03
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
Hi everyone, I am using this 2 sided shader that cuts out the alpha information and correctly sorts polygons:

Code:
MATERIAL* mat_Correct_Alpha_3 =    //------------------------------- CORRECT SORTING OF TGA ALPHA IN A MODEL!! 2 sided
{


	specular_blue = 100;
	specular_green = 100;
	specular_red = 100;
	
	power = 10;



		flags =   ENABLE_TREE | PASS_SOLID;
	//my.transparent=on;
	
	effect="
	
	

		DWORD ref=128.0f;
	
	technique test
		{		pass p0	
		
		
			{			
			
			cullmode=NONE;
			zenable=true;
			zwriteenable=true;
			alphablendenable=false;
			alphatestenable=true;
			AlphaRef=<ref>;
        	AlphaFunc=Greater;
	
	
			}	
			
			}
			
				";
}



Is there a way to get this shader, or any shader to work on both sides for PSSM shadows? The shadows are correctly cast on the main side of a triangle, but the backside (cullmode=NONE) of the polygon, you can see the shadow through it!

Last edited by jumpman; 05/11/17 00:03.
Re: Double sided shader that works with PSSM [Re: jumpman] #465752
05/11/17 07:31
05/11/17 07:31
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
to be honest PSSM shadows are slow, I got much better performance AND quality in MapBuilder by the non-stencil-buffer based solution, using Slin's shadow cascade calculation... and never had problem with any transparent stuff.


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Double sided shader that works with PSSM [Re: sivan] #465846
05/15/17 06:09
05/15/17 06:09
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
Mapbuilder has a shadow solution that can only be run with Mapbuilder? Or can that shader be used with WED?

Re: Double sided shader that works with PSSM [Re: jumpman] #465872
05/16/17 04:25
05/16/17 04:25
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
it is modular and can be used in any project, similarly to the water and terrain shaders. I can help you...


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Double sided shader that works with PSSM [Re: sivan] #465874
05/16/17 04:37
05/16/17 04:37
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
I would like that! Where can I download a demo/source file? I can send you a message if you'd like

Re: Double sided shader that works with PSSM [Re: jumpman] #465884
05/16/17 14:03
05/16/17 14:03
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Originally Posted By: jumpman
Where can I download a demo/source file?

look at his signature wink

Re: Double sided shader that works with PSSM [Re: txesmi] #465889
05/16/17 14:39
05/16/17 14:39
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
I see it, thank you! Im assuming I can find the shadow code in here and extract it for my project?

Also, Sivan, mapbuilder looks pretty amazing. Have you ever thought about making the actual mapbuilder into a game itself? Like a premise where you are a level designer and you have to create a level for a player (governed by an AI)?

Re: Double sided shader that works with PSSM [Re: jumpman] #465892
05/16/17 15:32
05/16/17 15:32
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
originally I made it for my RTS, which worked fine, but finally decided to switch to unreal engine 4 in 2015, because in long term I felt it is safer, and I think it was a good decision.

but if anybody is creating a nice game with 3dgs I can help, it would be at least motivating to fix the current bug causing a crash on loading materials... laugh


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Double sided shader that works with PSSM [Re: sivan] #465893
05/16/17 16:46
05/16/17 16:46
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
@sivan, if I'm not mistaken, you used shadows from older shade-c, right? I even got the rip-off, did you add any adjustments/tweaks to it (version I have does have darkness adjustments + different blurring algorithms, but not moving shadows from trees and grass)? If it's the latest version, I could share my ripoff with jumpman, but if there is a newer version, I would like to get my hands on it as well grin

Greets


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Double sided shader that works with PSSM [Re: 3run] #465908
05/17/17 10:19
05/17/17 10:19
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
originally I used old shade-c one, but it was full with problems (no smooth borders), and used a custom and a bit strange lighting, so I totally rewrote it.

first I corrected the variance shadowmapping, and finally replaced it with another nicer faster approach called exponential shadowmapping, which is still up to date, and enough to use only 1 or 2 cascades. this technique used in unreal engine too (but UE4 does it faster even for 4 cascades). you can find it in scsm.h and scsm.c

moreover I rewrote pssm shadows to use Slin's custom split calculation. you can find it in pssm.h and pssm.c

if you search the project for pssm/scsm _init() _start() and _close() functions you can see how simple to use it.


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Double sided shader that works with PSSM [Re: sivan] #465941
05/18/17 08:58
05/18/17 08:58
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Thank you! Can I rip it off the mapbuilder for personal use and to share it with those who is looking for shadowmapping? Do we need to give you any credits? laugh

Edit: ripped off the scsm, tried to run Scsm_Start in main loop, no errors, but no shadows (included all .fx files mentioned in both .c and .h files). Tried settings SHADOW flag for level_ent and even tried to set FLAG6 (saw in somewhere in your code, I guess in mapent.c ?) but no luck. Where can I find materials related to scsm to apply them for level blocks etc? Plus there is still issue with no moving shadows after terrain and grass models (which are animated via shader).

Last edited by 3run; 05/18/17 10:16.

Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Double sided shader that works with PSSM [Re: 3run] #465946
05/18/17 13:19
05/18/17 13:19
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
materials are set dynamically in MBmaterials.c according to actual shadow_stencil value (can be -1, 1, 8)

Code:
else //if (shadow_stencil == (var)-1)
				{
					// MB materials got shader to have self shadows
					effect_load(mtl_detail		,"sc_obj_sprite_MB.fx");				// obj_animGrass1_MB (no shadow response, bad with height fog) or sc_obj_sprite_MB
					effect_load(mtl_shrub		,"sc_obj_sprite_MB.fx");
					effect_load(mtl_grass 		,"sc_obj_grass1_MB.fx");
					effect_load(mtl_obstacle	,"sc_obj_model_MB.fx");
					effect_load(mtl_tree			,"sc_obj_tree1_MB.fx");
					effect_load(mtl_mapent		,"sc_obj_level_MB.fx");
					effect_load(mtl_terrmdl		,"sc_obj_model_MB.fx");
					effect_load(mtl_building	,"sc_obj_model_MB.fx");
					
					// 3DGS materials can be used to not to have self shadow
//					effect_load(mtl_terrain		,"sc_obj_model_MB.fx");					// not used, in action own shader
					effect_load(mtl_model		,"sc_obj_model_MB.fx");
					effect_load(mtl_sprite		,"sc_obj_sprite_st_MB.fx");	
					effect_load(mtl_flat			,"sc_obj_level_MB.fx");
					effect_load(mtl_shaded		,"sc_obj_level_MB.fx");
					effect_load(mtl_sky			,"sc_obj_sky_MB.fx");
					
//					mtl_tree.flags |= ENABLE_TREE;											// ENABLE_RENDER or ENABLE_TREE
//					mtl_tree.event = sc_tree_billboard_event;
					
					// RTS unit materials 
{}
#ifdef PLAY02_PS
					effect_load(mtl_bonesanim	,"sc_obj_bones_MB.fx");	// FIL	 	// slower SM3.0 shader with pixel shader - capability of player colour display
#else
					effect_load(mtl_bonesanim	,"obj_bones_MB.fx");		// FIL		// no pixel shader
#endif					
				}



but as I mentioned in the MapBuilder thread yesterday, there is a bug in loading settings from a file, so next week it is going to be fixed.


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Double sided shader that works with PSSM [Re: sivan] #465947
05/18/17 13:20
05/18/17 13:20
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
of course you can rip it off, just give me credits.
I think earlier I made a separate demo and shared in the forum...


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Double sided shader that works with PSSM [Re: sivan] #465994
05/19/17 10:02
05/19/17 10:02
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
I'm getting black screen :<

Didn't load any settings, since they are set to default values in scsm header. Applied all shaders via effect_load, as in your example. Compiles with no errors, all .fx files are included. Maybe you remember facing this issue? I'm pretty sure that it's easy to fix, I'm just missing something. Also, what about not moving shadows for animated (via shader) grass and tress?

Edit: also another question, were you able to get shadows working for animated sprites?


Best regards!

Last edited by 3run; 05/19/17 11:06.

Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Double sided shader that works with PSSM [Re: 3run] #466022
05/21/17 15:09
05/21/17 15:09
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
I used animated sprites (as far lods of characters) with shadows. I don't know why you get black geometries, some material settings could be wrong. I can help next week I'm really tired now, I have finished today morning a one day long ultra-marathon in a team...


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Double sided shader that works with PSSM [Re: sivan] #466024
05/21/17 18:08
05/21/17 18:08
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Sounds awesome man! Did your team win?

It would be great if you could help us out with this. Having some shaders seperated from your project MapBuilder could be helpful for those who are still torment gamestudio grin

Best regards!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Double sided shader that works with PSSM [Re: 3run] #466205
05/31/17 19:33
05/31/17 19:33
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Howdy, Sivan does your MapBuilder's shadowmapping work in combination with the shade-c (evo)?
(I am using shade-c (evo) now and while the sun shadows are fairly sharp it drains fps alot)

Quote:
Having some shaders seperated from your project MapBuilder could be helpful for those who are still torment gamestudio grin
, yes please be our knight in shiny armor smile

Last edited by Reconnoiter; 05/31/17 19:35.
Re: Double sided shader that works with PSSM [Re: Reconnoiter] #466219
06/01/17 16:45
06/01/17 16:45
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
no they are incompatible, moreover evo uses a deferred renderer I have no experience with.

I wanted to update Mapbuilder this week, but I have been very-very busy, so it should happen next week only...

my shadowmapping was developed for my RTS game, so its main purpose was to have something fast beside acceptable quality, preferably using only one depth view. it can be okay with high resolution beside keeping shadow area small, but near sharp edges some defects are often visible. so for a 1st or 3rd person game a pssm is better, but since using the stencil buffer with 3dgs results in bugs (related to transparency, mirror views, or terrain lod I don't know), a shader only version would be a better choice. I think I made earlier such a test project...


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Double sided shader that works with PSSM [Re: sivan] #466238
06/02/17 11:04
06/02/17 11:04
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Okay thanks for the info.

Re: Double sided shader that works with PSSM [Re: Reconnoiter] #466572
06/21/17 16:48
06/21/17 16:48
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
Hey everyone, is there a way to change the shadow color of gamestudios PSSM shadow? Or can it only be black?

Re: Double sided shader that works with PSSM [Re: jumpman] #466594
06/22/17 10:49
06/22/17 10:49
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
imo it is possible..... maybe by stencil_color or something similar


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Double sided shader that works with PSSM [Re: sivan] #466595
06/22/17 10:52
06/22/17 10:52
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
NO!

from manual:

The transparency of stencil shadows can be set through mtl_shadow.alpha (default = 50), and their color can be set through mtl_shadow.diffuse_blue, mtl_shadow.diffuse_green, and mtl_shadow.diffuse_red (default = 0,0,0 = black).


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Double sided shader that works with PSSM [Re: sivan] #466611
06/23/17 14:57
06/23/17 14:57
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
those settings are for stencil shadows only, correct? I changed these settings, switched to stencil shadows, and was able to change the shadow colors. However these settings dont change the PSSM shadow colors.

Re: Double sided shader that works with PSSM [Re: jumpman] #466629
06/24/17 13:19
06/24/17 13:19
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
ahh sorry. then you have to change the pssm shader. I remember once I made it for debugging the different cascades, not too tricky. but it's on my old pc, not yet ported my 3dgs stuff to the new one.

Last edited by sivan; 06/24/17 13:20.

Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Double sided shader that works with PSSM [Re: sivan] #466669
06/26/17 20:39
06/26/17 20:39
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
thank you, thats what im trying to figure out

Page 1 of 3 1 2 3

Moderated by  Blink, Hummel, Superku 

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