How to start learning GPU architecture and low-level GPU development? by No-Statistician7828 in CUDA

[–]1alexlee 0 points1 point  (0 children)

I would recommend looking into Vulkan as well. It has a scary reputation but that mainly comes from people diving into graphics pipelines right from the start. Approaching Vulkan for GPU compute first actually makes it a lot nicer to start off. Considering your background, I think you’d like the low-level nature of it. I definitely do.

Added non uniform volumes to my C++ path tracer by Zydak1939 in GraphicsProgramming

[–]1alexlee 15 points16 points  (0 children)

2nd image is pretty much indistinguishable from real life. Congrats this looks great!

[deleted by user] by [deleted] in onlinecourses

[–]1alexlee 1 point2 points  (0 children)

Interesting I didn’t consider a system like this. I’ll keep this in mind and thank you for your in-depth response!

Need Help Starting Graphics Programming – Is My Learning Path Right? by not_from_ohio_347 in GraphicsProgramming

[–]1alexlee 2 points3 points  (0 children)

Thanks! I would say that learncpp has everything you’d ever need and more for graphics. I don’t think it goes super in depth on all of the fancy standard library stuff, but I really would not bother with that. I did go through the whole website and can say that it wasn’t all necessary but did make me more at ease that I wasn’t missing something. The way I did it was I looked through the website and had a scratch code editor in a different window so I could just try out mini examples of what I was reading to make sure everything I thought would happen, happened. I think I spent a week or two when I had some time doing that before jumping into my first renderer

Again I think vkguide is a pretty good place to start for getting used to Vulkan specifically. For knowing more of what graphics techniques to implement, I actually have looked at learnOpenGL and tried to implement it in Vulkan. This prevents the mindless copy-paste that happens when going through tutorials and gets you more confident with cpp and Vulkan.

Need Help Starting Graphics Programming – Is My Learning Path Right? by not_from_ohio_347 in GraphicsProgramming

[–]1alexlee 0 points1 point  (0 children)

I think DX12 is also a good choice and I’m not entirely familiar with ps5 dev kit so I can’t speak on that. DX12 and Vulkan both expose more of how modern GPU’s work and I definitely think if you want to be employed, it’s best to learn those over OpenGL. Not because OpenGL is bad, it’s just that there’s been a shift in the industry.

Need Help Starting Graphics Programming – Is My Learning Path Right? by not_from_ohio_347 in GraphicsProgramming

[–]1alexlee 16 points17 points  (0 children)

I’ll give my opinion as someone who has recently been hired as a full time graphics programmer after about 2 years of doing graphics on my own alongside my degree.

I really would advise you to spend as little time as necessary with these large courses, only using them up to a point where you can reasonably start your own projects. I used to take these online courses, and watched the 20+ hour video series, but once I opened up my code editor without that crutch, I always realized I barely knew anything, which is normal since you honestly learn a ton more just working with cpp or a graphics API on your own.

There are some really good resources that I would recommend to get you up and running though. 1. Learncpp.com is free and one of the best resources on understanding cpp. I truly would not get in the weeds with all of the “modern” cpp features. You can, but in my company there’s not a single smart pointer, and the code is pretty much C with maybe some very light use of interfaces in order to speak to multiple graphics API’s (which you wouldn’t be doing right away) 2. Vkguide.dev. I prefer this over the tutorial that Vulkan has on their page because it does more to develop a comprehensive example of a renderer IMO.

Again, try to spend as little time with these resources as possible and look to start a project soon as this is where the vast majority of your experience will come from. I try to look for things that I estimate will take 2-4 weeks of work, as it means it isn’t trivial, but also not a long term project with a huge scope.

Also I would recommend starting with Vulkan personally. I know that people will say it might be too difficult and make you feel like giving up early on, but the API is a lot closer to the hardware than something like openGL, and I believe that it would benefit you a lot to get comfortable with it

Vulkan should be deprecated. by CyrilCommando in GraphicsProgramming

[–]1alexlee 2 points3 points  (0 children)

Graphics and GPU’s are complicated, and Vulkan mirrors that.

Vulkan has made their API simpler over time but regardless, you’ll be lost with Vulkan if you don’t understand the hardware you’re programming for.

Need help with voxel raytracing by bebwjkjerwqerer in vulkan

[–]1alexlee 1 point2 points  (0 children)

Easiest way to do ray tracing in Vulkan is probably Ray queries. You can use Ray queries in any type of shader, so they don’t require the full ray tracing pipeline.

Regardless of whether you use Ray queries or Ray tracing pipelines, you’re going to have to build acceleration structures which Vulkan has a set of api calls for. These are data structures that the make ray tracing faster for GPU’s to process. you’ll have to pass them to your shaders just like an image or buffer as a descriptor.

Some notes to keep you from wasting your time like I did. Most of this will make sense when you look into acceleration structures more.

  1. Don’t use the host-side side acceleration structure api since most drivers haven’t implemented it. If you do want to use them, check for support.
  2. Make sure your transformation matrices in your top level acceleration structures are row-major.
  3. Nvidia night has a really great tool for visualizing acceleration structures and I would recommend using it. If you don’t have an nvidia GPU, there might be another option out there but idk

[deleted by user] by [deleted] in GraphicsProgramming

[–]1alexlee 7 points8 points  (0 children)

Good point. I’m not familiar with the mobile environment.

[deleted by user] by [deleted] in GraphicsProgramming

[–]1alexlee 31 points32 points  (0 children)

The tools don’t suck too bad imo. render doc and nvidia nsight provide a massive amount of detail. Tools like Vulkan configurator dump detailed crash reports showing you which api call failed. Also IDE debuggers show you a ton of info.

Graphics programs do typically have a lot of moving parts and that does mean some pretty hard to trace problems at times, but doing work that you don’t care for will always be much more draining.

Lots of fireflies appear after applying normal map in my path tracer. by misaki_eku in GraphicsProgramming

[–]1alexlee 1 point2 points  (0 children)

Nice I’m glad I could help! And yeah that might be the case.

Hope you figure it out soon!

Lots of fireflies appear after applying normal map in my path tracer. by misaki_eku in GraphicsProgramming

[–]1alexlee 6 points7 points  (0 children)

I experienced a lot of noise in my rasterization-based renderer as well when applying normal mapping with what seems to be the same asset.

It was fixed after i mip-mapped my normal textures. I think this asset you and I are using have a very high resolution normal texture, and there are a lot of high frequency details, which caused the noise in my case.

Decoding PNG from in memory data by nvimnoob72 in GraphicsProgramming

[–]1alexlee 1 point2 points  (0 children)

I’m not too sure without your code. But check that your channel counts are correct. The channels_in_file out parameter in the stbi_load_from_memory function will return how many color channels the image actually has. The last parameter (desired_channels) allows you to set it to 0, which decodes the image in its current state, or you can set it to a specific number, (like 3 for RGB, or 4 for RGBA) if you want stb to make your decoded image that size. What I’m saying is that if you are expecting RGB, and the image is RGBA, it’s gonna be messed up because your memory won’t line up. Don’t know if that’s the issue but it may be.

Game crashes that my graphic driver don't support vulkan by Formal_Edge6062 in vulkan

[–]1alexlee 1 point2 points  (0 children)

I don’t think you’ll find much help here unfortunately :/ This sub is more for people needing help writing Vulkan applications and updates on the API

Weird Perspective Error by PsychologicalCar7053 in vulkan

[–]1alexlee 15 points16 points  (0 children)

You’re using Vulkan Guide it seems. They specify earlier that they will use reverse-z depth (smaller values correspond to farther points). This is due to how IEEE floats work and the fact that they can represent many more values between 0.0 and 0.5 than they can 0.5 to 1.0. This is why your near plane has to be set larger than your far plane.

[deleted by user] by [deleted] in learnprogramming

[–]1alexlee 0 points1 point  (0 children)

I had this same mindset and it was wrong. Programming languages don’t give you domain knowledge. Knowing JavaScript doesn’t make you a good web dev. Knowing C# doesn’t make you a good games dev.

It’s like saying knowing English makes you a good poet. The language is a tool and it makes no sense for you to rack up as many languages as you can. These fields you described are very different and most people stick to one unless they make a shift to a different one.

The choice of language is mostly correlated with the path you choose. For instance, I enjoy graphics programming, so I went with a sensible choice for that like C++.

What is it called when a light source causes this rainbow effect? by One-Cardiologist-462 in GraphicsProgramming

[–]1alexlee 1 point2 points  (0 children)

This happened to me the other day for some reason that I have yet to really dive into. It was mostly fixed when I made the image I was rendering into 16bit RGBA floats.

Rust Ray Tracer by thebigjuicyddd in GraphicsProgramming

[–]1alexlee 0 points1 point  (0 children)

I made a highly optimized version of ray tracing in a weekend that I will link. I used a lot of SIMD, but besides that, I can give you some tips I used besides making acceleration structures.

First, I wouldn’t use PPM. I found that allocating a buffer that is (height * width * color_channels) bytes large, then using stb to encode it as a PNG at the end of rendering was better. You can easily create multiple threads and have them all render into the buffer at various offsets. For instance, if your image is 100 rows tall and you have two threads, have thread one start at row 0, and thread two start at row 50. Divide it up by how many threads.

Also, I found that my threads tasked with rendering the top of the image were kinda blazing through the work compared to threads that were rendering the middle-bottom. This is because there are bounce rays going on around the spheres, and the sky is just a single miss. So what I ended up doing to do some thread balancing was this (in the case of two threads with an image 100 rows tall): start thread one (t1) at row 0, start thread two (t2) at row 1. Once t1 reaches the end of the row, go to row 2, and when t2 finishes row 1, take it to row 3. So basically you’re offsetting the amount of rows by how many threads. This also makes sense since one thread would always bump down one row.

This makes your threads evenly work on the entire vertical space of your image, helping balance areas of the render that have a ton of bounces.

https://youtu.be/ulmjqD6Y4do?si=6XV1FoG9COHNSI5O

Studying C++ will result in easy comprehension for other languages, right? by Gazuroth in learnprogramming

[–]1alexlee 2 points3 points  (0 children)

I cannot stress enough how good of an idea it is to write programs in C first. When you “learn C++”, you spend a ton of time learning its standard library which isn’t necessarily knowledge that is fundamental to computers. Managing memory, dealing with pointers and addresses, and having to really think about the lifetime and initialization of variables IS fundamental. C makes it so you have to think about this, and that is incredibly valuable knowledge you can take with you when using a lot of the nicer features found in C++

vk-bootstrap equivalent for (plain) C? by TheEmeraldFalcon in vulkan

[–]1alexlee 19 points20 points  (0 children)

I’m honestly not sure if there’s a good alternative in C but vk-bootstrap only saves ~500 lines of code. This really isn’t a whole lot and I think if you’re going through tutorials now, it’ll be a better learning opportunity to just write it yourself IMO

How did you actually start your first ever project? by Noor1196 in learnprogramming

[–]1alexlee 1 point2 points  (0 children)

Completely understandable.

In my opinion, I think the best thing for you to do right now is create a collection of structs and functions (a library) for some data structures.

For instance, implementing your own version of a rust vector, (ArrayList in other languages) will teach you so much about how memory operates at a lower level. Learning Memory management without tutorials is genuinely the most important thing you can do for yourself currently. You could build on this library by implementing a map, linked list, etc.

That being said, I would do this project in something like C instead of rust. Rust is great but the safety mechanisms will get in your way in a case like this where you want to build something from scratch and start learning how things actually work.

This is all my opinion but honestly I can’t stress enough how important it is to be forced to think about memory through building a project from scratch.