Jump to content
  • Advertisement
Sign in to follow this  
Halsafar

Texture Splatting Questions

This topic is 4809 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 have decided to use the alpha map texture splatting method. I will start with my first two related question: Should each node in my quad tree have its own alpha map for the vertices it contains? See I render the whole terrain with one vertex buffer which has been filled appropriatly with all triangles in the frustum. I'm not to sure how this alpha map thing works but if I render the terrain with one DIP call then do I need one alpha map for the whole terrain?

Share this post


Link to post
Share on other sites
Advertisement
If you want to render the whole terrain with one DIP call, you need to have the alpha map for the whole terrain, that´s for sure, yup. That is, because you have to set the alpha map as a texture in some texture stage and setting the appropiate render states for using it. And the textures set in the texture stages will apply for the whole DIP call. I don´t know these render states exactly, so I can´t help you there.... never done alpha mapping using the FFP, sry.

Share this post


Link to post
Share on other sites
Its all good, I can code it all and figure the states myself.

Having one texture for the whole terrain as an alpha map is plausable I would think but it cause's some quick limitation. ie. a alpha map n^2 and a max of 512x512 on most cards.

Generating the map would be a bit tricky as well, I'm having a problem with theorizing/picturing it in my head.


So before I continue down this path, if anyone is familiar with texture splatting a whole quad-tree frustum culled terrain with one giant alpha map please give me your insight.

Thanks,
Halsafar



Edit:
What is the FFP?
Nvm, fixed function pipeline.

Brings me another question: This can be done without renderstages, setting textures, or DIP calls or what?

Share this post


Link to post
Share on other sites
It depends if you want to do it via vertex & pixel shaders or the fixed function pipeline.

My method of rendering terrain, which is sorely needed to be changed to not ream the texture cache quite as much, is as follows:

The entire terrain is divided up into a square grid of zones which contain the alpha map, light map, and a vertex buffer. The quad-tree is then computed from the map, and each leaf will fall into a particular zone. Each leaf also contains index buffer information.

Using the quad-tree, determine which nodes are visible. Save this information.

+Do a base pass with the colour & detail texture across all the leaves that are visible
+-disable Z read/write
+-for all existent layers
+--for all recorded visible leaves
+---render the layer with the colour & detail texture, modulated by the alpha using (one, invsrcalpha) blend mode, only if this layer exists in the leaf
+do final pass with the light map

So this particular method requires n-passes, provided n layers exist. However, not all layers will be visible in all zones, so some leaf passes can be skipped. I render by layer order so that the textures are only sent to the card once per frame rather than rendering by QT leaf order and running through 'active' layers each time.

To help with using less texture units, I merge the detail texture into the colour texture's alpha channel. I use a bilinear filter (I'd prefer bicubic if I could find some info on the algo that I understood) to resample the base & detail textures to the largest dimensions of the two and merge them into one texture that I save in the terrain file. So this effectively means 2 texture units per layer. I plan on changing it so that more than one texture layer can be rendered per pass (up to 3 layers per pass).

I've just had a hard time recently to actually START to code :(

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!