Anti-Blur on textures

Discussion in 'General Gameplay Discussion' started by Deckerd Smeckerd, Dec 12, 2019.

  1. Deckerd Smeckerd Active Member

    When a texture is getting stretched, doesn't it get blurry because some original pixle in that texture (which was, for example, red) which was bordered by lets say, black pixles, as all those pixles get larger they just multiply the number of pixles that are red and black. But it would be better if every pixle was more like a polygon, that as it stetched became a gradient between itself and the neighboring pixle which was also becoming a gradient. So if a red pixle was next to a black pixle, the middle color between them would be an mix of red and black as the texture stretched. Of course, I havn't seen that so I don't know what it would actually look like. Might be ok though.

    It wouldn't be perfect but it might help. Though that would mean more processing on the texture.
  2. Deckerd Smeckerd Active Member

    To get a hard edge. Once the pixels are represented by polygons, if the difference in color between neighboring polygons looks like a shading difference (like a slightly different shade of red), you can add the polygons together and blend their colors. If the difference makes it look like the artist mean to create a different area (the colors are very different) then that polygon is in a different group of polygons.

    But you have to add the polygons together probably by connecting the center of the pixels.

    Sometimes the artist seems to add white or black to the texture to create a sense of depth. An artist probably knows the rule for how to apply those colors. Those rules might help create an algorithm to create a slightly 3d texture. Or if that is too far fetched, then perhaps those highlights can be refined or removed.
  3. ttobey Makes the Monsters Move

    As someone who works with polygons and pixels every day, I have no idea what you are talking about!
    MasterMagnus, Breanna and Dude like this.
  4. Deckerd Smeckerd Active Member


    I need Grammarly. Haha. Sorry, I will try to explain my idea better. I would put in photos to help explain, but I can't make that work right now. I am not a graphics engine engineer so my observations are of the layman variety.

    When the texture needs to stretch because the camera is very close...

    I think the image gets very blurry because the process that stretches the image is multiplying pixels but doesn't modify their colors. You probably know exactly how that stretched texture is created. When I observe a wall texture from a far distance the designs on the texture look good and of good resolution. That leads me to believe that the textures are not very big at their native size. When i get really close, it looks very blurry and the edges of the designs in the texture (like a picture of a bolt) look very jagged.

    What I am wondering is, can the texture be stretched in a different way. I am not sure what the best method of doing it is, but if I can get the idea across to you, I think you will be able to figure out what the best method of doing it is, because you know how the graphics engine works. I assume so, because you said you work with polygons and pixels every day.

    Let me use that picture of a bolt as an example. At a distance, the bolt will look perfectly round because that is how it was originally drawn. When I move closer, it will not be perfectly round, it will be jagged and blurry. I was trying to figure out a process that would allow the image to retain a perfectly circular shape without blocks of colors that were originally unintended.

    Using the bolt as an example, if the bolt were brown with minor shading differences across the bolt, I thought it should be possible to represent the area of the texture that contains the bolt's pixels as one group because they are all of a similar color. So, I thought it should be possible to draw a circle around it and using the color data from the texture to shade that circle more gradually as it is enlarged.

    The process would group batches of color together until the entire texture is now a group of polygons ( like a puzzle board). When it is done, now the polygons need to be stretched so that the total area of all the polygons match the size of the texture needed.

    Now I want to create a more gradual change in color across the polygons. For example, one of the groups was the circular bolt. Imagine that on the original texture that I wanted to stretch, half the bolt was a little bit darker of a brown than the other side. The two halves were close enough in color to be included into one polygon. Imagine this bolt originally had 30 pixels to represent it but I am going to stretch it to twice the original height and width. For simplicity, lets just imagine it will be represented by 120 pixels when the final texture is created. I want to gradually change the color of the 120 pixels based on where the 30 original pixels would be, if they were spread out over the same area that the 120 pixels now occupy.

    So basically breakdown the texture by outlining all groups of colors that are close to each other. Enlarge all the outlined areas. Shade the outlined areas using the original color data. Turn it back into a texture. Now the texture is enlarged but hopefully still has good resolution.

    I am sorry. It is hard to write the explanation. If I am still unclear, I will write a document with pictures and with greater detail and give it to you.

    edit (Oh, I see in you signature that you don't accept suggestions. Do you mean these type of suggestions or something else?)
  5. Deckerd Smeckerd Active Member

    Though, I had not thought about it, but I am using a 4k -55 inch TV as my display. So that might cause additional blurring because I am running the game in a lower resolution than 4k. My TV is blowing it up too, I guess.
  6. Cragfire Well-Known Member

    As an ex-Animator/Modeler... I'm puzzled as well... heh.. But I think I can clear up some confusion...

    @ Deckerd Smecherd

    You have a good mind and it is working creatively. You are touching upon several things. A polygon is a triangle made up of three points (vertices) and three lines (edges).. A model in 3d is made up of these polygons; which the game engine uses to create the object within the game world. I'll glaze past the programming side of it, since that's not needed in this discussion; we will keep it simple and just call it a model.

    The model is then wrapped in a texture of various resolutions. In the design/build stage of a model one of the final steps is the "unwrap" the model (all the polygons) out onto a texture map; generally in squares of the number 8... so, 8x8, 64x64...1024x1024, 4092x4092... ect... Why? That we get back more into the programming side of things and how memory works and bits, bytes, ect... I digress..

    The model (wireframe) can scale indefinitely but your "texture resolution" is set by your "texture resolution"; so generally there are several textures made for any given model starting with the "master model", the highest quality version made, then scaled down. At this stage the artist has to determine if that want to "bake" any of the model detail into the texture detail.. You can bake "Normals"and you can bake "Shadowing", "Bump", "Specular" (highlights/whats shiny), and of course "Colors".

    Now withing the game engine (or engine) itself you can apply shading / shaders and blend things further, a long with adding lights.

    Now... Finally, getting to your thoughts... It sounds like you want to scale up the texture resolution automatically the closer you get to an object.. The game engine already dose this by utilizing LOD, Level of Detail.. The further an object is from the camera, the less detail is needed as pixel-resolution is decreasing the further the distance.. So the engine knows this and will load a very low resolution texture for the object, a long with a lower resolution wireframe for said object. Now when your character/camera gets closer to the target, these two (wireframe and texture) are swapped out for higher detailed versions automatically.

    Now with all of this in mind.. When your character runs of to a wall, and you can "see" the pixels in the walls texture... That is just a very low resolution texture being used. Probably with good reason... Games have to balance performance all the time, and if it is just a wall, it is just a wall.. so low priority on the performance scale (meaning, go low and as a cheap as possible to get the lowest hit for performance).

    It sounds like you want to increase texture detail dynamically. There are ways to do this and one day technology will get to the point we could do it in real time... just like how we now have real time ray tracing.. But as far as textures go, the above is really the best way for the given current technology, given having to balance for real-time, and in a mmo game environment. The last thing you want to do is to add more overhead for performance. is it faster for it to be completely dynamic and ever scaling, or just use a LOD system and sway textures every in-game "X" meters?

    For a pixel based scaling system for up-scaling and down-scaling textures (now directly pixels) would be far more taxing then current real time ray tracing, and computers are struggling with that.

    Another approach to up-scaling textures would be to utilize real time "pixel shifting" of rendered in real time frames.. but you'd have to render at least 4 to 6 frames in-between current visual frames to get that 1 new frame. Now if the player wanted at least 144 frames per second, you'd need at least 900 frames and the horsepower to pull that off for hardware.

    Technology just isn't there yet. But we have LOD, and it works well and has minimal costs on performance, special coupled with Line of Sight Culling (not rendering whats not seen by the camera)..

    (Sorry for the long post, the above is simplified the best I could, as briefly as I could. Its actually far more complex and there are move variables.)

    [Edit: there are typos.. I'm too tired to correct them, its 7am and Ive been up all night :) ]
    Rosyposy likes this.
  7. Deckerd Smeckerd Active Member


    Hi, Cragfire. I feel like you are a kindred spirit. A fellow gaming enthusiast that likes peeking under the hood too. Yes, you are exactly correct. I was looking at a real-time version, specifically. I will read over your message today. It's more than I know and can understand in one sitting. As for the polygons, though a polygon is a triangle, it can also be more than 3 sides. I was thinking the polygons needed for this process would need to have many sides, sometimes.
  8. ttobey Makes the Monsters Move

    No you are fine, I was talking about something else!
    Breanna and Rosyposy like this.
  9. Cragfire Well-Known Member

    That's deeper under the hood, so to speak... Polygons are, technically three sided, and always will be, on the engine level... For us humans it can be a mess to look at, so we generally model on quads, or four sided polygons. This is just for looks.

    Here is an example. Take a four sided polygon, we will use a slice of bread.. Now holding that bread by the corners with each index finger and thumb... now twist.. 45+ degrees on hand and 45- degrees the other. Now describe whats the surface is like in the middle. You will have two vertices "high" on opposing corners, and two "low".. But how would the engine render this?

    The engine would resolve it by guessing, either tie the two "high" vertices together with an edge, or the two "low" vertices together with an edge. Either way could drastically change the silhouette, shading and lighting of the model.. Now this is an extreme case.. and if I bumped into this while modeling, I'd force an edge so the engine wouldn't have to guess to the shape Im after.

    Some modelers will even "triangulate" a model, turn all non-three sided polygons into tris... just as a final quality of model check, then convert back leaving a few triangles in detailed areas.

    But yeah.. it can be confusing.. the term polygon is floated around, and you are correct it can mean more then 3 sides almost without limit. But in the end, on the engine side, all if it is converted back down to triangles.

    Computers have no soul or sense of art, they want just the vertices and edges... :)
  10. MightyMeaghan Well-Known Member

    Ignore his signature. He's always open to suggestions, the more outlandish the better. Especially when it comes to new mounts and player races. He loves getting those.
    Rhodris, Breanna and Dude like this.
  11. Breanna Well-Known Member

    In fact we have a whole list of mounts that he's going to make for us.
    Rhodris and Dude like this.
  12. MightyMeaghan Well-Known Member

    I'm still waiting on my Bristlebane dumbfire pet with the anvil on the balloon.
    Breanna likes this.
  13. Breanna Well-Known Member

    LOL I'm just glad he doesn't monitor all the threads I might find myself moving up his list if he did. I think the anvil on the balloon would be easy. They could just use the balloons from moors and attach an anvil to it. Piece of cake.
  14. MightyMeaghan Well-Known Member

    But then the balloon has to pop and drop the anvil on the target.
    Breanna likes this.
  15. Breanna Well-Known Member

    Well that should be easy too, they could combine it with the bristlebane diety spell that drops the anvils.