Jump to content

problem with camera projection


mattd

Recommended Posts

I am trying to perform a texture projection by using a texture SOP and assigning it to a camera view. If I render from that camera, I see artifacts in the texture caused by the irregular geometry I am trying to project on. Is there a way to get the image rendered to perfectly match the original texture? (no matter what kind of geometry you are projecting on?)

Perhaps it has to do with using NDC somehow - it's baffling me.

Maya will do this when you project at the shader level and render from that camera, there are no artifacts.

Perhaps it is in the need to create UV's that the artifacts are created, is the there a way to do a camera projection in VOPS somehow?

Thanks

MD

Link to comment
Share on other sites

I am trying to perform a texture projection by using a texture SOP and assigning it to a camera view. If I render from that camera, I see artifacts in the texture caused by the irregular geometry I am trying to project on. Is there a way to get the image rendered to perfectly match the original texture? (no matter what kind of geometry you are projecting on?)

Perhaps it has to do with using NDC somehow - it's baffling me.

Maya will do this when you project at the shader level and render from that camera, there are no artifacts.

Perhaps it is in the need to create UV's that the artifacts are created, is the there a way to do a camera projection in VOPS somehow?

Thanks

MD

it might help if you attach a file, I've done this in the past with no problem.

Link to comment
Share on other sites

it might help if you attach a file, I've done this in the past with no problem.

can't put up the original, but I whipped up this which exaggerates the issue.

Render looking through the projector camera. It is obvious that there are not enough uv's and it is interpolating between the ones that exist. A solution is to increase the number of points, this solves the problem in in simplified example. In my project, however, I am seeing slight tearing distortion. Raising the polycount prior to projection solves it eventually, but at the expense of an unmanageable scene.

Maya has a perspective projection at the shader level that does what I am looking for flawlessly. The uv's in this case just need to exist, but they can be a random projection and it still works.

So I think it needs to all happen in the shader, that's where I am lost. The UVproject VOP is limited to ortho, cylinder, and sphere. I think that this would solve it if it had a perspective projection option.

Thanks

MD

camera_projection_problem.hip

Link to comment
Share on other sites

yes, that is how it is done in the file I posted. I am looking for a way to do it at the shader level, without relying on the uv's of the underlying geometry since I would need to have far too many points on the mesh so it does not get distorted.

MD

Hi Matt,

Did you try a UV Texture SOP with the Perspective From Camera option? This way, your geometry will get its UV from a camera you specify.

Cheers!

steven

Link to comment
Share on other sites

I've been having the same issues, first time I had to do cp in Houdini... the artefacts kinda looks like those really old games that were unable to do perspective corrected texture mapping (in a racing game the road textures would warp on the bottom of the frame). In the end I ended up sub-dividing the geometry to heck, luckily this consisted of really simple ground/sky plane... anything more complex and we are kind of screwed in Houdini.

I knew about the ndc thing, what I don't get is how do you get this to stick to the object, and what if you want to project from a different camera than the one you want to render from?

cheers

S

Link to comment
Share on other sites

I've been having the same issues, first time I had to do cp in Houdini... the artefacts kinda looks like those really old games that were unable to do perspective corrected texture mapping (in a racing game the road textures would warp on the bottom of the frame). In the end I ended up sub-dividing the geometry to heck, luckily this consisted of really simple ground/sky plane... anything more complex and we are kind of screwed in Houdini.

I knew about the ndc thing, what I don't get is how do you get this to stick to the object, and what if you want to project from a different camera than the one you want to render from?

cheers

S

yea, the NDC method above makes a virtual plane on the camera and works as expected. While that is a valid solution, I did not properly explain myself; and I do need it to stick (and smear/breakup) when the rendering camera moves away from the projecting camera. My problem occured when the projecting camera and the rendering camera lie on top of each other, you would expect the rendered image to match the source texture exactly (it does so in maya). It works kinda, but you have to have huge tesselation since the Texture SOP is just creating UV's rather than a shader that will do a per pixel lookup regardless of UV's

for those with access to maya, it's a file node -> projection node (set to perspective) -> to material

MD

Link to comment
Share on other sites

yea, the NDC method above makes a virtual plane on the camera and works as expected. While that is a valid solution, I did not properly explain myself; and I do need it to stick (and smear/breakup) when the rendering camera moves away from the projecting camera.

The NDC approach is the cleanest, and it can be made to stick, just like a UV projection, but without all the issues you already discovered.

A light is also a camera... a light can project a texture (colored light) parameterized by its own NDC space, just like a camera. A light is independent of the render camera. And finally, the position that gets transformed to NDC doesn't *have* to be the global shading position P, it can also be a rest position. Put all ot these things together, and you have all the requirements you're looking for:

1. Project the texture from a light. (freeing you from the NDC from camera restriction).

2. On the surface shader side, capture this light using a rest position of the object. (freeing you to move/shatter/deform the object as you please).

There's an old thread that is related to this topic. It's somewhat out of date so the VOPs that were posted showing some of these projections (toward the end) may need to be tweaked to work in H9.5 (maybe), but it's probably worth checking out.

HTH,

Cheers.

Link to comment
Share on other sites

thats the ticket, I did not consider looking at it from the lighting angle (perhaps my search would have found that thread). Now to digest all that. Thanks Mario

MD

The NDC approach is the cleanest, and it can be made to stick, just like a UV projection, but without all the issues you already discovered.

A light is also a camera... a light can project a texture (colored light) parameterized by its own NDC space, just like a camera. A light is independent of the render camera. And finally, the position that gets transformed to NDC doesn't *have* to be the global shading position P, it can also be a rest position. Put all ot these things together, and you have all the requirements you're looking for:

1. Project the texture from a light. (freeing you from the NDC from camera restriction).

2. On the surface shader side, capture this light using a rest position of the object. (freeing you to move/shatter/deform the object as you please).

There's an old thread that is related to this topic. It's somewhat out of date so the VOPs that were posted showing some of these projections (toward the end) may need to be tweaked to work in H9.5 (maybe), but it's probably worth checking out.

HTH,

Cheers.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...