Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Jagged Edges between Mesh and HLSL Shader

Posted on 2004-09-07
2
Medium Priority
?
504 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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

670 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