-
I am currently using Magnum to write a 3D editor, but I am encountering a problem that is quite tricky for me. I have tried many times but have not been able to solve it. I hope to receive help. I used PickingExample as the basis, rotated the x-axis by -90 degrees, and used planeSolid and grid3DWireframe as the ground and scale lines. However, I found that the scale lines had severe jagged edges, especially after adding the ground, the effect was even worse. I have tried the following but have not been able to solve it. What should I do? 1.Enable anti aliasing, but it has no effect `
` `
` I will draw it in the following way. `
At the same time, I want to use the following code to draw the main and auxiliary scale lines, but the effect does not meet expectations. Can you give me some ideas? Thank you
` To change the z-up mode, I used the following code to adjust the camera. The example of an arcball is good, but it cannot be freely scaled according to the mouse position. Is there a directly available solution there?
My development environment is |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 2 replies
-
Forgetting to configure wxwidgets also has no effect, as shown below
` |
Beta Was this translation helpful? Give feedback.
-
Add a zoom effect image, the zoom effect is not very good when there is ground, How to achieve smoothing effect? thanks |
Beta Was this translation helpful? Give feedback.
-
The following code solves some smoothing problems, but the picking function is malfunctioning. I have tried many times but currently have no solution. Can you give me some suggestions?
` |
Beta Was this translation helpful? Give feedback.
-
Hi, sorry that I wasn't able to reply earlier. Multisampling + object picking is kind of tricky, unfortunately. You managed to solve the multisampling part with the above it seems, that's great. But reading from a multisampled framebuffer will likely give you a GL error, you have to blit (a part of) it to a non-multisampled framebuffer first, and then read that. So, something like this: /* Create just once, perhaps even in a smaller size and then use different
input and output rectangle in blit() */
GL::Texture2D resolvedObjectIdTexture;
GL::Framebuffer resolve{{{}, viewportSize}};
resolvedObjectIdTexture.setStorage(GL::TextureFormat::R32UI, viewportSize);
resolve.attachTexture(GL::Framebuffer::ColorAttachment{1}, _resolvedObjectIdTexture);
/* Blit just the part you want to read */
GL::AbstractFramebuffer::blit(_framebuffer, resolve,
Range2Di::fromSize(fbPosition, { 1, 1 }), GL::FramebufferBlitMask:Color);
/* Like before */
resolve.read(
Range2Di::fromSize(fbPosition, { 1, 1 }),
{PixelFormat::R32UI});
... Regarding the strangely missing lines in the grid I'm not sure. Isn't it possible that some Z fighting is going on? Or the other grid being drawn white and thus making it look like some lines disappear? There's also the Mouse Interaction example which draws a grid, uses multisampling (in the default framebuffer) for smooth lines and implements controls for depth-aware panning and zooming with a mouse. So maybe there are some ideas you could reuse? |
Beta Was this translation helpful? Give feedback.
-
Thank you for providing ideas and direction. After trying, the problem should be solved, and the cause of the grid line flicker issue has also been identified, which was caused by Z-fighting. The current gridline effect does not meet expectations, and I am trying to customize shaders to achieve it. Currently, there are still issues with transparency, and I am still researching. The overall effect is very good.
` Resolve the issue of grid flicker ( Z-fighting)
` |
Beta Was this translation helpful? Give feedback.
-
Boss, describe my problem. The gridlines are implemented through custom shaders, as shown in the above picture. The core code is as follows I want to implement a function similar to drawing lines on a transparent canvas, that is, making the planeSolid transparent, but the grid lines implemented by shaders are opaque. I have tried various methods recently but have not received an answer. I also tried planWireframe, although it has transparency function, the shader code cannot work. Now only setOpacity (. 5f) is available; But it resulted in unclear images. `
` This is the configuration for JS, similar to this configuration. How should I proceed and provide some suggestions,
` |
Beta Was this translation helpful? Give feedback.
Thank you for providing ideas and direction. After trying, the problem should be solved, and the cause of the grid line flicker issue has also been identified, which was caused by Z-fighting. The current gridline effect does not meet expectations, and I am trying to customize shaders to achieve it. Currently, there are still issues with transparency, and I am still researching. The overall effect is very good.
The rendering logic is adjusted as follows
`