Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Wrote some simple SharpdDX tutorials, what do you think?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
12 replies to this topic

#1 DwarvesH   Members   -  Reputation: 471

Like
7Likes
Like

Posted 24 February 2014 - 08:12 AM

Hello everybody!

 

I did not find some proper SharpDX tutorials so I started writing a few. I know that SharpDX is basically DirectX, but porting your knowledge from one to the other is not as straightforward and I did have to spend quite a while searching for things in the documentation. I finished tutorial 9 back in December and wanted to write another one, but then I got into physically based BRDF and that is a huge topic so I couldn't finish the 10th one. Sorry that I did not post them before but I needed to clean them up badly and I've been super busy in 2014.

 

So a few words about the tutorials: they are built on the idea that you take a very simple sample and keep adding small features to it until you have a basic but rich renderer. The code is written for people who like DirectX (i.e. having full control, manually setting device states, sampler states, shader variables, etc.) but at the same time would like to have a full set of features pretty much out of the box. So you will manually fill in buffers and set variables to achieve simple things like rendering a cube, but that cube will be rendered using normal mapping, bloom, AA. etc.

 

The code is for DirectX 9.

 

I have the scripts written for the first 10 tutorials, but I did not have time to write the articles for them yet.

 

The tutorials do a lot of seemingly random shit, but all of them are there to fix some strange behaviors or instabilities. The written articles would contain explanations for those sections.

 

What is implemented:

  - master control for post processing and MSAA

  - MSAA and CSAA

  - FXAA and SMAA

  - bloom

  - directional light normal mapping with optional spherical harmonics hack ambient lighting

  - good window control and input (screen capture friendly)

 

What I would like to add in the future:

  - DirectX 10 mode

  - physically based BRDF 

  - HDR rendering

  - custom resolve for HDR with MSAA (only DirectX 10)

  - flexible light composition scheme (almost done)

  - depth of field

 

I hope I'll have time to write the articles and the rest of the tutorials, but until then I'm dropping a link here for anybody who might be interested: 

Dependencies (needed only for compiling): http://dl.dropboxusercontent.com/u/45638513/sdx/Dependencies.zip

Media (needed for Tut11+)http://dl.dropboxusercontent.com/u/45638513/sdx/Media.zip

Tut01: http://dl.dropboxusercontent.com/u/45638513/sdx/Tut01.zip

Tut02: http://dl.dropboxusercontent.com/u/45638513/sdx/Tut02.zip

Tut03: http://dl.dropboxusercontent.com/u/45638513/sdx/Tut03.zip

Tut04: http://dl.dropboxusercontent.com/u/45638513/sdx/Tut04.zip

Tut05: http://dl.dropboxusercontent.com/u/45638513/sdx/Tut05.zip

Tut06: http://dl.dropboxusercontent.com/u/45638513/sdx/Tut06.zip

Tut07: http://dl.dropboxusercontent.com/u/45638513/sdx/Tut07.zip

Tut08: http://dl.dropboxusercontent.com/u/45638513/sdx/Tut08.zip

Tut09: http://dl.dropboxusercontent.com/u/45638513/sdx/Tut09.zip

Tut10: http://dl.dropboxusercontent.com/u/45638513/sdx/Tut10.zip

Tut11http://dl.dropboxusercontent.com/u/45638513/sdx/Tut11.zip

Tut12http://dl.dropboxusercontent.com/u/45638513/sdx/Tut12.zip

Tut13http://dl.dropboxusercontent.com/u/45638513/sdx/Tut13.zip

 

Important note: Tut11 though Tut13 need the contents of Media.zip. All Zip achieves should be unarchived. If you unarchive in foo, you should have foo/Media and foo/TutXX. If you also want to compile, you should have foo/Dependencies.

 

A few notes:

  - you need .Net 4.0 or compatible

  - you can find ready to run binaries for each tutorial in the TutXX/TutXX/bin folders (this is why the download is so big)

  - the code should be ready to be compiled and run, but running will only work in release mode. For debug mode you need to copy the contents from bin/Release to /bin/Debug. I did not copy it for you in order to keep the download size smaller.

  - there may be bugs. Some coding bug or some resulting from my lacking understanding of the topic. In particular bloom may seem kind of blocky in some samples.

 

If you find any bugs or have any feedback please let me know smile.png.

 

I'm learning DirectX 10 now for future tutorials. Did not manage to make any meaningful progress here because DXGI is just not cooperating and even without it rendering fullscreen with MSAA is 3-4 time slower than with DirectX 9.


Edited by DwarvesH, 04 September 2014 - 08:45 AM.


Sponsor:

#2 ta0soft   Members   -  Reputation: 123

Like
0Likes
Like

Posted 26 February 2014 - 07:01 AM

Awesome! You're so right there is a lack of good SharpDX tutorials on the web. These tutorials are great I'd like to see more!



#3 DwarvesH   Members   -  Reputation: 471

Like
4Likes
Like

Posted 27 February 2014 - 07:47 AM

Thanks!

 

I wrote the 10th one: http://dl.dropboxusercontent.com/u/45638513/sdx/Tut10.zip

 

It should have the sources and a working exe. If you want to compile it you'll need this too: http://dl.dropboxusercontent.com/u/45638513/sdx/Dependencies.zip

 

To take control of my running away back log I'll write up the text of the tutorial before I continue!

 

Now that I remember, I forgot to give the controls for the demo:

  • Mouse buttons: camera control
  • P: Toggle cube rotation
  • Alt-Enter: toggle fullscreen
  • F2: Toggle VSync
  • F3: Cycle MSAA/CSAA
  • F4: Cycle FXAA/SMAA
  • F11: Toggle master post processing override. This way you can force to off the entire post processing framework. Good for debugging.
  • F12: Toggle master AA override. This way you can force to off the entire MSAA/CSAA framework. Good for debugging.
  • T: Toggle debug text.
  • +/-: Adjust bloom threshold
  • O: Toggle bloom debug overlays
  • B: Cycle though bloom modes. Mode 0 is no bloom. Mode 1 is default bloom. The rest of modes are not that useful for realistic rendering.
  • E: Cycle though render modes:
  1. Low
  2. Medium
  3. High: Default
  4. Debug: Ambient spherical harmonics lighting
  5. Debug: Diffuse lighting
  6. Debug: Specular lighting

 

edit: typo


Edited by DwarvesH, 02 March 2014 - 03:50 AM.


#4 DwarvesH   Members   -  Reputation: 471

Like
4Likes
Like

Posted 03 March 2014 - 05:55 AM

This is why I don't like releasing stuff until it is 100% done :). I found some CSAA 32x and multithreading bugs. I fixed them and back-ported the fixes to each version.

 

I also split up the tutorials, each in its own archive to make it easier to edit one. I edited the first post with links.

 

DirectX 10 is not progressing at all. I'm getting super strange bugs and abysmal fullscreen MSAA performance, so I'll leave it for later.

 

The next tutorial is going to be on GUI. Unless someone can point me to a good lightweight but powerful GUI system for SharpDX. I couldn't find one. If you know of one please let me know.

 

Oh, and I should stop calling these tutorials. They are far too complex for that title. It is more like a DIY step-by-step iterative toy engine and shaders for each common rendering task.



#5 Tombstone   Members   -  Reputation: 168

Like
0Likes
Like

Posted 24 March 2014 - 12:39 AM

I second ta0soft. Great stuff. Hope to see DX10/11 versions some day:) Thanks!

 

#6 DwarvesH   Members   -  Reputation: 471

Like
0Likes
Like

Posted 24 March 2014 - 02:07 AM

 

I second ta0soft. Great stuff. Hope to see DX10/11 versions some day:) Thanks!

 

 

 

Thanks! I'll get to that one day.

 

In the meantime tutorial 13 is in a bit of a hiatus. First I wanted to do it about physically based BRDF, but that subject is far too wide to cover in one go. I could dump in the shaders and be done with it, but that does not seem alright.

 

So as a next topic I investigated integrating available SSAO shaders with ease in a forward renderer. But since have never done this before, I'm not sure yet if it looks alright, I'll wait.

 

There are other obstacles too. I started creating a sort of "spiritual coexistor" of Neoforce Controls for XNA (it's too soon to call it a spiritual successor since Neoforce is still around). It is a light weight GUI library for SharpDX that uses roughly the same API and look & feel of Neoforce. It has less features than Neoforce, but the code base is much smaller and maintainable.

 

I tried getting in contact with the maintainer of Neoforce to see what to do with it. Optimally he'll like the idea and I can open-source it. But if he won't, since it is a fresh implementation, not a port, I can drop the API compatibility and create a new original skin and still open-source it.



#7 Ulysses5   Members   -  Reputation: 115

Like
2Likes
Like

Posted 09 April 2014 - 07:45 AM

Great work!

I signed up here just to reply this.

I'm looking forward to the GUI Tutorials. I just need that!smile.png

 

Why SharpDX don't have some libs like Neoforce?



#8 PlehXP   Members   -  Reputation: 118

Like
3Likes
Like

Posted 03 July 2014 - 02:25 PM

SharpDX port of NeoForce controls here...

 

https://github.com/PlehXP/NeoforceControls-SharpDX



#9 Jason Z   Crossbones+   -  Reputation: 5154

Like
3Likes
Like

Posted 05 July 2014 - 07:20 AM

I echo the call for D3D11 versions :)



#10 AvengerDr   Members   -  Reputation: 751

Like
0Likes
Like

Posted 06 July 2014 - 04:14 PM

Speaking of SharpDX UI libraries, I'm also developing a UI library as part of my game. It uses Direct2D and does not rely on any artist resources. Controls are rendered on the fly thanks to Direct2D's capabilities and can be skinned through XML theme files. I've just finished implementing a very primitive DataBinding system so that it is possible to bind property values to ViewModel instances.

 

If anybody is interested, I could write a short article on how to use the library. Here is the repository. It contains two samples: MiniUI is just a basic UI sample consisting of a panel and a button, while DataBinding shows the databinding features. 

Help is welcome, lots of controls needed still! 
 


--Avengers UTD Chronicles - My game development blog

#11 DwarvesH   Members   -  Reputation: 471

Like
0Likes
Like

Posted 04 September 2014 - 08:43 AM

Been busy with other projects in the last few weeks, but I missed 3D so here is another sample that builds upon the previous ones: the first post has been updated with links to Tut13.

 

The main purpose of Tut13 is to bridge the gap between the base of the "tutorials" and the shader research playground I usually use. The first tutorials had a design I moved a bit away from and now things are more in sync, allowing me to share spinets of code easier between tutorials and my code.

 

But this does not mean there aren't any real features. Tut13:

  • add asset import using AssImp. In the future I'll clean up the rather terrible disk serialization code that is still included.
  • this version officially includes for the first time (with permission) my super-lightweight SharpDX GUI based on a re-implementation of NeoForce. I updated my real code base to use this version, so the GUI will become better and more bug free as time goes on. There are now real ports of NeoForce to SharpDX created by other people, but my mini version is 74 KiB of code so I prefer it.

 

With DirectX 12 on the horizon, I should probably give it another go and try to implement DirectX 10 support :). DirectX 9 is getting really old :). So next version will be either DirectX 10 or my take on filmic HDR form Uncharted.



#12 spazzarama   Members   -  Reputation: 780

Like
0Likes
Like

Posted 04 September 2014 - 10:57 PM


With DirectX 12 on the horizon, I should probably give it another go and try to implement DirectX 10 support

 

Probably worth just jumping to DX11 first do DX10 later. Btw great work - SharpDX is a great library and we need to keep supporting it out there!


Justin Stenning | Blog | Book - Direct3D Rendering Cookbook (using C# and SharpDX)

Projects: Direct3D Hook, EasyHookAfterglow, C#raft

@spazzarama

 

#13 DwarvesH   Members   -  Reputation: 471

Like
0Likes
Like

Posted 05 September 2014 - 07:20 AM

 


With DirectX 12 on the horizon, I should probably give it another go and try to implement DirectX 10 support

 

Probably worth just jumping to DX11 first do DX10 later. Btw great work - SharpDX is a great library and we need to keep supporting it out there!

 

 

Thank you!

 

I tried DX10 first because it may be a smaller jump form 9 to 10 than form 9 to 11. I am very familiar with 9 and all its quirks, but I have never worked with 10+.

 

The good news is that I like DX10. The design is a lot better than 9 and 11 is probably even better. I don't know how hard this is under C#, but with C++ I could easily abstract away the API.

 

The bad news is that it will probably take a few weeks before my DX10 is stable and stops crashing the display driver.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS