Solved

Jagged Edges between Mesh and HLSL Shader

Posted on 2004-09-07
2
499 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

734 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