Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimization: Better typing across the package #23

Open
VarLad opened this issue Mar 6, 2024 · 8 comments
Open

Optimization: Better typing across the package #23

VarLad opened this issue Mar 6, 2024 · 8 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@VarLad
Copy link
Member

VarLad commented Mar 6, 2024

Taking a look at the package code, it'd be nice if we can:

  • Have proper types across multiple structs for better dispatch and compilation.
  • Use StructArray for storing vector-of-structs (like scene.objects).
@arhik
Copy link
Member

arhik commented Mar 8, 2024

We already have a project tab here https://github.com/orgs/JuliaWGPU/projects/3

We can file an issue where type system needs work and complete it. Keeping this issue active anyways.

@arhik
Copy link
Member

arhik commented Mar 11, 2024

We can pick each example and fix typesystem for each example. This will help us understand the benefits of type stability. I have Tracy integration example which might help us document performance improvements or julia use new chainmarks.jl package.

For me Typesystem is a way towards static compiling purpose.

@arhik arhik added enhancement New feature or request help wanted Extra attention is needed labels Mar 11, 2024
@VarLad
Copy link
Member Author

VarLad commented Mar 11, 2024

@arhik Whats the purpose of this variable defined here?
https://github.com/JuliaWGPU/WGPUgfx.jl/blob/main/src/primitives/camera.jl#L15
I was wondering why didn't you use I instead of defining a coordinateTransform

I also can't find any instances of invCoordinateTransform being used 🤔

@arhik
Copy link
Member

arhik commented Mar 11, 2024

This is used to convert between conventions used in different frameworks like opengl, webgl, blender, etc ... We cannot use I since we exchange rows for different types of transformations. If any framework or data we load uses different convention then we can just exchange rows or flip sign using this matrix. Such matrices won't necessarily be identity matrices.

For example: if some framework uses (x, z, -y) as coordinate conventions instead of (x, y, z) we can simply exchange 2 and row of this matrix and also flip sign of y. Then when we multiply [a, b, c] data with this matrix it becomes [a, c, -b].

@arhik
Copy link
Member

arhik commented Mar 11, 2024

I think we can simply use inv function. They are unitary matrices so I remember calling inv should do inverse transformation. Will have to double check though.

@arhik
Copy link
Member

arhik commented Mar 11, 2024

Sorry I misread your comment. I didn't need inverse transform yet. But we will most likely. Its rather common in computer vision and graphics.

@arhik
Copy link
Member

arhik commented Mar 11, 2024

They are both like placeholders for now. I used it some of my own experiments like robotics simulator to load blender data.

@arhik
Copy link
Member

arhik commented Mar 11, 2024

Properly generalizing it will be good feature to add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
Status: Todo
Development

No branches or pull requests

2 participants