View Full Version : Facing Ratio-Based Squash
baandersnatch 07-25-2007, 05:25 AM Yeah, so I got a brain scratcher on my hands. I want to be able to squash a polygon model based on the camera/facing ratio. However, it has to be done in such a way so that the edges/boundary of my model remain unsquashed and dimensional, yet the inside part of the model gets squashed inward, leveling that part of the model out like a plate. So what I'd be left with is a model that has a dimensional silhouette with the rest of it flattened. Kind of like taking a fully sculpted character and reducing it to a gingerbread cookie based on the camera.
I think I have a solution, except it's missing one very important step. What I do is just apply a squash deformer and constrain its orientation to the camera. The missing step is that I need to able to apply a fresnel/facing ratio shader to the "factor" channel of the squash deformer. The problem is that the "factor" channel is unmappable.
So does anyone either know how to come at this from a different angle or make the "factor" property mappable? Any and all help would be MAGNANIMOUSLY appreciated!!!
And yeah, I realize I made a huge rookie mistake and posted this in the wrong maya forum...
|
|
Wattana
07-26-2007, 03:04 PM
Hi man.
Sorry but I think that it's impossible.
I mean. The sqash factor is a one number attribute, and it's not mapable. You can animate it, connect to another attribute, or create an expression, but not map it.
The squash deformer is also a non-linear deformer, but it has orientation, and deforms in a specific way (axis).
It's my opinion, I'm not the Maya Master...
Duncan
07-26-2007, 07:29 PM
I've done a facing ratio based displacement map in the past, but the results were a little iffy.
Why not simply modify only the normals at render time? This will be fast and you will not have to deal with all sorts of occlusion issues. I've attached a Maya 8.5 file with a simple shading network that blends the current normal into one facing the camera, based on the facing ratio.
First I pipe the facingRatio from a samplerInfo into a remapValue node so I can control the amount it modifies the normal using a ramp attribute. I pipe the normalCamera from the samplerInfo into a blendColors node. It is the first color to blend and the second color is pure blue( the normalCamera 0 0 1 or pointing towards the camera ).The remapValue output is used to control the blend amount. I then pipe the blendColor output into a vectorProduct node with "no operation" and "normalize output" to ensure that the resulting blended normal is unit length. The result of the vectorProduct can be connected to the normalCamera of all your shaders to "flatten" them. You only need the one network and can use a fan out connection.
Duncan
baandersnatch
07-27-2007, 05:37 AM
Duncan,
This method is absolutely PERFECT for situations not using texture maps. I have to congratulate you on the superbly well-thought out approach. However, as I am using surface shaders for all of my models (ignoring lighting) the normal values are irrelevant. I guess what I want would need to be programmed from scratch, as the only option I see possible is facing ratio based dispacement; but displacement doesn't squash, it only extends. The idea is to squash the actual mesh so that the texture flattens out along with it.
I guess I should say what I'm actually doing, which is to simulate a painting in 3d, which necessitates flattening out the characters as a post process.
Right now all I'm able to do as a realistic solution is just use a super telephoto lens on the camera, barring programming a whole new squash deformer.
Thanks a lot for the help so far Duncan, and if you can add any more insight that would be awesome!
CGTalk Moderation
07-27-2007, 05:37 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.