Jump to content
Sign in to follow this  
gubar

Offset UVs based on angle, movement relative to camera

Recommended Posts

Hi,

I've got a problem I want to solve. Basically - I want to have a layered texture with different UV sets on a flat object, but I want the layers to appear to have depth within the object, with parallax between the layers. So, I'd like the UVs to be offset by different factors, and that offset to be driven by objects position, distance, movement, rotation relative to the viewing and render camera.


Normally I used Houdini for lighting so this is a challenge for me :)

Any advice gratefully appreciated!

Thanks,

G

Share this post


Link to post
Share on other sites

Hi Steven,

you can get camera coordinates using optransform() and cracktransform(). Here is a minimal example that shifts UVs based on the camera's position:

matrix xform_cam = optransform('../../cam1');
vector pos_cam = cracktransform(0,0,0,0,0, xform_cam);
v@uv = (v@uv + pos_cam) % vector(1.0);

 

offset_uv_by_camera_position.hipnc

  • Thanks 1

Share this post


Link to post
Share on other sites

Hi Konstantin,

 

thanks so much for taking the time to post this for me. I'm going to have a look into it right now!

 

Great forum, thanks again.

 

Steven

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×