renderingto texture while using same texture for lookup

renderingto texture while using same texture for lookup

Post by Janu » Sun, 20 May 2007 19:46:29


Is is possible to
render a cene to a texture A
set the texture A as lookuptexture
render scene to texture A

This means that in the second render call the texture is being red and
written at the same time.

I assume the answer is no, but in theory I assume it could... if one reads
the axact pixel one is about to write?
 
 
 

renderingto texture while using same texture for lookup

Post by legalize+j » Sun, 20 May 2007 20:03:55

[Please do not mail me a copy of your followup]

"Janus" < XXXX@XXXXX.COM > spake the secret code
<464ed585$0$21932$ XXXX@XXXXX.COM > thusly:


No, this is not valid. Render to one texture while sampling from a
different one.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
< http://www.yqcomputer.com/ ~legalize/book/download/index.html>

Legalize *** hood! < http://www.yqcomputer.com/ ;

 
 
 

renderingto texture while using same texture for lookup

Post by Janu » Sun, 20 May 2007 22:28:42

> No, this is not valid. Render to one texture while sampling from a

I tried deleting my post, but aparently I was not fast enough.

However, since the thread is started then let me ask another way...

I want to do some custom alpha blending on a device without seperate alpha
blend.
I was considering writing a shader for it.
The procedure would be to render one surface to a texture and blending it
into another texture by
setting them as lookups and setting a third texture as target and render a
full screen quad. For every pixel i would lookup the corosponding pixels in
the textures and output the blend. Then i would use the result as lookup in
the next pass along with one of the other textures which I first render a
surface into.
This way I would have a composition being built up and two other textures
taking turn being the target for new geometry.

This should be possible, though perhaps badly explained here, but is there
another accepted way of accomplishing this?
 
 
 

renderingto texture while using same texture for lookup

Post by Janu » Sun, 20 May 2007 22:30:57

> This should be possible, though perhaps badly explained here, but is there

What I neglected was that the texture with the composition will have to be
compied to one of the other textures since I can not write into the
composition while reading from it to blend with the newly rendered object in
the other texture
 
 
 

renderingto texture while using same texture for lookup

Post by Janu » Sun, 20 May 2007 23:57:23

> What I neglected was that the texture with the composition will have to be

I am writing the stupidest posts right now, so please disregard this thread.

Using three testures this is easy enough, andunless the shader part is slow,
which I can not see why it should be, then its quick.

three testures, A,B and C A always received the new surface to be blended
into the scene
all are empty to begin with

A<- new surface
C<-pixelShaderBlend(A,B)
A<- new surface
B<-pixelShaderBlend(A,C)
A<- new surface
C<-pixelShaderBlend(A,B)
A<- new surface
B<-pixelShaderBlend(A,C)

and so on.when the composit scene is in C I blend A and B and vice versa

Now I can blend the colors and the alpha any way I like