-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Example for random sampling #13507
Example for random sampling #13507
Conversation
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.
Looks good to me :)
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.
I don't have much to say about the code itself, but I will note the following:
- Camera motion felt too fast, I think it would be good if you first converted mouse delta to a screen-space percentage and then scaled that by some sensitivity factor, rather than choosing an arbitrary pixel -> radian value.
- The code should explain more that the sampling does NOT take into account the transform of the mesh, the fact they agree is due to how the scene is constructed. (Maybe show the user how to use the cube entity's global transform to transform the sample to world-space?)
- Would be nice if: You could tilt camera up/down.
- Would be nice if: (as you said) You could look at various other shapes
- Would be nice if: Some sort of batching for the point spheres to let me to look at more of them!
- Would be nice if: Some sort of free-running mode where points spawn (and despawn) by themselves).
We can tackle the would be's in another example to improve the readability of this one or just not at all.
Hmm, I do use pretty low mouse sensitivity! I actually just copied what I did in the
Yeah, I should have addressed that more explicitly. Maybe I'll add the transformation to the sampling code even if it doesn't do anything, just to give the right idea. |
My rationale for the suggestion of using window units is that: But it's definitely not a blocker, just some polish I felt would be good. |
I'll merge this Monday: feel free to tweak it until then :) |
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.
Clean and fun to use! Looks good :)
Objective
We introduced a bunch of neat random sampling stuff in this release; we should do a good job of showing people how to use it, and writing examples is part of this.
Solution
A new Math example,
random_sampling
, shows off theShapeSample
API functionality. For the moment, it renders a cube and allows the user to sample points from its interior or boundary in sets of either 1 or 100:On the level of code, these are reflected by two ways of using
ShapeSample
:Testing
Run the example!
Discussion
Maybe in the future it would be nice to show off all of the different shapes that we have implemented
ShapeSample
for, but I wanted to start just by demonstrating the functionality. Here, I chose a cube because it's simple and because it looks good rendered transparently with backface culling disabled.