Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Ayumi), 838 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Shaders and Alpha and RGB #27886
05/25/04 01:41
05/25/04 01:41
Joined: Jan 2004
Posts: 585
Alexandria, VA
Alkai Offline OP
Developer
Alkai  Offline OP
Developer

Joined: Jan 2004
Posts: 585
Alexandria, VA
Thank you all very much for the great information available in this forum. Without your help, I would never have been able to accomplish what I have so far with shaders. I have been able to use the shader code provided (without really understanding it) and have amazed myself with the results.

Now I have a few questions that I need to ask for clarification, and to make sure that I understand correctly. I will try to word my questions as clearly as possible. Since I am still a newbie as far as shaders are concerned, I apologize if I am not as clear as I would like to be. I have actually gotten quite confused trying to digest all of the technical information.

My questions deal with the alpha channel and how exactly it is used by pixel and vertex shaders to multi-texture terrains. I have looked at people's sample TGA files and I am trying to digest how exactly they work.

1) The alpha channel is always greyscale, right?
2) Does the transparency value of the alpha channel determine the level of shading and the blending used?
3) When you create a TGA image and give it an alpha channel, are the RGB values used at all by the shader? If so, how does this work?

It is just an assumption on my part, but it seems like the red channel controls one texture, the green controls another, and the blue yet another. Then the transparency values control the actual shading.

How far off am I?

Many thanks to any who can assist me in understanding this.


If you gaze long into an abyss, the abyss will gaze back into you. 3.0 GHz Pentium 4 w/HT 1 Gig 400mhz DDR SDRAM 128mb NVidia GeForce FX 5200
Re: Shaders and Alpha and RGB [Re: Alkai] #27887
05/25/04 02:13
05/25/04 02:13
Joined: Dec 2003
Posts: 1,097
Maryland, USA
Steempipe Offline
Serious User
Steempipe  Offline
Serious User

Joined: Dec 2003
Posts: 1,097
Maryland, USA
Yah... things get confusing, especially following tons of posts that bounce around and such.

The alpha channel will hold black to white values. 0 - 255. In these terrain effects 0 = no blending, while 255 = total coverage. The values basically hold a "weight" and anything in between will be a mix. For example 127 would be 50/50. You will probably notice that on some of my alphamaps that there will be a soft brush used, so that at the edges there will be softer transition between textures.

In the pixelshader1.1 terrain effect the blend map is in the alpha and there was additionally a map in the blue channel that is moved to the alpha. Here we could not use the red and green channel to swizzle.

In the pixelshader1.4 terrain this was not a limitation and therefore could use RGB and A as homes for our blendmaps. This just works out good because when the textures went thru the vertexshader the tileable textures were scaled.

In the detailmap code that I added to the pixelshader1.1 I used an alphachannel of one of the tileable textures to store the detailmap. Because I was going to tile the detailmap anyways, it did not matter.

The RGB's will only be used by the instructions that you provide. Same with the alpha. If you pass an RGBA texture thru just the vertexshader (mov t0, v7) you are going to see the RGB channels and not the A.

Hope this helps.... If I am off track here, somebody chime in Or just add to it as well.

Re: Shaders and Alpha and RGB [Re: Steempipe] #27888
05/25/04 02:40
05/25/04 02:40
Joined: Jan 2004
Posts: 585
Alexandria, VA
Alkai Offline OP
Developer
Alkai  Offline OP
Developer

Joined: Jan 2004
Posts: 585
Alexandria, VA
Hey thanks a lot, Steempipe! This information helps greatly! I'll probably have a few more questions once I'm able to experiment with the information you've provided.


If you gaze long into an abyss, the abyss will gaze back into you. 3.0 GHz Pentium 4 w/HT 1 Gig 400mhz DDR SDRAM 128mb NVidia GeForce FX 5200

Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1