Page 1 of 1

How to get rid of shading?

Posted: Wed Jun 06, 2018 10:24 pm
by DemiMaximoff
when the written shader XL_detailShadlessOutline is chosen, the model always has one level of shade. Is there a way I can edit the .fx file so that the model is rendered flat without any shading (like when render group is set to 10 in material editor) while retaining the outlines?

Re: How to get rid of shading?

Posted: Mon Jun 11, 2018 1:38 am
by Anx
DemiMaximoff wrote:when the written shader XL_detailShadlessOutline is chosen, the model always has one level of shade. Is there a way I can edit the .fx file so that the model is rendered flat without any shading (like when render group is set to 10 in material editor) while retaining the outlines?
Sure, you can edit the .fx file so that the model is rendered flat without any shading.
Just comment (using //) the 3 lines that produce the "one level of shade".

Code: Select all

float4 XL_PS(BasicVertexShaderOutput input) : COLOR0
{
	float4 diffuseColor;
	if (!AlphaPass) {
		diffuseColor = GetDiffuseColor(input.TexCoord);
		diffuseColor *= input.Color;
		float phongShadingFactor1 = CalcPhongShadingFactors_1(input.NormalWorld);

		// if (phongShadingFactor1 < 0.1) {
		//	diffuseColor.rgb *= 0.7;
		// }
	} else {
		diffuseColor = tex2D(DiffuseTextureSampler, input.TexCoord);
		diffuseColor.rgb = 1;
	}
	return saturate(diffuseColor);
}

Or extend the .fx file with your new technique

Code: Select all

float4 DemiMaximoff_PS(BasicVertexShaderOutput input) : COLOR0
{
	float4 diffuseColor;
	if (!AlphaPass) {
		diffuseColor = GetDiffuseColor(input.TexCoord);
		diffuseColor *= input.Color;
		float phongShadingFactor1 = CalcPhongShadingFactors_1(input.NormalWorld);

		//if (phongShadingFactor1 < 0.1) {
		//	diffuseColor.rgb *= 0.7;
		//}
	} else {
		diffuseColor = tex2D(DiffuseTextureSampler, input.TexCoord);
		diffuseColor.rgb = 1;
	}
	return saturate(diffuseColor);
}

technique DemiMaximoff
{
    pass P0
    {
        VertexShader = compile vs_2_0 BasicOutlineVS();
        PixelShader = compile ps_2_0 BlackPS_2();
	CullMode = CW;
    }

    pass P1
    {
        VertexShader = compile vs_2_0 BasicVS();
        PixelShader = compile ps_2_0 DemiMaximoff_PS();
	CullMode = CCW;
    }
}

Re: How to get rid of shading?

Posted: Sat Mar 14, 2020 9:22 am
by SteeLisPain7
I usually go and change the lighting parameters mostly, should be easy.