Forum

Author Topic: Single camera texturing using UV  (Read 3944 times)

olihar

  • Full Member
  • ***
  • Posts: 215
    • View Profile
Single camera texturing using UV
« on: July 10, 2014, 04:58:00 PM »

It would be fantastic to be able to project single camera on user created UV, then one can project few times selected cameras and paint and fix the texture in Photoshop afterwards.

This does not seem to be an option right now.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15067
    • View Profile
Re: Single camera texturing using UV
« Reply #1 on: July 10, 2014, 05:02:43 PM »
Hello olihar,

As a workaround I can suggest to disable all but one camera and then build texture using Keep UV + Average settings.
Best regards,
Alexey Pasumansky,
Agisoft LLC

James

  • Hero Member
  • *****
  • Posts: 765
    • View Profile
Re: Single camera texturing using UV
« Reply #2 on: July 10, 2014, 05:17:16 PM »
I came up with a script (with some help from Alexey) to achieve this.

Code: [Select]
import PhotoScan

outDir = "D:\\Some\\Directory\\"

chunk = PhotoScan.app.document.activeChunk

enabled = []

for cam in chunk.cameras:
if cam.enabled:
enabled.append(cam)
cam.enabled = False

for cam in enabled:
cam.enabled = True
oldMask = cam.mask()
cam.setMask(cam.image())
chunk.buildTexture(mapping="current",size=8192)
chunk.model.save(path=outDir + chunk.label + "_" + cam.label.replace(".tif",".obj") ,format="obj",texture_format="png",texture=True,normals=True,cameras=False)
cam.setMask(oldMask)
cam.enabled = False

for cam in enabled:
cam.enabled = True

First you need to UV unwrap your model, either in an external program, or by building a texture in photoscan.

Then disable all but the images you want projected individually, and run the script.

It will save out individual models/textures with each of the remaining enabled cameras projected using the current UVs.

The script also temporarily disables any masks present in the images.

Each saved model is named after the input image that is projected onto it in each case, and in the script above it assumes a .tif extension, but you could modify this to be more generic or suit another specific type by changing the extension.

It just saves out 8 bit PNG texture currently, i haven't looked at scripting out 32 bit textures yet!