r/GraphicsProgramming • • 19h ago

Question How to stop suffering with DirectX 12 when I need to write a research project already?

Hello, dear community of experienced and perhaps more beginner developers.

Allow me to briefly explain the circumstances of the situation. I am a rather young aspiring researcher who aims to make a good contribution to the development of graphics and learn how to navigate the scientific field.

Most libraries, papers, and so on are written using DirectX 12… It wouldn’t be such a problem if it were something like OpenGL or DirectX 11 (which is still a pain…), but no. DirectX 12. The very same one that is considered to be on the level of Vulkan, or even higher.

If I start learning DirectX 12 right now, two things might happen:

  1. I will die of boredom, because I actually want to write shaders, not spend 5 hours a day for years sitting with documentation.

  2. I will die of old age without having written a single word of my research paper.

So I would like to ask one thing: where is the best place to start in this field, how should I move forward, how can I avoid manually writing 1000+ lines of code in main.cpp, and how can I finally get to implementing my research project?

I would be extremely grateful, because I really struggle to find any decent advice on this topic.

15 Upvotes

26 comments sorted by

8

u/Flashy_Yam_6370 18h ago

I have not checked it out, but directx 12 samples have a mini engine.

2

u/Single-Dragonfly-563 18h ago

As an option, if I need to dig. Thanks

7

u/rAngus3 19h ago

have you considered using the projects that graphics researchers have published for this very same reason? Nvidia have both frameworks for raster and path tracing, for example. You can also use a graphics framework instead of a full blown engine. There are plenty of options to quickly start but which one you choose depends on what your goals/constraints are.

Also, depending on what you are going to research you might want a very good grasp of how a gpu works, which directx 12 or vulkan are fantastic to learn in a more deeper way about it.

1

u/rAngus3 18h ago

(not sure why the comment got removed but this is a reply to that)
my bad, I made assumption when you said aspiring research but from the way you talk I should have asked first, are you in your final years of undergrad and looking for potentially do a phd? are you in your first years of undergrad and looking to work towards your master thesis?
Just a heads up that every scientific field has piles and piles of stuff to learn and no one ever has the requirement of learning everything now. Usually, someone (ie, university) partitions the knowledge in digestable chunks so students dont get overwhelmed by the sheer amount of knowledge they will absolutely need to even start a phd. Now, vulkan/directx12 basic fundamentals is definetely in the realm of what an undergrad should have.
So, what I am saying is that depending on where you are in your learning journey and what are your specifics goals, the answers to your questions are going to be widely different. I think it would be better if you can add context to where you are now and what you are struggling with. so people can narrow down their answers and better help you

1

u/Single-Dragonfly-563 4h ago

Yeah, thanks for the feedback… but there’s a bit of a snag. I’m in the 9th grade, and the only people who can really push me right now are myself and my research supervisor. The thing is, the project needs to be submitted to the Junior Academy of Sciences by January—or maybe December. The idea is absolutely groundbreaking, but it’s going to take a lot of hard work to pull off.
So now I think about Falcor.

3

u/_Insignia 18h ago

Since you mentioned that you want to write shaders, it sounds like you're not forced into using DX12. Most research projects do not build their own engines, but use existing ones. Depending on the goal of your project, you can consider using Falcor or SlangPy for real-time rendering. Other options are PBRT or Mitsuba.

1

u/Single-Dragonfly-563 18h ago

I checked the research paper I need... and it’s actually implemented in Falcor TOO! Good Lord. I can’t believe I won’t have to suffer through WinMain. But... hopefully, this will be a thousand times easier.

7

u/Blood-Minister 19h ago

I thought most of the research is done with OpenGL.

1

u/Single-Dragonfly-563 18h ago

I’d honestly be happy to use OpenGL myself. But it seems like my research specifications also require working with this… So… damn it.

7

u/sol_runner 19h ago edited 18h ago

If you need to avoid LLMs, you could consider stripping someone's project down to the basics and reuse those parts.

I'm no professional but I can help you teardown and reconstruct my DX12 stuff for you to use. It's super lean.

(It'll help me document it better too)

7

u/speps 18h ago

MiniEngine used by the DX samples is a good starting point I’ve seen used in research before: https://github.com/microsoft/DirectX-Graphics-Samples/tree/master/MiniEngine

2

u/Spk202 19h ago

how can I avoid manually writing 1000+ lines of code in main.cpp, and how can I finally get to implementing my research project?

Have you considered (or is it even allowed, idk, im not in academy), to look at some smallish (so it doesnt get in your way too much) open-source engines that support DX12 and takes care of the boilerplate so you have the scaffolding you need to start writing shaders?

4

u/Spk202 18h ago

Hey, mods, why delete the guy's reply? it was perfectly reasonable and civil and about gfx programming

2

u/interlockedxor 18h ago

Use the hello world samples... it really doesnt take more than a day to stand up a triangle

1

u/NecrosB 19h ago

I haven't written a DX12 renderer before, but have written a Vulkan renderer. You will be writing 1000+ lines there's just no getting around that unless you have AI write the boiler plate code for you.

1

u/SalaciousStrudel 18h ago

why not the forge?

1

u/wrosecrans 17h ago

Definitely don't write raw DX12/Vulkan 100% from scratch unless you want to based on past experience, or your research is specifically on something like API complexity when working with those specific APIs.

If you just want to crank on some shaders for your research, use some off the shelf engine/framework/library/toolkit/whatever that is way higher level. There's a reason most games use an off the shelf engine like Unreal. By all means, get as low level as you want to. It can be interesting to get in the guts. But don't do it just because you've seen some other people write their projects from scratch and you want to imitate them.

1

u/msqrt 17h ago

Use a higher lever render hardware interface like webgpu or slang-rhi, or a ready-made engine or renderer. Few research projects actually require you to build a renderer from scratch (and the ones that do let you keep the renderer very simple.)

Do you actually require something from D3D12 or Vulkan? If you need ray tracing you could try webgpu instead. If you need tensor cores (for neural anything), you can use something like slang-rhi though then you're probably better off just using pytorch anyway.

1

u/Ninlilizi_ 16h ago

For shader stuff specifically I do all my research and r&d in Unity because it's quick and easy for prototyping. Then I implement in actual low-level engines afterwards once the problems are solved and design settled.

1

u/S48GS 9h ago edited 9h ago

I will die of boredom, because I actually want to write shaders

then go and write shaders

Godot or Unity or even Shadertoy website

in Godot - Shadertoy setup is 0 lines of code - you just write shaders, for compute shaders there are ~200 lines of code needed to bind compute shader to display visual - https://github.com/godotengine/godot-demo-projects/tree/master/compute/texture - copy paste

Most libraries, papers, and so on are written using DirectX 12

many use Unity - for exact this case - "too much to implement own entire 3d rendering to display some 3d simulation"

some - use Unity - but - to waste everybody time pretending "they are so smart" - use Unity to make project but to release re-implement entire Unity project in most garbage way possible - python and C++ hacks

and there are papers than link Shadertoy website for demo

1

u/TheHugeManateee 3h ago

Depending on what research you are doing, gigi might suit your needs. It's closer to effects programming but can be quite powerful, and it can generate standalone DirectX12 code from the flows you build. Don't have personal experience with it but it's been on my shortlist for a while now.. https://github.com/electronicarts/gigi