AUTOMAPUV~ An automatic UV script for blender map makers.

A forum to store posts deemed exceptionally wise and useful
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

AUTOMAPUV~ An automatic UV script for blender map makers.

Post by omaremad »

Im sure any one who attempted at using blender at making levels found a very annoying problem:

UV mapping of brushes.

The problem is unlike deled quark etc... blenders automatic reaction when adding a texture to a brush is to stretch the whole texture over the face, moreover there isnt any automatic method available in blender that takes into account the size of the face etc... most uv methods in blender arent suited to repating textures too which games require.

so i made asmall simple scipt that automatically uv`s any mesh that is composed of quads. The uvmapper yields quite diffrent results from blender's ones and looks more like a specialised mapping tool

Here is a comparision picture
Image


As we can see, the AUTOMAPUV and DELED look exactly the same

while through blender's uvmap options the smaller faces are squashed/while there are no repettions on the bug face.

Some of you may say there is LSCM unwrap in blender but that requires mannual assignement of seams and still doesnt allow repettions

This method exports perfectly with the OCTTOOLS art flow thus makes the user able to add radiosity lightmapped scenes to irrlicht made freely in blender

http://omaremad.gdlib.net/automapuv.py

Moreover the texture doesnt get deformed when a cube/cuboiaad brush is edited in edit mode in to other shapes
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

whoa! great work Omaremad! :D more goodies for my beloved blender!

You got a quickstart guide on how to use it? Or simply load it from the scripts menu when UV mapping a mesh?
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

Hehe gald you liked the idea.


Here is a mini tutorial:

1-Model the Brush(editmode scaling is allowed here too :D )
2-apply scaling(objectmode)
3-go into face select mode
4-make a uv window
5-DO NOT modify any verts in this window just leave it
6-click image in the UV window then open
7-select image
9-open text window
10-click open
11-load the script
12- ALT-P while mouse in script window

DADA

Maybe you could make a new video tutorial for map making in blender and using it with fsrad, DELED's lightmapper isnt very good...
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

Nice, thanks! :D

About that tut, it would be cool, but I'm not too familiar with Murphy's tools. I think it's about time I catch up since I'm a bit more familiar with blender now.

Do you know where to get the latest version of the OCTTOOLS?

thanks Omaremad. I'll let you know how things go.

EDITED: can it be any kind of model or mostly levels (meaning like square-rectangle brushes mainly). Can I select all of the faces at once and apply a single texture to them?
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

followed your tut, got this error on the console:
Image

Vermeer has to check this project as well; he's gonna love it for its possibilities with OCTTOOLS! :wink:

EDITED: got it! I deselected the faces. All faces must be selected to get it to work.
http://afecelis.gdlib.net/Blender/automap_ok.jpg

Quick question: how do you change the tiling factor? Directly on the script?
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

Image

well its works with cylinders :)

Howver i havent coded it so it can accept triangles yet so thats why i removed the cylinder caps

id have to figure out the vertex ordering in triangles since blender seems to have a weird vertex ordering depending on the direction of the face.

it wouldnt work too well on really organic meshes but it wasnt created for that since organic meshes are bettr done mannually or via sphere mapping.

about octools:

ok here are the links
http://www.constantthought.com/project/OCTTools

to create levels in blender here is the workflow:

1-make brushes
2-uv in the method as seen in the method in my previous post
3-add lights (spot only)
4-run octtools script
5-take output and rn it through fsrad
6-load in irr

Im sure it would be better if you made the tutorial bc of your previous experience in video tut making
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

ahh that error comes up if you dont have any objects selected

anyway ill try and make a triangle script that integrates withthe quad one

tiling factor is scale based or can be overriden by the overide variables at the start of the script.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

nice! Thanks for the link and the quick explanation on OCTTOOLS. I'll try to get started with them.

I still got some trouble with the tiling, but I'll explore it with calm. Nice script!
Please keep us updated. :D I'll let you know of things I build with it.

Quick OCTTOOLS question: only spot lights are supported? No omni lights? (lamps). So we're supposed to light our levels only with spots?
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

good news! I got to export properly to oct, loaded in fsrad and got my output.oct properly created, then I ran oct2obj and got my obj and mtl files created!!! And the obj loads perfectly in unwrap3d (whoa! just checked and so does in blender!). Now I need a sample app to load it using the provided loader class. I just dropped Vermeer a line to see if he can give me a hand.

but anyway, I had never gotten so far with OCT before, so I'm glad! :D
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

opps i meant point lights.

Well that is the hard way to go about things.

just run the .octfile that came out of blender into fsrad then the oct file that comes out of that into irrlicht, no obj tools required. irrlicht has native .oct suppourt

Here is a scene i made that demonstrates that there is no need for the obj's
the scene is made all of oct's

omaremad.gdlib.net/main.exe
-run in opengl mode
-look around the first part is very dark

Ill try and improve the tiling method too, please give me pic's of any artifacts that pop up.

Nb: this script was created and debugged in less than a few hours so there is plenty of work to be done :)

AHHH now i think i might know why tiling troubles you.

the problem is the script doesnt save the previous uv's so multiple applications of the script tend to produce artifacts, ill have to find a way to store the originals.
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

just run the .octfile that came out of blender into fsrad then the oct file that comes out of that into irrlicht, no obj tools required. irrlicht has native .oct suppourt

Exactly...The good old murphy made a lot of my petitions a reality..I insisted a lot in obj workflows...

as is a general 3d format very supported by tools, specially good for the "poor man" ways..

Omaremad, a question. Are you sure to bet for oct? I allways was a bit down for the fact that it does not support normals for curved surfaces. Murphy did ok doing so, as , well, Fsrad itself does not support em, neither blender has a fast way to generate other thing than "all smooth" or generate the smoothing creases by breaking the mesh, a detail that makes not happy to some of us...

I guess...if u plan on using blender as the scene setup , which for that, my extra step of loading in the irrlicht viewer he made for the blender-exported-oct, works cool as allows a go back and forth fast method of checking, as...well...u never know well how stuff is going...

Yup, lamp only where allowed, if I recall well, but remember: u can do proyectors with meshes, ie like cones, or put a light inside a torcj holder, etc...I think we had a way to not export the fake mesh...

So, I much liked his MIM format; sadly, mim didn't make his way as to be supported fro ever as standard in Irrlicht oficial versions...

MIM does support perfect vertex normals. Wings3d meshes wehre taken perfect, as well as OBJ+OBJ exports from Giles.

Normals where there as I made em in Wings 3d.

There's then many obj based extra utils he gently made...

obj2mim, my favourite, which did take the obj with texture,and the one with a lightmap tga, and converted in a perfect level ,lightmapped, wit h all perfect, and able to change by text quicly the lightmapping mode, etc, by me, the artist, also... ;)

Oct to obj, which you already used, was another petition of mine...(good old Murphy ;) ) , as so to allow the user fix or add stuff to the final level, ie, add smoothing normals, etc, etc. But I think there were more...

There's a mim loader some where(I have one, at least, maybe one of the latest)... The problem is also fsrad. It wont take normals in consideration, is not only that u loose them, but that it does generate lighting according only to flat surfaces! Do make th etest of adding a cilinder or cone, you will, see in your blender scene to be exported to fsrad as oct...

So, to me the blender route, better use a format like mim, or use a free lightmapper Like LMMAKER, and add a loader which loads great from there...The fact is you seem to like the lights stuff set up inblender, I do too...(but for a good check previous to export at the oct viewer, which wasbest, I remember I used change lights to spot, so to be able to raytrace shados and see how more or less lighting would go... There's as allways, a game of tweaking light colors, distance which light will achieve, and intensity, among other things...)

My main hopes with MIM was that...well, Blender yet does not have 2 uv channels, neither a solid lightmapping solution...was that it'd export as OBJ, you'd do in two steps if get raybaker from macouno to work well i ur case, or in one only step, only the obj with texture. If second case happened u'd need a lightmapper to generate that lightmap tga bitmap file. pitty is I dunno if there's one for Linux, really. In windows, there's Lmmaker, as the free one which I know has no limits in lm size, and supports smoothing normals...Some say is very slow, or have probs with large scenes...I dunno if there'd be a workaround for that, neither the conditions of those ofending 3d scenes...

Then use obj to MIM, and voilá.Way shorter than oct workflows, and more quality for the aspects I mentioned.


Imho that automap uv plugin looks very useful for level editing, kudos :)

I use Ultimate Unwrap, but for ppl more using Blender, it must rock :)


PD: I mean, the workflow of oct is good and works...is more up to each one about the flattened only problem..which as I say, is double...wouldnt be enough to just fix normals, or asign by code an autsmooth value...the lightmap was generated for all flatten faces....
Finally making games again!
http://www.konekogames.com
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

For those interested in a MIM (lol, I'm almost proposing you (omare) to give it a coding try... ;) ) Blender direct workflow, but this time not counting on fsrad...[that is: export 2 OBJs, one with tetxure, one witha lightmap baked directly in Blender! ] would find terribly interesting this script (it keeps evolving, in good, expert bledner and 3d/gaem hands, am sure would work..er..in my hands... ;) hehe, so humble I am...) :

BRayBaker 3
- http://www.alienhelpdesk.com/index.php?id=22


and this thread compiles a bunch of scripts updated related with this whole thing, more or less :

-http://blenderartists.org/forum/showthread.php?t=72243


if any of u get the way to lightmap well a level with an script (before was much harder, the radiosity-->vertex color--> bitmap, was muuch harder before...) and you have (or ask me if not) a working version of MIM loader, and OBJ2MIM tools, imho would be the most easier way...Providing in Blender you'd split the mesh where u wont creases (select the edge vertices, hit Y key (which is split)) , before or after applying a whole smooth all faces... The obj will forcedly allways show a crease there, it's a break, nothing to mess there..I hope the engine or code wont get issues... So, you export your obj-with-texture(include allways export obj mtl files!), and your OBJ-with-lightmap(as standard texture!!, in uv channel1, no other possibility and is what OBJ2mim understands, was done for this purpose, mainly...) ...no put in obj2mim folder the 2 OBJs (is same exported twice with different textures! just it..) , with its mtl files, and the texture, and lightmap tga. Execute obj2mim (cool to read commands it has in the dos window, and make a bat for speed of use...) and bang, ur MIM file there, a full lightmapped level in text editable xml format... I have also a mim viewer where I check all went right, so I dont need a coder to make all workflow and check...crucial for fasten the artist workflow! and aavoid extra coder nightmares...

This method would be freaking fast, and in my view, graphically perfect....And following the poor man's rules, with an exception...OBJ2MIM is windows/msdos based, as was done with Delphi...I hope it'd be possible to port to Linux. It'd rock all workflow so perfect in graphic quality, to also be full at linux (dunno if a dos command tool can be executed in Wine or the like...)

But anyway, as MIM tools and loader are usually only available by my temp uploaded files, and some other generous guys, and murphy is not around...I guess is the explanation of lack of interest about mim...

Besides, the OBJ+obj solution, allows extra edit of stuff in any free modeler out there...be it linux or win...


BTW, I'm convinced his lightmapper he was making would have rocked...

Not to hijack the thread, but for people working hard, specially if more of the code side, I think they'd need to know a bit of oct problems...
Finally making games again!
http://www.konekogames.com
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

WOW thats a lot to read, i'll read it now but just a point to make, why do we need smoothed normals if we arent using dynamic lighting?

moreover smoothed surfaces? i exported an arc just fine.

lastly doesnt blender average the normals on any mesh you want and the oct exporter exports these normals?

i exported and lightmapped meshes with flipped and "good" normals and they worked just fine.

you want perfect normals so curved surfaces are perfectly lightmapped?

for me the "normal" oct flow works fine, i have one mesh that is produced by clicking the go button on fsrad then importing in irrlicht, not to metion the higher speed as there is no need for double the polygons to be rendered, moreover with shaders we can truely render multitextured objects in one pass(some cards add extra polygons internally for lightmaps)

The lightbaker script is fine but it require mannual UV of the meshes for effciency moreover it exports to one mega huge texture so it can be problematic If hardware limits come in (max texture size), moreover for seprate lightmapped images we would have to mannually group faces export two meshes.......

its so impratical and time consumeing and not very hardware friendly.

please show me artifacts that arise when using the oct method, maybe i can do some bug fixes

btw im gonna do tiling based on the texture size as well.
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

btw Spotlights are easily emulated and are better this way:

add a cone of mesh around a point light! You would need that cone anyway for the lamp/light source mesh
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

Btw blender can do smoothing groups if you were complaining about all smooth with this statement:
other thing than "all smooth" or generate the smoothing creases by breaking the mesh,
Just go in edit mode and select faces then press smooth, the selected faces are only smoothed , the others remain unchanged.

Btw for people using Automapuv always apply smoothing after running the script because the normals tell the script allot of important info
Post Reply