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
4 registered members (M_D, AndrewAMD, Quad, Ayumi), 806 guests, and 5 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
Depth Shader with Alpha transparency information #467837
09/04/17 05:48
09/04/17 05: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
Hello, Im using the depth.fx file to generate a depth map for my scene, to be used for post processing.

Is there a shader I can apply to the camera/.fx that also takes into account entity alpha maps? I use a shader that cuts off alpha information as well as PASS_SOLID which looks nice. But I want a depth shader that takes this into account, not just polygons.

What can I add to this shader to make it account for alpha transparency?

Code:
////////////////////////////////////////////////////
// Depth rendering shader
// Copyright (c) 2007 Conitec. All rights reserved.
////////////////////////////////////////////////////
	
// Application fed data:
const float4x4 matWorldViewProj;

//////////-----------------------

//////////------------------	
	
	
void DepthVS (in float4 InPos	: POSITION,
				out float4 OutPos	: POSITION,
				out float OutDepth: TEXCOORD0)
{
// Output the transformed position
	OutPos = mul(InPos,matWorldViewProj);

// Output the scene depth
OutDepth = (OutPos.z)*.002;




	//	OutDepth = OutPos.z;
	

	//OutDepth -= OutDepth;
}

float4  DepthPS( in float InDepth: TEXCOORD0 ) : COLOR0
{

	
	

	
// Output the scene depth to a R32 floating point texture
//	return float4( InDepth, 0.0, 0.0, 1.0 );	

return float4(InDepth, 0.0, 0.0, 1.0 );	
	
	
}

technique DepthTechnique
{
	pass p0
	{
		Lighting	= False;			
		VertexShader = compile vs_2_0 DepthVS();
		PixelShader  = compile ps_2_0 DepthPS();
	}
}


Re: Depth Shader with Alpha transparency information [Re: jumpman] #467840
09/04/17 09:34
09/04/17 09:34
Joined: Aug 2003
Posts: 118
Deutschland
E
Ezzett Offline
Member
Ezzett  Offline
Member
E

Joined: Aug 2003
Posts: 118
Deutschland
Are you looking for something like this:

http://www.rastertek.com/dx10tut49.html

Re: Depth Shader with Alpha transparency information [Re: Ezzett] #467846
09/04/17 13:43
09/04/17 13:43
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
thats almost exactly what Im looking for Ezzett, thank you. Its in DX10 though, and im having trouble trying to get it to work, but its the right principle

Re: Depth Shader with Alpha transparency information [Re: jumpman] #467893
09/05/17 23:53
09/05/17 23:53
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
This is easy, just sample the texture in your depth shader for each object and do something like this:

clip(tex.a-0.5);

Re: Depth Shader with Alpha transparency information [Re: Matt_Aufderheide] #467917
09/07/17 19:47
09/07/17 19:47
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
thanks matt!


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