Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#Actualiedoc

Posted 27 February 2012 - 08:40 AM

you could use a point samper to avoid the blending problem. But even with blending, i needed to make sure that every other pixel was exactly the other texture, with blending, i can't be sure that the blending operation will do that perfectly. I needed an operation that was very predictable if you know what i mean

but this was actually a double post (although i only clicked the send button once...). The answer was solved already, all i needed was SV_Position to get the position of the current pixel. i didn't realize SV_Position could be used in the pixel shader (I mean, i knew that, but for some reason i had spaced it out... I'm really not very good with hlsl). Just knowing you can use SV_Position to get the position of the current pixel was all i really wanted to know though, but thanks for an in depth answer. My pixel shader ended up like this:

float4 _3D_PS(VS_OUTPUT input) : SV_TARGET
{
	 float4 LeftEye = LeftEyeTexture.Sample( TexSamplerState, input.TexCoord );
	 float4 RightEye = RightEyeTexture.Sample( TexSamplerState, input.TexCoord );

	 int tempIntX = input.Pos.x % 2;
	 int tempIntY = input.Pos.y % 2;

	 if(tempIntX == 0)
	 {
		  if(tempIntY != 0)
		  {
			   return LeftEye;
		  }
	 }

	 return RightEye;
}

#5iedoc

Posted 27 February 2012 - 08:39 AM

you could use a point samper to avoid the blending problem. But even with blending, i needed to make sure that every other pixel was exactly the other texture, with blending, i can't be sure that the blending operation will do that perfectly. I needed an operation that i was very predictable if you know what i mean

but this was actually a double post (although i only clicked the send button once...). The answer was solved already, all i needed was SV_Position to get the position of the current pixel. i didn't realize SV_Position could be used in the pixel shader (I mean, i knew that, but for some reason i had spaced it out... I'm really not very good with hlsl). Just knowing you can use SV_Position to get the position of the current pixel was all i really wanted to know though, but thanks for an in depth answer. My pixel shader ended up like this:

float4 _3D_PS(VS_OUTPUT input) : SV_TARGET
{
	 float4 LeftEye = LeftEyeTexture.Sample( TexSamplerState, input.TexCoord );
	 float4 RightEye = RightEyeTexture.Sample( TexSamplerState, input.TexCoord );

	 int tempIntX = input.Pos.x % 2;
	 int tempIntY = input.Pos.y % 2;

	 if(tempIntX == 0)
	 {
		  if(tempIntY != 0)
		  {
			   return LeftEye;
		  }
	 }

	 return RightEye;
}

#4iedoc

Posted 27 February 2012 - 08:34 AM

you could use a point samper to avoid the blending problem.

but this was actually a double post (although i only clicked the send button once...). The answer was solved already, all i needed was SV_Position to get the position of the current pixel. i didn't realize SV_Position could be used in the pixel shader (I mean, i knew that, but for some reason i had spaced it out... I'm really not very good with hlsl). Just knowing you can use SV_Position to get the position of the current pixel was all i really wanted to know though, but thanks for an in depth answer. My pixel shader ended up like this:

float4 _3D_PS(VS_OUTPUT input) : SV_TARGET
{
	 float4 LeftEye = LeftEyeTexture.Sample( TexSamplerState, input.TexCoord );
	 float4 RightEye = RightEyeTexture.Sample( TexSamplerState, input.TexCoord );

	 int tempIntX = input.Pos.x % 2;
	 int tempIntY = input.Pos.y % 2;

	 if(tempIntX == 0)
	 {
		  if(tempIntY != 0)
		  {
			   return LeftEye;
		  }
	 }

	 return RightEye;
}

#3iedoc

Posted 27 February 2012 - 08:33 AM

you could use a point samper to avoid the blending problem.

but this was actually a double post (although i only clicked the send button once...). The answer was solved already, all i needed was SV_Position to get the position of the current pixel. i didn't realize SV_Position could be used in the pixel shader (I mean, i knew that, but for some reason i had spaced it out... I'm really not very good with hlsl). Just knowing you can use SV_Position to get the position of the current pixel was all i really wanted to know though, but thanks for an in depth answer. My pixel shader ended up like this:

float4 _3D_PS(VS_OUTPUT input) : SV_TARGET
{
     float4 LeftEye= LeftEyeTexture.Sample( TexSamplerState, input.TexCoord );
     float4 RightEye= RightEyeTexture.Sample( TexSamplerState, input.TexCoord );

     int tempIntX = input.Pos.x % 2;
     int tempIntY = input.Pos.y % 2;

     if(tempIntX == 0)
     {
          if(tempIntY != 0)
          {
               return LeftEye;
          }
     }

     return RightEye;
}

#2iedoc

Posted 27 February 2012 - 08:32 AM

you could use a point samper to avoid the blending problem.

but this was actually a double post (although i only clicked the send button once...). The answer was solved already, all i needed was SV_Position to get the position of the current pixel. i didn't realize SV_Position could be used in the pixel shader (I mean, i knew that, but for some reason i had spaced it out... I'm really not very good with hlsl). Just knowing you can use SV_Position to get the position of the current pixel was all i really wanted to know though, but thanks for an in depth answer. My pixel shader ended up like this:

float4 _3D_PS(VS_OUTPUT input) : SV_TARGET
{
     float4 LeftEye= LeftEyeTexture.Sample( TexSamplerState, input.TexCoord );
     float4 RightEye= RightEyeTexture.Sample( TexSamplerState, input.TexCoord );

     int tempIntX = input.Pos.x % 2;
     int tempIntY = input.Pos.y % 2;

     if(tempIntX == 0)
     {
          if(tempIntY != 0)
          {
               return LeftEye;
          }
     }

     return RightEye;
}

#1iedoc

Posted 27 February 2012 - 08:29 AM

<p>you could use a point samper to avoid the blending problem,</p>
<p> </p>
<p>but this was actually a double post (although i only clicked the send button once...). The answer was solved already, all i needed was SV_Position to get the position of the current pixel. i didn&#39;t realize SV_Position could be used in the pixel shader (I mean, i knew that, but for some reason i had spaced it out... I&#39;m really not very good with hlsl). Just knowing you can use SV_Position to get the position of the current pixel was all i really wanted to know though, but thanks for an in depth answer. My pixel shader ended up like this:</p>
<p> </p>
<p>
float4 _3D_PS(VS_OUTPUT input) : SV_TARGET</p>
<div>{</div>
<div>     float4 LeftEye= LeftEyeTexture.Sample( TexSamplerState, input.TexCoord );</div>
<div>     float4 RightEye= RightEyeTexture.Sample( TexSamplerState, input.TexCoord );</div>
<div> </div>
<div>     int tempIntX = input.Pos.x % 2;</div>
<div>     int tempIntY = input.Pos.y % 2;</div>
<div> </div>
<div>     if(tempIntX == 0)</div>
<div>     {</div>
<div>          if(tempIntY != 0)</div>
<div>          {</div>
<div>               return LeftEye;</div>
<div>          }</div>
<div>     }</div>
<div> </div>
<div>     return RightEye;</div>
<div>}
</div>

PARTNERS