Jump to content
ibotatar

I vector dot product problem

Recommended Posts

Hi, community.

Let's say I have an object in my scene and I want to change it's color in render depending on camera height (view direction). For example :  when i'm looking from above to that object I want to color it orange, otherwise to color it blue.

The first idea I had was to compute dot product in shopnet between I(vector) and another manually created up(vector) pointing up. But the result did not make me happy.

For some reason on the rendering image it separetes an object and colors it from the center of an image. And it does't matter from which angle I'm looking at it. The separation line is always at the center.

Did anyone confront with this kind of problem? Will be grateful if Anyone colud hepl me with that.

Also, attached a rendered image.

vector_I.jpg

Share this post


Link to post
Share on other sites

I had similar effect in my last project, attached is my solution. I just added the point inside camera and read it in the VOP. Subtract P.y (camera-point) and ramp the resulting float to color.

camera.hiplc

Share this post


Link to post
Share on other sites

Thanks for your responsiveness Jiri. Thats really cool idea. But I think this method won't work in my case, cause I'm reading my geo as packed disk primitive. And I would like to solve this during shading.

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

×