Solved

Jagged Edges between Mesh and HLSL Shader

Posted on 2004-09-07
2
496 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
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 a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

856 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