Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

3 Dimensional Chat / Trouble baking tiled textures in Blender

Author
Message
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th May 2009 00:39
Hello,

I've been trying to make a baked image out of a tiled texture in Blender.

This is basically what I'm doing:

1. I'm importing a wavefront (.obj) model of an interior into blender.
2. The floor is a tiled texture, and there are a few other items that are tiled as well.
3. As soon as I unwrap the mesh in face mode, the tiling disappears - that's the first problem.
4. If I manage to retile the mesh (I haven't been able to consistantly do it so I'm not sure what works for this or not), after baking the texture, there are huge black rectangles or squares intermittantly.
5. And, what seems to happen often and I don't know how to prevent it, when I create a new image to bake onto, the blank black image I create replaces the texture of my mesh and I get a bad bake! Or one of the original images is replaced with the black bake.

Does anyone have any ideas?

Thank you

Enjoy your day.
Sid Sinister
19
Years of Service
User Offline
Joined: 10th Jul 2005
Location:
Posted: 20th May 2009 01:35
Just read this real quick because I have to get out the door but if your automatically UV mapping this (or packing) you'll lose what your trying to do. You'll need to manually map and position elements on your UV Map. Overlap the portions you want tiled so that it will only take up the same space on the texture sheet. Since they are overlapping, they will all just reference the same part.

Hope that helps, if not, restate what your trying to say because I'm a bit lost.

"If I have seen a little further it is by standing on the shoulders of Giants" - Isaac Newton
Current Project: http://strewnfield.wordpress.com/ (Last updated 05/06/09)
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th May 2009 09:43 Edited at: 20th May 2009 09:54
@Sid Sinister

Thank you, I think I understand what you mean. But so I'm more clear Let me try and make it simpler. For this particular test I;m using Blender 2.45 . The results seem the same for Blender 2.48, but I'd have to switch to linux to test that and at the moment I can't.

Let's say I have a model that just has a floor and a wall. The floor has a tiled texture of a rug or something. Just to be clear as to what I mean by tiled is that the same image repeats over and over across the face(s) of the object. The wall also has a tiled texture, but maybe not the same number of repetitions as the floor and it is a different image than the floor. I import this model into Blender as an OBJ .

Because the tiling was already set before the import, the UV map should already contain the proper scaling for the materials, right? Or is this assumption where I'm going wrong?

Anyway, when I go to face mode, the texture is tiled and the UV coordinates are wider than the image - that seems correct. Do I still need to unwrap the mesh? because when I do, that's when the problems start. Let's say I don't unwrap it and leave the texture coordinates as they seem from the import. I would now add a blank image, and then bake onto it. But if I do, the original image of the material gets baked black and the mesh becomes textured with the black image. Both the new image, and the original texture image are now black.

Let's say I do unwrap it and rescale the UVs. I then add the new image and bake. I get really strange results - usually missing chunks of the original texture. I've attached a screeny of this effect.

Here's a step by step process just starting with a plane and using blender's procedural textures. This seems to do exactly what I expect - I get a baked tiled texture so I'm not sure what the difference is when I start with an already textured model.

1. Start a new project
2. Press X to get rid of the default cube if it is there.
3. Press SPACE and add a Mesh > Plane
4. Press S and scale it to maybe 5 or 6
5. Create a material for it. Press F6 to add a texture and just choose Stucci
6. Press F5 to return to the material panel and choose Map To
7. Make sure Col and Nor are highlighted
8. Drag the Nor slider any where from 15 to 20
9. Under Map Input, choose UV
10. Split the window and open the UV/Editor Screen
10. Press F to go to face mode. Press A to select all the faces
11. Press U to unwrap. Use Reset
12. In the UV/Editor, press S and scale the UV's larger than the grid
13. Press f12 to look at the render
14. Scale the UVs differently and the press f12 to see the difference. When satisfied, in the UV/Editor, choose Image > New
15. Bake the image

If I load an image and try this instead of using the procedural texture, the resulting baked image isn't tiled.

Enjoy your day.

Attachments

Login to view attachments
Sid Sinister
19
Years of Service
User Offline
Joined: 10th Jul 2005
Location:
Posted: 20th May 2009 21:04
Quote: "Because the tiling was already set before the import, the UV map should already contain the proper scaling for the materials, right? Or is this assumption where I'm going wrong?"


I think this is where you are going wrong.

I just asked this on the polycount IRC:

"Quick question, if you tile something in Max using the UV sliders in the material window, does that tiling get saved into the UV data for the model once it's applied? I'm thinking no, and I should know this , but just double checking."
"No, you cant ile or not tile a shader. It has no effect on the mesh it's applied to. At least in regards to changing the UV's"

I'm not really sure if that helps what I said above or not. Don't really get it.

I do know the way I would do it though.

I made a video for you: http://screencast.com/t/BLLpUJnrQ

"If I have seen a little further it is by standing on the shoulders of Giants" - Isaac Newton
Current Project: http://strewnfield.wordpress.com/ (Last updated 05/06/09)
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th May 2009 22:02
Thank you. I'll check that video out.

Since the last post, and what you wrote before, I've discovered something. If I want to export a model with a tiled image in whatever 3d format, Scaling the UVs will tile the image appropriately.

It seems that if I want to bake an image that is tiled, I have to set the Repeat button in the material/texture panel (F6) and adjust X and Y to whatever the tiling should be. The resulting baked texture will then be tiled. The internal rendering (baking) does not yield/influence the same visual results as modifying the UV map. It seems there has to be a balance struck between the two (rendering settings and mesh/scene design) to get what one expects.

The flip is, if I just use the internal Repeat option without adjusting the UV map, an expected tiled mesh will not be exported with a tiled UV map - though in rendering, it will be tiled.

Now I'll see if I can apply this to my imported mesh. I still don't get the big black missing areas of the tiled texture, but maybe this all relates. Thanks for your help.

Enjoy your day.
RUCCUS
20
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 21st May 2009 07:16
Im not too sure what you're trying to do, I can't really get a grasp of your exact goal. But just pointing out that if you're overlapping UV's in order to tile a texture or re-use texture space, then if you're baking a lightmap onto that texture, the overlapping UV's will appear darkened or in some cases black as the rendering is essentially combining all of the lighting information for all of the overlapping UV's onto one UV coordinate.

Again I dont know if this helps in your situation but keep it in mind.
Sid Sinister
19
Years of Service
User Offline
Joined: 10th Jul 2005
Location:
Posted: 21st May 2009 21:10
Good point, made the mistake a few weeks ago. I just took out the shells that needed to have separate back data out of the overlapping stacks and made it it's own.

"If I have seen a little further it is by standing on the shoulders of Giants" - Isaac Newton
Current Project: http://strewnfield.wordpress.com/ (Last updated 05/06/09)
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 22nd May 2009 00:39
Quote: "the overlapping UV's will appear darkened or in some cases black as the rendering is essentially combining all of the lighting information for all of the overlapping UV's onto one UV coordinate"


Ah, that makes sense.

The original goal was light mapping and imported model, then I noticed imported models' UVs didn't bake tiled. Then the goal became how to bake tiled imported model textures and bake them. With an inkling of understanding what's happening, now the goal is light mapping an imported model such that the textures remain tiled as they were on import - without having blank spaces in the baked output.

I still am not quite sure how to get this working without retooling the whole model in Blender. It doesn't seem to work to just import the model, place some key lights, and bake. I can't leave the UVs as is because I think they are overlapping and causing the black spots. Doing a face by face texturing/creating seams unwrapping scenario defeats the purpose of already having a textured model.

Enjoy your day.
RUCCUS
20
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 23rd May 2009 13:49
I think your best bet then is to make a copy of the model, open up the UV's in whatever UV editor you're comfortable with, take any of the UV's that are rendering properly and move them out of the UV space, and then take any overlapping UV's and spread them out. Render the lightmap, then open it up in photoshop. Then just cut and paste / resize the lightmap sections from the more recent version to the original. I cant see any other way if you're not willing to re-UVmap it.
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 23rd May 2009 18:23
Thank you.

Yeah, I'll probably just have to break down and "embrace" the texturing/UV methods in Blender which I find to be a nightmare in general. I think Blender is fantastic all around and has some amazing results, but It's very hard to find out how to do something you specifically want to do or even voice the question when the method is hidden throughout multiple selections, menus, screens, and panels. The thing that really messes me up is, the render can look different (the texture layout) than the model in texture view - and the render influences the bake.

I'll prod along and see what I can come up.

Thanks, everyone, for your suggestions.

Enjoy your day.
Kravenwolf
16
Years of Service
User Offline
Joined: 14th Apr 2009
Location: Silent Hill
Posted: 23rd May 2009 19:52
Don't know if this has already been solved, but if you UV Map is bigger than the texture size you have applied to it, you cannot render baked lighting. Baked lighting only applies to the texture. Since the texture is seamless, any shadows/lights from baking will only repeat across the floor if your floor's UV layout is larger than the texture (i.e. the black squares).

If you need your texture to be smaller so it doesn't become pixelated on the floor, you can small tile the texture in a paint program.


-Kravenwolf

Success is not final--failure is not eternal.
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 23rd May 2009 21:35
Ok, I see... That explains a lot. I was thinking that a new texture would be generated from the render based on the UV settings (scaling in particular) . So if the UVs were beyond 0 to 1 they would start creating a tiled texture. But apparently that's not so when it comes to baking. I'm starting to see the light! So the black squares in the baked textures, are the areas where the UVs are "out of bounds" so to speak, being larger than the texture.

I think I understand what is happening, but I would think that Blender should take this into account. The easiest way to tile a texture is to scale it's UVs up. Isn't that standard? If I want a texture to repeat across a quad face 2 times, wouldn't the coordinates be something like 0,0 0,2 2,0 2,2 ?

So In order to create a baked light mapped tiled texture for an imported model I either have to remap the UV's for an already UV mapped model that I'm importing into Blender, making sure the UV's don't overlap and stay within the bounds of the texure - and for any tiling for the bake, I'll have to use the internal material controls (which don't affect the UVs)

or

Create pre-tiled textures that map neatly - without over scaling or overlapping - to the original model.

or

Don't import any models I want light mapped and create everything from the get-go in Blender.

Is that about right?

Texturing in Blender is not my thing so the answer to this next question might seem obvious: Is there and what is the way to capture all of the materials and textures of a mesh and have them combined into 1 image so that the UVs of the model can use this single image to texture the whole thing instead of multiple materials/texture images? If the UVs of the whole mesh could use this 1 texture, then light mapping/baking should follow quite easily.

Thanks.

Enjoy your day.
Sid Sinister
19
Years of Service
User Offline
Joined: 10th Jul 2005
Location:
Posted: 24th May 2009 07:26
Hey Latch, I see you still haven't figured this out buddy

Why bother texturing it like you are? Listen, here's what I would do.

1. For all the separate parts of your model I would apply a solid base color to each of them that would match the main color of that particular objects final texture. So if the carpet is mainly red, pick a red for the carpet object. If your confused, or it's all one object, just apply an off-white (not exactly white), to the whole thing.

2. UV Map your objects. Overlap UV shells that are exactly identical and that will have the same texture. KEEP IN MIND, that if you are baking the lighting in (which you are) to only overlap shells that will have the exactly same baked look to them. So, if your scene doesn't allow for this, just skip that part. You may not be able to overlap anything, that's fine.

This is what you don't want to happen:


There I overlapped UV shells that were the same, without keeping in mind that it would tile not only the texture but the light bake as well... You can see it on the panels as well as a few errors in floor.

3. Render to Texture or whatever blender calls it when you render the baked lighting across your UV template. Here is an example of a chair render to texture I did:



4. Bring it into photoshop or gimp and texture it. TILE IT THERE. Screw trying to figure all this out in Blender, that's why this workflow was invented and used over and over again. Tile it in Photoshop! Simply load up an image, set it to multiply and put it over your bake image. Save, import into Blender, wallah.



Final diffuse texture after baking lighting data, texturing in photoshop, and reloading back into Max.



"If I have seen a little further it is by standing on the shoulders of Giants" - Isaac Newton
Current Project: http://strewnfield.wordpress.com/ (Last updated 05/06/09)
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 24th May 2009 19:40
Wow, thanks for the detail and all your help! I'll give it a go!

Enjoy your day.

Login to post a reply

Server time is: 2025-05-31 01:38:07
Your offset time is: 2025-05-31 01:38:07