Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, dr_panther), 791 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Generating random numbers in a pixel shader [Re: MasterQ32] #443496
07/17/14 14:57
07/17/14 14:57
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
wow. maybe is it the way how in RTS games behind effect is rendered where only you see a silhouette of a unit if behind e.g. a building?


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Generating random numbers in a pixel shader [Re: sivan] #443497
07/17/14 15:07
07/17/14 15:07
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
@^: Most (if not all?) games that I saw were using pp-shaders for this effect.


POTATO-MAN saves the day! - Random
Re: Generating random numbers in a pixel shader [Re: MasterQ32] #443552
07/19/14 17:15
07/19/14 17:15
Joined: Mar 2010
Posts: 120
Switzerland
T
TehV Offline OP
Member
TehV  Offline OP
Member
T

Joined: Mar 2010
Posts: 120
Switzerland
Originally Posted By: MasterQ32
AAaaah much complicatated, such work!

Simple use a two pass approach:
First pass renders only depth of your model (One + Zero), second pass renders your model as a silhuette (remove first part to see overlapping)
Code:
float4 ps() : COLOR0 {
	return float4(0.3, 0, 0, 1);
}

technique { 
	pass {
		ZEnable = true;
		ZFunc = Less;
		ZWriteEnable = true;
		AlphaBlendEnable = true;
		SrcBlend = Zero;
		DestBlend = One;
	}
	pass {
		ZEnable = true;
		ZFunc = LessEqual;
		ZWriteEnable = false;
		AlphaBlendEnable = true;
		SrcBlend = One;
		DestBlend = One;
		PixelShader = compile ps_2_0 ps();
	}
}



That worked. The only problem I'm having is that I can't make it a transparent black (which is what I wanted). Is there a way to do this?

Page 2 of 2 1 2

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