Solved

Jagged Edges between Mesh and HLSL Shader

Posted on 2004-09-07
2
487 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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video discusses moving either the default database or any database to a new volume.

763 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now