Archived

This topic is now archived and is closed to further replies.

goughchr

Need help with Texture_ENV_Combine..... BADLY!!!!!!!

Recommended Posts

Ok, So I have this great landscape engine happening. It works beautifully. It uses multitexturing. It runs really well on a GF1, and someone said it actually runs ok on a TNT2 they tried too. Because of this, I wanted to only have to use two textures at any one time, because more would mean multiple passes, which I dont really feel like doing for a number of reasons. I had this plan whereby I would have two textures at any time for each patch - one "general", which would get tiled across the whole map, and one "specific", which would be specific to that patch. IE: "general" texture is the "feel of the map" (grass, sand, snow), "specific" texture is the "feel of the local area" (rocky, steep, muddy). The two would be blended by a function of altitude and gradient (like everyone else does). That ties up the two texture units, so I was using standard GL lighting as well. Which is also good seeing as the maps are randomly generated, and generating huge lightmaps from random maps at load time is a hassle. The theory was that I would use gl_arb_texture_combine, and its nice gl_interpolate mode to blend the two. I was thinking that I could set the first texture unit to simply render normally, then set up the second using interpolate_arb, taking the "previous" color, and the second texture, and blend based on alpha, which would be specified in a pre-computed color array (I am using vertex arrays, etc). But it doesnt work. I can get it to interpolate based on color, so you get the dark bits (due to lighting) replaced with the second texture. Which is entirely not what I want, obviously - kinda defeats the point of lighting, and the whole point is to be able to blend through where I choose, not where the light happens to make dark bits/shadow. I have seen a demo where the guy has two textures, and blends between the two based on the alpha he specifies using straight glColor4f() calls, so it *should* work - I am effectively doing exactly what he is doing. So I guess what I am asking is, is there any way to do lighting as well as arbitrarily blended textures on two texture units using env_combine. Or any other method. OR am I going to have to do multipass, and even then is it possible? HEEEEEEEELLLLLLLLLP MEEEEEEEEEEEEE!!!!!!!!!!!!!

Share this post


Link to post
Share on other sites
is BADLY a word? i only knew this as newbie-slang..

and the whole is quite newbieish anyways..

i''ll suggest to SEARCH. the topic is discussed tons of times yet.. you can really find much info about this. but the most important is: READ how texenv works.. its easy, but its something that takes some time to understand.

someone else can answer..

"take a look around" - limp bizkit
www.google.com

Share this post


Link to post
Share on other sites
Ok, I think I got something sorted. Am I right in assuming that interpolation doesnt work properly with lighting? If you turn lighting off, it seems to work fine.

Which is a pain in the butt, cos I wanted to use gl lighting.

Anyone know if lighting is the only problem I was having, and whether or not there is a way to do GL lighting as well as interpolate between two texture units based on alpha?

Multiple passes maybe?

How about using another texture unit?

Share this post


Link to post
Share on other sites