Re: Render-Target destination alpha
From: Tomas Vykruta (tom_at_surreal.com)
Date: 02/20/04
- Next message: Tomas Vykruta: "DX9 control panel"
- Previous message: Tomas Vykruta: "Re: Render-Target destination alpha"
- In reply to: Tomas Vykruta: "Re: Render-Target destination alpha"
- Next in thread: Rich [Microsoft Direct3D MVP]: "Re: Render-Target destination alpha"
- Reply: Rich [Microsoft Direct3D MVP]: "Re: Render-Target destination alpha"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 20 Feb 2004 14:46:54 -0800
Well here is a nasty surprise. Even if you EXPLICITALLY write a pixel
shader that sets the .a value to "0", while that value does get used in the
blend equation, it never gets written to the destination buffer. I wish
there had at least been some documentation about this so that I wouldn't
have wasted 2 days trying to get it to work. Xbox is SO much easier to work
with. Is DX9 the only way to write an alpha value to a target buffer?
Switching at this point is going to cost tons of dev and QA time. Maybe
there's another way to do this effect.
here is how it works: I set 'STENCILWRITE' to true for some materials.. at
the end of the scene, I copy the framebuffer to a small 256x256 texture,
only copying pixels that are stencil marked. Some processing is done on
these, then it is blended back onto the RT, which itself gets moved to the
FB. Since you can't use "STENCIL" as a read mask, because it is attached to
the depth buffer, I'm copying the stencil bits to the alpha channel. Any
ideas of how else this could be done? One way would be to allocate yet
another full-sized buffer, clear it, and copy the target to this new buffer
with stencil write mask. This iwould be a huge waste of memory and fillrate
though.
"Tomas Vykruta" <tom@surreal.com> wrote in message
news:OCQ1hDA#DHA.3488@tk2msftngp13.phx.gbl...
> I'm using DX81 (too late to switch to 9), where this feature isn't
> supported. I wouldn't feel comfortable using such a new feature anyway, I
> doubt many vendors support it. Lived thorugh a a nightmare with Fellowship
> PC last year where I used a bunch of infrequently used DX8 features, and
> after the game shipped we had a huge amount of returns because things
didn't
> work. The patch fixed alot of them but not all.
> How does dx8 deal with render target alpha? I may just have to write 2
pixel
> shaders, one that sets alpha to 0 for the 'clear' pass, and one that sets
it
> to 255 for the 'stencil' pass.
>
>
> "Philip Taylor [ATI]" <ptaylor@online.newsgroup-poster.ati.com> wrote in
> message news:#Ias16$9DHA.1648@tk2msftngp13.phx.gbl...
> > is D3DPMISCCAPS_SEPARATEALPHABLEND set?
> >
> > did you use D3DRS_SEPARATEALPHABLENDENABLE as well as D3DRS_ALPHABLEND?
> >
> > see doc section "Render Target Alpha"
> > "Tomas Vykruta" <tom@surreal.com> wrote in message
> > news:eOHMnd$9DHA.548@TK2MSFTNGP11.phx.gbl...
> > > When rendering to a texture that's D3DFMT_A8R8G8B8, what gets written
to
> > the
> > > alpha channel? How is this determined? Where is it documented? I'm
> > trying
> > > to do this:
> > >
> > > Render scene into render target, flagging some pixels as stencil bits
> > > Render untextured poly, clearing alpha channel
(D3DRS_COLORWRITEENABLE,
> > > D3DCOLORWRITEENABLE_ALPHA)
> > > Render untextured poly, using a stencil mask, setting alpha channel to
> > 0xff
> > > for each pixel that passes stencil test
> > > Set target as source texture, and render to another texture using
alpha
> > > reference test to mask out all non-stencilled pixels.
> > >
> > > This could be done using the stencil buffer exclusively, except the
> second
> > > target would have to be the same dimensions as the original texture..
in
> > > this case it is much smaller.
> > >
> > > Unfortuantely I can't even get step 2 working, clearing the alpha
> channel.
> > > I'm starting to wonder if drivers even implement writing to the alpha
> > > channel since this isn't typically required. Is this documented
> anywhere?
> > >
> > > Tomas Vykruta
> > >
> > >
> >
> >
>
>
- Next message: Tomas Vykruta: "DX9 control panel"
- Previous message: Tomas Vykruta: "Re: Render-Target destination alpha"
- In reply to: Tomas Vykruta: "Re: Render-Target destination alpha"
- Next in thread: Rich [Microsoft Direct3D MVP]: "Re: Render-Target destination alpha"
- Reply: Rich [Microsoft Direct3D MVP]: "Re: Render-Target destination alpha"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|