PDA

View Full Version : I'm dying, help me!



haigu
11-16-2000, 07:45 PM
I've posted my question in the beginner's section, but cannot find an answer. http://www.opengl.org/discussion_boards/ubb/frown.gif
My problem is, for example, I have 4 RGB textures and 4 alpha channels. If I alpha blend the RGB textures, using different alpha channels, I'll have to build 4*4 = 16 RGBA textures. This is a waste of memory, no?
I want to combine RGB and A without having to build 16 RGBA textures.
One way is to assign the vertex alpha value, but it is too coarse.
How can I solve my problem?
HELP ME!!! or tell me this is impossible in OpenGL. http://www.opengl.org/discussion_boards/ubb/biggrin.gif

Olive
11-16-2000, 11:52 PM
Try it with multitexture. That should solve your problem at least if the video card supports multitexture and if not do it in two passes.

Roderic (Ingenu)
11-17-2000, 01:03 AM
Maybe I didn't understanf you're problem, but here's an answer:

Create 4 RGBA textures.
Use multitexturing to render them.

see http://nehe.gamedev.net/tutorials/lesson22.asp
for a multitexturing tutorial.

haigu
11-17-2000, 02:43 AM
Sorry that I couldn't make me understood. I am not a native English speaker ;(
My problem is not multitexture or multipass.

Suppose I have 2 textures, one is grass, the other is rock. I want to draw a grassland with some rocky fields. I use grass as the basemap, then overlay rocks with blending enabled, so that the change doesn't look too sharp. like the figure below
|---------|
| grass |
| _____ |
| |rock| |
| | | |
| ----- |
| |
-----------
The alpha map of the left,right,upper and bottom sides and that of the upper-left, upper-right, bottom-left and bottom-right are all different.
then do I have to build 8 different RGBA textures, with the only difference in alpha map?

haigu
11-17-2000, 02:48 AM
oops, the figure is distorted, i draw another.
'.'stands for grass
'*'stands for rock

...........
...........
..******...
..******...
..******...
...........
...........

Roderic (Ingenu)
11-17-2000, 04:48 AM
I see your problem.
While I cannot give you much details since I'm not working on the Landscape part of my 3D engine right now, I can point you to the OutCast Game Engine description.
http://www.appeal.be/products/page1/Outcast_GDC/outcast_gdc_1.htm

I do think they use some king of ligtmap for modulating different terrains contribution to final color.
Try this way, I think it's the good one.

mandroka
11-17-2000, 04:57 AM
I think the solution for blending two textures with an independtent alpha texure is the texture environment combine extension.

I saw a demo tha demonstated the very same effect, but I forgot the url http://www.opengl.org/discussion_boards/ubb/frown.gif