| |
Articles |
By Millz
Published: March 17, 2008
Updated: March 17, 2008
Print
Email
Hey folks, I'm Emiel Regis - The New Era's coder. Although there are
many things I work on, I'd like to share my experience with dynamic
scope system I finally got to work lately.
Dynamic scope means
that there is a texture in appropriate place in the viewmodel (the
scope of course) which is a render target. What does that mean? The
current view of the character is drawn dynamically into the scope,
which, combined with ironsights, gives a very realistic feel for
zooming with scope-equipped weapons. Instead of just drawing a
full-screen zoomed overlay, you see a realistically zoomed image appearing
on the three-dimensional scope.
Question arises - how to do it? I started with
MirrorView article on developer.valvesoftware.com. Theoretically, the
code there would work for scopes with only little modifications. The
reality proved otherwise - after many hours of coding, changing the
render target texture (which needs to be compiled with an external
tool) and cursing over, it became apparent that the method lacks a
certain detail - initilization of the very render targets. Without
this, a purple checkboard or just a plain black texture would appear on
the scope. After searching the MP SDK which TNE is built on I was quite
puzzled: There wasn't any reference for render targets initilization in
the code - but it must be done somewhere, otherwise things like water
reflections would not work, while they did.
At this point I
started asking fellow coders from hlcoders mailing list. It was not
until I joined their IRC channel and talked with guy named omega, who
happened to have working render targets in his mod and willing to share
- huzzay I thought
After another few hours of work and cursing, the thing actually started
to work! Here are a few screens of dynamic scope on the A-280:
Looks
cool, doesn't it? The obvious disadvantage of this method over a simple
overlay is that all pixels in the view need to be drawn twice -
however, with current optimizations of Source Engine and moreover
multi-threaded Orange Box code, which is out there and waiting to be
merged with existing TNE codebase, the problem does not seem so acute
anymore and peformance decreases only slightly.
View Comments (7)
|
|
|
|
|
|
|
| |
Online Now: 2 0 Members | 2 Guest
Most users ever online was 46 on February 29, 2008 at 06:21 AM.
|
|
|
|
|
|
Looks nice.. however.. why does the edge of the scope look like aluminum foil xD
Yep.. was wondering the same thing :P Good job though.. and by the way; make sure to make a diary for the lightsaber development(whenever that is).. im curious as hell about how your gonna do that
i made this for insurgency mod isit any use? to help you
http://img509.imageshack.us/img509/6007/insadvancedshottingrangmh5.jpg
thanks, but unfortunately, no use for us. They're using an entirely different method of rendering the scopes.
Looks awesome. Can't wait for trying it in the real game.
"Looks nice.. however.. why does the edge of the scope look like aluminum foil xD"
'cause it was just a "prototype" i guess.. anyway, nicely done..
I just hope that the method you're going to use in TNE is even better...
Looks great, all it's missing is a red dot.