-
-
Notifications
You must be signed in to change notification settings - Fork 56
Quad drawing in Mesh Shader, when the input index has shape(nx4) #529
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
Conversation
Vertex Shader adjustments in Mesh Shader for quad type inputs
Thanks for contributing! Some feedback in order to get this merged:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome!
Most of my comments are shader-specific details.
As @Korijn said, it woud be great to have an example that just used the gui.auto
. Perhaps using some data generated by the example itself. Or you can put data in the examples/data
folder. An example showing both normal shaded quads as well as the wireframe would be really nice 😄 ! Could be two separate examples if that makes more sense for you.
BTW: this repo is autoformatted with |
Co-authored-by: Korijn van Golen <korijn@gmail.com>
Co-authored-by: Korijn van Golen <korijn@gmail.com>
Co-authored-by: Korijn van Golen <korijn@gmail.com>
Co-authored-by: Korijn van Golen <korijn@gmail.com>
Co-authored-by: Almar Klein <almar@almarklein.org>
Co-authored-by: Almar Klein <almar@almarklein.org>
Co-authored-by: Almar Klein <almar@almarklein.org>
Yep, without the wireframe mode it paints the quads as expected. |
@almarklein Holy Zeus! ⚡ |
Co-authored-by: Almar Klein <almar@almarklein.org>
- change "vertex_color_channels" for color_mode = face to "face_color_channels
I was on holiday, so could not check earlier.
I tried with wgpu-py from pypi, but nope, same result :)
Everything works as expected, except that it's a saw-shape instead of a strip of quads. I suspect there's a subtle detail in the shader that makes certain values zero. I'll have a more proper look early next week. |
Is this correct for nr 3? The issue was that the indices were int64, which the GPU cannot handle. Why it does work for you is beyond me. We should add a check to guard against that ... I created #579 for that. For this PR, you can simply |
Just wanted to chime in and show some appreciation here; the persistence and collaboration is a joy to see! Awesome to have quad support in pygfx soon. We're almost there! |
@almarklein that doesn't look right. The face colour should be a gradient stop from white to black (higher Z to lower Z values). I did a fresh install on my home pc, and it's working as expected. Recording.2023-08-06.174304.mp4 |
I was afraid it didn't 😄. I looked into it, and it's the same problem: the texcoords are int64. |
It's weird that it works on both my work and home computer. I tried starting the example by defining the dtype as int64 and it doesnt load.
I am using python 3.11.3, numpy > 1.24, gpu: nvidia 1030gt on my work computer |
Wow, there's two things at play here: I think indeed your numpy version defaults to int32 for the arrays created in the example. Also, on my system, when the int64 array is converted to a memoryview, that memotyview reports a format of "l", which means 32bit. See https://docs.python.org/3/library/struct.html#format-characters. This is strange. Your machine reports "q" as expected. This is why the error was not caught on my machine, and the example ran, although broken. I'm working on a pr to fix that. |
@almarklein you must be using Linux right? I read that on windows the numpy dtype defaults to in32 unless it cant be represented as int32. On other platforms it defaults to int64. But I guess thats a good bug caught on memory view :) |
How convenient 😕. So if a Windows user posts code online, any Linux/MacOS user that want to run that code, may get an error from pygfx ... |
Ok, I tested the example again:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@almarklein Thanks a lot for the fixes! I am excited to see this in the gallery section! :D |
Many thanks for your contribution @sharon92 ❤️ |
Yeah, great to see these improvements landed! |
No description provided.