Jump to content

Why does this low-rez texture look this way?


You are about to reply to a thread that has been inactive for 959 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I was interested in learning more about how to achieve the results I want with textures while minimizing loads on the system. I made 8 x 8 black and white checkerboard texture. I made two versions, one 1024x1024 and the other 8x8. I uploaded them and applied them to two boxes expecting that the boxes would look the same. They didn't. The checkerboard pattern was sharp and well-defined on the box with the higher-rez texture and was blurry on the box with the low-rez texture.

Why?

Cubes.thumb.png.6dd9730cf94891296f916cd495c941d4.png

Link to comment
Share on other sites

2 hours ago, Fritigern Gothly said:

When uploading the 8x8 texture, it is upscaled to (IIRC) 128x128

That's not quite correct. Any viewer can upload textures with resolution as low as 4x4 and some even 1x1 - depending on which jpeg2000 library the viewer uses. The viewer still blurs them when rendering though so it doesn't help much.

I'm not sure if such micro-optimisation really is a good idea anyway. I use monchrome full transparent and blank 4x4 textures. Those won't blur of course so that's not a problem, but nor have I been able to measure performance improvement compared to the default 32x32 pixel full transparent and blank textures.

Sometimes you can actually take advantage of the blur. Look at this grille:

bilde.png.2c7a7586014de8a5dd7506bca7f00a83.png

It uses a 4x4 checkered texture with four squares, two opaque white and two fully transparent. With alpha masking I can use the blur to add the horizontal connections that tie it all together.

Btw, I don't suppose I have to tell anybody here but just in case. For a two colour checkered pattern like the one in Jennifer's post, you do of course use a four squares texture like this with texture repeats (I've made the white squares yellow to separate them from the web page's background colour):

bilde.png.15c2e06bed5946c2ed0d427bd1efa8ea.png

That way you get the same sharpness with far fewer pixels. Here is a cube textured that way with five different texture resolutions. Top to bottom: 16x16, 32x32, 64x64, 128x128 and 256x256.

 

271323070_Checkeredcube16.thumb.png.d5ddbf318b3db610787cc54bc0ad23d0.png

903760569_Checkeredcube32.thumb.png.edc1dfcdf6cddb9bd3d53357ba194222.png

394873468_Checkeredcube64.thumb.png.1ded1ff5dbca7bb99b1cc34db3f49c5e.png

817950840_Checkeredcube128.thumb.png.c95754791490ae080741db68c695186b.png

370951417_Checkeredcube256.thumb.png.2b72f5f4e7333aba014b582a1a287977.png

Edited by ChinRey
  • Like 1
  • Thanks 2
Link to comment
Share on other sites

I created a bug report / feature request with LL about this specific thing, it got no interest.

https://jira.secondlife.com/browse/BUG-215951

It is possible to create objects that show razor sharp pixels from a very low resolution texture map - HOWEVER .. this is all kinds of ugly hack.

fbBLOPY.png

Every "pixel" must be its own pair of triangles and the UV mapping needs to be ... "special".

Edited to add this image from the BUG report / feature request I created.

Z2wzw3d[1].png

Edited by Coffee Pancake
  • Like 4
  • Thanks 1
Link to comment
Share on other sites

It's because SL displays textures using linear interpolation between the closest pixels.

In general, you want to blend between pixels rather than displaying every point as exactly the pixel it falls within, since the latter makes even full-res textures look slightly more block-dotted. What you're seeing is the drawback of using that method on unusually low-res texture images. Unfortunately, SL doesn't give you the option of setting different interpolation methods for different materials like Blender does.

  • Like 1
  • Thanks 2
Link to comment
Share on other sites

5 hours ago, Quarrel Kukulcan said:

t's because SL displays textures using linear interpolation between the closest pixels.

I have a rough understanding of what Linear Interpolation is and why it is one of the options in Gimp when scaling images up or down but can you try to explain why Interpolation is used when uploading an image to SL. ?

5 hours ago, Quarrel Kukulcan said:

SL doesn't give you the option of setting different interpolation methods for different materials like Blender does.

Reading this gave me a clue to sorting a texture problem I ran into this evening :)

Nearest.gif.89b05df2247cffd093e6415424f346e1.gif

 

  • Thanks 1
Link to comment
Share on other sites

12 minutes ago, Aquila Kytori said:

 

I am not suggesting anyone use this method.  I was just curious how Coffee managed to do it in the first place as an illustration for the jira. and thought others would be to. 🙂

 

That would be why I didn't explain how to do it .. because you just know everyone is going to be doing it now.

32RZEMl.png

Link to comment
Share on other sites

18 hours ago, Aquila Kytori said:

I have a rough understanding of what Linear Interpolation is and why it is one of the options in Gimp when scaling images up or down but can you try to explain why Interpolation is used when uploading an image to SL. ?

It's not used when uploading. (Okay, it is used when uploading if the image has a dimension larger than 1,024 or that isn't a power of 2, but that's a separate issue.)

It's used when displaying in-world. The points that SL renders on your monitor might need to be pulled from anywhere, mathematically, in the face texture. Imagine that your texture pixels are NOT full squares of color, but instead are infinitely small pinpoints that only define a color at their precise locations. For every spot that doesn't line up perfectly with those, your renderer will have to use some method of figuring out what color to use. SL's renderer doesn't have the option of using the closest one like Blender does. It's locked into "average the closest ones based on linear distance".

What color does SL need to render the spot inside the purple circle on this cube face if that face has a 2x2 pixel texture? Well, since SL is gonna linearly interpolate, that won't be white. That circle is about 30% of the way from the top pixel, so it will be about 70% of the top pixel's color + 30% of the bottom pixel's. The side effect of huge pixels is that basically every point on the texture is between pixels of different colors.

lowres.jpg.e0fae664bb017d5572881a2440519ee0.jpg

 

If we use a higher resolution texture, we'll get something like this. Now the exact same spot is halfway between a white pixel and another white pixel. SL will take 50% of white and add it to 50% of white to get white.

highres.jpg.93d86022e1476d4e48e9cac2714c1b43.jpg

  • Like 4
  • Thanks 1
Link to comment
Share on other sites

Interpolation is :

On 9/1/2021 at 8:09 PM, Quarrel Kukulcan said:

It's not used when uploading.

It's used when displaying in-world

 

I noticed that both Gimp and Blender don't have a "Nearest Neighbour" option but instead use Interpolation "None" or "No Interpolation".

Does that mean that to implement Coffee's jira request LL don't even need to write new "Nearest Neighbour" code, only add the option "No Interpolation" under the Select Face in the Texture tab of the  SL build floater?

Interpoalion.thumb.png.58257a32f04ebafe9a3b06011b8a3825.png

 

 

Link to comment
Share on other sites

2 hours ago, Aquila Kytori said:

I noticed that both Gimp and Blender don't have a "Nearest Neighbour" option but instead use Interpolation "None" or "No Interpolation".

Does that mean that to implement Coffee's jira request LL don't even need to write new "Nearest Neighbour" code, only add the option "No Interpolation" under the Select Face in the Texture tab of the  SL build floater?

"Nearest neighbor" and "No interpolation" are the same thing.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 959 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...