chrsmith2

chrsmith2

About Me

Expertise
Not Specified
Location
Not Specified
Website

Connect

Recent Forum Posts

writing shader - diffuse and alpha question March 25, 2004, 12:02 a.m.

Hi everyone,

I'm just learning about how to write shaders in VEX. I understand how the final pixel color is determined by the diffuse color, lighting, etc. But what I don't understand is how the shader handles the pixel color when it it is slightly transparent and there are other polygons behind it. If I have a box with transparency, does it execute the code twice and get the final color by getting the color for the front face of the box and adding the color for the back face of the box?

For example: I have a grid with a grey color on it and grey alpha. If I copy this grid a few times so that there are several that I'm looking through in a row, the final color gets brighter than the original grey. This happens with default VEX shaders like VEX Constant. But this seems incorrect. The color shouldn't be any brighter than my original diffuse color. How do I get the final value for Cf so that it doesn't get brighter when layered?

What I'm eventually trying to do is create a cloud using grids (like sprites) with puffy texture maps, all bunched together. Each grid has a greyish puff on it, but when they are bunched together, the cloud gets bright white and loses all its detail. I'm using “VEX decal2” by Side Effects, and figure that I'll have to modify it to get the effect I want.

Thanks!
Christine Smith