Jump to content
  • Advertisement
Sign in to follow this  
Squirm

overhung terrain texturing

This topic is 4727 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've asked this before, but I have a conceptual solution so I was wondering if someone with a better knowledge of graphics libraries and wacky new features of G-cards could point me in the right direction. I have a terrain in which there a lots of overhanging cliffs - basically it does not approximate to a heightmap - but it has many of the same rendering issues: it is a lot of triangles, I am repeating a tileable texture over it. Now, if I drop textures onto it from above I get those nasty vertical stretch marks, and I want rid of them. Best I have so far: multi-texturing with 3 textures, one along each axis. Pros: easy. cons: stretch marks still visible, just less obvious. What I'd like is a way to make the alpha of the textures depend on the angle of the terrain at which they hit - I would apply one texture all over, on the X/Y plane, and then apply the next on the X/Z plane but with an alpha of 1.0 where the surface is parallel to X/Z and an alpha of 0.0 where it is perpendicular. Then I would repeat for Y/Z with a third texture. However, oldstyle (which is all I know) that involves calculating a whole heap of material colours for each vertex. All I know about shaders is that they sound quite pretty... Im happy to learn something new, but could someone suggest the alternative approaches I might take to get the effect I'm after? I don't want to learn GL slang only to find that a) my graphics card doesnt support it and b) I could have done it in 3 lines of code with pixel shaders. I hope people understand what I'm asking :) Thanks

Share this post


Link to post
Share on other sites
Advertisement
yeah i suppose that would be a piece of ceak for a pixel shader.

doing it with vert. colors would require multiple rendering passes, no? but it should be just as possible. just make sure the parts sum to one, which you can simply do by multiplying each component of the normal by itself. should give the desired effect i think.

Share this post


Link to post
Share on other sites
Indeed, a pixel shader would be the easiest way. I think it could be possible to use the dot3 extension (per-pixel lighting) to blend between three textures without shaders in one pass but it's limited to black and white... So it'd be just a detail texture and you'd have to supply the color per vertex or something. Most likely you'd still need at least two passes.

Share this post


Link to post
Share on other sites
I'm thinking there might be some way to do this useing the defuse and specular vertex colors to define blending weights. if you set the components of defuse//specular to 255*dot(vertex_normal, world_x//y) then you did a multiply of the defuse color with the texture for x (and a mult add with specular and the y texture) then this might get you close to what you want, but this wqouldn't allow for dynamic lighting, and I don't know if ther'd be a way to handle the z texture properly. but try playing around with storeing DOTs of normals with world vectore in vertex colors and the lerp and mutl_add texture stage opperations (I'm useing D3D termonology assumeing that's what you are useing sence you don't want to learn OGL) you might find somthing that works for you.

..maybe averageing the two side textures and lerping based on the vertex dot with world Z, that would get you close.

I am assumeing that this is non-lit (or more acurately pre-lit) static geometry were the DOT values can be precalculated and stuffed in the vertex buffer.

Share this post


Link to post
Share on other sites
Oh, I know OpenGL, and Im sticking with it since I like to be cross platform. Sounds like the general consensus is pixel shaders. Google is almost overcome with enthusiasm in answering a search for tutorials - looks like CG is thw way forwards for a C++ programmer, unless OpenGL 2.0 suddenly becomes standard?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!