How to get rid of shading?

General discussion and questions about XNALara go here.

Moderators: ObscureMemories, Runa, Love2Raid

Posts: 1
Joined: Wed Jun 06, 2018 9:53 pm
Custom Rank: Veteran Page Scroller

How to get rid of shading?

Postby DemiMaximoff » Wed Jun 06, 2018 10:24 pm

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?

User avatar
Posts: 146
Joined: Wed Aug 22, 2012 2:52 am
Location: Gravlex Med

Re: How to get rid of shading?

Postby Anx » Mon Jun 11, 2018 1:38 am

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;
    }
}

Posts: 12
Joined: Sat Mar 14, 2020 7:39 am

Re: How to get rid of shading?

Postby SteeLisPain7 » Sat Mar 14, 2020 9:22 am

I usually go and change the lighting parameters mostly, should be easy.

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest