Solved

Jagged Edges between Mesh and HLSL Shader

Posted on 2004-09-07
2
494 Views
Last Modified: 2013-12-26
Does anyone know why I might be getting jagged edges between my game water and terrain?  The water is a mesh created by a vertex and pixel shader.  The land is a textured mesh.  I think I might need to enable multisampling but I am not sure if that is the right approach.  Any ideas?  

Here is a screenshot showing the water's jagged edges:   http://67.173.251.144/~suva/screenshots/jaggies.jpg


Thanks,
Shaun
0
Comment
Question by:stonstad
2 Comments
 
LVL 17

Accepted Solution

by:
davebytes earned 500 total points
ID: 12007595
Try increasing the resolution of your Z buffer -- that's zbuf artifacting you are seeing there.  Try 24/32 instead of 16.  Also, this will depend upon the camera position -- if you are REALLY far back from the mesh (which it looked like you might be for that shot), zbuf errors will show up like that, as the visible surfaces are REALLY far away into the z buffer.  You could also try w-buffering as an alternative approach, though I don't know of a lot of people going that direction..  Multisampling won't really help, it'll just 'blur' the jaggies a bit, but still have jaggies.

Other things you can try:
- having the water 'softly' go to 100% transparent right near the shoreline
- actually 'clipping' the water so it doesn't physically intersect the landscape
- having the color of the water, reflectiveness, etc, drop off as it nears the shoreline.
- change the z comparison mode, and which gets drawn first.

Since I spent a lot of time co-developing the water system in Lords of the Realm 3, where the water is controlled by shaders, and the land is a fixed mesh, I know EXACTLY what you are up against... ;) ;)  You can improve things a lot, but at some point you create more work for yourself than the results are worth.  Some small steps however can make a big difference.



-d
0
 

Author Comment

by:stonstad
ID: 12013331
Splendid.  I used D24X8 and that fixed it.  

Dave, I like your suggestions and I am going to be thinking long and hard on how to change color and reflectiveness given proximity to a shoreline.  That's a tough one.  That's pretty nice work in Lords of the Realm 3.  I am a developer in the Aerospace biz; nonetheless, development on this game is what I look forward to.  A person's passion is also their prison.

Yours,
Shaun (shaun@tonstad.net)
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question