“Project UV from Camera” is a new Asset that allow you to project gameObject(s) UVs from camera screen space. This can be usefull if you want the gamer to project a precise planar mapping over one or many meshes. This package was done in C#. A full API support is available, but no need to have specials developer skills to use it… One button, and it’s done. This asset can be used for camera mapping in Unity.
Works on Unity pro and free (mobile and desktop)
Features :
Project with one button the UVs from camera to object(s)
Realtime or manual projection (even in editor)
Planar and spherical projection
Precise projection for spherical mapping
UV Tiling
Project from whatever camera
Project on single or multiple sub-objects
Optional GUI watermark to preview the projection over the object(s)
Keep the watermark texture aspect ratio or fill the entire screen
Set up watermark opacity
Restore original UVs with a single backup button or by deleting component
EDIT v1.2 : NEW SPHERICAL PROJECTION for spherical environment mapping. Spherical projection
EDIT v1.23 : NEW MINIMUM UPDATES MODE (avoid useless cpu peaks when possible) LAYER FILTER (filter sub-objects projection by layer)
EDIT v1.3 : Nth FRAME PROJECTION MODE : allow to project every nth frames. This ensure to spare cpu for realtime projections that doesn’t need very high frequencies. SPECIAL OCULUS RIFT MODE
EDIT v1.5 : Full source code included
EDIT v1.55 : SkinMesh support
Hi !
awesome script ! I 'm very interested by a additional spherical and panorama mapping project uv, it’s possible ? thanks
(sorry if my english is bad im french )
Projecting cylindrical or spherical mapping from camera screen space strictly is impossible (camera screen space is flat, not spherical or cylindrical).
But, projecting a classical cylindrical or spherical mapping on the object might be possible. I will consider this feature may be for a next version.
No. It’s not possible to project shadows like a light would do.The package project UV coordinates, not a texture. So your textures (whatever it is) will “look like” it’s projected from the camera. The main advantage is that you can keep every texture you like, and every shader you wish. And above all, you can do camera mapping.
The UV projected does not condition the contents of the texture the mesh has. It just drives the way the texture is wrapped on it.
I suspected as much, thanks for explaining.
So in theory I could render a depth texture from the projector camera and use a shader on the object(s) that does depth testing to achieve shadows.
That’s a serie of render to texture, then processing the bitmap (via shader) to obtain a product of two bitmaps that you can easily use as a texture mapping on your object(s). You then only need to project UVs with “Project UV from Camera” to camera map the view. Et voilà.
Didn’t tried, but theoricaly this should do the trick… at least it works in Photoshop.
Nice effect!
Btw, in that video it looks like your camera control and uv scripts have a little execution order problem, causing the uv’s to shake when you move the camera.
Nothing really fancy. Everything is computed by CPU (+ the video capture). The scene has nearly 30 000 vertices to reset UVs each frame. This is quite expansive.
Yes, I plan it, but not everything will be possible (precise spherical mapping for example since it need the mesh to be altered). The gain of speed would be very interesting but there is an ugly drawback from my point of view : this would need a specific shader to operate. With the actual “cpu version”, there is no need to change the scene, the mesh or the materials to work. For non realtime projection, this “cpu version” is perfect, but for realtime… yes I would definitively think about a “gpu mode” (with some disadvantages it would bring). the next version will certainly bring this enhancement, but I try to maintain the usability Project UV already has.
@Cec,
Can you add OnDemand realtime projection. I do not want to update the UVs every frame. I want to Project UV once and use it. Is this possible in current version ?
New features in v1.23 : Minumum updates mode : Optimize CPU usage when possible, and limit projections if not necessary. This avoid dramatical useless CPU peaks. Layer filter : Allow you to filter projection of some sub-objects by layer. This feature is quite usefull when there is a complex nested parenting of sub-objects whom UV projections need to be filtered.