PDA

View Full Version : Switching UVs via LScript



rom
05-04-2008, 08:04 AM
Hi all,
I would like to know if it is possible to switch UV maps in all surface layers using LScript.
I am trying to work around the fact that there is no way to export 2 uv maps using the fbx exporter(autodesk).
Also to achive a painless texture baking pipeline.

I would like to : (not by hand)
1) Setup a surface baking camera for each object
2) Setup buffer exports of "raw","spec" etc
3) Switch all uvs to say "uv1" for baked textures
4) Render out Surfaces
5) export as scene.fbx (with uv1)
6) Switch all uvs to "uv2" for lightmaps
7) Switch surface baking camera to use uv2
8) Render out Surfaces (for shadow buffer)
9) export as scene_uv2.fbx (with uv2)

I have c# game engine code that will conect all the dots, ie
auto apply all the buffers, and auto select shaders
so by cracking this in lightwave, a great workflow will be achieved

Any help would be greatly appreciated

Blochi
05-05-2008, 08:28 PM
Don't know if there is a specific command for this.
You can always resort to scene parsing. Just make a simple scene, save it with both states, and figure out the difference in a text editor.

Blochi

Dodgy
05-05-2008, 09:14 PM
You can set the UV maps using lscript.

http://www.mikegreen.name/Lscript/Lscript%20Index.html

Look under texture layers. My images to planes lscript sets the UV map so you might want to read through that code.

rom
05-06-2008, 02:39 AM
Great, many thanx
I presume you are speaking of this lot.

mytexture=mysurface.getTexture(SURFCOLR);
mytextlyr=mytexture.addLayer(TXTRIMAGE);
mytextlyr.setValue(TXLRIMAGE,myimage);
mytextlyr.setValue(TXLRPROJECT,TXPJUVMAP);
mytextlyr.setValue(TXLRVMAP,myvmap);

Thanx for the pointer. I am sure I will progress well now.

rom
05-06-2008, 02:48 AM
I think the bases are covered,
I hope Newtek will include Lscript access to the new fbx IO in 9.5
that will complete the circle for this exercise
any way let's see