Ehehe, I didn’t explain myself too well… J

Let’s imagine I just need to do an albedo change, and I want to do it with blending (as you suggested, if I recal)…

I’d get a pixel shader something like:

{

float4 source_color=tex2D(rt1,in.uv_screen);

float4 decal_color=tex2D(decal_texture,in.uv_decal);

return float4(decal_color.xyz* decal_color.a+rt1.xyz*(1-decal_color.a);

}

So I need to use rt1 as both input and output, and I think that’s a no-no in a modern video card… So I fail to see how can I do blending operations on the G-Buffer…

Diogo

From: Jeff Russell [mailto:jeffdr@8monkeylabs.com]
Sent: quarta-feira, 13 de Janeiro de 2010 17:20
To: Game Development Algorithms
Subject: Re: [Algorithms] Decals and deferred rendering

Well, since its a decal, you shouldn't need to use Rt3 as output (you're not modifying positions of anything, just painting new material properties over the existing geometry). So maybe we confused the terms, I was recommending you render into albedo, normal, specular, etc. but not position.

Jeff

On Wed, Jan 13, 2010 at 11:14 AM, Diogo de Andrade <diogo.andrade@netvisao.pt> wrote:

Hi all,

I'm not sure I understood what you and Jeff are recommending, to be
honest...

Clarifying:

I start rendering to the G-Buffer... I have the buffers organized like this:

Rt0.xyz=normal (world space)
Rt0.w=depth (0..1 normalized)
Rt1.xyz=albedo
Rt1.w=ambient intensity
Rt2.x=specular intensity
Rt2.y=specular gloss
Rt2.z=diffuse intensity
Rt2.w=emissive intensity
Rt3.xyz=position (world space)
Rt3.w=unused

Let's imagine I have a maze... I render all walls to these buffers, and now
it's time to render the decals themselves.

With the G-Buffer still as the rendertarget, I draw the geometry that makes
up the decals (obtained through intersection of the world geometry with the
decal frustum)...
Now, the part I don't understand is how to achieve blending (which would be
sweet), without having the G-Buffer simultaneously as a render target and as
input texture (which I think is not allowed under the majority of the
videocards). If I could have that, I'd be able to do whatever I wanted in
the way of blending and such...
To be honest, now that I think about it, I'm not even seeing how I can make
a shader to render the decal in a way it only influences the albedo, even if
it is a simple replace, without using colorwrite masks (which I didn't want
to use because they makes me have to switch states). What I'm trying to
achieve (but may be impossible) is to have a "decal sheet", which has all
the decals, so that with a single draw I can get all decals up... not sure
if that's possible...

Thanks all,

Diogo

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
GDAlgorithms-list mailing list
GDAlgorithms-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list

--
Jeff Russell
Engineer, 8monkey Labs
www.8monkeylabs.com