View Full Version : Camera autofacing bitmaps
07-13-2002, 09:35 AM
I'm attempting to produce small items in API format using 'The Sign' object in NOVA 1.6 which auto-rotate so that they always face the camera. Currently, my API's produce the right looking objects, but I can't get them to auto rotate! I'm trying to produce taxy lights, etc with the smallest possible frame hit. I'm fairly sure it can be done - I've seen other API's that do it. Can anyone help me out?
07-13-2002, 10:21 PM
Hi... 'Sounds like you're looking for the RotateToAircraft opcode? It works very well to keep things pointed at you :-).
Here's a macro I made of a statue (same as a sign I suppose)that always stares at you. Note that the "Action" line of code comes right after the RefPt & from there on, you need to use your own draw and texture code.
Hope it Helps; J.R.
Area( 5 %1 %2 %3 )
IfVarRange( :no_display 346 %12 4 )
PerspectiveCall( :h0 )
Jump( : )
mif( %11 )
RefPoint( 2 :h3 %4 %1 %2 v1= %10 E= %11 %13 %14 )
RefPoint( 7 :h3 %4 %1 %2 v1= %10 %13 %14 )
RotateToAircraft( :h2 0 0 0 0 0 1 0 0 0 )
-2 0 0 ; 0
-2 8 0 ; 1
3 8 0 ; 2
3 0 0 ; 3
LoadBitmap( 0 6 e0 0 0 0 Madonna.bmp )
ShadedTexPoly( ai ;Glows in the dark
0 95 251
1 95 63
2 2 63
3 2 251
07-14-2002, 01:32 PM
Although Jaybird is correct about the command that you need to make 'sprites' that always face the viewer, I don't think that you will find that this meets your requirements for maximising frame rates. Just the opposite in fact, because each light would need to rotate around its own RefPoint and I think you'll find this causes quite a hit on frame rates. Are you really sure that the default taxi lighting is causing you a problem in the first place?
07-16-2002, 03:32 PM
Gerrish... Yes, I didn't stop to consider that Moriarity might need "hundreds" of such rotating objects, which, as you remind, would no doubt tend to bog things down. I know that you probably have more experience at this than any other designer, with your knowlege base in giving us those IMHO truly great "sprite based" trees.
I spent a few minutes trying to merge the "TransformCall(" into a "RotateToAircraft(" macro because the MM document states" "That means you can assume the new temporary reference point is at the given delta_# distances from the original point." My experience was that it starts out that way, however, then all objects start rotating in a radius around the original RefPt instead of around the "assumed new temporary" refpoint.
I then remembered your stands of trees routines which seem to work correctly in keeping many trees in place while rotating. Did you apply TransformCalls in doing that -- or maybe such a routine might apply in the requesters question?
Best Regards.. J.R.
07-16-2002, 04:12 PM
The present macros assign a separate RefPoint to each individual tree. I have been meaning to investigate myself whether a preceding TransformCall moves the rotation axis relative to the current RefPoint, but from what you say it sounds as if it may not. However, it may be worth experimenting with the dx,dz,dy offsets in the RotateToAircraft command itself -
RotateToAircraft( :Lab dx dz dy fx fy fz vx vy vz )These offsets might well move the rotation axis, or they may just have the same effect as TransformCall (i.e. shift the coordinates of the displayed object, but leave it still rotating around the RefPoint)?
If you are going to try it out, let us know the outcome!
07-16-2002, 05:05 PM
By the way, I noticed a couple of slips in your original code block in this thread.You can omit the Perspective command - it is obsolete and is simply ignored in recent versions of FSYou need VecPoints to make ShadedTexPoly work correctly, not plain old PointsThe real purpose of ShadedTexPoly is to apply shading across a polygon that (a) moves with the position of the sun, and (b) makes the surface look rounded (ideal for your statue). It also makes a multi-faceted object look smoothly rounded. Because the light/shade effect does make the surface/object look a bit brighter, it will make Maddona glow a bit - but the best way to get her glowing in the dark is with an _lm texture.
07-17-2002, 12:44 AM
>>>By the way, I noticed a couple of slips in your
original code block in this thread. You can omit the Perspective command - it is obsolete and is simply ignored in
recent versions of FS<<<
*** Only a couple ?? Hey, that's a record for me. I usually crash umpteen times before I get a macro working and then I keep my eyes closed when I run BGLTest :-). Thanks for the advice and BTW, I wasn't aware that the later sims didn't need the perspective for 3D objects anymore. 'Just a query on that -- is that because of the inherent Z biasing in FS2000 and later -- or what? ***
>>>You need VecPoints to make ShadedTexPoly work correctly, not plain old Points. The real purpose of ShadedTexPoly is to apply shading across a polygon that (a) moves with the position of the sun, and (b) makes the surface look rounded (ideal for your
statue). It also makes a multi-faceted object look smoothly
rounded. Because the light/shade effect does make the surface/object look a bit brighter, it will make Maddona glow a
bit - but the best way to get her glowing in the dark is with
an _lm texture.<<<
*** Yes, I've carried the guilt of not doing that right for a couple of years now. When FS2000 first came out, one of the well known scenery designers mentioned that use of ShadedTexPoly with the original old points system allowed a texture to show the same brightness regardless of the time of day. I realize I'm doing it wrong per the SCASM docs --- but it works. Someday, I'll try to make Ms. Madonna look even better by trying to do it the right way :-). Yes, I have used an _LM.bmp on her but since (to me) it looked good at night and allowed more brevity of code in the macro, went back to the old "Cheating on ShadedTexPoly" cop-out using DXT1 mipped textures. Also, since the original post dealt with lights, I thought STP might be an appropriate application here.
Thanks Much Gerrish. It's a real pleasure to have you helping us in this forum; J.R.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.