Texture Shows Flickering / Aliasing / Moire Patterns in Godot, Despite Mipmaps - graphics

If I load a checkerboard texture into Godot:
And stand far enough back from it, I get strange artifacts called Moiré patterns:
This is a well-known problem in computer graphics which appears whenever you sample a texture that has a higher resolution than the area of the screen it is being rendered onto. (See this article for another illustration and full explanation.)
The usage of mipmaps is a technique to eliminate this problem by making lower-resolution versions of the texture that are then used when the camera is sufficiently far away from the object. So, I went to find out how to enable this in Godot only to find out that it was already enabled by default:
Why then am I still getting aliasing? What can I do to eliminate it?

By default, Godot selects a higher resolution mipmap than what is needed to completely eliminate aliasing. At the cost of making your materials blurrier, the aliasing can be almost entirely removed by increasing the "Texture Mipmap Bias" by one. What this does is tell Godot's rendering engine to pick the mipmap that is half the resolution of the one it would normally pick. The setting can be found as follows:
Go to Project > Project Settings....
Enable "Advanced Settings" to the right of the search bar.
Navigate to Rendering > Textures on the left.
The setting can then be found in Default Filters > Texture Mipmap Bias on the right.
The result:

Related

The image seems no so clear in openseadragon as its origin

I use openseadragon show arts in my web site, but they seem not so clear as its origin. (I do not have so much reputation to post snapshots):
The original one is sharper, and the one rendered by openseadragonone is blurred.
I was thought that it caused by Deep Zoom Composer, which decreased quality when creating DZI image parts, but i was wrong. The part image in DZI directory and the original one are exactly same, and all of them are readered by a browser(IE 10).
Now the reasonable explaination is the randering type of openseadragon cause the difference, is this a bug? or is there an option / argument which can improve rendering effect in openseadragon?
Two possible issues here. Are you on an HDPI (i.e. "retina") screen? If so, there is a bug fix in master that's not on the latest release yet.
Otherwise, it's probably the minPixelRatio. By default OpenSeadragon allows the image to not be entirely full resolution at some zoom levels, to save on bandwidth. You can modify this value by passing minPixelRatio: 1 as one of the options when you create your viewer (the default value is 0.5).
We can continue the discussion in the issue here: https://github.com/openseadragon/openseadragon/issues/646

Did XAML caching behavior change in Windows 8.1 Preview

I have a repeating XAML animation of multiple scaling arrows which update several times per second which has worked fine on Silverlight, Win8, WinPhone7, and WinPhone8. But now, with the Windows 8.1 Preview I'm getting the following unexpected behavior:
Initial display of the animated arrows is correct through one cycle of all scaled sizes.
On the second and subsequent repetitions of the animation, the arrows are scaled to the correct size, but are all apparently scaled up versions of a low rez, cached bitmap of the arrow. This looks horrible.
If I switch apps and return to my app, the initial display is correct and then reverts to the bad low-rez version (in other words behaviors 1 and 2 repeat).
I would assume this is due to some change in UIElement caching behavior in Win8.1 Preview, but can't find any documentation of a change in this area.
UiElement.CacheMode would seem a likely candidate to effect a fix, but I'd like to know if this behavior is by design or will require code changes for the final release.
Answering my own question: A work around to the bug/feature in Windows 8.1 Preview XAML is adding the following to the TransformGroup associated with the problematic UIElement:
rotateGroup.CacheMode = null;
I have absolutely no idea why this change was necessary. One further description of the problem before the above hack was added:
If the arrow resizing changes incrementally by a small amount, then the bug appears. If the scale factor changes in larger jumps, then the bug goes away and the arrows display correctly.

How to generate sprite art assets for different resolution screens?

I'm working on a game using OpenGL displaying sprites, i.e. 2d quad-mapped graphics with no projection, that will be displayed on several different resolution screens. (i.e. iPhone retina/non-retina, iPad.. my next project the problem will expand to desktop resolutions which are far more numerous)
I'm OK with handling different aspect ratios, that can be handled by opengl and my placement of the sprites. I'm also OK with slightly different resolutions - use same art and either border the screen, or display a little bit more info.. but when things start to grow/shrink by like 50%+ it's a major issue.
What is standard procedure for generating the art assets in this situation? Generate for the largest resolution and just let OpenGL worry about resizing during it's rasterizing, or do people generate art sets for each main resolution?
Rasterized sprite art tends to get ugly when it's stretched (interpolated), so I'm concerned.. but generating different sizes really means for practical purposes I have to go with vector drawings and export several resolutions. Limits the artist and is somewhat complicated as far as loading and managing the assets
(Yes, I can "just try it" to an extent, but I already have an idea of the results. I'm looking for solutions people use and angles I maybe wouldn't have thought of. This question does have an answer(s) it's not subjective or lazy)
You are correct that scaling bitmaps tends to make sprites bad. There are a couple of ways of dealing with that:
Draw them (pixelart) at all required resolutions. That is a lot of work but gives you full control.
Draw them (vectors) and render them at all required resolutions. Less work but scaling up or down beyond 50% or 200% might give bad results.
Draw them (3D appliction) and render them at all required resolutions. Quite some work but a very consistent set of sprites.
For each of these options you are free to post-process the bitmaps to clean them up or add details but if you do this for options 2 and 3, you are breaking the chain and will have to apply the changes again when rendering the same set again.
An other option is to limit the variation of resolutions.
As far as I know it is very common in the (game) industry to make all (or the most used/visible) sprites as pixel perfect as possible. This is what they pay the artists for...

Advanced Text Rendering with Direct3D

Let me describe the "battlefield" of my task:
Multi-room audio/video chat with more than 1M users;
Custom Direct3D renderer;
What I need to implement is a TextOverVideo feature. The Text itself goes via network and is to be rendered on the recipient side with Direct3D renderer. AFAIK, it is commonly used in game development to create your own texture with letters/numbers and draw this items. Because our application must support many languages, we ought to use a standard. That's why I've been working with ID3DXFont interface but I've found out some unsatisfied limitations.
What I've faced is a lack of scalability. E.g. if user is resizing video window I have to RE-create D3DXFont with new D3DXFONT_DESC while he's doing that. I think it is unacceptable.
That is why the ONLY solution I see (due to my skills) is somehow render the text to a texture and therefore draw sprite with scaling, translation etc.
So, I'm not sure if I go into the correct direction. Please help with advice, experience, literature, sources...
Your question is a bit unclear. As I understand it, you want easily scalable font.
I think it is unacceptable
As far as I know, this is standard behavior for fonts - even for system fonts. They aren't supposed to be easily scalable.
Possible solutions:
Use ID3DXRenderTarget for rendering text onto texture. Font will be filtered when you scale it up too much. Some people will think that it looks ugly.
Write custom library that supports vector fonts. I.e. - it should be able to extract font outline from font, and build text from it. It will be MUCH slower than ID3DXFont (which is already slower than traditional "texture" fonts). Text will be easily scalable. Using this way, you are very likely to get visible artifacts ("noise") for small text. I wouldn't use that approach unless you want huge letters (40+ pixels). Freetype library may have functions for processing font outlines.
Or you could try using D3DXCreateText. This will create 3D text for ONE string. Won't be fast at all.
I'd forget about it. As long as user is happy about overall performance, improving font rendering routines (so their behavior looks nice to you) is not worth the effort.
--EDIT--
About ID3DXRenderTarget.
EVen if you use ID3DXRenderTarget, you'll need ID3DXFont. I.e. you use ID3DXFont to render text onto texture, and then use texture to blit text onto screen.
Because you said that performance is critical, you can delay creation of new ID3DXFont until user stops resizing video. I.e. When user starts resizing video, you use old font, but upscale it using texture. There will be filtering, of course. Once user stops resizing, you create new font when you have time. you probably can do that in separate thread, but I'm not sure about it. OR you could simply always render text in the same resolution as video. This way you won't have to worry about resizing it (it still will be filtered - along with the video). Some video players work this way.
Few more things about ID3DXFont. There is one problem with ID3DXFont - it is slow in situations where you need a lot of text (but you still need it, because it supports unicode, and writing texturefont with unicode support is pain). Last time I worked with it I optimized things by caching commonly used strings in the textures. I.e. any string that was drawn more than 3 frames in the row were rendered onto D3DFMT_A8R8G8B8 texture/render target, and then I've been copying that string from texture instead of using ID3DXFont. Strings that weren't rendered for a while, were removed from texture. That gave some serious boost. This solution, however is tricky - monitoring empty space in the texture, removing unused strings, and defragmenting the texture isn't exactly trivial (there is nothing exceptionally complicated, but it is easy to make a mistake). You won't need such complicated system unless your screen is literally covered by text.
ID3DXFont fonts are flat, always parallel to the screen. D3DXCreateText are meshes that can be scaled and rotated.
Texture fonts are fuzzy and don't look very clear. Not good for an app that uses lots of small text.
I am writing an app that can create 500 text meshes, each mesh averaging 3,000-5,000 vertices. The text meshes are created once, then are static. I get 700 fps on a GeForce 8800.

What is the maximum practical height and width for a Web application?

Suppose I want to make a Web application which uses a fixed width and height, and I want the interface to fit on screen for common screen resolutions. Assume the application will only be used on laptops and workstations (and not on mobile devices), and it will be used by IT professionals.
What is the largest possible size I can make the application? I think the key considerations here are what is the smallest screen resolution commonly used and how much space to reserve for browser chrome, which may depend on whether the user has toolbars installed, etc.
Or should I make all the page elements resizable and go with fluid layout? That seems like it might be quite a lot of work.
Fluid layouts are great if your design works for it.
Otherwise, 960px wide is very common and works in pretty much any browser on a 1024x768 screen resolution (which is still VERY common).
As for height, people are generally okay with scrolling down, but if you need it in one window then you have to stay under about 500-600px depending on browser and what toolbars the user has installed.
960x600 pixels
You could use an analytics tool to figure out what resolution your current users are running.
You might try making only part of the layout fixed, and then using CSS's max-width/min-width and max-height/min-height to constrain what you must. Have decoration be fluid as much as it can (e.g. large background images shouldn't force the browser to be 1600px wide; just show as much as possible in the width available in the user's browser, without horizontal scrollbars; try setting the container width to 100%).
You could put a min-width of maybe 30em on a main text column, for comfortable reading (see Ideal line length for content), and perhaps an upper limit of something wide but still readable. It is unpleasant when browsing a site with a layout that crams the content into a small, fixed-size box, especially when it's only for the sake of preserving their design. If your design requires dynamic content to fit within a fixed size, the design could probably use some more thought.

Resources