Sign in to follow this  
goldie83

Jump start to DirectX/SharpDX

Recommended Posts

Hi,

 

Background:

A working application written in c#, .net > 4.5, wpf with helix toolkit (but not the SharpDX implementation). When the amount of triangles goes over let say 1.5M the rendering time is too long. FPS is going very fast to almost zero. With this implementation I could not even come close to my goal. I the mean time I’ve created some converters – to lower the level of details but I think it will be impossible go down with the amount of triangles presented on the view to a lower value than 1.5 million of triangles. So – helix toolkit is for me a no go.

Wanting to exchange the helix toolkit to something more „low level“. So far, the choice is SharpDX.

 

Input data:

Models as .obj files with vertices, faces (can .obj store triangle strips?) and materials per face (no textures, no normals, all faces build counter clock wise).

Each model will have multiple levels of details (many .obj files per model). For example the biggest so far .obj file has about 55Mb of data (only 400k vertices and 500k-600k triangle faces at highest LOD).

 

Each instance of the model has its own transformation matrix and a visibility bit. The model can change his mesh to another level of detail based on the distance to the camera. So I can move each instance of a model to any position and orientation, eventually blank or display it.

 

Idea:

Almost the same as the input data. A let say “city” of elements will be loaded with all models and all levels of detail (or only loaded on demand and cached). There will be many instances of the same model, but when the distance of the model to the camera changes another level of detail will be presented.

 

Situation now:

Because DX (for me will be the target D3D 11) is for me now a total new thing,  I don’t even not know how to make a jump start with this idea (okay, my last experience was 10 years ago with some simple OpenGL renders). Never programed a vertex shader nor a pixel shader, maybe a good tutorial fitted for my needs would help. Can somebody guide me a little bit how to prepare correct data, structures, vertex shaders(?) to pass to the DX?

I’ve gone through some examples* found on the net but till now I think that I don’t understand how to build a such thing.

 

* https://github.com/RobyDX/SharpDX_Demo - especially Tutorial 13 could be interesting for me – but here I’ve my troubles to understand how I could pass more transformation matrices to any of the instanced objects.

Again in Tutorial 04 if I understand it correctly the input layout for the shaders is: with each vertex a color vector is sent – but here I’m a little bit concerned about unnecessary amount of the colors sent – I have a color/material per face, not per vertex. But I cannot understand how should be a such programmed…

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