• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
GeneralMeliante

Making holes on a heightmap based terrain

6 posts in this topic

I'm currently working on a cylinder shaped terrain produced by a height map. What happens in the program is simple, there is a texture for the colors of the terrain that has the alpha value of regions in with i want it to be invisible and another texture ARGB with the A being the gray scale for the heights and RGB is the normal for the light. The texture is such that the A value goes from 1 to 255 and I'm reserving the 0 for the regions with holes, meaning i don't want then to exist. So in theory no problem, I'm making those regions invisible based on the first texture but on practice what's happening is that the program is considering the 0 as the minimum height and, even with the texture on top, is creating some lines towards this regions of 0, like trying to make its triangle but not getting there because i cut the next vertex by making it invisible.

The image below is with a clip() function making the region invisible

[img]http://i.stack.imgur.com/ZuEPk.png[/img]

This next image is without the clip function:

[img]http://i.stack.imgur.com/MyFmG.png[/img]

Notice the lines going to the center of the cylinder This is how it gets when i stop making those vertex invisible
So, just to say, i used the function Clip() on the pixel shader to make it invisible.

My questions are: Is it possible, the same way i used clip() on the pixel shader i do something like that on the vertex shader and get rid of the unwanted vertex? Basically, is possible to just say to ignore value 0? Any ideas to fix this? Another thing is that we can see that the program is interpolating the values from one vertex to the next, that is why i cuts on halfway through to the invisible vertex.

On a more technical point of view the domain shader is the one picking the heights from the texture and plotting it.

I managed to fix this somehow by modifying the texture, through the program, by changing the 0 values of the heights to a more proper one, but i'd like to know if there's a possibility through the HLSL.

I'm working with Directx11 API with C++ and the program uses Tessellation.
Thank you for your time and will be very glad with any input on this!
0

Share this post


Link to post
Share on other sites
[quote name='PhillipHamlyn' timestamp='1349813263' post='4988463']
To have a hole you'd have to have a hole in your geometry, such that the Vertex Shader would not get passed the triangles that describe the hole.
[/quote]

Well, you can certainly "reject" triangles in the vertex shader by setting each of the 3 vertices to the same position. But that's going to be difficult/impossible if you're sharing vertices between triangles in your terrain, since the same vertex will be used for triangles you don't want to reject.
0

Share this post


Link to post
Share on other sites
I strongly advice to [b]not [/b]do so at vertex level.
It's worth noticing it is [b]not possible[/b], in a VS to set "each of the 3 vertices to the same position". This is Geometry/Primitive shader capability, for which you could just avoid emitting a primitive to rasterize.
Also note that moving vertices has a consequence on shading and rasterization on all primitives using it.

In the past, I've been moderately successful using height map parametrization to encode hole points. It required some uniforms and I didn't consider it good enough for general use so I didn't invest on it. However, this technique has [url="http://www.valvesoftware.com/publications/2010/gdc2010_vlachos_l4d2wounds.pdf"]re-surfaced in L4D2[/url].
I'm currently inclined to use precomputed low-res distance fields instead. But given the availability of large (for my purpose) uniform storage in SM4 and beyound, I guess I won't spend more effort on it.

[size=2]edit: typo[/size] Edited by Krohm
1

Share this post


Link to post
Share on other sites
[quote name='Krohm' timestamp='1349852199' post='4988627']
It's worth noticing it is not possible, in a VS to set "each of the 3 vertices to the same position".
[/quote]

Sure you can do this, I do it all the time. Maybe I phrased it incorrectly - if each of the 3 vertices outputs the same position from the vertex shader, the primitive is essentially rejected.
0

Share this post


Link to post
Share on other sites
Yes, I understand what you mean.
But as you wrote "[i]that's going to be difficult/impossible if you're sharing vertices between triangles[/i]".
Anyway, no matter how we phrase that thing, VS cannot [i]natively [/i]do that. It needs to be instructed in doing that using a texcoord. It is just better to use a GS.
The primitive is not rejected. It is degenerated, a 0-fragments triangle. That's not the same as rejecting a primitive, nor the same as rejecting the rasterized fragments. I notice you have used quotes to de-emphatize the word but I find that idea dangerous to let go.

Because of the limitations of this system and the lack of flexibility, I advice against this method. If it works for you, good (implies independent vertices for terrain?). But I'm having difficulties thinking at it as a best practice.

[size=2]edit: more elaborations on what "reject" means here.[/size] Edited by Krohm
0

Share this post


Link to post
Share on other sites
Well guys, first thank you very much for your input.

Based on the overall answer it looks like this "move" on the VS is a very tricky one and not recommended if it is possible.

And yes what i was doing is using a diffuse texture to get those holes transparent and what i was trying to fix was this weird lines trying to reach the regions of zero because from one vertex to the zero one there is a direct line connecting then and when i clip the zero vertex it keeps half the line.

As sad on my first post i managed to fix this quite well by changing the zeros of the texture to a better suited value. In a way that the zero region would now have a value equal to its non-zero neighbor and the lines wouldn't go weirdly to the center so when i passed the diffuse texture the lines would, in theory, be pointing along the the cylinder terrain.
What did happen is that i can hardly see the lines now, so great.

Thanks very much, it was very informative :) (btw i loved the L4D2 thing)
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0