Implementing Proper Lighting in DirectX9 ($100-150 REWARD to the person who helps!)

Discussion in 'Game Development (Technical)' started by TomTheFox, Jan 5, 2020.

  1. TomTheFox

    TomTheFox New Member

    Jan 5, 2020
    Likes Received:
    (IMMEDIATE $100-$150 REWARD TO THE PERSON WHO HELPS ME FIRST/THE MOST IN SOLVING THIS--*MUST* be ZELLE, not PayPal, PayPal banned my SSN in 2007 for ad-clicking back when I was a teenager writing botnets.)

    Hey guys,
    I'm writing my own game engine in C++ using DirectX9(Don't ask why I'm not using 10/11, long story, I'll port it later when finished). In order to get the engine going, I'm starting out by making a little crappy slenderman-type horror game. Everything is going well, except for one part -- lighting. My engine parses BSP maps, so you can use map editors such as GTKRadiant and load them into the engine and she'll spit 'em out just fine, with perfect physics and all. But the lighting is terrible, as you'll see in the video provided. My engine is capable(or to *become* capable of both 2D and 3D games, and in the 3D aspect of the engine, to parse BSP trees, I borrowed a header file from Ken Wright's tutorials from, I essentially stole the damn thing) to parse BSP-tree's because I wasn't going to spent two months learning everything little particular thing about every class/struct for every item, shader, etc. I have "bsp.h" in my project, which is on my Google Drive below: (If you're having problems helping me out and are still willing, I'd suggest looking at his source code for his projects on his site. The man's a genius in my eyes).
    ****If you're going to try and run his projects you will not be able to get any lighting whatsoever, you need to add pDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE); in DrawFace() under BSP.h to get *any* lighting effect whatsoever.

    Now, normally a simple 3D game with a simple map wouldn't have the problem I'm having, because each face is created by two opposing tri-primitives to form a square/box/etc. Thing is, with BSP maps, they save the amount of tris drawn by, for example, making a massive roof out of two simple tri's and having the texture repeat itself over and over, giving the illusion of a large roof. This is, *I think*, where my problem lies. In my video, you'll see that the ceiling/floor simply disappear-reappear. This is because the ceiling and floor are just one massive face comprised of two tri's, and therefore, a simply point/spot light will not illuminate it as evenly as the walls around the player (the lightsource position is the player/camera's position, so it illuminates as the player moves). So, as you can see in the video of my crappy test game, the lighting is in no way fluid and even, walls light up quickly, ceilings disappear altogether. This is a major brick wall I've hit in my engine thus far and am willing to pay the person who is able to give me the solution to this problem -- I'm traditionally an OpenGL guy, I'm no expert in DirectX by any stretch of the imagination, so please give me your answers in a way a toddler could understand. If I hear suggestions about altering Rendering Pipelines/Index/Vertex-Buffers/HLSL/Pixel Shading/Parallax mapping/Phenn-Phong-ping-pong-chinaman lighting without elaboration my head will explode, so please treat me as the mouth-breathing knuckle-dragging idiot I am.

    Here is the video of my test game thus far(holy JESUS It's running at 20-odd FPS instead of ~65 because of the concurrent video capturing device sucking my GPU..I promise the game is not this horrible at run-time):

    (The cursor is only visible due to the video capture, but that's irrelevant).

    You can see as early as 0:40 seconds that the lighting is in no way even. I go into my debug console and adjust the lighting level accordingly, you can see the changes.
    At 1:23, the scene looks really nice. Then the player approaches the wall and SNAP everything is lit.
    At 1:55, you'll see the player is looking up, and there's no roof whatsoever. Just Blackness. Then I adjust the "brightness level", which is just the range of the spot light. Then boom, roof.

    At various points throughout the video I go into wireframe mode, to attempt to show you guys the amount of polygons drawn. You'll notice there's only *one* line for the ceiling, hence I believe why it is not being illuminated. Everything except the lighting goes nicely, except I make too much damn noise, wake the monster, he gets his ass stuck in my yet-to-be-perfected pathfinding class, as you can see in the top-down view. Then, as the supreme humiliation, I get an access violation code in one of my linked lists because I've been rushing. This is a pre-pre-alpha experimental version of a game engine, please don't knock me for not coming to you guys with a perfect game with only a lighting problem :)

    I'd like to be able to make it so the player is holding a flashlight, I'll just throw in a mesh for a light, render it, inverse the matrix to keep it rotating with the player. But I obviously cannot do that with lighting effects that are this bad. There *has* to be a way in DirectX to get around this, the last book I read on DX was for DX6 by Andre Lamothe and I was 12 years old. Not much knowledge was retained. So I really need the help of you fine gentlemen.

    Now, as to the cash reward, I'm not joking. If you're able to find a solution to this problem, which I know I must not be the first to come into and the makers of this API must've anticipated, I *will* pay. You have my full name on YouTube, and if you still do not trust me, then make a video of you doing it successfully, send it to me, and I will pay you upfront prior to you sending me any kind of help. Why am I so desperate to get this done quickly? I'm on a deadline -- I have to show a judge that I've been able to write a perfect game engine by February 18th or I face 2-9 years in prison because one of my firearms was unregistered. I'm(actually ...was..) a paralegal in law school and worked with the DA's office for years and the understanding is I get off on probation, on a VIOLENT FELONY(it's *very* bad in NY to possess an unregistered firearm, it's a mandatory minimum of 3.5-15(Violent C) years in prison irrelevant to your criminal history, even though that breaks the second amendment, Article VI Section II of the constitution, and the mandatory minimum abridges the 8th amendment, but screw it NY does what it likes), and the DA I'm negotiating with is into IT as well. So I really need your help here, guys. Please.

    tl;dr: Watch my video. Lighting is uneven regardless of how I fill a light/material structure and apply to device. I want to have the lighting fluid and even, going with the player, not random polygons illuminating/disappearing. Attenuation has had no effect on this whatsoever. It's how the polygons are drawn and lighting is applied that is the problem. Will pay for quick/easy-to-understand solution.

    Thank you all very much in advance for your support. I'm really counting on someone here to help me out of this jam I'm in. Thanks!

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer