Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (degenerate_762, Nymphodora), 1,012 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 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
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