Gamestudio Links
Zorro Links
Newest Posts
Alpaca Plugin v1.5.2 Release
by kzhao. 01/11/26 13:42
Alpaca Plugin v1.4.0
by kzhao. 01/11/26 13:38
separating groups of 3 digits by a comma
by joe_kane. 01/11/26 00:01
MRC.c and WFO
by joe_kane. 01/10/26 23:58
BarOffset (default = 940 for daily bars?
by joe_kane. 01/10/26 23:46
NOMAX undeclared identifier.
by Petra. 01/09/26 21:12
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 2,814 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
joe_kane, Namitha_NN, Syndrela, agasior, mosfet
19189 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 | 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