Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411576 Posts in 69386 Topics- by 58444 Members - Latest Member: darkcitien

May 04, 2024, 09:09:58 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Implementing proper lighting in DirectX9 ($100-150 REWARD to the one who helps!)
Pages: [1]
Print
Author Topic: Implementing proper lighting in DirectX9 ($100-150 REWARD to the one who helps!)  (Read 1737 times)
TomTheFox
Level 0
*


View Profile
« on: January 05, 2020, 09:21:41 AM »

(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 xbdev.net(well, 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:
https://drive.google.com/open?id=16Q6pKQAPGZ_K4_K5lomSEsxZuwBhhcNV (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-primatives 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's 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 Smiley

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!

 




Logged
TomTheFox
Level 0
*


View Profile
« Reply #1 on: January 05, 2020, 01:13:36 PM »

Here's proving that my theory of uneven prims around the player are causing the issue:


Logged
qMopey
Level 6
*


View Profile WWW
« Reply #2 on: January 06, 2020, 05:54:47 PM »

Wait why would a judge care if you made some game engine? Also what defines perfect? I'm just curious.
Logged
BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #3 on: January 12, 2020, 12:53:49 AM »

I see similar popping in the walls as well as the ceiling. I take it the bsp algorithm will make long polygons for continuous stretches of walls.

I think it would help if you shared the code for lighting. There could be something odd there (e.g. i find it odd that the lighting doesn't update every frame in the second video).

I don't remember directX 9 too well. Is your lighting per-vertex (the fixed-function pipeline). i.e. light calculations are only done on vertices, everything else is interpolated. If so, that is going to make large polygons impossible to light correctly. I believe the simplest solution is tesselation - when generating the level, subdivide any polygons that are too big.

Or you can switch to programmable shaders (the modern solution). Shaders (even in DX9, iirc) compute light per-pixel and have no issues with large polygons.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic