Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / [DarkGDK 2.0] AdvancedLighting

Author
Message
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 27th Jul 2012 02:21
Like the title suggests I was wondering if anybody have gotten Evolved's AdvancedLighting rendering system ported and running in DarkGDK2 / PureGDK?

I've been trying this out myself over the last few weeks, but it is a lot of code to go through, especially due to the fact that the thing is pretty tightly coupled so you basically can't test run it until you've written a good 3000+ lines.

Anyway, I'm having the slight issue now that no 3D is rendered at all (2D operations and text work though). Closer examination reveals that all of the images AL renders to internally are pure black. I've ensured that they are indeed rendered to (ie. the images are not black by default and then never accessed), forcefully setting their camera's backdrop colours only affect one of the 12 cameras, the others render just as black. I've been messing around trying to figure out whatever causes this all night and am quite frankly starting to run out of things to test :p
I've begun to wonder if there might be some faulty function (maybe in the shader department?) that causes this and was therefore wondering if someone's managed to get (at least a part of it) working thus proving that not to be the case?
Or better yet, maybe someone knows what might cause this particular issue?


Sorry for the vague question and not supplying any code, however I currently have about 3.5k lines (roughly the AdvancedLighting.dba and Common.dba source files ported over, and in addition to that they're using homemade OOP wrapper classes for most DarkBASIC functionality so... doubt it would shed much light on the situation for anyone not wanting to spend days tracking down elusive errors )


"Why do programmers get Halloween and Christmas mixed up?"
Olby
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 27th Jul 2012 02:55 Edited at: 27th Jul 2012 02:57
Quote: "I've begun to wonder if there might be some faulty function (maybe in the shader department?) that causes this and was therefore wondering if someone's managed to get (at least a part of it) working thus proving that not to be the case?
Or better yet, maybe someone knows what might cause this particular issue?"


Well your best bet is to do a step by step verification. Start by making a separate project and test certain aspects of the code you've translated. This way you'll find the command that doesn't work (if any) a lot faster rather than trying to fight with 3.5k lines.

Additionally, I've read on EVOLVED forums that he's working on a new ADV lights system for last couple of months. Not sure how far he got but there are some promising pictures.

If you ask me, honestly I rather stay away from ADV lighting. It looks good and obviously makes your games more polished but the performance is appalling. I don't think there will be any extreme performance increase if ported to any other language since it's DBP's renderer that cannot handle such amounts of render to texture and other shader related slowdowns. Hopefully EVOLVED will somehow manage to speed it up substantially for the upcoming release.


Intel Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, Windows Vista Ultimate SP2, PureBasic 4.61 + DarkGDK 2.0
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 27th Jul 2012 05:18
What kind of advanced lighting? I am currently using Evolved's NormalMapping 2.0 (multiple lights) and Reflective/Refractive Water Shader. The both work beautifuly. I'm using c++, though, so this may not help you. But, this at least shows Evolved's shaders work with GDK2.0.

My advice is to start over with a simple program and empliment only one shader at a time. When you have all the shaders working in that program, you may be able to figure out what you are doing wrong in your game. Good luck.

The fastest code is the code never written.
Olby
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 27th Jul 2012 12:06
Quote: "What kind of advanced lighting?"


Top one here: http://www.evolved-software.com/code/codesnippets


Intel Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, Windows Vista Ultimate SP2, PureBasic 4.61 + DarkGDK 2.0
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 28th Jul 2012 16:18
Quote: "Well your best bet is to do a step by step verification. Start by making a separate project and test certain aspects of the code you've translated. This way you'll find the command that doesn't work (if any) a lot faster rather than trying to fight with 3.5k lines."

Well, the problem is that the system pretty much requires all those 3.5k lines to work at all x)
The update function spans about 800 lines, the setup one ~500. Together these two invokes about every other function I've ported. I suppose I could try to break out some semi-standalone part like, say point lights. That would still be a major hustle however.

What I've managed to narrow it down to so far is that the shaders doesn't seem to get the information they require (might be missing coordinates or some error in a matrix computation somewhere, I guess it might also be an incorrect technique being / not being set or pretty much whatever) and thus any object with such a shader applied is rendered completely black.


Quote: "I rather stay away from ADV lighting. It looks good and obviously makes your games more polished but the performance is appalling."

Obviously it isn't lightning fast but I think it should do just fine for what I need it for. And sure shader-less graphics might be all well for certain projects but if I were to go that route here... well, let's just say it would be a nice plus if the game didn't look like it was made in the late nineties


Quote: "My advice is to start over with a simple program and empliment only one shader at a time."

I would, but if you look at Olby's link you'll see that it's a big (and quite frankly, not too well put-together) collection of various shaders with lots of cross references between subsystems. It feels like trying to break it down (which I had hoped to do anyway to make it object oriented) isn't worth the effort if there's the possibility that the system itself won't work with DGDK2 for whatever reason (I know it should since it uses the same plugins as DBP, but you never know).


"Why do programmers get Halloween and Christmas mixed up?"
Olby
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 28th Jul 2012 16:57
Quote: "What I've managed to narrow it down to so far is that the shaders doesn't seem to get the information they require (might be missing coordinates or some error in a matrix computation somewhere, I guess it might also be an incorrect technique being / not being set or pretty much whatever) and thus any object with such a shader applied is rendered completely black."


Could it be the new vector system in 2.0?


Intel Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, Windows Vista Ultimate SP2, PureBasic 4.61 + DarkGDK 2.0
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 28th Jul 2012 19:39
Good catch, that might be it, I will look into it
Now if only there was a way to print some text from a shader... oh well, guess I'll have to go with some sort of "set colour" thing.


"Why do programmers get Halloween and Christmas mixed up?"
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 28th Jul 2012 21:58
Just a follow up response here; that seems to indeed be the issue.
Vectors and (probably, haven't tried debugging those yet) matrices doesn't seem to be properly transferred to a shader using dbSetEffectConstantVector / dbSetEffectConstantMatrix.

In the case Mistrel would happen to come along, may I ask how your DarkGDK.dll performs all the vector / matrix operations? Does it just push the values into a internally created DBPro standard vector / matrix or have you rewritten these functions completely?
In the latter case there might be an issue with the additional vector / matrix functions supplied by DarkShader (and possibly other plugins as well) since I suppose you are not entitled to their sources?


"Why do programmers get Halloween and Christmas mixed up?"
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 28th Jul 2012 23:19
All the vector commands are broken at the moment, Mistrel knows about it and is working on it.

[b]
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 29th Jul 2012 01:05
All of them?
Wow, sneaky.
Good to know though, thanks


"Why do programmers get Halloween and Christmas mixed up?"
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 29th Jul 2012 17:21
The 2.0 vector is utilized in the new shader commands. I am using multi-pass lighting (Evolved's NormalMapping.fx) and it works just fine. I'm also using Evolved's PostBloom and it works fine. I think it is very likely that you are switching syntax order for your effect function calls.

The fastest code is the code never written.
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 29th Jul 2012 18:02 Edited at: 29th Jul 2012 18:03
Hm, really?
Can you try this simple test then and see what your results are;


It should give you 54 (2 * 3 + 2 * 6 + 4 * 9 = 6 + 12 + 36); for me it however reports something around 4.5 * 10^-39 which clearly is way off.


I've begun using the DXVECTOR functions in my wrapper classes for vectors, it's not done yet, but of the functions I've got changed so far all seem to report correct results. Of course the problem will still be to shuffle these vectors to other DB functions; I suppose I'll have to revert to using the built-in ones that relies on a vector index and copy my data to those when required.


"Why do programmers get Halloween and Christmas mixed up?"
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 29th Jul 2012 19:54
I think you've got something there. The vector "math" doesn't seem to work right. However, where are you using dbDotProductVector3 in the shader commands?
Quote: "I've begun using the DXVECTOR functions in my wrapper classes for vectors"

Me too. I don't think it's harder to use directx math than db math... Besides, directX math is streamlined for speed.

The fastest code is the code never written.
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 29th Jul 2012 20:03
No, but it's such a simple function that you can figure out it's result in your head. Other functions are faulty as well when comparing to their DX equivalents (not all though, but if some are its a good hint that its probably not safe to use).

Quote: "I don't think it's harder to use directx math than db math"

The DB functions are merely wrappers for those very DirectX functions. Look at them, even their prototypes are identical (well, save the fact that DBP's system wraps them in a id-pointer hash map).


"Why do programmers get Halloween and Christmas mixed up?"
Olby
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 29th Jul 2012 23:23
Quote: "The DB functions are merely wrappers for those very DirectX functions. Look at them, even their prototypes are identical (well, save the fact that DBP's system wraps them in a id-pointer hash map)."


Exactly, looks like they just wrapped DX commands:



Hopefully Mistrel has an idea how to incorporate them into 2.0 and actually make them work.


Intel Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, Windows Vista Ultimate SP2, PureBasic 4.61 + DarkGDK 2.0

Login to post a reply

Server time is: 2024-04-24 20:44:32
Your offset time is: 2024-04-24 20:44:32