-
-
Notifications
You must be signed in to change notification settings - Fork 320
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
Replace voxel uvmap interface with uv_transform interface #4758
base: master
Are you sure you want to change the base?
Conversation
Benchmark ResultsSHA: 53987012ad8bfdd38f77ee0af4dffd12279b84b5 Warning These results are subject to substantial noise because GitHub's CI runs on shared machines that are not ideally suited for benchmarking. |
|
@enbyd you would have to add all Makie packages in the stack: add MakieCore#47de4854c97ea14c924b92af14e9dbd52b2ae85c Makie#47de4854c97ea14c924b92af14e9dbd52b2ae85c WGLMakie#47de4854c97ea14c924b92af14e9dbd52b2ae85c |
@asinghvi17 thank you! This resolved the earlier issue and i can now replicate the example given in the pr, i.e. when passing a value for the However when the attribute is not passed, as such: |
That's undefined behavior. It was before this pr too. But it would be good if this either errors or does something reasonable. I'm leaning towards making this an error, because it seems more likely to me that someone would forget to pass a In general - if you have (more) complaints/feedback on voxels I'd love to hear it. I think that would be quite helpful to polish voxel plots. |
I noticed that tex = FileIO.load(assetpath("cow.png"));
f,a,p = voxels(ones(UInt8, 2, 2, 2), color = tex; uv_transform = [I])
voxels(f[1,2], ones(UInt8, 2, 2, 2), color = tex; uv_transform = [I], gap = 0.5)
f |
Maybe. Though it is a bit of a strange case since it behaves like padding voxels within some bounded region, which is less clear cut than other examples. But For context, most of my experience mapping textures to voxels is using Mojang's resource pack specification for Minecraft, which supports custom block models made from sets of generalized cuboids, to which rectangular texture regions can be mapped. And there, any transformation applied to the cuboid takes the texture with it; you do not need to reconfigure the UVs. Have you used that system before? |
I would agree that |
I spoke with intricate yesterday to try and formulate a clear response. We also generally agreed that it would be more likely that someone forgets the attribute than that they want to intentionally leave it out, assuming they are applying a texture. If someone is using the color attribute for a color only (not a texture) I would not expect them to use Also, if when applying a texture you must include |
I believe uv_transform=:identity is a thing. |
That would be great, but is there a list of these somewhere? I looked through the code for similar strings and found some, but the only set that I found that could return an identity matrix was commented out and was called |
They are constructed by the Actually you're right that there's no uv_transform(action::Symbol)
Creates a 3x3 uv transformation matrix from a given named action. They assume 0 < uv < 1 and thus may not work correctly with Patterns. The actions include
• :rotr90 corresponding to rotr90(texture)
• :rotl90 corresponding to rotl90(texture)
• :rot180 corresponding to rot180(texture)
• :swap_xy, :transpose which corresponds to transposing the texture
• :flip_x, :flip_y, :flip_xy which flips the x/y/both axis of a texture
• :mesh, :meshscatter, :surface, :image which grabs the default of the corresponding plot type |
On gap - I also think that scaling would be better. So I guess I'll change this here too. W.r.t per voxel (?) transformations - that's impossible with the way they are rendered here. The shader is just drawing a bunch of large planes that combine into many voxels, rather than cubes. So any transformation has to be global.
Right, there are ~three modes atm: A
That does exist as TODO I'm taking away from this:
|
Understood, thanks. For generalized cuboids like those I mentioned, would you recommend Also, out of curiosity, is there support or plans for backface culling (or visibility culling in general, for that matter)? The rendering is already relatively performant, but I'm wondering how much more time you'd wager there is to reasonably squeeze out of the renderer, and face culling comes to mind as one possible way. |
With
If you're looking to load a voxel model and transform the whole thing as one you can still do that with a voxel plot. I.e. using |
I noticed that the uv debug image was intentionally rotated so that when using that debug image, the texture appears upright using the current default mapping. @lntricate1 and I have been discussing default texture mapping over the past couple days to come up with what we consider a sensible alternative to the current default mapping that will work better for how voxel texture packs tend to be designed and used. These pictures show how we'd expect an orientable texture to appear on a voxel. To summarize, the side textures appear upright (and the texture itself looks exactly like that in any editor or viewer), the top face appears upright when looking towards -x, and the bottom face also appears upright when looking towards -x. To render this, we used these transformations: The hope is that this will better match user expectations by default, while also still permitting general transformations as needed. |
This was an interesting rewatch. I'd seen it closer to when it was published and thought it was a clever approach, so it's cool to see it implemented here. One of the common comments on the page there is about overdraw, and how there are whole planes that may be mostly or entirely hidden from view. I think my initial comment about culling was prompted by similar observations, in particular by flying through a mass of voxels, and seeing all of the middles of the planes visible there. But yeah it sounds like the tradeoff between this method and another that uses something like raymarching at least depends on world size. I did also start poking around for info and research on brickmaps and SVOs. I was able to find more info about the latter. Both sounded neat. Thanks for the info |
Description
The current interface only allows you to define a LRBT for the texture coordinates of a voxel. This means that you can't rotate the textures applied to voxels. The
uv_transform
interface allows for this and also aims to solve more or less the same problem formeshscatter
. So seems natural to me to reuse it here.Quick example:
Type of change
Checklist
:rotr/:rotl
being switched in uv_transform