Texturing a cube in Blender, and going to pull my hair out - SLUniverse Forums
Navigation » SLUniverse Forums > Development Discussion and Support > Content Creation » Texturing a cube in Blender, and going to pull my hair out


Content Creation Discuss building, scripting, and other forms of content creation for SL.

 
Reply
 
LinkBack Thread Tools Display Modes
Old 10-07-2011, 06:52 AM   #1 (permalink)
Lustful Cockmonster

*SLU Supporter*
 
Joshua Nightshade's Avatar
Unedited
 
Join Date: Jun 2007
Location: Sydney, Australia
Posts: 51,807
My Mood:
SL Join Date: October 2004
Blog Entries: 1
Texturing a cube in Blender, and going to pull my hair out

This has been driving me completely crazy and no one I know has any idea of what to do to get it to work so I'm coming to you, internet, and begging for your help.

I am trying to understand texture baking in Blender. I figure if I can do something simple like apply a texture to a cube in Blender and bake it to an image I can then upload in-world, I can use those fundamentals to texture and bake more complex geometry down the line.

I understand the modelling and I've got my head more or less around unwrapping, but something wrong is happening with the texturing and texture baking itself and I don't know what to do.

My objective is to end up with this:



Nice cube, nicely textured on all sides, looking good.

I have figured out how to get that result but I can't do it in Blender alone; I can use Blender for the modelling, but I have to use another program for the texturing. I would much prefer to do it all in Blender itself if I can.

However, what happens in Blender when I unwrap the UVs and apply the texture is:



Totally broken. It just seems to apply the texture to the model as a whole and then stretches it out across all faces instead of duplicating it properly on each one.

My way to fix this has been to export the geometry to Cheetah3D and texture there, which works seemingly because it allows me to utilise two different UV layers. I can use one for the cubic projection and another for replicating the faces across all sides, so I get this:



Baking that gives me a nice texture that I just upload to SL and drag onto the mesh and everything appears as intended with the texture and shadowing baked nice and purty-like.



That is what I want, but I don't know what I'm doing wrong. I have played with all the image mapping options under the texture panel and nothing makes a difference. Switching the coordinates from UV to Generated gets something a little closer, a la



but that's only on the top face (I rotate the cube to demonstrate) and the sides of the cube look like the image was just stretched down. Playing around with the Projection makes no difference.

Now I don't know how much of my problem is because it's a cube or what, but I would think that would be the simplest thing to texture. I'm really out of my depth on this and I have been hitting a brick wall for weeks and not understanding what I can do.

This isn't a product or anything, but it was a tutorial to myself because I figured if I understood what I was doing on this I would be able to extrapolate it to properly texturing boots and body parts and avatars as a whole, etc. However, I have no idea what I'm doing and it's all broken and it's making me want to cry.

Please somebody help me, the computer's physical safety is in jeopardy otherwise.
__________________
Quote:
Originally Posted by Teeny Leviathan View Post
Those Super Gays are as tough as a T-800 terminator and they are gay.
Joshua Nightshade is offline   Reply With Quote
Old 10-07-2011, 07:05 AM   #2 (permalink)
Tya
Gone

*SLU Supporter*
 
Join Date: Aug 2007
Posts: 5,080
SL Join Date: August 28 2003
Business: [PM] Pixel Mode
Client: 2.0
Blog Entries: 16
in your uv map, where it looks like a T, this is what you texture everything outside the T isnt part of your cube.


remember once you change your uv map your model changes also so you would have to upload a new model

Tya is offline   Reply With Quote
Old 10-07-2011, 07:07 AM   #3 (permalink)
Lustful Cockmonster

*SLU Supporter*
 
Joshua Nightshade's Avatar
Unedited
 
Join Date: Jun 2007
Location: Sydney, Australia
Posts: 51,807
My Mood:
SL Join Date: October 2004
Blog Entries: 1
What's behind the T is just the reference image I loaded behind the UV map. It's not applying the image to the UV itself.
Joshua Nightshade is offline   Reply With Quote
Old 10-07-2011, 07:11 AM   #4 (permalink)
Tya
Gone

*SLU Supporter*
 
Join Date: Aug 2007
Posts: 5,080
SL Join Date: August 28 2003
Business: [PM] Pixel Mode
Client: 2.0
Blog Entries: 16
Quote:
Originally Posted by Joshua Nightshade View Post
What's behind the T is just the reference image I loaded behind the UV map. It's not applying the image to the UV itself.

did you create UVs in blender? or just leave it as the default? most programs you have options of what type of mapping you want, it appears you did a planer mapping in your other program and left the default in blender



dont be afraid to touch your UVs, you can lay them out any way you want just be-careful of overlap
Tya is offline   Reply With Quote
1 User Agreed:
Old 10-07-2011, 07:14 AM   #5 (permalink)
Old Cynic

*SLU Supporter*
 
Erich Templar's Avatar
 
Join Date: Sep 2007
Posts: 1,029
Export the UV map as an image. Paint your texture inside the lines.

I don't think uv-mapping in Blender works the way you think it works. I've been trying to get to grips with it myself over the past few weeks, and it's a real struggle:

This might help :Learning Blender 2.5 UVW maps and unwrapping a mesh : KatsBits TUTORIALS

Even better: http://cgcookie.com/blender/2011/01/21/intro_uvmapping/

If doing the texturing in Cheetah works, why don't you keep doing it that way?
__________________
Beware of geeks bearing GIFs.

Erich Templar
Textures, prefabs, more textures....
http://www.templarcreations.com
Templar Creations Main Store (SLURL)
SL Marketplace Merchant Page

Last edited by Erich Templar; 10-07-2011 at 07:18 AM. Reason: Added a link to a better tutorial
Erich Templar is online now   Reply With Quote
1 User Agreed:
Old 10-07-2011, 07:20 AM   #6 (permalink)
Senior Member
 
Laverne Unit's Avatar
Artificial Person
 
Join Date: Jun 2011
Location: UK
Posts: 376
My Mood:
SL Join Date: Dec 2006
Business: Hello Spacegirl
Client: V3/Exodus
This is only useful for rendering purposes as far as I can see, but...

Have a UV/Image editor pane open beside your 3D view. Go into edit mode, select all faces by hitting a, and press u>unwrap. That should unwrap to a single face, taking up the whole of the UV space. If it doesn't, try u>reset. In the UV pane, go to Image>open. Choose the image, hit OK. To make it show up in the 3D view, make sure your Viewport shading is set to Textured rather than Solid. The texture should now repeat over all faces.

If you actually want it to show up in a render, you also need to add a new material and in the resulting material's settings pane, go to options and make sure Face Textures is checked.
__________________
Hello Spacegirl | Blog | Flickr
Laverne Unit is offline   Reply With Quote
Old 10-07-2011, 07:29 AM   #7 (permalink)
♂♂
 
OrinB's Avatar
*Poof!*
 
Join Date: Sep 2009
Location: London, UK
Posts: 3,531
My Mood:
SL Join Date: 25th May 2007
Blog Entries: 1

Awards: 1
SLU Creepy Avatar Competition 2014 Participant 
If you want the same texture for each face, then overlaying or stacking all the UV map faces of the cube to match your texture will make the model use the same texture for each face. Wouldn't you then need to make seams for each face and re-unwrap so you have 6 faces stacked to fill the texture space?

Or you can keep your unique UV and move the UV maps around to fill the space that your texture takes up.

I really think all the info you need is in this tutorial somewhere...
cannedmushrooms's Channel - YouTube

ETA: took me so long to reply, all of the above is more relevant!
__________________
"If you were a horse... you'd be a burger by now!" - the lovely Couldbe Yue!
(And I bet she's glad she isn't me if she thinks I would be a burger! )

Last edited by OrinB; 10-07-2011 at 07:34 AM. Reason: slow!
OrinB is offline   Reply With Quote
Old 10-07-2011, 07:32 AM   #8 (permalink)
Senior Member
 
Laverne Unit's Avatar
Artificial Person
 
Join Date: Jun 2011
Location: UK
Posts: 376
My Mood:
SL Join Date: Dec 2006
Business: Hello Spacegirl
Client: V3/Exodus
Oh wait! Yes, I think I know how to do it.

Ignore everything I said above. Get your cube, and unwrap it however you like (Either with seams and u>unwrap, or just go for Smart UV Project. It's not important at this stage.)

Add a new material. Leave the settings as they are for now, and go to the Textures tab. Press New, and under Type, select Image or Movie. Then go to Image>Open and find your texture. Go down to Mapping, and under Projection, choose Cube. Bake the image, and the texture will be on every face. You may note that the orientation of some faces is around the wrong way; that's to do with how you unwrap it and can be fixed in the UV editor by selecting the offending face and rotating it.
Laverne Unit is offline   Reply With Quote
Old 10-07-2011, 07:42 AM   #9 (permalink)
Senior Member
 
Laverne Unit's Avatar
Artificial Person
 
Join Date: Jun 2011
Location: UK
Posts: 376
My Mood:
SL Join Date: Dec 2006
Business: Hello Spacegirl
Client: V3/Exodus
I promise I will stop flooding the thread after this, but here's the result. It means you don't have to fiddle around with an external image editor to place the texture on each face of your UV map (which is an option, but in this case a tedious one); it does it for you.

Attached Thumbnails
Texturing a cube in Blender, and going to pull my hair out-cube-bake.jpg  
Laverne Unit is offline   Reply With Quote
1 User Said Yay!:
Old 10-07-2011, 07:43 AM   #10 (permalink)
Lustful Cockmonster

*SLU Supporter*
 
Joshua Nightshade's Avatar
Unedited
 
Join Date: Jun 2007
Location: Sydney, Australia
Posts: 51,807
My Mood:
SL Join Date: October 2004
Blog Entries: 1
Ahhhh yes! That's what I want to do.

Now how did you do it?
Joshua Nightshade is offline   Reply With Quote
Old 10-07-2011, 07:48 AM   #11 (permalink)
Lustful Cockmonster

*SLU Supporter*
 
Joshua Nightshade's Avatar
Unedited
 
Join Date: Jun 2007
Location: Sydney, Australia
Posts: 51,807
My Mood:
SL Join Date: October 2004
Blog Entries: 1
Quote:
Originally Posted by Laverne Unit View Post
Add a new material. Leave the settings as they are for now, and go to the Textures tab. Press New, and under Type, select Image or Movie. Then go to Image>Open and find your texture. Go down to Mapping, and under Projection, choose Cube. Bake the image, and the texture will be on every face. You may note that the orientation of some faces is around the wrong way; that's to do with how you unwrap it and can be fixed in the UV editor by selecting the offending face and rotating it.
Okay I'm trying to do this, but it's not working. Can you go through it step by step?
Joshua Nightshade is offline   Reply With Quote
Old 10-07-2011, 08:02 AM   #12 (permalink)
Senior Member
 
Laverne Unit's Avatar
Artificial Person
 
Join Date: Jun 2011
Location: UK
Posts: 376
My Mood:
SL Join Date: Dec 2006
Business: Hello Spacegirl
Client: V3/Exodus
Sure thing.

I'm starting off with the default cube selected and in object mode.

In the Material tab, just press New, and nothing else.

Moving one tab along, the Textures tab, press new again. It'll generate an automatic texture of clouds, which you can see in the Preview, also in this tab. Where it says Type: Clouds, change Clouds to "Image or Movie". (At this point, the preview should change to black.)

Go to the section of the tab called Image, which should have two options: New and Open. Open your texture. It should now appear in the preview, and it should be repeating itself. (If it isn't repeating, go to Image Mapping and make sure that Extension is set to Repeat. Also make sure that Repeat is set to x:1 and y:1.) In the next section, Mapping, leave Coordinates as generated and change projection to Cube.

At this point, if you render the scene by hitting f12, you should see the cube with the texture on every face.

Now for baking: in the 3d pane, change to edit mode by hitting Tab, or select it from the 3d pane's toolbar. Make sure everything is selected by hitting a. Press U, then choose Smart UV Project, then press OK to the resulting settings. Your UV pane should show a wireframe of your unwrapped cube.

In the UV pane, press New, and make sure the UV texture is the size you want, then hit OK. The UV pane should now show the wireframe unwrap over a black background.

Go to the Render tab (the first one, with the camera). Right at the end should be the "bake" option. Press Bake, and the UV should change to have the texture on every face of the cube.

N.B. if the render or the baked image are all black, you have no lights active. Go to the world pane and check Environment Lighting, then try again.

Let me know if you need screenshots of anything.
Laverne Unit is offline   Reply With Quote
1 User Hugged You:
1 User Said Thanks:
Old 10-07-2011, 08:19 AM   #13 (permalink)
Lustful Cockmonster

*SLU Supporter*
 
Joshua Nightshade's Avatar
Unedited
 
Join Date: Jun 2007
Location: Sydney, Australia
Posts: 51,807
My Mood:
SL Join Date: October 2004
Blog Entries: 1
Quote:
Originally Posted by Laverne Unit View Post
In the next section, Mapping, leave Coordinates as generated and change projection to Cube.
Okay I started fresh with an unwrapped cube just to be safe and followed along to this point, but I don't have those options. Do they only appear once there's a UV unwrap present?

I'll try that and then continue along.
Joshua Nightshade is offline   Reply With Quote
Old 10-07-2011, 08:26 AM   #14 (permalink)
Senior Member
 
Laverne Unit's Avatar
Artificial Person
 
Join Date: Jun 2011
Location: UK
Posts: 376
My Mood:
SL Join Date: Dec 2006
Business: Hello Spacegirl
Client: V3/Exodus
Quote:
Originally Posted by Joshua Nightshade View Post
Okay I started fresh with an unwrapped cube just to be safe and followed along to this point, but I don't have those options. Do they only appear once there's a UV unwrap present?

I'll try that and then continue along.
Hmm. I can see them before and after I unwrap the cube. I can see them in this screenshot you posted up-thread, too, just under "Mapping" in the right sidebar.

edit: here's a screenshot to illustrate exactly where it is (or should be):

Attached Thumbnails
Texturing a cube in Blender, and going to pull my hair out-cube-mapping.jpg  

Last edited by Laverne Unit; 10-07-2011 at 08:30 AM. Reason: adding screenshot
Laverne Unit is offline   Reply With Quote
Old 10-07-2011, 08:38 AM   #15 (permalink)
Lustful Cockmonster

*SLU Supporter*
 
Joshua Nightshade's Avatar
Unedited
 
Join Date: Jun 2007
Location: Sydney, Australia
Posts: 51,807
My Mood:
SL Join Date: October 2004
Blog Entries: 1
Ahhhhhhh!!!



Thank you so much! You have no idea how despondent I have been over not understanding this.

Okay so how much of my problem has been because I used a cube, and I was replicating the same texture across all the faces? Would it be easier to texture/bake more complex geometry where presumably I will be using different textures that aren't repeating in the same way?

Like I said my objective was to start with something "simple" so I understood what I was doing, and go from there.
Joshua Nightshade is offline   Reply With Quote
2 Users Said Yay!:
Old 10-07-2011, 08:41 AM   #16 (permalink)
Lustful Cockmonster

*SLU Supporter*
 
Joshua Nightshade's Avatar
Unedited
 
Join Date: Jun 2007
Location: Sydney, Australia
Posts: 51,807
My Mood:
SL Join Date: October 2004
Blog Entries: 1
Quote:
Originally Posted by Laverne Unit View Post
and make sure Face Textures is checked.
And what is this/where do I check it/what does it do?
Joshua Nightshade is offline   Reply With Quote
Old 10-07-2011, 09:01 AM   #17 (permalink)
Senior Member
 
Laverne Unit's Avatar
Artificial Person
 
Join Date: Jun 2011
Location: UK
Posts: 376
My Mood:
SL Join Date: Dec 2006
Business: Hello Spacegirl
Client: V3/Exodus
Quote:
Originally Posted by Joshua Nightshade View Post
And what is this/where do I check it/what does it do?
It tells the material to use the assigned texture instead of the material colour settings, which is needed if you haven't assigned the texture to the material as we have. But ignore that post - it's not useful in this case.

This trick with the Projection being set to Cube will only really work for, well, cubes. I find it more intuitive to UV map and texture a more complex object - getting something to repeat like this is a different process, and not the most obvious one. It depends on what you're making, but usually I unwrap the model and bake an Ambient Occlusion map, and then take that out into a picture editor to actually texture it.

I should probably have pointed this out earlier, but since the texture is tied to the material you created, it inherits the colour tint of the material and any other settings (e.g. Specularity, hardness, transparency, etc) unless you tell it not to. And to do that...

Underneath Mapping there's a section called Influence, where Color should already be checked, indicating that the texture is influencing the colour of the material. If you also check Intensity just above it (Intensity is the amount of diffuse reflection) the texture will appear just as it does outside of Blender. The other checkboxes you can leave for now.
Laverne Unit is offline   Reply With Quote
Old 10-07-2011, 11:45 AM   #18 (permalink)
Senior Member
Daintastics Meshes
 
Join Date: Aug 2009
Posts: 400
My Mood:
And, if you use a texture in the Material, please set the coordinates under mapping to "UV"



That means it will not generate a "square" map but add the texture accordingly to the UV coordinates.

So the texture gets spread out evenly over all the unwrapped polygons

Dain Shan is offline   Reply With Quote
Old 10-07-2011, 12:59 PM   #19 (permalink)
Senior Member
 
Johnnie Carling's Avatar
DEUS EST HOMO
 
Join Date: Nov 2007
Posts: 3,858
My Mood:
SL Join Date: 2007-08-17
Client: Viewer Development
Quote:
Originally Posted by Joshua Nightshade View Post
Okay so how much of my problem has been because I used a cube, and I was replicating the same texture across all the faces? Would it be easier to texture/bake more complex geometry where presumably I will be using different textures that aren't repeating in the same way?
The problem is you were telling Blender that the texture will look like A then giving it a texture that looks like B.

The way you unwrapped the cube, what you needed to do was save the UV layout and open it in photoshop or whatever then scale your texture down and copy it so each box of the "T" had a copy of the box texture in it. then bring it back into Blender.


Now if you wanted to do it all in Blender..

Make a new cube
Mark every edge as a seam
Unwrap it
Now you should have six non-connected boxes in the UV image editor
Load your texture
Take one of the squares and scale and move it (right click s, right click g) until it's the size of the texture
Now do that for the 5 other squares.. stacking them on top of each other.

Now every square box/crate texture will work.
Johnnie Carling is online now   Reply With Quote
Old 10-07-2011, 07:13 PM   #20 (permalink)
Senior Member
 
Drongle's Avatar
 
Join Date: Mar 2010
Posts: 251
My Mood:
If it's just seeing the right thing in the Blender 3D view that you want, you can simply scale your UV map 4x and center any of the squares so it exactly fits the whole image. The texture will be implicitly tiled. Set to textured display and all the faces will have the texture.

If you then do the texture-> material thing as Laverne described, it will texture all the faces the rendered cube too. To my surprise, this implicit tiling also happens when you upload this extended UV map. So applying the texture gives the desired effect without adjustment (I expected the UV coordinates would be normalised and I would have to set the repeats to 4x4).

This will not work if you want to bake a texture for the whole box. In that case you have to keep the whole UV map within the boundary of the image you are baking to (I think)....unless the faces are all lit the same, in which case you only need one baked face and the implicit tiling will do the rest.

Doing it by making more seams is not so good because that will increase the download weight because the internal format means a vertex position has to be duplicated to appear with the different UV coordinates. (ok, doesn't matter for a simple cube, but....). So will doing it by unlinking the squares in the UV editor and superimposing them (stacking).
Drongle is offline   Reply With Quote
Old 10-07-2011, 07:42 PM   #21 (permalink)
Lustful Cockmonster

*SLU Supporter*
 
Joshua Nightshade's Avatar
Unedited
 
Join Date: Jun 2007
Location: Sydney, Australia
Posts: 51,807
My Mood:
SL Join Date: October 2004
Blog Entries: 1
Quote:
Originally Posted by Laverne Unit View Post
It depends on what you're making, but usually I unwrap the model and bake an Ambient Occlusion map, and then take that out into a picture editor to actually texture it.
Quote:
Originally Posted by Johnnie Carling View Post
The way you unwrapped the cube, what you needed to do was save the UV layout and open it in photoshop or whatever then scale your texture down and copy it so each box of the "T" had a copy of the box texture in it. then bring it back into Blender.
Yeah, that's what Adam and others were telling me, but it was something I was trying to avoid doing. I wanted to do it all within Blender.

It does sound like, however, this was its own inherent problem that was actually not a "simple" thing like I believed, and it shouldn't be a problem when I do more complex geometry. I did manage to figure out that I can assign the UVs and I can bake textures to something I can upload in SL, which was half the battle, so I'm feeling better now.
Joshua Nightshade is offline   Reply With Quote
Old 10-07-2011, 08:36 PM   #22 (permalink)
Tya
Gone

*SLU Supporter*
 
Join Date: Aug 2007
Posts: 5,080
SL Join Date: August 28 2003
Business: [PM] Pixel Mode
Client: 2.0
Blog Entries: 16
The real question, are you having fun learning?
Tya is offline   Reply With Quote
1 User Likes This:
Old 10-08-2011, 09:29 AM   #23 (permalink)
Pedantic Geek
 
Maggiedoll Alter's Avatar
 
Join Date: Oct 2010
Location: Maryland
Posts: 3,657
SL Join Date: 1/30/2008
Business: Perception
If you want the whole texture to repeat on every face, just select the whole cube and reset the unwrap. u > reset (reset is down at the bottom) The default is actually that the texture repeat on every face.
If the orientation is wrong after you've done that, use face select mode, sync the selections between the UV panel and the 3D view panel (it's the third button over in the UV bar from where you select what image to use. The one with a cube, a pointer, and two points.) Then you can select the offending faces in the 3D window and rotate them in the UV window. (And remember that it matters where your mouse is!)

That's not particularly useful on more complex geometry, but is rather useful when creating lower LODs. Play with the other unwrap options too, especially project from view, and remember that you can unwrap faces or groups of faces separately.
It's the just plain "unwrap" option that's affected by the seams that you set.
Maggiedoll Alter is offline   Reply With Quote
Old 11-05-2011, 03:16 PM   #24 (permalink)
Senior Member
rawr!
 
Join Date: Feb 2011
Posts: 298
My Mood:
SL Join Date: 2006
Quote:
Originally Posted by Laverne Unit View Post
Hmm. I can see them before and after I unwrap the cube. I can see them in this screenshot you posted up-thread, too, just under "Mapping" in the right sidebar.

edit: here's a screenshot to illustrate exactly where it is (or should be):
thank you so much for this!

also thanks joshua for asking the right questions
Attached Thumbnails
Texturing a cube in Blender, and going to pull my hair out-snapshot_001.jpg  

Last edited by Whisper; 11-05-2011 at 04:26 PM. Reason: added image
Whisper is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On