rtx use example #32

Open
opened 2023-11-04 06:44:00 +00:00 by tigrazone · 34 comments
tigrazone commented 2023-11-04 06:44:00 +00:00 (Migrated from github.com)

I have 2 questions.

  1. did you can publish example with use of rtx raytracing?
  2. why you use sdl?
    thank you!
I have 2 questions. 1. did you can publish example with use of rtx raytracing? 2. why you use sdl? thank you!
BeRo1985 commented 2023-11-04 15:43:35 +00:00 (Migrated from github.com)

Thanks for asking about ray tracing capabilities in PasVulkan. I am still actively working on integrating this feature. It's a complex task that requires careful implementation to meet the performance and functionality standards I've set for PasVulkan.

And I appreciate your question on why SDL is utilized in specific contexts within PasVulkan. Allow me to outline the reasoning behind its selective integration based on the operating system:

The integration of SDL is highly contingent on the operating system:

  1. Linux: SDL is invaluable in this environment due to the complex and varied nature of the available APIs for different system functionalities, ranging from UI/visuals (X11, Wayland, Raw-Framebuffer) to audio (ALSA, OSS, JACK, PulseAudio, PipeWire, and so on) and input devices (jsapi, xinput, evdev, among others). The abstraction provided by SDL simplifies the process by managing this diversity. This is especially helpful considering that Linux does not always maintain backward compatibility with its APIs, which are subject to frequent changes and trends (e.g., systemd and the like). SDL, therefore, relieves developers of the considerable task of maintaining API wrappers by deferring this responsibility to the SDL and Linux distribution maintainers.

  2. Windows: Contrary to Linux, PasVulkan does not use SDL on Windows. The consistent backward compatibility of Windows APIs allows for a more streamlined and stable native development process, making the need for the SDL layer unnecessary. As a result, PasVulkan runs smoothly and reliably on Windows without the need for SDL, utilizing the Windows native APIs for its operations in a direct way.

  3. Android: SDL's role in PasVulkan for Android falls somewhere between its usage in Linux and Windows. While direct native API usage is generally smoother for certain tasks, such as handling display modes, SDL still provides a layer of abstraction that can be beneficial in managing the diversity of Android's system functions, since Android is also introducing new APIs and breaking old APIs often. It's a balancing act of leveraging SDL for its strengths while also recognizing scenarios where native APIs offer better performance or control.

Overall, SDL is integrated into PasVulkan where it offers significant advantages, which is mainly in the Linux environment. But for Windows, PasVulkan takes advantage of the robust native OS APIs, and on Android, it strikes a balance between SDL and native APIs based on what offers the best outcome for performance and control.

I hope this clarifies why SDL is used selectively in PasVulkan as cross-OS-API-wrapper, at least for Linux and Android.

Should you have further questions, feel free to ask.

Thanks for asking about ray tracing capabilities in PasVulkan. I am still actively working on integrating this feature. It's a complex task that requires careful implementation to meet the performance and functionality standards I've set for PasVulkan. And I appreciate your question on why SDL is utilized in specific contexts within PasVulkan. Allow me to outline the reasoning behind its selective integration based on the operating system: The integration of SDL is highly contingent on the operating system: 1. **Linux:** SDL is invaluable in this environment due to the complex and varied nature of the available APIs for different system functionalities, ranging from UI/visuals (X11, Wayland, Raw-Framebuffer) to audio (ALSA, OSS, JACK, PulseAudio, PipeWire, and so on) and input devices (jsapi, xinput, evdev, among others). The abstraction provided by SDL simplifies the process by managing this diversity. This is especially helpful considering that Linux does not always maintain backward compatibility with its APIs, which are subject to frequent changes and trends (e.g., systemd and the like). SDL, therefore, relieves developers of the considerable task of maintaining API wrappers by deferring this responsibility to the SDL and Linux distribution maintainers. 2. **Windows:** Contrary to Linux, PasVulkan does not use SDL on Windows. The consistent backward compatibility of Windows APIs allows for a more streamlined and stable native development process, making the need for the SDL layer unnecessary. As a result, PasVulkan runs smoothly and reliably on Windows without the need for SDL, utilizing the Windows native APIs for its operations in a direct way. 3. **Android:** SDL's role in PasVulkan for Android falls somewhere between its usage in Linux and Windows. While direct native API usage is generally smoother for certain tasks, such as handling display modes, SDL still provides a layer of abstraction that can be beneficial in managing the diversity of Android's system functions, since Android is also introducing new APIs and breaking old APIs often. It's a balancing act of leveraging SDL for its strengths while also recognizing scenarios where native APIs offer better performance or control. Overall, SDL is integrated into PasVulkan where it offers significant advantages, which is mainly in the Linux environment. But for Windows, PasVulkan takes advantage of the robust native OS APIs, and on Android, it strikes a balance between SDL and native APIs based on what offers the best outcome for performance and control. I hope this clarifies why SDL is used selectively in PasVulkan as cross-OS-API-wrapper, at least for Linux and Android. Should you have further questions, feel free to ask.
tigrazone commented 2023-11-04 16:54:18 +00:00 (Migrated from github.com)

Is no equivalents like ImGUI for Pascal for glfw/vulkan, no SDL?
I see in c++ world ImGUI now is standard

Is no equivalents like ImGUI for Pascal for glfw/vulkan, no SDL? I see in c++ world ImGUI now is standard
BeRo1985 commented 2023-11-04 19:22:38 +00:00 (Migrated from github.com)

At least, PasVulkan has its own quite feature-complete GUI framework, but it's a retained-mode GUI and not an immediate-mode GUI, because I personally don't like the idea behind ImGUIs.

In my opinion, retained-mode GUIs (RmGUIs) offer a superior approach to user interface design, particularly due to their robust handling of state and event management. The upfront layout and automatic state retention simplify the development process, making it far more convenient to handle user interactions and dynamic changes within the UI. This built-in efficiency is a significant advantage, enabling the creation of complex, responsive interfaces with less manual overhead.

Admittedly, immediate-mode GUIs (ImGUIs) can facilitate quicker development and more straightforward iteration of GUIs, often in a single pass, which can be particularly beneficial during prototyping or for simpler interfaces. However, it's important to weigh these advantages against the potential downsides, such as less efficient rendering and more complex state management, to determine if it's the best approach for a given project.

But tastes are different, after all. I myself favor RmGUIs. :-)

Screenshot_20231104_200514

At least, PasVulkan has its own quite feature-complete GUI framework, but it's a retained-mode GUI and not an immediate-mode GUI, because I personally don't like the idea behind ImGUIs. In my opinion, retained-mode GUIs (RmGUIs) offer a superior approach to user interface design, particularly due to their robust handling of state and event management. The upfront layout and automatic state retention simplify the development process, making it far more convenient to handle user interactions and dynamic changes within the UI. This built-in efficiency is a significant advantage, enabling the creation of complex, responsive interfaces with less manual overhead. Admittedly, immediate-mode GUIs (ImGUIs) can facilitate quicker development and more straightforward iteration of GUIs, often in a single pass, which can be particularly beneficial during prototyping or for simpler interfaces. However, it's important to weigh these advantages against the potential downsides, such as less efficient rendering and more complex state management, to determine if it's the best approach for a given project. But tastes are different, after all. I myself favor RmGUIs. :-) ![Screenshot_20231104_200514](https://github.com/BeRo1985/pasvulkan/assets/428863/958e5322-d60f-4001-b1f5-2df0ddb1c768)
tigrazone commented 2023-11-04 19:45:07 +00:00 (Migrated from github.com)

I want to see as soon as possible your rtx approach with RmGUI.
When it can be possible? It can be first rtx project on pascal.
One more question. Is in RmGUI can be changed font and font size?

I want to see as soon as possible your rtx approach with RmGUI. When it can be possible? It can be first rtx project on pascal. One more question. Is in RmGUI can be changed font and font size?
Coldzer0 commented 2023-11-16 18:00:03 +00:00 (Migrated from github.com)

Is no equivalents like ImGUI for Pascal for glfw/vulkan, no SDL? I see in C++ world ImGUI now is standard

I've been working on a binding for ImGui in Pascal ^_^
https://github.com/Coldzer0/ImGui-Pascal

You may find it interesting.

> Is no equivalents like ImGUI for Pascal for glfw/vulkan, no SDL? I see in C++ world ImGUI now is standard I've been working on a binding for ImGui in Pascal ^_^ https://github.com/Coldzer0/ImGui-Pascal You may find it interesting.
tigrazone commented 2023-11-16 18:14:45 +00:00 (Migrated from github.com)

Is no equivalents like ImGUI for Pascal for glfw/vulkan, no SDL? I see in C++ world ImGUI now is standard

I've been working on a binding for ImGui in Pascal ^_^ https://github.com/Coldzer0/ImGui-Pascal

You may find it interesting.

did you use OpenGL3 or SDL?

> > Is no equivalents like ImGUI for Pascal for glfw/vulkan, no SDL? I see in C++ world ImGUI now is standard > > I've been working on a binding for ImGui in Pascal ^_^ https://github.com/Coldzer0/ImGui-Pascal > > You may find it interesting. did you use OpenGL3 or SDL?
Coldzer0 commented 2023-11-16 18:34:23 +00:00 (Migrated from github.com)

Is no equivalents like ImGUI for Pascal for glfw/vulkan, no SDL? I see in C++ world ImGUI now is standard

I've been working on a binding for ImGui in Pascal ^_^ https://github.com/Coldzer0/ImGui-Pascal
You may find it interesting.

did you use OpenGL3 or SDL?

SDL2 is for window creation, and OpenGL3 is a renderer.
But you can change the backend to anything you want
I'm currently working on implementing more of the ImGui backends in pure Pascal.

> > > Is no equivalents like ImGUI for Pascal for glfw/vulkan, no SDL? I see in C++ world ImGUI now is standard > > > > > > I've been working on a binding for ImGui in Pascal ^_^ https://github.com/Coldzer0/ImGui-Pascal > > You may find it interesting. > > did you use OpenGL3 or SDL? SDL2 is for window creation, and OpenGL3 is a renderer. But you can change the backend to anything you want I'm currently working on implementing more of the ImGui backends in pure Pascal.
tigrazone commented 2023-11-16 18:46:15 +00:00 (Migrated from github.com)

I wish not use SDL. Like in c++ version of ImGUI ;-)

I wish not use SDL. Like in c++ version of ImGUI ;-)
Coldzer0 commented 2023-11-16 18:58:53 +00:00 (Migrated from github.com)

I wish not use SDL. Like in c++ version of ImGUI ;-)

ImGui has a lot of backends, and SDL is one of them; you can use any of them.
What operation system are you targeting?

> I wish not use SDL. Like in c++ version of ImGUI ;-) ImGui has a lot of backends, and SDL is one of them; you can use any of them. What operation system are you targeting?
tigrazone commented 2023-11-16 19:50:04 +00:00 (Migrated from github.com)

And I think If you want talk more about it we may use something like Discord my handle is coldzer0

I dont use Discord.
Preffered os for me is Windows and Linux. I like to use backends OpenGL/GLFW without SDL, maybe Vulkan

> And I think If you want talk more about it we may use something like Discord my handle is `coldzer0` I dont use Discord. Preffered os for me is Windows and Linux. I like to use backends OpenGL/GLFW without SDL, maybe Vulkan
tigrazone commented 2024-10-29 09:55:23 +00:00 (Migrated from github.com)

ok. what about rtx usage after 1 year of my question.
is example with rtx pipeline and ray_query pipeline exists?
with SDL is not a problem.

one more question. Is this repo works on mac?

ok. what about rtx usage after 1 year of my question. is example with rtx pipeline and ray_query pipeline exists? with SDL is not a problem. one more question. Is this repo works on mac?
tigrazone commented 2024-10-29 10:00:34 +00:00 (Migrated from github.com)

one more idea is gltf viewer with ray_query pipeline. i interesed with build PBR raytracer

one more idea is gltf viewer with ray_query pipeline. i interesed with build PBR raytracer
BeRo1985 commented 2024-11-02 04:42:00 +00:00 (Migrated from github.com)

The current PasVulkan’s Scene3D based gltfviewer has been using ray_query for raytraced shadows for a long time. If a GPU with raytracing capabilities is detected, it enables raytraced shadows; otherwise, it falls back to shadow mapping. PasVulkan’s Scene3D also includes fairly complete raytracing support on the mesh side, including BVH BLAS refitting and rebuilds for animations and dynamic meshes, among other features. However, the code for BVH BLAS compaction (a two-pass method for creating BVH BLAS instances for static meshes that are smaller in VRAM than those built with a one-pass approach) is not yet complete. This feature is primarily for memory optimization and does not impact other functionalities.

Additionally, full raytracing/pathtracing support is planned for PasVulkan’s Scene3D in the near future, although this won’t be implemented until after I complete the current PasVulkan-based indie game project.

Regarding Vulkan on macOS, it’s a complicated topic. Apple does not support Vulkan natively, so you would need to use the MoltenVK Vulkan-to-Metal wrapper. However, MoltenVK cannot wrap all Vulkan features to Metal because Metal lacks support for some Vulkan features or supports them in a way that makes wrapping challenging or even impossible.

The current PasVulkan’s Scene3D based gltfviewer has been using ray_query for raytraced shadows for a long time. If a GPU with raytracing capabilities is detected, it enables raytraced shadows; otherwise, it falls back to shadow mapping. PasVulkan’s Scene3D also includes fairly complete raytracing support on the mesh side, including BVH BLAS refitting and rebuilds for animations and dynamic meshes, among other features. However, the code for BVH BLAS compaction (a two-pass method for creating BVH BLAS instances for static meshes that are smaller in VRAM than those built with a one-pass approach) is not yet complete. This feature is primarily for memory optimization and does not impact other functionalities. Additionally, full raytracing/pathtracing support is planned for PasVulkan’s Scene3D in the near future, although this won’t be implemented until after I complete the current PasVulkan-based indie game project. Regarding Vulkan on macOS, it’s a complicated topic. Apple does not support Vulkan natively, so you would need to use the MoltenVK Vulkan-to-Metal wrapper. However, MoltenVK cannot wrap all Vulkan features to Metal because Metal lacks support for some Vulkan features or supports them in a way that makes wrapping challenging or even impossible.
tigrazone commented 2024-11-02 08:55:15 +00:00 (Migrated from github.com)

thank you for impressive work. I go to test it

thank you for impressive work. I go to test it
tigrazone commented 2024-11-02 11:39:55 +00:00 (Migrated from github.com)

I'm try to compile gltfviewer but I have compiler error.
Before compile I call start.bat
Windows 10.
Lazarus 3.6
compiler-err1

I'm try to compile gltfviewer but I have compiler error. Before compile I call start.bat Windows 10. Lazarus 3.6 ![compiler-err1](https://github.com/user-attachments/assets/13f20af5-4a24-4fd2-a7ea-8d78586e04fd)
BeRo1985 commented 2024-11-02 13:33:52 +00:00 (Migrated from github.com)

Which FPC version you're using?

I'm using

Free Pascal Compiler version 3.3.1-12650-gb53034705f [2023/05/06] for x86_64

and as well

Free Pascal Compiler version 3.3.1-16487-g7d83cea8da [2024/09/23] for x86_64
Which FPC version you're using? I'm using ``` Free Pascal Compiler version 3.3.1-12650-gb53034705f [2023/05/06] for x86_64 ``` and as well ``` Free Pascal Compiler version 3.3.1-16487-g7d83cea8da [2024/09/23] for x86_64 ```
tigrazone commented 2024-11-02 16:52:38 +00:00 (Migrated from github.com)

I use
Free Pascal Compiler version 3.2.2 [2024/09/29] for x86_64
I compile from Lazarus.
Open projects\gltfviewer\src\gltfviewer.lpi
And Run/Build
Maybe I must set some in project options?

I use Free Pascal Compiler version 3.2.2 [2024/09/29] for x86_64 I compile from Lazarus. Open projects\gltfviewer\src\gltfviewer.lpi And Run/Build Maybe I must set some in project options?
BeRo1985 commented 2024-11-02 21:17:43 +00:00 (Migrated from github.com)

To compile PasVulkan, you need to use either the trunk version of FreePascal (currently 3.3.1) or a recent version of Delphi. This is because the stable versions of FreePascal often lack certain features (which are available in Delphi) or contain bugs that are triggered by the PasVulkan source, especially in areas like generics, inline assembly, code generation, register allocation, and so on.

To compile PasVulkan, you need to use either the trunk version of FreePascal (currently 3.3.1) or a recent version of Delphi. This is because the stable versions of FreePascal often lack certain features (which are available in Delphi) or contain bugs that are triggered by the PasVulkan source, especially in areas like generics, inline assembly, code generation, register allocation, and so on.
tigrazone commented 2024-11-02 22:46:01 +00:00 (Migrated from github.com)

I built it with FreePascal 3.3.1
but 212mb(217 885 772) exe. why?

I built it with FreePascal 3.3.1 but 212mb(217 885 772) exe. why?
BeRo1985 commented 2024-11-02 23:19:49 +00:00 (Migrated from github.com)

The large size is due to debugging symbols, as PasVulkan is a sizable project with a substantial amount of code. Without debugging symbols, the executable should be around 34 MB. Additionally, keep in mind that PasVulkan’s Scene3D requires a significant number of precompiled shader permutations, as they need to be prebuilt in SPIR-V format. So even without debugging symbols, the file size will be at least about 34 MB.

The large size is due to debugging symbols, as PasVulkan is a sizable project with a substantial amount of code. Without debugging symbols, the executable should be around 34 MB. Additionally, keep in mind that PasVulkan’s Scene3D requires a significant number of precompiled shader permutations, as they need to be prebuilt in SPIR-V format. So even without debugging symbols, the file size will be at least about 34 MB.
tigrazone commented 2024-11-03 00:09:14 +00:00 (Migrated from github.com)

hm. I pick "strip symbols from executable".
Delphi give me 40mb exe

hm. I pick "strip symbols from executable". Delphi give me 40mb exe
tigrazone commented 2024-11-03 00:20:22 +00:00 (Migrated from github.com)

maybe exe can be smaller?
for example, switchable parameters.
also i have proposition - please add some indicator of loading file.
I try to load big gltf and where is no indicator

maybe exe can be smaller? for example, switchable parameters. also i have proposition - please add some indicator of loading file. I try to load big gltf and where is no indicator
tigrazone commented 2024-11-03 00:23:48 +00:00 (Migrated from github.com)

big scenes rendered with 4-5 fps on my rtx 3060.
used rtx or why is slow?

big scenes rendered with 4-5 fps on my rtx 3060. used rtx or why is slow?
BeRo1985 commented 2024-11-03 00:37:23 +00:00 (Migrated from github.com)

Unfortunately, the executable can’t be made smaller, as it’s now effectively a comprehensive game engine (currently powering two commercial games in development). The name "gltfviewer" might be misleading here, as it has evolved into a general 3D model viewer that runs on a full game engine. The gltfviewer is intended primarily as a starting-point example project for using the Scene3D stuff.

The performance slowdown could be due to raytracing but might also result from running out of video RAM, causing the system to swap in and out, which can be extremely slow—especially if you don’t have ReBAR-ready hardware (CPU, motherboard, or GPU).

Unfortunately, the executable can’t be made smaller, as it’s now effectively a comprehensive game engine (currently powering two commercial games in development). The name "gltfviewer" might be misleading here, as it has evolved into a general 3D model viewer that runs on a full game engine. The gltfviewer is intended primarily as a starting-point example project for using the Scene3D stuff. The performance slowdown could be due to raytracing but might also result from running out of video RAM, causing the system to swap in and out, which can be extremely slow—especially if you don’t have ReBAR-ready hardware (CPU, motherboard, or GPU).
BeRo1985 commented 2024-11-03 00:52:39 +00:00 (Migrated from github.com)

And try CTRL+F8 for dumping the Vulkan-side memory usage, and Shift+F8 for Resource usage and just F8 for CPU+GPU profiler time values (it will get dump into the terminal console window).

And try CTRL+F8 for dumping the Vulkan-side memory usage, and Shift+F8 for Resource usage and just F8 for CPU+GPU profiler time values (it will get dump into the terminal console window).
tigrazone commented 2024-11-03 07:55:56 +00:00 (Migrated from github.com)

Delphi build works without console and I dont know why

Delphi build works without console and I dont know why
tigrazone commented 2024-11-03 07:57:16 +00:00 (Migrated from github.com)

about 34 MB.
Maybe some special flags?
Give it to me

> about 34 MB. Maybe some special flags? Give it to me
BeRo1985 commented 2024-11-03 09:03:55 +00:00 (Migrated from github.com)

about 34 MB.
Maybe some special flags?
Give it to me

image

Delphi build works without console and I dont know why

And with FreePascal + Lazarus?

> > about 34 MB. > > Maybe some special flags? > > Give it to me ![image](https://github.com/user-attachments/assets/12c4dcba-6095-4eb4-a4a6-50c46ba86bc4) > Delphi build works without console and I dont know why And with FreePascal + Lazarus?
tigrazone commented 2024-11-03 09:38:33 +00:00 (Migrated from github.com)

On this screen all checkboxes off in my Lazarus. Only last where strip is on

On this screen all checkboxes off in my Lazarus. Only last where strip is on
tigrazone commented 2024-11-03 09:39:56 +00:00 (Migrated from github.com)

Fpc+Lazarus generate code with console by default. Maybe sort of "generate gui app" dont show console

Fpc+Lazarus generate code with console by default. Maybe sort of "generate gui app" dont show console
tigrazone commented 2024-11-03 09:45:51 +00:00 (Migrated from github.com)

If gltfviwer is demo for game engine, where I can read about this engine? And maybe cheatsheet of api?

If gltfviwer is demo for game engine, where I can read about this engine? And maybe cheatsheet of api?
tigrazone commented 2024-11-12 14:41:09 +00:00 (Migrated from github.com)

about 34 MB
When I removed -dDEBUG from Project/Project Options/Custom Options I can compile 34 MB exe

> about 34 MB When I removed -dDEBUG from Project/Project Options/Custom Options I can compile 34 MB exe
tigrazone commented 2024-12-02 19:58:20 +00:00 (Migrated from github.com)

Additionally, full raytracing/pathtracing support is planned for PasVulkan’s Scene3D in the near future, although this won’t be implemented until after I complete the current PasVulkan-based indie game project.

When you plan to implement fully path tracing support? I interested on this feature

> Additionally, full raytracing/pathtracing support is planned for PasVulkan’s Scene3D in the near future, although this won’t be implemented until after I complete the current PasVulkan-based indie game project. When you plan to implement fully path tracing support? I interested on this feature
tigrazone commented 2024-12-02 20:33:05 +00:00 (Migrated from github.com)

please don't take it as impudence, but could you please give an example of path tracing with accumulation and use of tonemapper?
And save result of rendering to hdr or png?

please don't take it as impudence, but could you please give an example of path tracing with accumulation and use of tonemapper? And save result of rendering to hdr or png?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
BeRo1985/pasvulkan#32
No description provided.