Sign in to follow this  
rob35

It seems that nobody here is smart enough, myself included...

Recommended Posts

There is a graphics maneuver that seems impossible to complete yet so basic... the very mention of it has put an end to [url="http://www.gamedev.net/topic/608918-dynamic-contour-plotting-in-pixel-shader-20/page__p__4851508#entry4851508"]this thread[/url] and [url="http://www.gamedev.net/topic/529926-terrain-contour-lines-using-pixel-shader/page__p__4926133#entry4926133"]this post[/url] on this forum.

I'll ask again: is there ANY way for Shader Model 2.0 cards to draw Contour Lines - not by crappily applying a 1d texture (that will look horrible... again, look at the first post [url="http://www.gamedev.net/topic/529926-terrain-contour-lines-using-pixel-shader/page__p__4926133"]here[/url]) but by using the screen-space derivative functions to do it properly? That functions (ddy, ddx, etc.) do NOT exist on SM 2.0 cards.

How do I proceed? I experimented using a derivative map that I passed along to the shader in a different texture channel, but there were two problems: 1. didn't completely standardize the widths of the lines and they became huge and pixelated when zoomed in (probably a precision problem) and 2. I am going to be animating datasets and interpolating along the time axis; perhaps I implemented it wrong, but it went bonkers when I tried this presumably because the derivate maps can't just be linearly interpolated.. (but shouldn't they be able to?)... there must be a simpler way to draw something as simple as contour lines over a texture! If I color the texture with a palette I can see the boundaries/edges where I want lines, so how do I get LINES?

Share this post


Link to post
Share on other sites
You could just make the line narrower/thicker based on the normal and distance (ie if the slope is tangental to the plane of contour or camera is close, the line would be thicker so have a narrower criteria). I haven't tried this but I don't see why you couldn't mathematically work out the correct criteria.

Share this post


Link to post
Share on other sites
Render the world position to a second render target and calculate the contours in a screen space pass...

Share this post


Link to post
Share on other sites
Just set SM3 as your program's minimum hardware requirement and the problem goes away; you can then get on with being productive.

Seriously - SM2 is so old that you're doing yourself and your program a disservice by aiming so low. Even SM3 is quite ancient. 5 or 6 years ago this would have been a genuine problem, and that's an eternity in computing. Today SM3 capable hardware is ubiquitous (even Intel have had it since 2006); there's absolutely nothing that's "fancy" or "new" about it. Edited by mhagain

Share this post


Link to post
Share on other sites
Thank you everybody for your responses; Hodgeman - I had not thought of that and will try it, thank you. SM2.0 is unfortunately the minimum for my project, but I agree that that is stupid.

[quote name='japro' timestamp='1341063896' post='4954309']
Render the world position to a second render target and calculate the contours in a screen space pass...
[/quote]
I am quite sure you seem to have more experience than I in this field; could you elaborate on this technique because it sounds to me like the best way of doing it. Thank you.

Share this post


Link to post
Share on other sites
The games I am working on this year are probably the last two big SM3 projects we will be doing. its all D3D11 with SM5 and SM4 profiles going forward . . .

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