Page 1 of 1

Alpha Blending or get the Color from the Background?

Posted: Mon Jun 22, 2009 2:06 pm
by h.a.n.d
Hi,

I have a shader question and I hope that somebody has an answer to it.

My scene consists of an plane background object with a texture and a moving object with a texture (plane/or 3D).

Image
What I want to achieve is that the moving object gets coloured like the background
texture at the given position of the moving object.

Image
Image

I want to do this with a shader, because if it comes the colour pixels,
it's the right place to go. My prefered shader language is CG but if you familial with any other I'll be able to adapt it.

What I do know is the position of the moving object the position and
the dimension of the background texture.

Maybe I'm trying to do something very simple because I can't find
anything in the web, or I'm using the wrong buzz words.

This is actually a workaround for my original problem that I have:

I'm using a particle system where the particle is a plane object and has a translucent circle
with a white border as texture, so you can see the background through it.
And the more particle there are the brighter the white will get.

Image

That behavior is right but not realy wanted. Because when the number
of the particle went through the roof, I end up with an opaque white
and the particles form a spongy mass and you can't see any more details in it.

Image

Is there an apha blending mode that I missed that will do the job?
I'm using EMT_TRANSPARENT_ALPHA_CHANNEL right now ...

One way to solve this problem is to make the center of particle texture opaque,
but I'm using the background texture as static light source so the particle gets
brighter at the top of the scene and darker at the bottom.

Thank you for your help.
If you need more details please ask.

Posted: Thu Jul 09, 2009 3:21 am
by Ulf
To me, your post is very contradictory and confusing.

Firstly, and simply, based on your quote:
h.a.n.d wrote: What I want to achieve is that the moving object gets coloured like the background texture at the given position of the moving object.
To do that all you need to do is make the object 100% transparent and it will look like the color of the background behind it. LOL. :lol:


Next:
h.a.n.d wrote: I want to do this with a shader, because if it comes the colour pixels,
it's the right place to go.
What did you say in English?


And
h.a.n.d wrote: This is actually a workaround for my original problem that I have:

I'm using a particle system where the particle is a plane object and has a translucent circle with a white border as texture, so you can see the background through it.
And the more particle there are the brighter the white will get.
Is that what it's supposed to do? Or what do you want?

h.a.n.d wrote: That behavior is right but not realy wanted.
Huh? It's correct BUT NOT WANTED! hahahaha. wtf?


Then the explanation why it's not wanted?
h.a.n.d wrote: Because when the number of the particle went through the roof, I end up with an opaque white and the particles form a spongy mass and you can't see any more details in it.
If it's supposed to get more white when there are more particles, then of course it's going to end up being opaque white. What are you talking about?


and then
h.a.n.d wrote: Is there an apha blending mode that I missed that will do the job?
Do what job?
What in hell do you actually want?