View Full Version : projection mapping based on camera direction

Carrot Juice
04-08-2004, 10:04 PM
Does anyone know how to write a script that would planar projection map all the faces of a model visible to the camera along the direction that the camera is facing every frame (with all the default planar projection attrs)?

I'm planning to use this in conjunction with "use frame extension" and a sketched-looking outline (tomcat) in order to acheive a hand-drawn effect. This script (if it's possible) would create painterly shading that has different texture and strokes each frame because of the 'use frame extension' images, and scales with the closeness of the camera. (if it just did a planar projection on all the faces instead of only those visible to the camera, the strokes in the image would seem to get bigger as the camera moved closer).

I have already figured out how to use the command polyProjection -ch 0 -type Planar -ibd on -icx 0.5 -icy 0.5 -ra 0 -isu 1 -isv 1 -md c pSphere1.f[0:99];
to make a projection map along the direction of the camera, but I'm unsure how to do this every frame as I am very new to MEL. Also what would seem to be the largest problem here is getting the projection map to apply only to visible faces. Perhaps the same stroke size consistency effect could be acheived by scaling the projection based on the camera distance, but I don't know how to do this either.


Roberto Chico
04-10-2004, 02:23 PM
I'm also looking for an answer, I have exactly the same problem but I'm even worse at MEL than you. :)

Carrot Juice
04-11-2004, 04:14 PM
Yeah... I doubt you're worse at MEL than me.

I've been doing some thinking, and it seems that the root of our problem lies in two areas:

1) how to get that UV map to scale/only project on visible faces? if it doesn't do that it wil never really look painted.

2)How to get it to use that UV map from camera direction script every frame?

04-11-2004, 08:10 PM
I'm confused. If you have a drawing per frame, and you're projection mapping with a camera projection each frame, won't that look exactly the same as if you'd just composited the image into your scene in 2D?

-- Mark

Carrot Juice
04-12-2004, 03:10 AM
Almost. The shader I'm using (tomcat cartoon shader) uses a ramp much like any other cartoon shader, except with a blinn it uses as a shading reference- the blinn is applied to your model. The dark regions are shaded with the bottom of the ramp, and the light regions are shaded with the top part. It interpolates between (the darker/lighter an area on the blinn-shaded model, the lower/higher its color will be on your ramp).

So it essentially has the same result as compositing it in in 2d, except that it shades it across the model- it's not just flat color. I have thought about doing it by compositing, but that would require so many layers that I will only do it if this is not possible.

CGTalk Moderation
01-17-2006, 11:00 PM
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.