Jump to content

  • Log In with Google      Sign In   
  • Create Account


Editing textures in a shader


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 Naruto-kun   Members   -  Reputation: 333

Like
0Likes
Like

Posted 18 July 2013 - 05:13 AM

Hi guys

 

Is it possible to write to a texture in a shader? For example i have a texture array of 4 textures, the first 3 have been loaded with images, the 4th is left blank. Now i sample the first 3, perform an alpha blend on them. Is it possible to send the resulting color to the 4th texture?

 

Thanks

JB



Sponsor:

#2 Zaoshi Kaba   Crossbones+   -  Reputation: 4109

Like
0Likes
Like

Posted 18 July 2013 - 06:05 AM

Yes. Just create texture with shader resource and render target flags.



#3 Naruto-kun   Members   -  Reputation: 333

Like
0Likes
Like

Posted 18 July 2013 - 06:16 AM

Im guessing then that the texture must be a render target and it will be filled with the returned values of the shader?



#4 Zaoshi Kaba   Crossbones+   -  Reputation: 4109

Like
0Likes
Like

Posted 18 July 2013 - 07:15 AM

That's right. Considering original post you'll need to set depth stencil to NULL while rendering into this texture.



#5 Naruto-kun   Members   -  Reputation: 333

Like
0Likes
Like

Posted 18 July 2013 - 07:36 AM

Got it. Thanks a bunch.



#6 Naruto-kun   Members   -  Reputation: 333

Like
0Likes
Like

Posted 18 July 2013 - 08:18 AM

Just to make sure I am not missing anything, how does one "execute" the shader function?



#7 unbird   Crossbones+   -  Reputation: 4973

Like
0Likes
Like

Posted 18 July 2013 - 09:05 AM

Shaders get executed by rendering (drawing) something. For your current problem a so-called full-screen quad is recommended - a quad which covers the whole target area. With D3D10/11 one can even avoid vertices/indices and a input layout altogether by applying the following trick (it's actually a full-screen triangle, but the result is the same).



#8 Naruto-kun   Members   -  Reputation: 333

Like
0Likes
Like

Posted 18 July 2013 - 09:52 AM

Thanks. Will try.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS