• Photon Lighting Engine: Cinematic Emergency Vehicle Lighting
    4 replies, posted
[URL="http://steamcommunity.com/sharedfiles/filedetails/?id=339648087"][IMG]http://i.imgur.com/1wKejdy.png[/IMG][/URL] Photon is a mock lighting-engine that uses HDR rendering techniques to create cinematic lighting for cars. While the primary focus is on emergency lighting, it also has some basic support for general car lighting. [IMG]http://i.imgur.com/Ibxn9tO.png[/IMG] [IMG]http://images.akamai.steamusercontent.com/ugc/496891999513536369/61D982174F49168FB44D6D51E200E88D91C29164/[/IMG] [IMG]http://images.akamai.steamusercontent.com/ugc/496891999504242013/C3F46F0008A00646151A6487E5F560D7DF3C999B/[/IMG] [IMG]http://images.akamai.steamusercontent.com/ugc/496891999500559487/44330003339EE636B3EC25B9A60F6A64725A43BD/[/IMG] [IMG]http://imgur.com/HcEJBY9.png[/IMG] [video]https://youtu.be/5bqLv3Xxqd8[/video] [IMG]http://i.imgur.com/JzopUxR.png[/IMG] So detailed feature information is available on the addon page (click the banner) if you're interested. This thread is geared towards the more advanced users of Garry's Mod. This project actually just started as a way for me to add emergency lights to cars in about September of 2013. I sporadically worked on the project until about June, when I moved away, got a job and had to lose my dedication to Garry's Mod. After periodic video comments of people asking about it, I figured I would go ahead and push to release it. So for the past month I've been working on it regularly. [IMG]http://i.imgur.com/YZ7YkIQ.png[/IMG] So there are indeed other mods that do similar things, and I think work reasonably well. Notably VCMod. Also Acecool created his own emergency lighting system for Crime City. And as a matter of fact, Photon is just [URL="https://www.youtube.com/watch?v=B33fQNh90W0"]stolen code from Acecool[/URL]*. Thanks, buddy. All I need now is a picture from my prom night on the banner. Anyways, I actually spent a great deal of time studying the effects of light on cameras to make this work. Photon, at its heart, is designed for enthusiasts of actual emergency vehicles. Why we love flashing lights and sirens, I truly don't know. My dad was a cop and somehow that made it into my blood, but lots of other people just have a fascination with this. Photon is designed for us, by allowing people to customize, share and spawn vehicles with unique specifications. For example, part of this release was a Seattle Police Taurus. The vehicle, light colors, siren and skin are all based on what the actual car looks like. I happen to live near Seattle so for me it was something I wanted to make. Someone in Los Angeles can take the car specification file and modify it to behave like an LAPD cruiser, by using some maps that I made and some they created. [IMG]http://i.imgur.com/8PFEXNz.png[/IMG] Photon itself is a standalone "engine." I say "engine" because really it's a unique system that uses layered colors to mimic how lights would actually look through a camera. It uses HDR strategies of hue shifting, but ultimately is not a special redo of Source lighting (which is just terrible, by the way). Cars have to be individually downloaded if people want to actually use the mod. I thought about packaging them together, but decided that it seems stupid to force people to use the NYPD Impalas and Seattle police car I made (nonetheless people are downloading the cars without the engine and wondering why it doesn't work -- you can never win). Each car uses a "specification" file (I was calling them "definitions" at first but decided it was inappropriate word usage). Everything that makes the car unique is mapped out in that file. As of writing this, you can specify the following: - Props to parent to the vehicle - Skin - Bodygroups - Color - Vehicle script (if you want to adjust handling for some reason) - Basic lighting parent (it will inherit the lighting information for basic cars, ie the Impala, but only if you want it to) - Positions for each light (it has more complexity to it than it sounds) - Colors (LED white, halogen soft white, halogen cool white, LED blue, LED amber, LED red, darker LED/halogen red) - Light behavior (flashing LED, rotating light, fading/pulsing light [usually halogen]) All of that sounds complex. And yeah, it actually is. Even as the sole developer of this, doing everything is a bitch. Making your own car is not for the faint of heart. There is no simply little GUI tool right now, everything has to be manually mapped out. But while it is really difficult to grasp at first, there is tremendous freedom in what can be done. For the most part, any kind of lighting you see in real life can be closely imitated by this mod (with the exception of lights that change positions). The point is that virtually any emergency vehicle has the ability to be replicated (as long as you have the models, which I have yet to know much about). [IMG]http://i.imgur.com/5rSy89n.png[/IMG] [I]CREATING EXPRESS VEHICLES[/I] [video]https://youtu.be/wbvr2E3FQhk[/video] [I]CREATING CUSTOM LIGHTING COMPONENTS & PATTERNS[/I] [video]https://youtu.be/wDfnP578Ceo[/video] [B][I]If you don't like to watch videos and want to read, here is everything in the above videos in text.[/I][/B] This is something I will need to write a lot of documentation for to fully explain. Being at work, I don't have access to the Lua files, so this is what I know until I get home and verify. Expanding on what was said above, each vehicle has its own specification file. This allows the car to appear in a player's spawn menu. Without the Photon addon, all you're doing is adding another car. If someone tries to spawn an NYPD Impala without Photon (as at least literally 16 people have done) the car will just be a blank LW Impala. The specification file adds a table to the car before it's inserted into the Vehicles list (in my specs it's called EMV). That file is shared, so both client and server will get it. (As a side note, this was colloquially called Emergency Vehicle Upgrade by me before I formally named it in the last few weeks, so the EMV and EMVU table names appear often in the code as just a legacy carryover). When the game starts, that table information is queued up into the master Photon table, indexed based on the car's name (so it's important you give cars a specific, unique name). When a car is spawned, it's checked against the Vehicles list. If it's flagged as being either EMV or Photon compatible (which it currently needs to be both in order to work) then functions will basically add a bunch of meta information onto the entity. As another side note, the basic lighting and emergency lighting are separate systems. The only real thing they have in common is an identical render process. This is so non-emergency vehicles can use car lighting without needing to behave like an emergency vehicle. With emergency vehicles, upon spawning, the skin, bodygroups, color and addon props are applied instantaneously, so it will appear as if the car is packaged the way it looks. Also, just so my boy Acecool knows, I am aware that the addon props are currently actual entities, and that they should be clientside props to be more efficient. That will be fixed with time, my love. The aforementioned table properties are pretty straightforward to understand. If you just want to change a skin on an existing car, it's very easy to do. The lighting is where it gets tricky. Here I will go over the different tables of lighting info: [U]Meta[/U] The [U]Meta[/U]table contains templates that the specific lights reference. The templates define source sprite, size, width multiplier, rotation behavior, relative angle offset and all sorts of other shit. Basically I tried to keep shared properties of lights in a template that can be referenced by the render function. For example, LED nodes on the lightbar facing the front will be different than the back, because front facing lights generally use a -90 degree offset. This is so the specific lights can use Angle(0,0,0) to face forward, then if rear-facing lights use 90 degrees, they can also be an empty angle to face
Can we see the source code?
The full GitHub page can be found [URL="https://github.com/ischmal/Photon"]here[/URL].
I love the presentation. Sleek, clean, and simple
This is so cool :)
Sorry, you need to Log In to post a reply to this thread.