Pages: « 1 2 3 »
  Print  
Author Topic: 3D functions and capabilities  (Read 5891 times)
Offline (Unknown gender) FroggestSpirit
Reply #15 Posted on: March 23, 2014, 12:13:54 PM

Member
Joined: Mar 2013
Posts: 79

View Profile
I'm having an issue with lighting on OGL 3 now. This is the game in OGL1.1 (how it should look)


and this is the same thing in ogl3:


It appears that it incorrectly does the lighting, or the vertex coloring... Any ideas?
Logged
This isn't easy to say, but…
Offline (Unknown gender) TheExDeus
Reply #16 Posted on: March 23, 2014, 03:44:14 PM

Developer
Joined: Apr 2008
Posts: 1860

View Profile
Yeah, GL3 lights were never completely finished and debugged. Work on that kind of stopped when surfaces broke. I'll try fixing it later, but I don't know when I will have the time.
Logged
Offline (Unknown gender) FroggestSpirit
Reply #17 Posted on: March 24, 2014, 11:48:12 AM

Member
Joined: Mar 2013
Posts: 79

View Profile
can some of the code be copied over from OGL1.1, or would that be incompatible?
I'm not familiar with OGL, but i could try and take a look into it.
Logged
This isn't easy to say, but…
Offline (Unknown gender) TheExDeus
Reply #18 Posted on: March 24, 2014, 12:33:55 PM

Developer
Joined: Apr 2008
Posts: 1860

View Profile
No, the reason why it's different is because they are made totally differently. GL1 has this thing called Fixed Function Pipeline - it basically means that it has predetermined things it can do and draw and so you cannot change anything. GL1 had vertex based (per-vertex) lighting with maximum 8 lights and limited amount of effects you could do. GL3 on the other hand requires you to do it all yourself. This is a lot harder, but it does mean a lot more customization. Like you can create normal mapping, per-pixel lighting, deffered shading and so on, but you have to do it yourself.
To make GL3 compatible with GM and GL1, the default lighting system would require to remake vertex based lights in FFP. This was not properly done (sorry, my fault) and I haven't been able to go back to that yet.
The shader used for drawing (including per-vertex lights) is here: https://github.com/enigma-dev/enigma-dev/blob/master/ENIGMAsystem/SHELL/Graphics_Systems/OpenGL3/GL3shader.cpp
And the light system itself is here: https://github.com/enigma-dev/enigma-dev/blob/master/ENIGMAsystem/SHELL/Graphics_Systems/OpenGL3/GL3d3d.cpp
Logged
Offline (Unknown gender) TheExDeus
Reply #19 Posted on: March 25, 2014, 02:17:30 PM

Developer
Joined: Apr 2008
Posts: 1860

View Profile
Spirit, I got around to fixing some of the problems with lights. Right now they are here in this branch: https://github.com/enigma-dev/enigma-dev/commits/GL3-cleanup
You can try that or you could give me an example I could test on myself. The fixes implement point lights (were totally not in previously) and fixes many bugs that were happening with lights previously. At least examples like Mario work fine. I don't have many examples that use GM lights.
I plan to make an extension that would invisibly replace the per-vertex lights with per-pixel lights (so all you would have to do is enable an extension). We currently don't have an easy system to use or replace shaders, so extensions will have to do for now.
Logged
Offline (Unknown gender) FroggestSpirit
Reply #20 Posted on: March 26, 2014, 09:18:34 AM

Member
Joined: Mar 2013
Posts: 79

View Profile
Not sure if it's my video card, or the way i merged, but i got a black screen, even with project mario. I downloaded the zip from your repo, replaced the files in my ENIGMA folder, and rebuilt the dll (and cleared the enigma folder in program data). I'll probably wait until it gets merged with the zip installer, but i'm sure it would work if it works on project mario. I dont really have any examples to distribute though :(
Logged
This isn't easy to say, but…
Offline (Unknown gender) TheExDeus
Reply #21 Posted on: March 26, 2014, 09:37:42 AM

Developer
Joined: Apr 2008
Posts: 1860

View Profile
Well that sucks. I really need an example to test and make sure. Maybe you have some other games/examples you are willing to share that have D3D lights?
I can't really explain the black screen though. Maybe I left something important when commiting into Git. If it was just a regular conflict, then you probably wouldn't have been able to compile. I'll look into that.
Logged
Offline (Male) Goombert
Reply #22 Posted on: March 26, 2014, 11:32:28 AM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
Project Mario crashes for me now after I merged my branch again with Harri's stuff. Prior to that his last commits at least worked, as in no segfault, and the main menu would at least draw "PRESS START" and the main room would draw at least the water, skybox, and HUD.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) TheExDeus
Reply #23 Posted on: March 26, 2014, 01:10:56 PM

Developer
Joined: Apr 2008
Posts: 1860

View Profile
Can you GDB and see what's causing the segfault? Because I just installed my branch from scratch in another directory and I can compile it fine. Here they are:

The GL3 is slightly shinier for some reason (even though specular is disabled for now). GL1 and GL3 will never be pixel perfect match anyway.

Also, how can I resize images in the forum?
« Last Edit: March 26, 2014, 04:44:51 PM by TheExDeus » Logged
Offline (Male) Goombert
Reply #24 Posted on: March 26, 2014, 03:03:37 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
I'll GDB right now.

Use the following to resize images.
Code: ( (Unknown Language)) [Select]
[img width=xxx]url[/img]
Edit: Weird, I am not getting the segfaults now. But here is what it looks like in GL3

At the main menu, I only see the "Press Start" text, everything else is black. Also GL3 runs significantly slower than GL1 (about 50% slower)
« Last Edit: March 26, 2014, 03:10:44 PM by Robert B Colton » Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) TheExDeus
Reply #25 Posted on: March 26, 2014, 04:49:06 PM

Developer
Joined: Apr 2008
Posts: 1860

View Profile
Run in debug mode and check the console. Maybe it will give some insight (I basically print everything about what shaders are doing). Because all of this is very weird. If it doesn't crash in GDB then it is basically a Heisenbug and unless I can replicate, I can't do anything about it.

Only idea why it would be black is because some uniforms are not set. That is possible only if your GPU (which probably isn't an Nvidia) returns uniform names differently and I rely on them to be by the standard. Later I plan to wrap all the uniform functions in cache equivalents and that should give better debug information.
Logged
Offline (Male) Goombert
Reply #26 Posted on: March 26, 2014, 05:14:42 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
The log is too long to paste, but now I know why it's running so slow, you're outputting this debug info even in run mode, stop doing that.

But here is something in the log. And no my card is AMD, this issue should have occurred for you as well.
Code: (Bash) [Select]
Closing game module and running if requested.
Running "C:/Users/Owner/AppData/Local/Temp/egm2094161423945681335.exe"
Shader[0] - Compilation failed - Info log:
Shader log empty
Shader[1] - Compilation failed - Info log:
Shader log empty
Program[0] - Uniform Light[0].Ls not found!
Program[0] - Uniform Light[1].Ls not found!
Program[0] - Uniform Light[2].Ls not found!
Program[0] - Uniform Light[3].Ls not found!
Program[0] - Uniform Light[4].Ls not found!
Program[0] - Uniform Light[5].Ls not found!
Program[0] - Uniform Light[6].Ls not found!
Program[0] - Uniform Light[7].Ls not found!
Program[0] - Uniform Material.Ks not found!
Program[0] - Uniform Material.Shininess not found!
Initializing audio system...
Opening ALURE devices.
« Last Edit: March 26, 2014, 05:17:51 PM by Robert B Colton » Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) TheExDeus
Reply #27 Posted on: March 26, 2014, 06:19:34 PM

Developer
Joined: Apr 2008
Posts: 1860

View Profile
Quote
The log is too long to paste, but now I know why it's running so slow, you're outputting this debug info even in run mode, stop doing that.
That is only outputted when compiling a shader. As that is only done once, then there is no real performance penalty. It's usually useful even when running in normal mode. So that is not the reason it's slow for you. For me GL3 (950FPS) is a little slower than GL1 (1100FPS), but not by a large margin. Not sure if it's just more radical for you or it's because of the shader problems you have.

Quote
Shader[0] - Compilation failed - Info log:
Shader log empty
Shader[1] - Compilation failed - Info log:
Shader log empty
This is a problem though. It says that compilation failed, but without an error.

Quote
And no my card is AMD, this issue should have occurred for you as well.
I don't have an AMD card. I have an Nvidia. That is why I said why you probably have an issue and I don't have it. I do have an AMD in my laptop though. I will try that tomorrow.

edit: I just did a quick test on my laptop now and I can partly replicate the sigsev. But did you also see "error 78: failed to open file for reading"? It happens just before sigsev and it's a LodePNG error. I haven't touched that thing. It's possible that it fails to load a file for some reason, but still tries to make and use a GL texture? It doesn't fail to load on my stationary PC. And I have copied all the files over.

edit2: I also replicated your black screen bug and I get the same water thing on the AMD. But that happens on a very old exe (the one I compiled when I was testing the GL3 about 2 months ago). Are you sure you got that black screen thing only now after the branch pull? Try the master and see if you don't have the same problem.

There is clearly some AMD stupidity going on.

edit3: I just looked trough the resource loading code and we truly have no checks at all. Like the file loading goes 4 functions deep because of the abstraction and if the lowest function fails, then it just segfaults, because nothing is catching those functions. But still, I cannot figure out why it would suddenly fail at loading files.
« Last Edit: March 26, 2014, 06:47:08 PM by TheExDeus » Logged
Offline (Male) Goombert
Reply #28 Posted on: March 26, 2014, 08:12:09 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
Quote from: TheExDeus
That is only outputted when compiling a shader. As that is only done once, then there is no real performance penalty.
What? No the log came out to be 50000000 lines long, apparantly it was outputting some vector coordinates every step, and I mean the fucking log was several mb's. You obviously forget to remove some other debug code from run mode or some shit.

Quote from: TheExDeus
This is a problem though. It says that compilation failed, but without an error.
Yes, those are fine, I actually want those output logs to show in the IDE somewhere, I may add a "Check syntax" to the shader editor but I think that would require JOGL.

But you did miss this part of that little fragment of the log.
Code: (Bash) [Select]
Program[0] - Uniform Light[0].Ls not found!
Program[0] - Uniform Light[1].Ls not found!
Program[0] - Uniform Light[2].Ls not found!
Program[0] - Uniform Light[3].Ls not found!
Program[0] - Uniform Light[4].Ls not found!
Program[0] - Uniform Light[5].Ls not found!
Program[0] - Uniform Light[6].Ls not found!
Program[0] - Uniform Light[7].Ls not found!
Program[0] - Uniform Material.Ks not found!
Program[0] - Uniform Material.Shininess not found!

Quote from: TheExDeus
But did you also see "error 78: failed to open file for reading"?
No, never saw that one, but I've been getting random segfaults on games that don't use PNG loading. This appears to have happened just since updating to Windows 8.

Quote from: TheExDeus
But that happens on a very old exe (the one I compiled when I was testing the GL3 about 2 months ago). Are you sure you got that black screen thing only now after the branch pull? Try the master and see if you don't have the same problem.
No, It's behaved this way for me ever since you merged your branch. Sometimes it segfaults, sometimes it don't, and when it does it has always behaved the way I have described to you.

Quote from: TheExDeus
There is clearly some AMD stupidity going on.
I am going to go ahead and disagree.
« Last Edit: March 26, 2014, 08:16:55 PM by Robert B Colton » Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) TheExDeus
Reply #29 Posted on: March 27, 2014, 01:52:13 PM

Developer
Joined: Apr 2008
Posts: 1860

View Profile
Quote
What? No the log came out to be 50000000 lines long, apparantly it was outputting some vector coordinates every step, and I mean the fucking log was several mb's. You obviously forget to remove some other debug code from run mode or some shit.
Ou that, yeah, it probably even outputs matrices or something. Not really important in the debug stage I am in with those changes.

Quote
But you did miss this part of that little fragment of the log.
That's not important. They are not used in the shader as specular component is disregarded (causes some clipping issues I didn't bother to fix, so I disabled it for time being).

Quote
you merged your branch
I didn't. You mean when you pulled my branch (sounds wrong :D), but I get the idea. I will have to debug with my AMD laptop and figure out when it started to happen to me.

Quote
I am going to go ahead and disagree.
Well the black rendering is an AMD thing. That means the compiled shader for AMD is wrong, but it's still possible it's because of uniform caching. I will investigate. So it's very possible it is some AMD stupidity. :D They never liked OGL anyway. At least the level Nvidia loves it.
Logged
Pages: « 1 2 3 »
  Print