Texturing complex levels in blender
Texturing complex levels in blender
I know that we can easyly texture small objects by UV unwrapping and paiting individual texture. i dont think that its a good idea to texture level by UV unwrapping. maybe anyone could direct me the right way? I could find only this tutorial but it seems tu be outdated, current blender does not have "From window" mentioned there so tutorial is useless...
You have to construct your level using seperate blender objects, then apply textures via face select mode and selecting the image in the uv window. I made a script that does tiled uv's in the same way quakeradiant and deled do it.
use alt p to runthe script
Code: Select all
# _____ ______ ____ ____ ______ ____
# /\ __`\ /'\_/`\/\ _ \/\ _`\ /\ _`\ /'\_/`\/\ _ \/\ _`\
# \ \ \/\ \/\ \ \ \L\ \ \ \L\ \ \ \ \L\_\/\ \ \ \L\ \ \ \/\ \
# \ \ \ \ \ \ \__\ \ \ __ \ \ , / \ \ _\L\ \ \__\ \ \ __ \ \ \ \ \
# \ \ \_\ \ \ \_/\ \ \ \/\ \ \ \\ \ \ \ \L\ \ \ \_/\ \ \ \/\ \ \ \_\ \
# \ \_____\ \_\\ \_\ \_\ \_\ \_\ \_\ \ \____/\ \_\\ \_\ \_\ \_\ \____/
# \/_____/\/_/ \/_/\/_/\/_/\/_/\/ / \/___/ \/_/ \/_/\/_/\/_/\/___/
# PRESENTS
# AUTOMAPUV
#a UV'er useful for map makers this automatically UV's boxes/brushes/planes/ in the same style as quark,deled,radiant
#I hope this will help game devlopers and mappers
#it should run out of the box but use the overrides for tweaking
#This script is works even if transforms are done in edit mode or object mode
#APPLY SCRIPT AFTER ALL THE MODELLING/COMPLEX UV`ING/SCALING IS DONE
#ALT-P to run
#please give critics as i hope to devlop this further
overrideX=1
overrideY=1
overrideZ=1
import Blender
import math
from Blender import NMesh, Material, Window
editmode = Window.EditMode() # are we in edit mode? If so ...
if editmode: Window.EditMode(0) # leave edit mode before getting the mesh
FactorX=1
FactorY=1
object = Blender.Object.GetSelected()[0]
me=object.getData()
for f in me.faces: # loop the list of faces
#The uv calculation depends which way the face is facing so we have to use normals to find out
#we are only interested in the axsis so we do ^2 then sqrt so the normals is always postive
normalZ=math.sqrt(f.no[2]*f.no[2])
normalY=math.sqrt(f.no[1]*f.no[1])
normalX=math.sqrt(f.no[0]*f.no[0])
######################################################
#ok here we see if the faces are mainly facing up/down
if normalZ>normalY and normalZ>normalX:
print "cycle"
#seems the vertex ordering depends on the normals so we have to add extra checks
xdist1=0
xdist2=0
if(f.no[2]>0):
#length of top edge
xdist1=(f.v[0].co.x*object.SizeX*overrideX)-(f.v[1].co.x*object.SizeX*overrideX)
xdist1=math.sqrt(xdist1*xdist1)
#print xdist1
#length of lower edge
xdist2=(f.v[2].co.x*object.SizeX*overrideX)-(f.v[3].co.x*object.SizeX*overrideX)
xdist2=math.sqrt(xdist2*xdist2)
#print xdist2
if(f.no[2]<0):
#length of top edge
xdist1=(f.v[0].co.x*object.SizeX*overrideX)-(f.v[2].co.x*object.SizeX*overrideX)
xdist1=math.sqrt(xdist1*xdist1)
#print xdist1
#length of lower edge
xdist2=(f.v[1].co.x*object.SizeX*overrideX)-(f.v[3].co.x*object.SizeX*overrideX)
xdist2=math.sqrt(xdist2*xdist2)
#print xdist2
#seems the vertex ordering depends on the normals so we have to add extra checks
ydist1=0
ydist2=0
if(f.no[2]>0):
print "above"
#length of top edge
ydist1=(f.v[0].co.y*object.SizeY*overrideY)-(f.v[2].co.y*object.SizeY*overrideY)
ydist1=math.sqrt(ydist1*ydist1)
#print ydist1
#length of lower edge
ydist2=(f.v[1].co.y*object.SizeY*overrideY)-(f.v[3].co.y*object.SizeY*overrideY)
ydist2=math.sqrt(ydist2*ydist2)
#print ydist2
if(f.no[2]<0):
print "below"
#length of top edge
ydist1=(f.v[0].co.y*object.SizeY*overrideY)-(f.v[1].co.y*object.SizeY*overrideY)
ydist1=math.sqrt(ydist1*ydist1)
print ydist1
#length of lower edge
ydist2=(f.v[2].co.y*object.SizeY*overrideY)-(f.v[3].co.y*object.SizeY*overrideY)
ydist2=math.sqrt(ydist2*ydist2)
print ydist2
if(f.no[2]<0):
f.uv = [(f.uv[0][0]*xdist1,f.uv[0][1]*ydist1),(f.uv[1][0]*xdist1,f.uv[1][1]*ydist1),(f.uv[2][0]*xdist2,f.uv[2][1]*ydist2),(f.uv[3][0]*xdist2,f.uv[3][1]*ydist2)]
if(f.no[2]>0):
f.uv = [(f.uv[0][0]*ydist2,f.uv[0][1]*xdist2),(f.uv[1][0]*ydist2,f.uv[1][1]*xdist2),(f.uv[2][0]*ydist1,f.uv[2][1]*xdist1),(f.uv[3][0]*ydist1,f.uv[3][1]*xdist1)]
###############################################
######################################################
#ok here we see if the faces are mainly facing up*down
if normalY>normalZ and normalY>normalX:
print "cycle"
#seems the vertex ordering depends on the normals so we have to add extra checks
xdist1=0
xdist2=0
if(f.no[1]>0):
#length of top edge
xdist1=(f.v[0].co.x*object.SizeX*overrideX)-(f.v[2].co.x*object.SizeX*overrideX)
xdist1=math.sqrt(xdist1*xdist1)
print xdist1
#length of lower edge
xdist2=(f.v[1].co.x*object.SizeX*overrideX)-(f.v[3].co.x*object.SizeX*overrideX)
xdist2=math.sqrt(xdist2*xdist2)
print xdist2
if(f.no[1]<0):
#length of top edge
xdist1=(f.v[0].co.x*object.SizeX*overrideX)-(f.v[2].co.x*object.SizeX*overrideX)
xdist1=math.sqrt(xdist1*xdist1)
print xdist1
#length of lower edge
xdist2=(f.v[1].co.x*object.SizeX*overrideX)-(f.v[3].co.x*object.SizeX*overrideX)
xdist2=math.sqrt(xdist2*xdist2)
print xdist2
#seems the vertex ordering depends on the normals so we have to add extra checks
zdist1=0
zdist2=0
if(f.no[1]>0):
print "above"
#length of top edge
zdist1=(f.v[0].co.z*object.SizeZ*overrideZ)-(f.v[2].co.z*object.SizeZ*overrideZ)
zdist1=math.sqrt(zdist1*zdist1)
print zdist1
#length of lower edge
zdist2=(f.v[1].co.z*object.SizeZ*overrideZ)-(f.v[3].co.z*object.SizeZ*overrideZ)
zdist2=math.sqrt(zdist2*zdist2)
print zdist2
if(f.no[1]<0):
print "below"
#length of top edge
zdist1=(f.v[0].co.z*object.SizeZ*overrideZ)-(f.v[1].co.z*object.SizeZ*overrideZ)
zdist1=math.sqrt(zdist1*zdist1)
print zdist1
#length of lower edge
zdist2=(f.v[2].co.z*object.SizeZ*overrideZ)-(f.v[3].co.z*object.SizeZ*overrideZ)
zdist2=math.sqrt(zdist2*zdist2)
print zdist2
if(f.no[1]<0):
f.uv = [(f.uv[0][0]*xdist1,f.uv[0][1]*zdist1),(f.uv[1][0]*xdist1,f.uv[1][1]*zdist1),(f.uv[2][0]*xdist2,f.uv[2][1]*zdist2),(f.uv[3][0]*xdist2,f.uv[3][1]*zdist2)]
if(f.no[1]>0):
f.uv = [(f.uv[0][0]*xdist2,f.uv[0][1]*zdist2),(f.uv[1][0]*xdist2,f.uv[1][1]*zdist2),(f.uv[2][0]*xdist1,f.uv[2][1]*zdist1),(f.uv[3][0]*xdist1,f.uv[3][1]*zdist1)]
######################################################
#ok here we see if the faces are mainly facing up*down
if normalX>normalZ and normalX>normalY:
print "cycle"
#seems the vertex ordering depends on the normals so we have to add extra checks
ydist1=0
ydist2=0
if(f.no[0]>0):
#length of top edge
ydist1=(f.v[0].co.y*object.SizeY*overrideY)-(f.v[2].co.y*object.SizeY*overrideY)
ydist1=math.sqrt(ydist1*ydist1)
print ydist1
#length of lower edge
ydist2=(f.v[1].co.y*object.SizeY*overrideY)-(f.v[3].co.y*object.SizeY*overrideY)
ydist2=math.sqrt(ydist2*ydist2)
print ydist2
if(f.no[0]<0):
#length of top edge
ydist1=(f.v[0].co.y*object.SizeY*overrideY)-(f.v[2].co.y*object.SizeY*overrideY)
ydist1=math.sqrt(ydist1*ydist1)
print ydist1
#length of lower edge
ydist2=(f.v[1].co.y*object.SizeY*overrideY)-(f.v[3].co.y*object.SizeY*overrideY)
ydist2=math.sqrt(ydist2*ydist2)
print ydist2
#seems the vertex ordering depends on the normals so we have to add extra checks
zdist1=0
zdist2=0
if(f.no[0]>0):
print "above"
#length of top edge
zdist1=(f.v[0].co.z*object.SizeZ*overrideZ)-(f.v[2].co.z*object.SizeZ*overrideZ)
zdist1=math.sqrt(zdist1*zdist1)
print zdist1
#length of lower edge
zdist2=(f.v[1].co.z*object.SizeZ*overrideZ)-(f.v[3].co.z*object.SizeZ*overrideZ)
zdist2=math.sqrt(zdist2*zdist2)
print zdist2
if(f.no[0]<0):
print "below"
#length of top edge
zdist1=(f.v[0].co.z*object.SizeZ*overrideZ)-(f.v[1].co.z*object.SizeZ*overrideZ)
zdist1=math.sqrt(zdist1*zdist1)
print zdist1
#length of lower edge
zdist2=(f.v[2].co.z*object.SizeZ*overrideZ)-(f.v[3].co.z*object.SizeZ*overrideZ)
zdist2=math.sqrt(zdist2*zdist2)
print zdist2
if(f.no[1]<0):
f.uv = [(f.uv[0][0]*ydist1,f.uv[0][1]*zdist1),(f.uv[1][0]*ydist1,f.uv[1][1]*zdist1),(f.uv[2][0]*ydist2,f.uv[2][1]*zdist2),(f.uv[3][0]*ydist2,f.uv[3][1]*zdist2)]
if(f.no[1]>0):
f.uv = [(f.uv[0][0]*ydist2,f.uv[0][1]*zdist2),(f.uv[1][0]*ydist2,f.uv[1][1]*zdist2),(f.uv[2][0]*ydist1,f.uv[2][1]*zdist1),(f.uv[3][0]*ydist1,f.uv[3][1]*zdist1)]
################################################
#f.uv = [(f.uv[0][0]*object.SizeY*overrideY*Factory,f.uv[0][1]*object.SizeZ*overrideZ*FactorY),(f.uv[1][0]*object.SizeY*overrideY*Factory,f.uv[1][1]*object.SizeZ*overrideZ*FactorY),(f.uv[2][0]*object.SizeY*overrideY*Factory,f.uv[2][1]*object.SizeZ*overrideZ*FactorY),(f.uv[3][0]*object.SizeY*overrideY*Factory,f.uv[3][1]*object.SizeZ*overrideZ*FactorY)]
me.update() # update the real mesh in Blender
if editmode: Window.EditMode(1) # optional, just being nice
"Irrlicht is obese"
If you want modern rendering techniques learn how to make them or go to the engine next door =p
If you want modern rendering techniques learn how to make them or go to the engine next door =p
look here for more info
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=14441
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=14441
"Irrlicht is obese"
If you want modern rendering techniques learn how to make them or go to the engine next door =p
If you want modern rendering techniques learn how to make them or go to the engine next door =p
Hehe, sorry about how it broke the formatting, my host has been down so you cant get the script from the old thread.
No its just the same .
Btw this tool is only useful if you want tiled textures, since most of blender's uv tools keep the uv coords normalised.
No its just the same .
Btw this tool is only useful if you want tiled textures, since most of blender's uv tools keep the uv coords normalised.
"Irrlicht is obese"
If you want modern rendering techniques learn how to make them or go to the engine next door =p
If you want modern rendering techniques learn how to make them or go to the engine next door =p
If the script errored mid execution it might do that.
Check your console in blender for errors, python is very strict when it comes to indents so maybe copyingand pasting ruined some of the formatting.
Check your console in blender for errors, python is very strict when it comes to indents so maybe copyingand pasting ruined some of the formatting.
"Irrlicht is obese"
If you want modern rendering techniques learn how to make them or go to the engine next door =p
If you want modern rendering techniques learn how to make them or go to the engine next door =p
UV wrapping is always the way to go that's what everyone does no matter how complex a level is. That's why people say it isn't a cake walk making 3D games. To make something as beatiful as Halo 3 you have to UV wrap it. You are going to need time, frustration, sweat, and hard work, but if you do it right the payoffs will be amazing.
TheQuestion = 2B || !2B
something bad is happening! When i load my scene with irrlicht i see this:
but it looks normal in blender and mviewer:
First i thought that it was scaling problem but model do not react to scaling. Im using this x exporter. Anyone? Suggestions?
but it looks normal in blender and mviewer:
First i thought that it was scaling problem but model do not react to scaling. Im using this x exporter. Anyone? Suggestions?
it is not going to be a game im just learning
EDIT:
someone, check this out. mwiever says that it is ok but irrlicht shows complete mess. normals inverted, scene flipped, exporter dont react to scaling... and i managed to get map in one peace just when i joined all objects in blender. separate objects can not be exported to x i gues...
EDIT:
someone, check this out. mwiever says that it is ok but irrlicht shows complete mess. normals inverted, scene flipped, exporter dont react to scaling... and i managed to get map in one peace just when i joined all objects in blender. separate objects can not be exported to x i gues...