PDA

View Full Version : A lazer beam that shoots out of the camera



I.C.UpsetPeople
04-23-2005, 10:02 PM
I want a lazer beam that shoots out of the camera amd bounces back to tell you how far away an object is from the lens. More measuring tools in layout would be a bonus hey!

MooseDog
04-23-2005, 10:50 PM
add a null to your scene, then click

properties>geometry>add custom object>range finder

instant laser :D

is that what you're looking for?

Lamont
04-24-2005, 12:32 AM
I went here: Utilities > Additional > Sea Bass. Make sure your dialouge box looks like mine. I then parented the sea bass to the camera.

I.C.UpsetPeople
04-24-2005, 10:00 AM
instant laser :D

No it is not an instant lazer because

A: you had to add a null

B: it isnt going to tell you the distance from the lens to a polygon, it will tell you the distance to the null.

I want to know the distance from the lens to the polygon that the crosshair is on, by a click of a button. No nulls to move around and parent to things, I want it to be easy to measure the distance.


I went here: Utilities > Additional > Sea Bass. Make sure your dialouge box looks like mine. I then parented the sea bass to the camera.

I will try your nonsence, it might work, but it should be a stat displayed along with XYZ for camera usage.

Lamont
04-24-2005, 10:10 AM
Yeah, I found that plugin at Flay.com.

So you want range finding in Layout? No you can't have it instant. And yes, if you really want to do it, you're going to have to make a null and move it to the poly in question.

And the lens would be the exact position of the camera.

Karmacop
04-24-2005, 10:13 AM
Yeah, what exactly do you need this for? To get the distance you'd need to shoot a ray off.

I.C.UpsetPeople
04-24-2005, 10:27 AM
i want to have it though, it is a request, a feature request. two examples of why I want it; dof and match moving. yes, I can parent a null to my battle ship or whatever and get the distance, but the distance between the lens and the poly's on the front of the ship is different from the distance from the lens to the polys on the side of the ship. and yes, i could get realviz matchmover to make match moving easier.

it is a request, a small simple feature request which would make layout easier, thats all.

Wade
04-26-2005, 09:52 AM
[QUOTE=it is a request, a small simple feature request which would make layout easier, thats all.[/QUOTE]


More power to ya - you will not get it if you do not ask. Good idea keep on asking until you get what you want and need.


Lamont - you had me looking for that sea bass plugin :o :o :o :p

Wade

Kvaalen
04-26-2005, 10:22 AM
Lamont - you had me looking for that sea bass plugin :o :o :o :p
LOL! The icon and the fake OK and Cancel buttons were an immediate give away before I even noticed what the interface was about. :)

I personally find this request useless. But that is just my opinion. It's a matter of literally 4 seconds to simply add a null and add the range finder. 4 more seconds to positin it at the polygon you want. No parenting whatsoever is needed.

But if you still want to request it, you're allowed to.

mattclary
04-26-2005, 12:16 PM
I want a sea bass with a frickin laser on it's head!! LOL


Of course, you COULD just use the available range finding tool.

Matt
04-26-2005, 04:46 PM
I went here: Utilities > Additional > Sea Bass. Make sure your dialouge box looks like mine. I then parented the sea bass to the camera.

LOL!!!!!!

:D

I.C.UpsetPeople
04-27-2005, 03:32 PM
I personally find this request useless. But that is just my opinion. It's a matter of literally 4 seconds to simply add a null and add the range finder. 4 more seconds to positin it at the polygon you want. No parenting whatsoever is needed.

Did you actually time yourself? It would probably take about that much time to program it in to Lightwave too. You can remove an 14mm nut with a pair of vise grips, but it's better to use a 14mm wrench.

Karmacop
04-27-2005, 04:13 PM
It's not that easy to code, as I've said you'd have to raytrace to find out the exact distance until it hits something. This value would then be useless when you animated if it as it's be changing dramatically each frame.

Just parent a null to a camera, and make that null your focal length. Then you can animate this null to animate your focal length. It's a much better way to do it, although not as automatic.

I.C.UpsetPeople
04-27-2005, 05:56 PM
It's not that easy to code

really, you saying it must make it so.

your just looking for an argument. example for use A: lets say i am using dof and the camera is on the inside of a ball and i want to focus on a paticular spot an pan to another spot. Would it be easier to point the camera at the spot and look at the value in the corner, or move a null around until it is in the exact spot? B: I want to move the arm of my animated object 5 meters closer to the camera from one frame to the next. Woud it be faster to point the camea at the finger and look at the value in the corner, or move a null around until it is in the exact spot?

and where does ray tracing come in? i wasnt talking about rendering mate.

Lamont
04-27-2005, 06:03 PM
Ray tracing is how you find a point in 3D space on a poly/surface.

Lamont
04-27-2005, 06:09 PM
Either way you're animating someting. You can either get the info from a HUD in the viewport and key it in the graph editor, or make a null that drives it and keyframe the null.

I think what we are all asking is: Is it that hard to use the null?

We're not trying to belittle you, but it just strikes us as odd.

I.C.UpsetPeople
04-27-2005, 06:23 PM
I think what we are all asking is: Is it that hard to use the null?

no, it isnt that hard to use a null.

what i want to know is: do you think that it would ever save you time, or make things easier?

Lamont
04-27-2005, 06:32 PM
I see it as the same. I have to keyframe something somewhere ;) What about static shots? You're going to have to use a null for that if nothing is moving.

I.C.UpsetPeople
04-27-2005, 06:32 PM
Ray tracing is how you find a point in 3D space on a poly/surface.

actually ray tracing is what determines the colors of the pixels in a render. the lines of code involved in this measuring device have nothing to do with color, shade reflection and so on. i might remind you that this tool is not a function of rendering either.

Lamont
04-27-2005, 06:34 PM
In OGL, you have to send out a ray to return info, color/location of a point in space.

I.C.UpsetPeople
04-27-2005, 06:41 PM
fine, you win. but when, not if, when you accidently scelect the wrong null out of the dozen you have in a scene someday, and you make a few adjustments here and there and all of a sudden you realized you scelected the wrong null, you just shot yourself in the foot while it was in your mouth.

Lamont
04-27-2005, 06:45 PM
I just umm.. name things and pay attention, use item-shapes.. ect.. so it doesn't look like a null.

It's not as hard as you make it seem, trust me. And you'll like it a lot more.

faulknermano
04-27-2005, 07:01 PM
just for fun... not one click, but not as cumbersome as rangefinder... i think. :D



@warnings
@script master
dist; cam;
c1..2;

create
{
dist = 0;
cam = Camera();
setdesc("LASER Range Finder");
}

options
{
reqbegin("LASER Range Finder");
c1 = ctlcameraitems("Camera",cam);
c2 = ctldistance("Distance",dist);
reqopen();


}

process: event, command
{
if(event == COMMAND && reqisopen())
{
cam = getvalue(c1);
obj = Scene().firstSelect();
if(cam && obj)
{
camLoc = cam.getWorldPosition(Scene().currenttime);
objLoc = obj.getWorldPosition(Scene().currenttime);
dist = vmag(camLoc - objLoc);
setvalue(c2,dist);
}
}
}

I.C.UpsetPeople
04-27-2005, 07:04 PM
lamont, you and your little karmacop friend can go in the corner and play with each other's nulls

i never said it was hard to use nulls. my idea would make things easier, faster and cleaner. that's not the thing around here so i will keep the rest of my ideas to myself.

Lamont
04-27-2005, 07:53 PM
Does it calculate to the objects absolute position or the point in space? Looks like it get's the objects pivot position.

faulknermano
04-27-2005, 08:16 PM
Does it calculate to the objects absolute position or the point in space? Looks like it get's the objects pivot position.

it's the object's pivot.. but ah... new and improved down below... :D



@warnings
@script master
dist; cam;
c1..3;
mp;
create
{
dist = 0;
cam = Camera();
mp = 1;
setdesc("LASER Range Finder");
}

options
{
reqbegin("LASER Range Finder");
c1 = ctlcameraitems("Camera",cam);
c2 = ctldistance("Distance",dist);
c3 = ctlchoice("Measure Point",mp,@"Pivot","Object"@);
reqopen();


}

process: event, command
{
if(event == COMMAND && reqisopen())
{
cam = getvalue(c1);
obj = Scene().firstSelect();
if(cam && obj)
{

camLoc = cam.getWorldPosition(Scene().currenttime);
if(getvalue(c3) == 1)
objPiv = obj.getPivot(Scene().currenttime);
else
objPiv = 0;
objLoc = obj.getWorldPosition(Scene().currenttime);
f_objLoc = objLoc - objPiv;
dist = vmag(camLoc - f_objLoc);
setvalue(c2,dist);
}
}
}

Karmacop
04-27-2005, 08:47 PM
really, you saying it must make it so.
your just looking for an argument. example for use A: lets say i am using dof and the camera is on the inside of a ball and i want to focus on a paticular spot an pan to another spot. Would it be easier to point the camera at the spot and look at the value in the corner, or move a null around until it is in the exact spot? B: I want to move the arm of my animated object 5 meters closer to the camera from one frame to the next. Woud it be faster to point the camea at the finger and look at the value in the corner, or move a null around until it is in the exact spot?


If you'r doing this, then how do you know which object you're hitting? You may think you're hitting the finger but you may actually be hitting something infront or behind the camera.



and where does ray tracing come in? I wasnt talking about rendering mate.

Because that's how you find the distance :rolleyes: Raytracing isn't used to find colour of a pixel, it is used to find when a ray intersects with an object. Once you find that intersection then you can find the incidence angle and colour etc etc.

So to find the distance from the camera to a point on the object you'll need some polygon intersection code, which would be similar to ray tracing or collision detection. If you knew the exact object and the camera then it'd cut down processing time.

faulknermano's script is fast, but it's based on the pivot position, so your distances could be far off, especially if you want the distance from the camera to the finger of a character.

I.C.UpsetPeople
04-27-2005, 09:19 PM
do you consider collision detection ray tracing as well?

Karmacop
04-27-2005, 09:36 PM
No but it's similar. They are both looking for an intersection; raytracing intersects a line with a poly, and collision detection intersects two polygons. From this intersection I could then find which way the light bounces off a mirror or which way a ball bounces off a wall.

For finding distance, I could shoot off a ray and find out the distance from the camera to the object. I could also shoot an object out from the camera and measure how far it travels before colliding with the object. Both methods do a similar thing in this situation.

GregMalick
04-27-2005, 09:52 PM
I should know better than speak while a Wall Bass is singing ...but here's a crazy idea....

1. Create two nulls a) FSTOP_NULL b) FDIST_NULL
2. Parent FSTOP_NULL to FDIST_NULL
3. Target the camera to FDIST_NULL
4. In the Envelope for Focal Distance create and apply an expression that calculates a value according to the distance between the camera to the FDIST_NULL
5. In the Envelope for FSTOP do a similar thing except use the distance between the two nulls....

moving the FDIST_NULL to where you want and the camera should point and the value set.... Move the FSTOP_NULL to change the Focal Distance.

faulknermano could whip up a generic LScript that does this in about 30 minutes. Nulls and all ;)

I.C.UpsetPeople
04-27-2005, 10:53 PM
why cant you just take the average global cordinates of the points that make up the poly the cross hair of the camera is on and calculate the distance?

faulknermano
04-27-2005, 10:57 PM
why cant you just take the average global cordinates of the points that make up the poly the cross hair of the camera is on and calculate the distance?

the problem is how do you know which polygon you want. the SDK provides no way to retrieve this. it's an OpenGL thing.

Karmacop
04-27-2005, 10:59 PM
Yeah you could do that. Again it could be very inaccurate, but it'd be faster than raytracing. I'm not sure if this could be done with the SDK or not, but it's certainly possible to do within opengl.

I.C.UpsetPeople
04-27-2005, 11:10 PM
ok, how about taking the global position of the poly and camera position and to make it more accurate, add camera angle. its possible with the cordiantes of the points to find the distance to where the crosshair is pointing. it would make things a little easier, and it probably could have been programed in less time than we have spent talking about it.

faulknermano
04-27-2005, 11:25 PM
and it probably could have been programed in less time than we have spent talking about it.

probably. especially considering how lw'ers like to talk and rant in circles.

as for your suggestion about "global position of the poly": IF the SDK provides hooks to the location of your CURSOR, then certainly it's worth pursuing as a plugin. else, pray and hope newtek adds this functionality in lw, or at the least, in the SDK (again, if this isnt in there already).

in layout, the problem is SPECIFYING what polygon (or point) we want.

in modeler, the problem is finding out the camera's position, and of course, a "non-modal" way of displaying the real-time info.

Karmacop
04-27-2005, 11:26 PM
The problem is with getting the poly under the crosshair. Open gl can do this because it has to render each polygon, so it can basically tell you which pixel belongs to which polygon. The only other way to find out which polygon is under the crosshair is to go through every polygon and find out which polygons intersect with the line extending from the camera at the angle of the camera. Then from those polygons you'd find the closest one.

It could be done, but it'd be slow, especially for objects with heaps of polys (even slower if it's done in lscript) and I can't think off the top of my head how you find the intercept between a line and a polygon ... but that can't be too hard to find ...

I.C.UpsetPeople
04-27-2005, 11:49 PM
well, you would have to program the "lazer beam" by using the camera angels and positioning; then have it detect if there are any poly's in its path, then if it does, you hit a sub routine that feeds out the calculation of where the cross hair is (or lazer beam) on the closest poly the the camera. i could see that slowing things down in complicated scenes. if it were a button you could push in the camera properties (which would just run the sub routine), it wouldn't slow anything down.

fortunately in modeler, there is a tool under "detail" called "measure tool": detail>measure>measure tool.

Karmacop
04-27-2005, 11:55 PM
Fortunately in Layout, there is a custom object under the geometry tab in the object properties panel called "range finder". ;)

faulknermano
04-27-2005, 11:59 PM
fortunately, i wrote a LASER Range Finder script UP THERE.

(see what i mean by lw'ers "talking in circles"?)

:D


edit: hey! i'm already over 1000 posts. :D

lardbros
04-30-2005, 06:12 PM
Hmmmm, now i'm bloody confoooosed!! Surely if you had a laser coming from the lens in your camera, you'd have to bother to aim the camera right at the poly you want to measure the distance from or to. This means, surely, that you'd 1.) mess the perfect composition up when you've spent days getting it perfect, or 2.) create an exact clone of the camera but move it around until it is looking right at the poly you wanted all along. In this case the rotated camera could be moved into a different position than the original one and therefore would be inaccurate.

Sounds easier to me to use the null. or the bass thing. (ace gag by the way :D :D )