Страница 1 из 1

decal:add, decal:blend

СообщениеДобавлено: 21 фев 2011, 14:24
gnoblin
Вот что я спросил:
I'd like to know how to use decal:add \ decal:blend (the 2nd one is a new feature in 3.2) in a surface shader (and when is the appropriate situation to use these directives).

I've found decal:add in Terrain's AddPass.shader, but have no idea how to use this directive in my own shader.

There's a mention of them in the manual:
"decal:add - Additive decal shader (e.g. terrain AddPass).
decal:blend - Semitransparent decal shader."

But besides that I haven't found any useful info.


Вот что ответил Aras в бетагруппе:

decal:blend is for "decal" objects, i.e. semitransparent objects that lie on top of some other surface (think bullet/explosion marks, footsteps, graffiti etc.).

Using decal:blend makes it a bit different from a regular semitransparent shader because shadows will be received by the decal object, both in forward and deferred rendering. However, for that to work, some other regular opaque object needs to be just below the decal surface. See the attached picture; there's a regular plane and a smaller plane with a tiled particle texture on top; and that smaller plane is using shader with decal:blend. I attached a small package with this scene & shader.

No other regular use cases come to mind for this, except for terrain's additive pass :) Overall it's just like decal:blend, except the blending is additive. It also needs some other opaque surface to be beneath it for shadows to work.

Re: decal:add, decal:blend

СообщениеДобавлено: 21 фев 2011, 18:46
Spike
О деталях реализации декалей этим способа можно только догадываться.
Если поставить на сцену два источника то видны отличия в forward & deferred рендерах. (в шейдере стоит decal:blend)
Первое это не одинаковый блендинг, в форварде если подсвечивать подложку с тенью, другим источником света, то декаль не правильно блендится с тенью.
Второе почему в форвард рендере этот же плейн дает 2 DC, а в диференде 1 :). В обоих ренедерах тени не принимаются, а свет принимается только от одного источника(с самой большой интенсивностью).

test_decal_blend.jpg