Click here to Skip to main content
15,911,646 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: DefWindowPro() Pin
Eytukan15-Mar-09 22:02
Eytukan15-Mar-09 22:02 
Questionhow to solve WASENOBUFS error? Pin
tyr200015-Mar-09 21:05
tyr200015-Mar-09 21:05 
AnswerRe: how to solve WASENOBUFS error? Pin
Hamid_RT15-Mar-09 21:13
Hamid_RT15-Mar-09 21:13 
GeneralRe: how to solve WASENOBUFS error? Pin
tyr200015-Mar-09 21:16
tyr200015-Mar-09 21:16 
GeneralRe: how to solve WASENOBUFS error? Pin
Eytukan15-Mar-09 22:21
Eytukan15-Mar-09 22:21 
GeneralRe: how to solve WASENOBUFS error? Pin
tyr200016-Mar-09 16:58
tyr200016-Mar-09 16:58 
GeneralRe: how to solve WASENOBUFS error? [Added] Pin
Eytukan15-Mar-09 22:23
Eytukan15-Mar-09 22:23 
QuestionPSSM and deferred shading (unfilled shadow) [modified] Pin
akira3215-Mar-09 21:04
akira3215-Mar-09 21:04 
I meet a problem about using PSSM(Parallel-Split Shadow Maps) to render the shadow to a shadow result texture (restore the shadow pixel, 1 means lighted, 0 means shadowed). The shadow result texture is a render target texture with the format of R32F. My problem is that if I render a flag model in PS_SRT (pixel shader to generate shadow result texture) and using "return fLightingFactor;", I will see the nofilled shadow. If I using "return float4(fLightingFactor,1.0f,1.0f,1.0f);" in PS_SRT, I will see the filled shadow.

The filled shadow: http://cid-fbeb6373d9321a7f.skydrive.live.com/self.aspx/Questions/shadow/PSSM%7C_shadow%7C_fill.JPG
The unfilled shadow: http://cid-fbeb6373d9321a7f.skydrive.live.com/self.aspx/Questions/shadow/PSSM%7C_shadow%7C_notfill.JPG

The filled shadow also has a stranger aliasing problem. The program is written by my lowerclassman. I implement PSSM into this program. I also implement the PSSM into my MapEditor, but my MapEditor has no this stranger shadow aliasing and no unfilled problem---no matter the return statement ("return fLightingFactor;" or "return float4(fLightingFactor,1.0f,1.0f,1.0f);" ).(My MapEditor's flag shadow : http://cid-fbeb6373d9321a7f.skydrive.live.com/self.aspx/Questions/shadow/PSSM%7C_shadow%7C_fill%7C_ME%7C_no%7C_aliasing.JPG).

These are my partial shader code:

void VS_RenderShadowMap(
						float4 vPos : POSITION,
						out float4 vPosOut : POSITION,
						out float3 vPixelOut : TEXCOORD0)
{
	// pass vertex position through as usual
	vPosOut = mul(vPos, wvp);
	// output pixel pos
	vPixelOut=vPosOut.xyz;
}

float4 PS_RenderShadowMap(float3 vPixelPos : TEXCOORD0): COLOR
{
	// write z coordinate (linearized depth) to texture
	return vPixelPos.z;
}


// This technique is used when rendering meshes to the shadowmap
// 
technique RenderShadowMap
{
	pass p0
	{
		// render back faces to hide artifacts
		CullMode = CW;
		ZWriteEnable=TRUE;
		ZEnable=TRUE;
		VertexShader = compile vs_3_0 VS_RenderShadowMap();
		PixelShader = compile ps_3_0 PS_RenderShadowMap();
	}
}

void VS_SRT(
			in float4 vPos : POSITION,
			in float3 vNormal : NORMAL,
			in float4 vDiffuseTex : TEXCOORD0,
			out float4 vPosOut : POSITION,
			out float4 vShadowTex : TEXCOORD0,
			out float4 vDiffuseTexOut : TEXCOORD1
			)
{
	// pass vertex position through as usual
	vPosOut = mul(vPos, wvp);

	// coordinates for shadowmap
	vShadowTex = mul(vPos, g_mShadowMap);
	vDiffuseTexOut=vDiffuseTex;
}

float4 PS_SRT(
			  float4 vShadowTex : TEXCOORD0,
			  float4 vDiffuseTex: TEXCOORD1
			  ) : COLOR
{

	float4 Color=tex2D(DiffuseMapSampler1, vDiffuseTex);
	if (Color.a<0.5f)
	{
		discard;
	}
	
	//float fTexelSize=1.0f/g_fShadowMapSize;

	// project texture coordinates
	vShadowTex.xy/=vShadowTex.w;

.......
	if (g_bUseColorfulSplit==true)
	{
.......

#ifdef _RETURN_FLOAT4_
		return float4(fLightingFactor,1.0f,1.0f,1.0f);
#else
		return fLightingFactor;
#endif
	}
	
}

technique generateSRT
{
	pass p0
	{
		// render front faces
		//CullMode = CCW;
		CullMode=CCW;
		ZWriteEnable=TRUE;
		ZEnable=TRUE;		
			
		VertexShader = compile vs_3_0 VS_SRT();
		PixelShader = compile ps_3_0 PS_SRT();
	}
}


modified on Monday, March 16, 2009 3:20 AM

QuestionOffice toolbar item - Generic Pin
ERLN15-Mar-09 20:46
ERLN15-Mar-09 20:46 
QuestionPlotting graph in MFC Pin
Febin Elizabeth15-Mar-09 20:14
Febin Elizabeth15-Mar-09 20:14 
AnswerRe: Plotting graph in MFC Pin
Eytukan15-Mar-09 20:19
Eytukan15-Mar-09 20:19 
GeneralRe: Plotting graph in MFC Pin
Febin Elizabeth15-Mar-09 22:42
Febin Elizabeth15-Mar-09 22:42 
GeneralRe: Plotting graph in MFC Pin
Eytukan15-Mar-09 23:13
Eytukan15-Mar-09 23:13 
GeneralRe: Plotting graph in MFC Pin
Cedric Moonen15-Mar-09 23:18
Cedric Moonen15-Mar-09 23:18 
GeneralRe: Plotting graph in MFC Pin
Febin Elizabeth16-Mar-09 18:28
Febin Elizabeth16-Mar-09 18:28 
GeneralRe: Plotting graph in MFC Pin
Cedric Moonen16-Mar-09 21:29
Cedric Moonen16-Mar-09 21:29 
GeneralRe: Plotting graph in MFC Pin
Febin Elizabeth17-Mar-09 4:35
Febin Elizabeth17-Mar-09 4:35 
GeneralRe: Plotting graph in MFC Pin
Cedric Moonen17-Mar-09 4:37
Cedric Moonen17-Mar-09 4:37 
GeneralRe: Plotting graph in MFC Pin
kip_chuko21-Dec-09 16:30
kip_chuko21-Dec-09 16:30 
QuestionUpdate CListCtrl Pin
durban215-Mar-09 20:08
durban215-Mar-09 20:08 
AnswerRe: Update CListCtrl Pin
CPallini15-Mar-09 21:27
mveCPallini15-Mar-09 21:27 
Questionshadow aliasing by using PSSM(one is right,another is error) Pin
akira3215-Mar-09 19:56
akira3215-Mar-09 19:56 
Questionresource script of hindi language Pin
Purish Dwivedi15-Mar-09 19:46
Purish Dwivedi15-Mar-09 19:46 
AnswerRe: resource script of hindi language Pin
Eytukan15-Mar-09 20:15
Eytukan15-Mar-09 20:15 
QuestionRe: resource script of hindi language Pin
Purish Dwivedi15-Mar-09 20:36
Purish Dwivedi15-Mar-09 20:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.