• 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

Grid tessellation size limit

8 posts in this topic

Hi guys!

Well sorry for the weird topic title as i don't really get the concept i`m talking about as clearly as i should.

So, i started my project on top of the sample "DetailTessellation11" from DirectxSDK and one of my intentions was to make it create a cylindrical terrain with a size of 1440 x 1653. I can use the image but it doesn't look as detailed as it should be.
Then i found this variable:
[source lang="cpp"]DWORD g_dwGridTessellation[/source]
It is used in a few functions during the program but it's main use is for creating the grid ( in this case a square with the amount of vertex of the grid equal to g_dwGridTessellation*g_dwGridTessellation ).
What i did get is that it determines the amount of vertex of the grid it's creating.

The problem:
Since I need to plot a 1440 x 1653 (or bigger) grid I changed the value of the variable and found out that it can't go over 180 and through breakpoints i have found out that this functions causes an Access violation probably because i`m overflowing a pointer or type of variable.

[source lang="cpp"] // Allocate memory for buffer of indices in system memory
WORD* pIndexBuffer = new WORD [nNumIndex];
WORD* pIndex = &pIndexBuffer[0];

// Fill index buffer
for ( DWORD i=0; i < dwLength; ++i )
{
for ( DWORD j=0; j < dwWidth; ++j )
{
*pIndex++ = (WORD)( i * (dwWidth+1) + j );
*pIndex++ = (WORD)( i * (dwWidth+1) + j + 1 );
*pIndex++ = (WORD)( (i+1) * (dwWidth+1) + j );

*pIndex++ = (WORD)( (i+1) * (dwWidth+1) + j );
*pIndex++ = (WORD)( i * (dwWidth+1) + j + 1 );
*pIndex++ = (WORD)( (i+1) * (dwWidth+1) + j + 1 );
}
}[/source]
Since this variable is inside a grid creation function it's name has changed to dwLength and dwWidth.

I did some researches and i thought that could be the change from DWORD ( unsigned long) to WORD ( unsigned short ) but couldn't change it in the program for some reason.

So basically am i correct about anything?
Is this a problem with this function or I simply cannot handle that many vertex?
What can i do here? If no possible to handle that should i just make the program create several grids and stick then together?

Thank you for you time!
0

Share this post


Link to post
Share on other sites
The upper limits are defined by:
D3D11_HS_MAXTESSFACTOR_UPPER_BOUND (for hull shaders)
D3D11_TESSELLATOR_MAX_EVEN_TESSELLATION_FACTOR
D3D11_TESSELLATOR_MAX_ISOLINE_DENSITY_TESSELLATION_FACTOR
D3D11_TESSELLATOR_MAX_ODD_TESSELLATION_FACTOR
D3D11_TESSELLATOR_MAX_TESSELLATION_FACTOR

All of these are defined as 64 except D3D11_TESSELLATOR_MAX_ODD_TESSELLATION_FACTOR, which is 63.
You should not exceed D3D11_TESSELLATOR_MAX_TESSELLATION_FACTOR.


[EDIT]
Never mind; I misunderstood the problem.
[/EDIT]


L. Spiro Edited by L. Spiro
0

Share this post


Link to post
Share on other sites
1440*1653 (which equals 2380320) overflows the range of a WORD (typically 0...65535) by a great margin. Have you tried to use 32-bit indices, which would raise the range to 0...2[sup]32[/sup]-1? The indices would then be represented as DWORD as opposed to WORD.

That said - independent of the above issue - it may be wise to spatially partition the mesh anyway, if the shading is complex enough. You probably don't see all the geometry at once, at any given moment? There is a fine balance here, though, in that the partitioning itself can use more time than you save by doing it. Edited by Nik02
1

Share this post


Link to post
Share on other sites
[quote name='Nik02' timestamp='1350455482' post='4991024']
1440*1653 (which equals 2380320) overflows the range of a WORD (typically 0...65535) by a great margin. Have you tried to use 32-bit indices, which would raise the range to 0...2[sup]32[/sup]-1? The indices would then be represented as DWORD as opposed to WORD.

That said - independent of the above issue - it may be wise to spatially partition the mesh anyway, if the shading is complex enough. You probably don't see all the geometry at once, at any given moment? There is a fine balance here, though, in that the partitioning itself can use more time than you save by doing it.
[/quote]

Thank you very much!
I did change the index buffer to be 32-bit and the WORD to DWORD on the grid creation, now i can get values bigger then 180 but, as you said, it gets a lot slower ( i'm using a 500 x 500 just as tryouts ).
What would you recommend for a performance boost? creating partitions of the cylinder instead of trying to do it all? the thing is that i use a texture for heightmap i would have to cut it to keep the heights.

The main point of my program is to keep the heightmap as perfect as the texture required. That is why i'm trying to keep the grid with the same amount of vertex of the heightmap texture.
0

Share this post


Link to post
Share on other sites
If your target hardware supports shader model 5, you can use a combination of a pre-tessellated cylinder and hardware tessellation to arrive at the needed resolution.

In the CPU side, you could divide the width and height resolutions by 64, and on the GPU tessellate the coarser geometry by factors of 64 to get the effective target resolution.

BUT consider this: do you actually need that kind of actual geometry resolution, or would a bump-map + displacement approximation be enough for the visual effect? The latter is a very common approach.

Regarding spatial partitioning, you could divide the cylinder surface to 4 separate sectors (and the possible cylinder caps as two more), and render only those that are within the view volume and that are actually facing the view. If you use more complex visibility culling logic, there is a greater chance that the visibility determination and increased device call count takes more time than just rendering the whole dataset at once. If you have heavy shaders, you can justify for heavier visibility determination too. Edited by Nik02
0

Share this post


Link to post
Share on other sites
Hi Nik02, well i did try to make but what happens now, after the modification to DWORD from WORD is that the tessellation bugs the visual creating little holes between triangles its very weird.
So i couldn't make the variation of using less cpu by dividing it size and tessellation gpu because of the problem above. the image below demonstrate the issue:
Using a 180 value for height and width with 8 tessellation only to see the bugged effect:

solid:
https://dl.dropbox.com/u/51198194/Trabalho/dividedby64solid.PNG
wireframe:
https://dl.dropbox.com/u/51198194/Trabalho/dividedby64wireframe.PNG

And for a 1653x1440 without tessellation it takes a lot of time to load and gets a really bad fps, shouldn't it get higher values when not looking to all the cylinder? how can i improve on this two subjects, load time and fps rate?

solid tube:
https://dl.dropbox.com/u/51198194/Trabalho/Tubesolid.PNG
wireframe:
https://dl.dropbox.com/u/51198194/Trabalho/TubeWireframe.PNG

Thanks, sorry for late response, thank you very much for your attention!
0

Share this post


Link to post
Share on other sites
If you use GPU tessellation here, are you absolutely sure that the edge tessellation factors (as computed by the hull shader's constant evaluation function) are consistent with regard to their actual position as related to their adjacent geometry? And that the tessellation algorithm (as specified by the corresponding attribute of the hull shader function) is one that produces consistent results (as in integer factors)?

Load time can be improved by using smaller vertex buffers.

Drawing performance is dependent on many other things as well. Each drawn primitive takes a certain amount of overhead (like vertex shaders and tessellator) regardless of whether or not they end up covering any pixels on the render target; in addition, each pixel (or fragment of pixel) drawn takes time, and the more complex logic is specified in the shaders to draw those, the longer it takes. There are also the matters of register pressure, resource waiting, bus bandwith...

Do profile your application with a GPU profiler (search for these) to gain understanding where your bottleneck is; after you've done this, it becomes possible to try to fix it.

Finally, FPS is a very poor measurement of relative performance. You should instead measure milliseconds per frame, it linearly corresponds to the time taken by all the ops for a given frame. FPS is a reciprocal of that. Edited by Nik02
0

Share this post


Link to post
Share on other sites
There is also a precision limit regarding the tessellator outputs.

Do you do excessive scaling in the domain shader? If you do, consider moving the scaling to vertex shader.
0

Share this post


Link to post
Share on other sites
Ok, keeping up with the idea of making less vertex and compensating it with tessellation there was the bug, but i managed to pin point the problem, it'`s something with the density based algorithm without it works perfectly, so by that i made the texture be something like a 72 x 83 and added a 20x tessellation and i get pretty good geometry except in regions of holes that the tessellation tries making more triangles based on the base text but a few parts of it are clipped after.
so look at the little spikes that appeared is there a way to make this better?

https://dl.dropbox.com/u/51198194/Trabalho/spikes.PNG
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