• Advertisement
Sign in to follow this  

The model can't be showed completely when stl file exceeded 144MB.

This topic is 898 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When the size of stl file is small (about less 128MB), the model can be showed completely.

However, the size is large, the model will be showed partially.

 

Firstly, I should do something to look for the reasons. 

 

I drew the model through Draw(int vertexCount, int startVertexLocation).

 

Like below,

https://goo.gl/photos/HYFmbDyziMMrSwXdA

Edited by StevenHuang

Share this post


Link to post
Share on other sites
Advertisement

Maybe you run into DirectX limits here, what if you try to break the model into parts and render them seperately?

Thank you for reply.

 

It confused me about how to know DirectX's limitation in SharpDx.

I want to check whether the reason is about the limitation.

Would you give any suggestion ? 



 

Share this post


Link to post
Share on other sites

Are you using 16-bit or 32-bit indices for your model? If you're using 16-bit indices, your draw calls would be limited to ~22000 triangles (65536 / 3). Show us the code where the index buffer is created.

Share this post


Link to post
Share on other sites

Are you using 16-bit or 32-bit indices for your model? If you're using 16-bit indices, your draw calls would be limited to ~22000 triangles (65536 / 3). Show us the code where the index buffer is created.

Hi ! 
I don't use indices but draw it by Draw(int vertexCount, int startVertexLocation).

I found the problem out  possibly.
When I  call Buffer.Create(), it should cost about 207MB memory.
The result is only 128MB.
I guess it is a problem.

 

Now, I should do what to solve this problem.

My partial code:
//build mesh buffer
VerticesBuffer = Buffer.Create( device,  BindFlags.VertexBuffer,  VerNormaldata );  //VerNormaldata size is about 200MB. 
context.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(VerticesBuffer, Utilities.SizeOf<Vector3>()*2, 0));
 
//Draw Model
context.Draw( ModelData, 0);

Edited by StevenHuang

Share this post


Link to post
Share on other sites

Drake is right, you're hitting a limit with how big a single resource can be. Direct3D11 (guaranteed) limits can be found here. Direct3D10 had a 128 mb limit for vertex buffers, but I guess you can go higher in D3D11 depending on your hardware. SharpDX will follow these limits (think of it as a nearly 1-to-1 wrapper for the Direct3D libraries...all the documentation applies.

 

So split up the vertex data into two buffers and make two draw calls.

Share this post


Link to post
Share on other sites

Google D3D10 resource limits... the first result is:

https://msdn.microsoft.com/en-us/library/windows/desktop/cc308052(v=vs.85).aspx

 

Look for Resource size (in MB) addressable by IA (input or vertex data) or VS/GS/PS (point sample)

 

I found Dx11 limits.

Resource size (in MB) for any of the preceding resources¹

min(max(128,0.25f * (amount of dedicated VRAM)), 2048) MB

D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_A_TERM (128)

D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_B_TERM (0.25f)

D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_C_TERM (2048)

   

 

How to calculus the limits in Dx11 ? (My card 740M 2GB)

Share this post


Link to post
Share on other sites

The page I linked is D3D10 limits (I just checked), and again its the first result from google when you search for "d3d10 resource limits".

 

edit - the directx11 limits are in the link that Starnick provided... here https://msdn.microsoft.com/en-us/library/windows/desktop/ff819065(v=vs.85).aspx

Again look for Resource size (in MB) addressable by IA (input or vertex data) or VS/GS/PS (point sample)

 

It says 

max(128,0.25f * (amount of dedicated VRAM)) MB

D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_A_TERM (128)

D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_B_TERM (0.25f)

 

So the maximum of 128MB or .25*dedicated VRAM if I'm not mistaken. (which is 512MB for your card if I'm not mistaken)

Edited by Infinisearch

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement