Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a procedurally generated terrain, as follows:

enter image description here

It is generated and then built using Farseer Physics, however I haven't found a way to create and apply a mask to texture it properly, I have already played with stencil buffers and pixel shaders but I still have no solution at the moment. How would I do that? Am I going the right direction with stencil and pixel shader? Thank You.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

I think the easiest way would be to just create some geometry you can actually texture. Just create a quad (2 triangles) for every segment of your world. This should be straight-forward to texture. To optimize this, you can remove quads that leave the screen during gameplay.

For an idea how you could apply your texture using UV coordinates, see this answer.

world geometry

share|improve this answer
    
I'll accept it as the answer for being the most complete one, even though I successfully implemented my pixel shader approach –  V.M. Mar 9 '13 at 20:54

taking a different approach i would look to do something similar to http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series2D/Random_terrain.php

essentially find what is below the line and generate a color

share|improve this answer
    
That was almost the exact approach I was trying with pixel shader, Thank you for the link –  V.M. Mar 8 '13 at 15:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.