projection based texture

   12298   17   3
User Avatar
Member
527 posts
Joined: July 2005
Offline
Im trying to figure out how to project a texture in houdini similar to maya's. So far it seems that one has to project uv's to get the same effect. Is that correct?
soho vfx
User Avatar
Member
527 posts
Joined: July 2005
Offline
This question must be too lame since the lack of response…..

However, in hope sake of finding out the information I will try to explain why I ask such a special little question.

In maya there are several ways to apply a texture. One is through the uv's of the object and the second is to directly project it in 3d space. The second one is of interest becaue it uses the existing uv's and manipulates the image to fit it according to the projection.

Is this possible in houdini? If so how with the what and where with the sometimes why?
soho vfx
User Avatar
Member
113 posts
Joined: July 2005
Offline
You mean like this?
8)

[img151.imageshack.us]
where am I?
User Avatar
Member
7760 posts
Joined: July 2005
Offline
You mean this?

Append UVTexture SOP:
- Texture Type: Perspective from Camera
- Camera Name: set to path of your camera (eg. /obj/cam1)
User Avatar
Member
2199 posts
Joined: July 2005
Online
You might also look at the option to modify existing UV's, again using the UVtexture sop.

Or there is the UVproject sop for creating new uv's in a slightly different way to the uvtexture sop.

And then there is a whole slew of other tools called UVblah for doing edits and transforms etc.
The trick is finding just the right hammer for every screw
User Avatar
Member
527 posts
Joined: July 2005
Offline
So to clarify…

It is correct in assuming that in order to project an image onto a surface, you need to create uv's via the desired projection method first. This in turn will give the look that the image is being projected onto the surface. One can not achieve the same effect with out modifying the existing uv attribute or creating a new uv attribute.
soho vfx
User Avatar
Member
2199 posts
Joined: July 2005
Online
Sort of.
That is the normal route, but you could for example write a shader that reads the xyz position as a texture coordinate. Or in the case of a NURBs surface just use the parametric space which can be adjusted with the basis sop. But they are non standard ways of doing things.
The trick is finding just the right hammer for every screw
User Avatar
Member
7760 posts
Joined: July 2005
Offline
Er, what about putting a texture map into the Projector Map parameter of the light? In the viewport display options, make sure you turn on Projected in Misc. Also make sure your light is looking at the object.
User Avatar
Member
2199 posts
Joined: July 2005
Online
Oh yeah, if you are trying to make a “projector” as ed says then use a light.
There's a projector map field right at the bottom of the shading tab.
or assign a VEX ASAD Light shader to your light with your image in the Slide projection field.

That's a whole different ball game. But your talking about projecting a texture map aren't you?
Maybe you should clarify what you are trying to achieve.
Do you want the stain glass window effect, or the sticker on a bottle effect.
The trick is finding just the right hammer for every screw
User Avatar
Member
527 posts
Joined: July 2005
Offline
Sorry I was on hollidays then I was consumed by work when I came back.

The light projection worked out great along with the mantra -u command! It would be easier if there was a way to see the projection in opengl. For now I just use the interactive render tool and play a game of marco polo.

ps. any ideas of how to wire up a vex shader that pipes the received light on the surface to the cd channel or something?
soho vfx
User Avatar
Staff
1072 posts
Joined: July 2005
Offline
Wren
It would be easier if there was a way to see the projection in opengl. For now I just use the interactive render tool and play a game of marco polo.

Try the Display Options > Misc > Projected Textures toggle.

Ondrej
User Avatar
Member
527 posts
Joined: July 2005
Offline
Perfect…

ps. Sorry Ed! I missed the part about the display options in your post. That is what happens when I read forums late at night).
soho vfx
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
Projecting textures with lights is fine but this discussion should lead directly to Magic Lights as they exist in PRMan.

The issue with projecting textures from lights is that it is a light property, not a surface shader property. The difference is huge.

Magic lights are a surface property and can be used to create uv's at render time. This is currently missing in Houdni's default workflow and shaders.

It isn't hard to build projected texturesthrough lights imported in to shaders. Surface shaders use illuminance loops so you can fetch your specially tagged lights and use these to build the uv sets which then get used to apply the textures however you want. build in edge feathering and other nice touches as you progress with the tools yourself.

A big issue here is that you can't apply displacements this way with Mantra as you do not have access to displacements in surface shaders and in displacement shaders, you don't have illuminance loops to querry the lights in your scene to build the uv sets.

There are clever hacks to get around the latter displacement issue but requires a dedicated workflow that currently does not exist in Houdini.
There's at least one school like the old school!
User Avatar
Member
527 posts
Joined: July 2005
Offline
Since it is using light there is a problem with the edges becoming darker on the projection. This light projection method works in a pinch but it would be preferable to have proper projections.
soho vfx
User Avatar
Member
941 posts
Joined: July 2005
Offline
Wren
Since it is using light there is a problem with the edges becoming darker on the projection.
The only reason I can think of why you'd get darkening around the edges would be if you're using some non-constant reflectance model in your illuminance loop (like diffuse)… which you shouldn't, since the light in this case is being used for texture projection, not illumination.

Wren
This light projection method works in a pinch but it would be preferable to have proper projections.
What do you mean?
Last time I checked, a projection from a light was a “proper projection”.
Mario Marengo
Senior Developer at Folks VFX [folksvfx.com] in Toronto, Canada.
User Avatar
Member
527 posts
Joined: July 2005
Offline
If I use an illumination model where the diffuse is constant how will it responds to light and recieve the projection?
soho vfx
User Avatar
Member
941 posts
Joined: July 2005
Offline
Wren
If I use an illumination model where the diffuse is constant how will it responds to light and recieve the projection?

Like a diffuse surface.

The “diffuse” model will, for every light source in the loop, do something like this:
result += Cl * diffuse_color * dot(normalize(N),normalize(L));
The dot product at the end there, means that even if the parameter “diffuse_color” is constant, the intensity of the reflected light (the result) won't be. That's not a mistake though, it's simply the way the diffuse model works.
But when the intent is to collect a texture color (as projected from a light), then we don't care about the surface's reflectance properties; we just want to look up a (projected) color. In that case then, the illuminance loop simply accumulates incoming color (without a BRDF like “diffuse”).

Here's a simple example in vex. It accumulates all the lights in “lmask” (or the object's lightmask by default) and gives you back exactly what came in – a “pass-through” or “constant” BRDF. Typically the object will be hit by a single projector (or non-overlapping ones), but it's possible to get a lot fancier and weigh contributions from several lights according to how well they line up to the surface normal (instead of just adding them) – useful when re-projecting live footage taken from different angles onto a cg object, for example.


#include <shading.h>
#include <math.h>

surface Canvas (
string lmask = “”;
)
{
Cf = 0;
vector Nf = normalize(frontface(N,I));
illuminance(P,Nf,M_PI_2,LIGHT_DIFFSPEC,“lightmask”,lmask) {
shadow(Cl); // optional
Cf+=Cl;
}
}

There was a discussion at odForce that touched on these issues (and where I posted some VOP versions of things like the above code snippet). You might want to have a look here [odforce.net].

Hope that helps.
Mario Marengo
Senior Developer at Folks VFX [folksvfx.com] in Toronto, Canada.
User Avatar
Member
527 posts
Joined: July 2005
Offline
That is very useful. Thank you for the help Mario!
soho vfx
  • Quick Links