Jump to content

View more

Image of the Day

#ld38 #screenshotsaturday Mimosa Fizz action gif #2 https://t.co/TUzdppvfUL
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Editing textures in a shader

4: Adsense

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   

442
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



#2 Zaoshi Kaba   Members   

8309
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   

442
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   Members   

8309
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   

442
Like
0Likes
Like

Posted 18 July 2013 - 07:36 AM

Got it. Thanks a bunch.



#6 Naruto-kun   Members   

442
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   Members   

8307
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   

442
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.