Login Panel
Username:
Password:
Remember Me

Not registered?
Register now!

Forgot your password?
Users Online
Online Now: 0
0 Members | 0 Guests

Most users ever online was 46 on February 29, 2008 at 06:21 AM.
Affiliates



Navigate
Home  >>  Developer Diary
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 8-) 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 (6)
Our IRC Channel
IRC Channel:
#thenewera

IRC Network:
Quakenet

Connect to channel
Latest Articles
We're going Orange

Website outage

New Developer Diary Video: Ammo pickups

TNE Dev Diary - 1 - Ammunition

Maintenance this weekend
  [1] 2 3 4 5   Next

RSS Syndicator
RSS Click here for RSS
Latest Posts
The Lightsabers
Posted by Supa
August 28, 2008

Colors and binds?
Posted by Supa
August 28, 2008

Sup guys
Posted by bigFoot
August 27, 2008

Beta Tester
Posted by Lindsey
August 27, 2008

Top Posters
User: Posts:
o0paradox0o 675
Darth.Hunter 619
_DT_ 573
Lindsey 237
Millz 233
Social Bookmarking
Add Star+Wars%3A+The+New+Era+-+Developer+Diary+-+Creating+a+3D+scope to del.icio.us Add to del.icio.us
Digg Star+Wars%3A+The+New+Era+-+Developer+Diary+-+Creating+a+3D+scope Digg it
Submit Star+Wars%3A+The+New+Era+-+Developer+Diary+-+Creating+a+3D+scope to reddit.com Submit to reddit.com
Submit Star+Wars%3A+The+New+Era+-+Developer+Diary+-+Creating+a+3D+scope to Blinklist Submit to Blinklist
Seed Star+Wars%3A+The+New+Era+-+Developer+Diary+-+Creating+a+3D+scope to newsvine Seed on Newsvine
Submit Star+Wars%3A+The+New+Era+-+Developer+Diary+-+Creating+a+3D+scope to Furl Submit to Furl
Submit Star+Wars%3A+The+New+Era+-+Developer+Diary+-+Creating+a+3D+scope to Spurl Submit to Spurl