Sign in to follow this  
rob35

Dynamic contour plotting in pixel shader 2.0

Recommended Posts

rob35    78
Hello,

I registered an account at this wonderful site to hopefully get help with my problem: I need to do exactly what [url="http://www.gamedev.net/topic/529926-terrain-contour-lines-using-pixel-shader/"]this guy[/url] needed to. The last post in that thread was him asking how to rewrite the code for SM 2.0, which I need to do. The fwidth function that the other poster uses generates an error in ps_2_0.

Computing line vertices is not an option for me - I am blending flat textures together that are mapped to a color palette to visualize gridded data. (This is entirely 2D, but you can think of the value at each spot in the texture as the third dimension) Basically, I am visualizing a dataset as an animation: each frame represents each hour. The program interpolates between data frames in the shader and is therefore showing something different at every screen update. I can't compute the lines that fast (30-60FPS), which is why I must do it in the shader.

Like the guy in the thread I linked to tried, if I just fill a range with color, it is too wide/thin at times. I'm not sure if I can get the effect I want (constant width pixels) unless the shader can compare its output at one pixel to the output at the next. SM 2 isn't letting me use any of the ddx/ddy functions to do this.

Shader model 2 is the maximum I can use for this project: can anybody help me get dynamic constant width contours on top of these textures?

Thank you very much; I appreciate the help!

~Rob

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this