Page 1 of 1

Fully functioning 3D hudmessage script

Posted: Wed Jun 22, 2016 6:09 pm
by ZZYZX
HI, finally made this.

The script separately: http://pastebin.com/9hqEzjR2
Example map: http://www.mediafire.com/download/u48iq ... 3/MEOW.wad

Use it by calling DrawText3D with the following arguments:
string — the text string to be drawn.
id — identifier of the hudmessage.
color — CR_ constant.
x, y, z — coordinates (in world space) of the hudmessage.
px, py, pz — coordinates of the camera.
fang — angle of the camera.
YAng — pitch of the camera.

People are free to use the script in whatever ways possible, I don't care.

Notes:
  • This is actually 3D, and as such only works for OpenGL renderer, for software version see HudMessageOnActor in the wiki.
  • Even though it mostly works under 2.0, there's no HUDMSG_NOWRAP in it and the text string will be wrapped once it's too close to the camera. 3.0 is advised.
  • Movebob/stillbob aren't implemented. An example on how to implement movebob is here (function CalculateBob, note that it's unfinished too).
  • FOV isn't implemented, only 90.

Re: Fully functioning 3D hudmessage script

Posted: Wed Jun 22, 2016 7:11 pm
by Catastrophe
Very cool. Though I imagine there's no way to prevent the message from appearing through walls?

Re: Fully functioning 3D hudmessage script

Posted: Wed Jun 22, 2016 7:16 pm
by ZZYZX
There is, if you do LOS checks with combination of a dummy thing+SetActorState. Not true Z-clipping if you mean that though.

Re: Fully functioning 3D hudmessage script

Posted: Wed Jun 22, 2016 8:59 pm
by Monsterovich

Re: Fully functioning 3D hudmessage script

Posted: Wed Jun 22, 2016 9:04 pm
by ZZYZX
Should've advertised it more. For whatever reason most people I asked don't even know about that library, notably TMC who asked me to do this :P
Korshun's implementation seems to be a bit better though, not sure (the video is short and lowres, and there was a weird bug in my version where the message would be off by 0.5-2 degrees sometimes).
My version is also posted at ZDoom :P

Re: Fully functioning 3D hudmessage script

Posted: Wed Jun 22, 2016 10:23 pm
by StrikerMan780
I don't see how this would be OpenGL-Only looking at the script. It just scales the hud size depending on distance. SetHudSize works fine in Software.

Re: Fully functioning 3D hudmessage script

Posted: Wed Jun 22, 2016 10:35 pm
by ZZYZX
Have you tried running it in software and looking up/down? The message will be moved in real 3D, while the map will be shown in 2.5D using the same formula as HudMessageOnActor.
This is at least until I make a valid library out of this, that'd support Z-sorting, visibility clipping, statusbar clipping (current behavior is weird) and other useful things.