UV MAPPING: RizomUV Rhinoceros3D Bridge workflow (AM Mesh Bridge)

RizomUV let me fix UV mapping and work with it. It is a specific tool for UV mapping. I use to make the UV mapping projection in Rhino and often since my target is game development or VR, improve them inside RizomUV.

@Micha I finish purchasing RizomUV Real Space. And I made up a bridge to Rhino. This allows a fast interaction. I call it “AM Mesh Bridge” for UV mapping just in case there will be a better official one. It allows to easily move the mesh back and forward between these two applications. It consists of just a button in each application that save and loads a static obj. In a Windows environment:

SETUP

  • Make a folder in your hard drive. For example X:\DoNotMove\RhinoRizom\OBJ
  • Place in it an OBJ file. For example “mesh.obj”
  • Copy the file full path. In this case will be: X:\DoNotMove\RhinoRizom\OBJ\mesh.obj

RHINO

  • In Rhinoceros3D make a new button
  • Place the RizomUV icon
  • Place this command script on the left to “Export To RizomUV”

! -_Export _GeometryOnly=_Yes _SaveTextures=_No _SaveNotes=_No _SaveSmall=_Yes
“X:\DoNotMove\RhinoRizom\OBJ\mesh.obj”
VertexWelding=Unmodified YUp=Yes enter enter

  • Place on the right to “Import from RizomUV”

! -_Import
“X:\DoNotMove\RhinoRizom\OBJ\mesh.obj”
MapYtoZ=Yes
enter

  • And press OK to save the button setup.

RIZOM

  • In RizomUV you need to make a Lua script. And for this open Notepad text editor
  • The script for importing the file with no UVs will be

mypath = “X:\DoNotMove\RhinoRizom\OBJ\mesh.obj”
ZomLoad({File={Path=mypath, ImportGroups=true, XYZ=true}})

  • Save it as: “LoadWithNoUVs.lua”
  • Just in case remember to change the txt extension to Lua
  • If you want to “LoadWithUVs.lua” will be

mypath = “D:/AM/DoNotMove/RizomUV/Obj/UVmesh.obj”
ZomLoad({File={Path=mypath, ImportGroups=true, XYZUVW=true, UVWProps=true}})

  • Open RizomUV and in the Script Hub section under S0 press “…”
  • Now select the Lua script. And done!

HOW TO USE IT
Let say you want to paint your Rhino polysurface object. Fist you convert to mesh (this is for another thread). In Rhino you make the unwrapping, cylindrical projection or other projection types. If you need to optimize the UV mapping mesh layout or make a different type of unfolding, you close the rhino UV mapping editor. You select the mesh you what to optimize and press this new Rizom button. Now Open Rizom, press the “S0” button, and the mesh will pop up. Do what you need and then press control S to Save. Go to Rhino, delete the mesh and right-click the new button to import the mesh back. If you wish you can include deleting inside import Rhino command.

I updated my workflow to Substance Painter: How to paint Rhinoceros FBX from Rino3D to Substance Painter workflow

How to make Lua scripting for Rizom: http://forum.rizom-lab.com/thread/1085/solution-use-lua-rizom-scripting

1 Like

Perhaps you could use a file in the %TEMP% folder instead of hard-coding the path:

mypath = "%TEMP%\RhinoRizomMesh.obj"
ZomLoad({File={Path=mypath, ImportGroups=true, XYZ=true}})

and

mypath = "%TEMP%\RhinoRizomUVmesh.obj"
ZomLoad({File={Path=mypath, ImportGroups=true, XYZUVW=true, UVWProps=true}})

That is of course assuming that through the Lua scripting you still can use these kind of environment variables such that they extrapolate correctly to the path it essentially should point to.

2 Likes

I’m not so expert in Windows and I presume that readers are not windows administrators.

What %TEMP% is for? What is the advantage?

That is a temporary location where anybody should have access to. Without access to %TEMP% many programs would stop functioning. To what it extrapolates can be different for each machine, even each profile/user on a machine.

You can figure out with echo %TEMP% on a cmd.exe what it is on your machine. On one of mine it is:

C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\amd64>echo %TEMP%
C:\Users\Nathan\AppData\Local\Temp
1 Like

Yes probably is a much better solution because external X: path this days are made up by hard disk. So when the script runs, the disk is call, and often need to wake up and start spinning before reading. These take like 2 sec. Using temp in C: probably will be a SSD or NVMe M2 drive that are super fast. Similar to a live link.

I notice that in Lua is forward slash and in rhino is back slash.
“D:/DoNotMove/Obj/mesh.obj”
“D:\DoNotMove\Obj\mesh.obj”

In Rizom works
“%TEMP%/RhinoRizomMesh.obj”

but
“%TEMP%\RhinoRizomMesh.obj”
is not working in Rhino

message: Failed to save as X:\DoNotMove%TEMP%/RhinoRizomMesh.obj.

Looks like you still have the X:\DoNotMove in the path.

Yes, but is a Rhino thing. Because my code is:

! -_Export _GeometryOnly=_Yes _SaveTextures=_No _SaveNotes=_No _SaveSmall=_Yes
"..%TEMP%/RhinoRizomMesh.obj"
VertexWelding=Unmodified YUp=Yes enter enter

Also import have the same problem.

Don’t use the double dot in the path.

I try without dots. I also restart rhino but still there. I wish to use the %TEMP% but it looks like it asks me to put the full path.

Ah, I see. it is the Rhino command-line that doesn’t do extrapolation of such variables. I think you’ll have to try a workaround with maybe a bit of Python.

Not sure yet how to do that.

@AlanMattano,

You can use this in a toolbar button:

! _-RunPythonScript (

import os
import os.path
import rhinoscriptsyntax as rs
tmp = os.environ['TEMP']

testobj = os.path.join(tmp, "test.obj")

rs.Command("! _-Export _GeometryOnly=_Yes _SaveTextures=_No _SaveNotes=_No _SaveSmall=_Yes \""+testobj+"\" _VertexWelding=_Unmodified _YUp=Yes _Enter _Enter")

)
1 Like

Ok, I like your suggestion of using temp folder and is working. Is faster if you have a SSD C: drive and If X: and the command does not suffer of hard drive change letter ocationally.

for Rhino command will be:

“C:\Users\YourName\AppData\Local\RhinoRizomUVmesh.obj”

‘YourName’ must be replaced by your user name
and for Rizom Lua

“C:/Users/YourName/AppData/Local/RhinoRizomUVmesh.obj”

So for example the import Rhino setup including delete will be:

!Delete
 -_Import
"C:/Users/YourName/AppData/Local/RhinoRizomUVmesh.obj"
MapYtoZ=Yes
enter

Be adviced though that the path isn’t necessarily the same across machines depending on Windows version and system settings. That is the reason I posted a snippet with RunPythonScript where the correct value is completely retrieved programmatically. No need for the user to change anything.

1 Like