Jump to content
  • Advertisement
Sign in to follow this  
prux

Applying pixel shader effect not to the entire texture

This topic is 3595 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Simple question: how to use the "pixel shader" not to an entire texture (screen) but just a part of it. (part square)

Share this post


Link to post
Share on other sites
Advertisement
A pixel shader is only applied to pixel in the geometry that you're rendering. Usually with post-processing, where you want the shader to be applied to the entire screen, you render a full-screen quad (usually using transformed vertices). If you modify the coordinates of the vertices you're rendering, you can have the shader applied to any shape you want.

Share this post


Link to post
Share on other sites
In any case, one can always use a "mask" texture to determine where specific code is executed in any given shader. You could for instance apply a certain section of code to only areas where the alpha channel of a texture is greater than 0.5.

This can be explicitly done using if() blocks, or implicitly using lerp.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!