Re: Camera projection
Posted: Sun Jul 18, 2021 2:44 pm
Show your work, get help, participate in development
https://forums.luxcorerender.org/
Code: Select all
scene.shapes.obj_shell_src.type = mesh
scene.shapes.obj_shell_src.ply = scenes/luxball/luxball-shell.ply
##
scene.shapes.obj_shell.type = cameraprojuv
scene.shapes.obj_shell.source = obj_shell_src
scene.shapes.obj_shell.uvindex = 0
Amazing, I'll give it a try tonight.Dade wrote: ↑Thu Jul 22, 2021 9:57 am I added the support for camera projection UV shape. The UV of a mesh can be computed with the following syntax:
This is a normal UV rendering:Code: Select all
scene.shapes.obj_shell_src.type = mesh scene.shapes.obj_shell_src.ply = scenes/luxball/luxball-shell.ply ## scene.shapes.obj_shell.type = cameraprojuv scene.shapes.obj_shell.source = obj_shell_src scene.shapes.obj_shell.uvindex = 0
i1.jpg
And this is a mera projection UV rendering:
i2.jpg
Note: the UVs are (pre-)computed at vertices so UV interpolation is done in screen space and not in world space. This means large triangles can introduce texture image deformation.
I test it and it is working as it is supposed to, just one thing that I do not know how to implement is how to use one camera as camera projection and render the image through another camera.Dade wrote: ↑Thu Jul 22, 2021 9:57 am I added the support for camera projection UV shape. The UV of a mesh can be computed with the following syntax:
This is a normal UV rendering:Code: Select all
scene.shapes.obj_shell_src.type = mesh scene.shapes.obj_shell_src.ply = scenes/luxball/luxball-shell.ply ## scene.shapes.obj_shell.type = cameraprojuv scene.shapes.obj_shell.source = obj_shell_src scene.shapes.obj_shell.uvindex = 0
i1.jpg
And this is a mera projection UV rendering:
i2.jpg
Note: the UVs are (pre-)computed at vertices so UV interpolation is done in screen space and not in world space. This means large triangles can introduce texture image deformation.
if there are more cameras maybe ask the user what camera should be used at about the same place where the setting is and the default is just the camera that is usedTAO wrote: ↑Sat Jul 24, 2021 10:24 amI test it and it is working as it is supposed to, just one thing that I do not know how to implement is how to use one camera as camera projection and render the image through another camera.Dade wrote: ↑Thu Jul 22, 2021 9:57 am I added the support for camera projection UV shape. The UV of a mesh can be computed with the following syntax:
This is a normal UV rendering:Code: Select all
scene.shapes.obj_shell_src.type = mesh scene.shapes.obj_shell_src.ply = scenes/luxball/luxball-shell.ply ## scene.shapes.obj_shell.type = cameraprojuv scene.shapes.obj_shell.source = obj_shell_src scene.shapes.obj_shell.uvindex = 0
i1.jpg
And this is a mera projection UV rendering:
i2.jpg
Note: the UVs are (pre-)computed at vertices so UV interpolation is done in screen space and not in world space. This means large triangles can introduce texture image deformation.
Let say we have two cameras, Cam1 that should be used as a camera projection map as the first camera and Cam2 that I want to use as actual render view.
There is only one single camera currently in LuxCore. The need of multiple camera definitions has never come up until now.
That's no longer a camera projection though.
In 3dsmax and maya it bakes in mesh UV through modifier same as Dade describe it and of course can be remove from modifier stack in anytime, so it can be used directlly like normal UV.B.Y.O.B. wrote: ↑Sat Jul 24, 2021 4:03 pmThat's no longer a camera projection though.
It's more a rotated planar projection (if we assume Cam1 is an orthographic camera).
By the way it's not clear to me why this needs to be implemented as a shape. Cycles does this stuff without baking it into the mesh vertices.
Bake has no rendering cost: back projecting the point for each ray intersection with such material/texture is far more expansive. The draw back is the one I explained in my note.B.Y.O.B. wrote: ↑Sat Jul 24, 2021 4:03 pm That's no longer a camera projection though.
It's more a rotated planar projection (if we assume Cam1 is an orthographic camera).
By the way it's not clear to me why this needs to be implemented as a shape. Cycles does this stuff without baking it into the mesh vertices.
Updating a scene is one solution, but i think having support for multiple camera at leat 2 camera is far more better solution, imagine that camera projection moving through the time, for each frame scene should be translate and again update after that to be able to render correctlly.Dade wrote: ↑Sat Jul 24, 2021 8:20 pmBake has no rendering cost: back projecting the point for each ray intersection with such material/texture is far more expansive. The draw back is the one I explained in my note.B.Y.O.B. wrote: ↑Sat Jul 24, 2021 4:03 pm That's no longer a camera projection though.
It's more a rotated planar projection (if we assume Cam1 is an orthographic camera).
By the way it's not clear to me why this needs to be implemented as a shape. Cycles does this stuff without baking it into the mesh vertices.
BTW, actually, it is possible to use multiple cameras: you create the object with Cam1, than edit the scene to redefine the camera as Cam2 and you will obtain the desired result. The object is backed with Cam1 but the rendering will use Cam2.