PDA

View Full Version : Ink n Paint help?


Shu
05-24-2003, 07:16 PM
I've figured out how to use the ink n paint material, however, the outline of my model remains fixed no matter what distance I view it from. All I want to do is have the outline of my material match the perspective scale of my model.

http://www.stefanmorris.com/help1.jpg http://www.stefanmorris.com/help2.jpg

Help anyone?

Bobo
05-24-2003, 07:28 PM
Originally posted by Shu
I've figured out how to use the ink n paint material, however, the outline of my model remains fixed no matter what distance I view it from. All I want to do is have the outline of my material match the perspective scale of my model.

Help anyone?


It requires a bit of tweaking parameters, but it works.

*In the Ink'n'Paint rollout, there is a map slot for the Ink Width.
*Add a Falloff Map to it.
*Set the map to Distance Blend, Camera Z Axis
*In the bottom group, you can define the Min and Max distance.
As a result the map will change from black (far) to white (near) as you move the camera relatively to the inked object.
*In the Ink'n'Pain material again, note that both Min and Max Width values have been enabled after adding the Map. There you can define the width for near and far (white and black) values.
If you move the camera now, the Ink width should change according to the distance...

Just an idea...

Bobo
05-24-2003, 07:31 PM
It wouldn't be me if I would not mention this, too: ;)

You could write a scripted controller or expression controller for the width value of the ink to achieve the same effect by measurung the distance between camera and inked object...

Shu
05-24-2003, 07:43 PM
I'm trying the falloff map now, but I'm still having problems...

The Scripting idea sounds more my style... I am actually a Flash developer and I prefer to use script whenever I can, but I've never scripted in Max (time to grab some tuts).

Would this be an easy thing to do? (sounds like it would be)

BTW, thanks for your help!

Bobo
05-24-2003, 08:09 PM
Originally posted by Shu
I'm trying the falloff map now, but I'm still having problems...

The Scripting idea sounds more my style... I am actually a Flash developer and I prefer to use script whenever I can, but I've never scripted in Max (time to grab some tuts).

Would this be an easy thing to do? (sounds like it would be)

BTW, thanks for your help!


Easy?
Asking the wrong man - scripting is always easy ;)

Ok, let's assume you have a Camera called Camera01 in the scene, and the object is called Arrow01.

*Select the Arrow01 object
*Open TrackView, expand all tracks, find the Material and locate the Min Ink Width track
*Right-click the channel, Assign Controller...
*Select "Float Script" controller
*Type in the controller's script field:

dependsOn $Camera01
dependsOn $Arrow01

dist = 1000.0/ (distance $Camera01.pos $Arrow01.pos)
if dist > 20.0 then dist = 20.0
if dist < 0.1 then dist = 0.1
dist


*Close the script editor to activate the controller...


What does this do?

First of all, dependsOn tells the controller which objects to monitor. Whenever one of these objects changes, the script will be reevaluated. This is not really necessary for rendering, but gives you realtime feedback when moving the camera and arrow around - the Min Ink Width value in the Material Editor will change dynamically...

Then you calculate a distance factor.
When you are 1000.0 units away, the ink width will be 1 pixel.
When you are 100 units, the ink will be 10 pixels width etc.

I added two if check to limit the ink from 0.1 to 20 pixels.
Feel free to edit all these constants to get the size you want.

Finally, the calculated value (dist) is returned as the result of the controller's evaluation and Max will use it in the respective track.


(I rendered a short animation with an inked teapot and it looked ok...)

To edit the script, you can always right-click the track in TrackView and select Properties... to open the script's editor.

Hope this helps...

Shu
05-24-2003, 08:31 PM
S W E E T.

I actually got the falloff material to work, but results were a bit less than desireable. I think this script will work a bit better.

My biggest concern is that I may not be using the best technique to achieve the result I am trying to get. Ultimately what I am trying to do is just create an outline around the arrow - that's it. No shading or anything, just a simple outline.

Unfortunately, the ink n paint material is not only adding an outline, but it is outilining all the edges in my model... take a look:

http://www.stefanmorris.com/help3.jpg

This is what I'm shooting for:

http://www.stefanmorris.com/help4.jpg

Bobo
05-24-2003, 08:38 PM
Originally posted by Shu
S W E E T.

I actually got the falloff material to work, but results were a bit less than desireable. I think this script will work a bit better.

My biggest concern is that I may not be using the best technique to achieve the result I am trying to get. Ultimately what I am trying to do is just create an outline around the arrow - that's it. No shading or anything, just a simple outline.

Unfortunately, the ink n paint material is not only adding an outline, but it is outilining all the edges in my model... take a look:



There are lots of options what sort of lines to ink - outline, internal edges, overlaps, underlaps and so on.

When I do this sort of things for 2D objects like arrows, I usually create two copies of the object.
Give the one black solid material, assign a wireframe white material to the other. Set wireframe mode to Units instead of pixels. Link the two objects and render...

Or create the arrow from a spline. Copy the spline. Set the one spline copy to renderable, give it the desired width and segments.
Add a MeshSelect to the other to mesh it. Link the two. Add black and white materials. Done!

I just thought you NEEDED to use Ink'N'Paint... If you don't really need to use it, try the above spline method. Might be easier...

Shu
05-24-2003, 08:50 PM
Actually the arrow is a 3d object, which is why I opted for this method. I just realized that it is working fairly well - I just needed to extrude the arrow a bit more.

That script works well, thank you much!

CGTalk Moderation
01-15-2006, 05:00 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.