Jump to content

Editing AO maps with ready textures without pixelation side effect


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

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

Recommended Posts

Hello all,

 

I'm not sure if there had been such thread before, but I haven't found any so I'm writing this...

I am a very beginner when it comes to texturing. Some time ago I had purchased pull perm building with AO maps so I can practise editing textures. The problem I’ve been struggling with is that I cannot edit ready texture (originally 2048x2048, later scaled to 1024x1024) with AO map (originally originally1024x1024) I have. I have wood floor panel texture, however, all textures I have are too big (not too high resolution) for my AO map. I tried to make small tiles in gimp and this effect works very good, but it affects the quality of the wood texture so it’s useless.  It’s very pixelated and of poor quality. I also tried to increase the resolution of the AO map and paste a few smaller copies of the floor texture so consequentially it will remain unaffected but it’s still not good enough. There is an easy way to stretch textures in SL without affecting the quality. Can regular floor textures which can be bought on marketplace be used with such AO map without being pixelated as well?

 

I’m attaching sample of textures I’m trying to work with.

 

2nd_floor.png

Wood-texture 1024x1024 cropped.jpg

 

Link to comment
Share on other sites

If you are dealing with tileable textures you are running into problems with AO maps. The AO map would have to be baked in a way that it would work with seamless tiling as well. Can be difficult to achieve

Usually the AO would be applied to a secondary UV channel of the mesh, overlayed and blended with a shader in the target engine. That's not possible in SL though. What can be done is laying a second mesh plane on the wood floor with an alpha masked AO map without any tiling. But you may have to deal with Z-Fighting issues then.

 

Link to comment
Share on other sites

I'm not sure if I understood you, but my problem is not AO map as it is to remain untouched, only overlaid in the end. What I want to do is to tile wood floor texture so it fits AO map ideally. I think the problem is that the floor area on this particular AO is far too small and therefore if one wants ideal match  one have to tile material texture numerous times.

My goal is to tile/stretch (or whatever) the wood floor texture in a way that the width of five floor panels will be equal to the width of this one particular light dropped shadow. I'm seeking an answer to the question if there is a way to tile a texture without actually affecting its quality in bigger resolution - I need 1024 x 1024. The original size of that wood texture is 2048 x 2048 so it's not small. 

Link to comment
Share on other sites

Yeah, that's what I was actually talking about. Tiling the wood floor without tiling the AO map. To keep the quality up, you would have to tile the wood in-world (texture repeats). But then the AO would tile as well. Hence the overlayed mesh plane, which leaves the AO at it's original scale, but the floor underneath will be tiled multiple times untill the scale of the planks match real world scale.

The other option is to downsample the wood floor in photoshop, until the scale matches. This way you will loose texture quality indeed, because there are less pixels left in the image to show the wood.

You could split the floor into multiple materials as well, and appling a 1024 wood multiple times and cut the AO in pieces. But that would require to have access to the mesh file outside of SL, to edit the mesh and reupload it.

 

Link to comment
Share on other sites

I'll give your suggestion a try. Although it's quite tricky and tortuous and I would prefer to have one nicely done texture with baked shadows it seems to be the only solution at the moment. Z-buffering may be overcome if two planes are kept separately enough so I wouldn't worry about it. 

I just wonder. If a texture can be stretched without losing its quality in SL there must be a way to do so in some graphic programme. Isn't it true?

Link to comment
Share on other sites


RayneBurnwood wrote:

I just wonder. If a texture can be stretched without losing its quality in SL there must be a way to do so in some graphic programme. Isn't it true?

Let's say that you have a 512x512 pixels size image in SL, you put it on a prim box face. When you stretch the prim - make bigger or make smaller - the texture size does not change, it will remain 512x512 pixels in size.

When you look at the prim face inworld, it might be that the pixel size of the texture on your screen is way smaller than 512 x 512 pixels. When you make the prim very large, lets say so that it covers 1024x1024 pixels on your screen then the 512 x 512 pixels texture will surely look blurry. But the texture itself has lost no quality at all, it's only that it is now displayed on your screen bigger than the resolution of the texture is.

Same thing in graphics program, you can view (zoom out) the 512x512 pixels texture in smaller sizes than the texture resolution is, and you can zoom back up to 512x512 pixels - you will see change in the quality. But if you zoom in to any larger than 512x512 pixel then you will begin to see blurrines in the image. The zooming in or out naturally does not change the texture resolution anywhere.

It is not possible to enlarge (stretch) a small image into a bigger one in graphics program, like for example 512x512 pixel texture into a 1024x1024 pixels without loosing quality.

 

You can think of it this way:

 

The stretching of the texture in SL is a similar corresponding action as zooming in the texture, or zooming out the texture, is in a graphics program. In both cases the texture's pixel size will not change. The blurrines will appear in both when the texture is displayed on your screen bigger than the texture's resolution is.

Link to comment
Share on other sites

Here's another attemp to explain, as this question does come up quite often...

On the top left here is a small (256x256) piece of a 1024x1024 floor texture. Let's suppose the floor is using a 4x4 tiling of this texture, and looking at it from a certain place in SL I see one pixel of the texture per pixel of the screen. Then it looks exactly as it does at the top left.

planxao.jpg

Now I want to combine this floor texturing with an AO/lighting map. So I make a texture 4096x4096 by tiling it 4x4. I combine that with the AO map expanded to 4096x4096 with appropriate smoothing. Now my texture has the same number of pixels per plank as before. However, I have to shrink it to 1024x1024 to upload it to SL. (If I don't, the uploader will shrink it for me.) So I do that in my image editor. Now the same number of pixels looks like the top right image. If I zoom in 4x, so that I am looking at the same area of floor as before, I see the image at the lower left. Each of the pixels in the data is now 4x4 pixels on screen, and I can see their sharp edges. In SL, I now see 4x4 times fewer pixels of the texture when I look at the floor from the same place as before. I don't see the sharp edges because the rendering tries to smooth out the sharp edges. This gives something like the image at the bottom right. It looks blurry because it is based on too little texture data.

In fact, it is more complicated than this because the UV mapping means that the floor actually has less than the whole texture on it, and that contributes to the lower pixel density as well, making the situation even worse, but the principle is similar.

There is (presently) no way around this in SL as long as externally combined textures are used. That is frustrating because we would like to use a small tiled texture with a small untiled AO map superimposed. The AO map can be small because blurring it (a bit) doesn't matter. Thw two small textures would be much more efficient than one large combined one, as well as overcoming this resolution limitation. The only solutio, as Arton pointed out, is to overlay the AO on an extra surface with different tiling. However, that means you have to use alpha blending, which is very gpu resource hungry, as well as extra geometry. It's not really very satisfactory.

Link to comment
Share on other sites

Thank you all for explaining the subject so clearly. I have another question though. I'm trying to work out overlaying two mesh planes but I've got myself confused with alpha blending. I uploaded AO maps with alpha channel which I edited in gimp, however, while I'm changing alpha mode nothing happens. Then I realised that only alpha channel existing is not enough so I changed opacity in gimp, but again failure. I've no idea how to deal with alpha to get an effect described by arton Rotaru. I am a noob in that respect. I've tried to tweak all alpha mode settings but no success. Can someone please explain me how to do it? How should I prepare a texture in order to get a desired effect?

Link to comment
Share on other sites

Hi :)

One way to change your Ambient Occlusion texture to one with an Alpha gradient texture is the following

1: There is some colour in your AO textue so first make it a true greyscale image by using the Desaturate filter:

           Colors > Desaturate > OK

2: Increase the Contrast and Brightness , the lighter the grey the more transparent it will be in the finished texture.

          Colors > Brightness-Contrast > and adjust the sliders > OK

3: Convert greyscale image to Alpha gradient.

          Colors > Color to Alpha > OK

Color to Alpha.gif

 

  • Like 1
Link to comment
Share on other sites

Aquila's method is more direct, but here's another example.

aotest_gimp.jpg

A few notes - at 1, actually it seems not to matter whether the underneath layer has an alpha channel or not. I didn't see any alpha glitch with the test example either way, maybe because the layers are so close. - At 7, this caught me out! If you have the masked layer in multiply mode, the AO shows up in Gimp, but not in the exported file (a bug?). You have to put the mode of the layer to Normal to export it!

Here are these being used inworld. Top layer is a flat box prim, all set to default transparent texture, except for the ao layer on the top. Anothe box as close as possible underneath has the plank texture. On the right, the latter is tiled 4x4. At the bottom is a closeup of that. (I know it isn't tiled seamlessly - that's because I only used a part of the plank texture!).

aotest_sl.jpg

Of course, with mesh the layers would most likely be two materials on the same mesh. but th principle is the same. There can be a problem accessing the underneath layer to put the right texture on it. Some thought in designing the mesh might be required (eg make it accessible at lowest LOD and use RenderVolumeLODFactor to see it), or you can always access the materials by face number in a script.

ETA - you can weaken the strength of the shadowing by dialing up the transparency of the AO layer.

  • Like 1
Link to comment
Share on other sites

1) Make the floor with 4 different linked meshes (or 9, etc).

2) Divide your AO into segments to fit the floor meshes.

3 Overlay your seamless floor texture over your AO in photoshop.

4 Apply textures to each of the segments in turn. 

And yes, you can get some seamless wood floor textures on the SL marketplace that will tile very well indeed.

 

  • Like 1
Link to comment
Share on other sites

Although what you suggest will work just fine, I'd suggest strongly NOT to do that for performance sake. Four unique 1024x1024 textures just for some AO effect will take up an unreasonable amount of memory, let alone nine tiles or more.

Making an overlay with a single plane a fraction above the floor for the AO sounds like a better plan, that way you can tile the wooden floor in SL.

In photoshop you can invert the AO map (so black and white are flipped),  then copy it onto the alpha channel. I'd use a white texture, so you can change the colour in SL after uploading.

Link to comment
Share on other sites

Thanks for such a clear tutorial,  Aquila.

I’ve just finished my work using overlay mesh plane solution. Dividing one surface into four (or more) wouldn’t work in case or irregularly shaped meshes and it would also have too high land impact. The other problem I had with other piece was that the wall had only one face while AO map consisted of both interior and exterior so I had to use additional copy of that plane not to affect interior wall and that was not satisfying as the wall has 8 LI. Anyway, thank you all for support, I’m attaching final effect of my work which wouldn't have succeded without your help :)

 

 

Snapshot_406.jpg

Snapshot_083.jpg

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3336 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...